Skip to content

Commit 373fc8b

Browse files
committed
docs: update documentation to reflect nanoflow implementation state
- Move JS action call and ELK layout from Future Work to Completed in proposal - Fix stale action counts in proposal (25/32+ → actual ~16 case branches) - Expand disallowed activities list in docs-site nanoflows.md (add DOWNLOAD FILE, REST, workflow, etc.) - Add CALL JAVASCRIPT ACTION to docs-site calling examples - Add CHANGELOG entries: LSP snippets, parser fixes, validation parity, DownloadFileStmt, flow cache, empty params - Update feature matrix: nanoflow Tests column N → Y - Document ValidateNanoflowBody/validateFlowBody and flow builder cache in parser architecture - Add CALL JAVASCRIPT/JAVA ACTION and nanoflow restrictions to quick reference - Update CLAUDE.md implementation status line
1 parent 3954e54 commit 373fc8b

7 files changed

Lines changed: 35 additions & 15 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
2020

2121
- **Nanoflow bug fixes** — Module existence validation for SHOW NANOFLOWS/MICROFLOWS, numeric return literals no longer get spurious `$` prefix, empty nanoflow/microflow names rejected at create time, `NanoflowCallAction` error handling type resolved correctly, `not()` expression spacing preserved on roundtrip, JavaScript action call rendering in DESCRIBE output
2222
- **Nanoflow diff support**`mxcli diff` now detects and displays nanoflow changes (previously silently skipped)
23+
- **Nanoflow validation parity**`mxcli check` now runs full body validation on nanoflows (undeclared variables, missing returns, branch scoping) via shared `validateFlowBody` helper; `allNames()` includes nanoflows for forward-reference detection
24+
- **DownloadFileStmt denylist**`DOWNLOAD FILE` added to nanoflow disallowed action list
2325
- **JavaScript action MDL syntax**`call javascript action Module.ActionName(params)` now fully supported in CREATE NANOFLOW/MICROFLOW bodies: grammar, parser, builder, serializer, and roundtrip
26+
- **LSP snippet completions** — Added `CREATE NANOFLOW (with params)`, `CALL MICROFLOW`, `CALL NANOFLOW`, `CALL JAVASCRIPT ACTION`, `CALL JAVA ACTION` snippets
27+
- **Flow builder cache**`lookupMicroflowReturnType` and `lookupNanoflowReturnType` now cache results with lazy-load bool flags, avoiding repeated `ListNanoflows`/`ListMicroflows` calls; nanoflow lookup uses `GetRawUnitByName` fast path
28+
- **Parser fixes** — Negative literals no longer greedily consumed by lexer (`-?` removed from `NUMBER_LITERAL`); XPath multi-predicate brackets correctly split and re-wrapped; multi-line string literals in change/create object expressions escaped; `ExclusiveSplit` (if/else) inside loop bodies now emits correct `end if;`
29+
- **Empty action params** — JS and Java action parameters with empty/nil values are omitted from DESCRIBE output instead of rendering as `...` or bare `= )`
2430
- **Association retrieve roundtrip fidelity**`retrieve $X from $Y/Module.Association` syntax preserved on roundtrip (previously converted to `from Entity where Assoc = $Y`)
2531
- **DESCRIBE empty-then optimization** — If/else blocks with empty true branches are swapped and condition negated for readable output
2632

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ Full syntax tables for all MDL statements (microflows, pages, security, navigati
465465
- MPR v1/v2 reading and writing
466466
- Domain model (entities, attributes, associations)
467467
- ALTER ENTITY (add/rename/modify/drop attributes, indexes, documentation)
468-
- Microflows/Nanoflows with 60+ activity types
468+
- Microflows/Nanoflows with 60+ activity types, JavaScript action calls, nanoflow validation parity
469469
- Pages with 50+ widget types
470470
- ALTER PAGE/SNIPPET (SET, INSERT, DROP, REPLACE operations on widget trees)
471471
- Image widgets (IMAGE, STATICIMAGE, DYNAMICIMAGE) with Width/Height properties

docs-site/src/language/nanoflows.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ $Result = CALL NANOFLOW Sales.NAV_ValidateCart (Cart = $Cart);
7070

7171
-- Call a microflow (triggers server round-trip)
7272
$ServerResult = CALL MICROFLOW Sales.ACT_SubmitOrder (Order = $Order);
73+
74+
-- Call a JavaScript action
75+
$HasNetwork = CALL JAVASCRIPT ACTION NanoflowCommons.HasConnectivity();
7376
```
7477

7578
### UI Activities
@@ -110,12 +113,15 @@ END IF;
110113

111114
The following activities are server-only and cannot be used in nanoflows:
112115

113-
- `RETRIEVE ... FROM Module.Entity WHERE ...` (database retrieval)
114-
- `COMMIT`
115-
- `DELETE`
116-
- `ROLLBACK`
117-
- `CALL JAVA ACTION`
118-
- `EXECUTE DATABASE QUERY`
116+
- `CALL JAVA ACTION` — Java actions cannot run client-side
117+
- `DOWNLOAD FILE` — file downloads require server-side processing
118+
- `CALL REST SERVICE` / `SEND REST REQUEST` — REST calls are server-side
119+
- `IMPORT FROM MAPPING` / `EXPORT TO MAPPING` — mapping operations are server-side
120+
- `EXECUTE DATABASE QUERY` — direct SQL requires server
121+
- `TRANSFORM JSON` — JSON transformations are server-side
122+
- `SHOW HOME PAGE` — home page navigation is server-side
123+
- `CALL EXTERNAL ACTION` — external actions are server-side
124+
- All **workflow actions** (create/open/complete workflow, user task, etc.)
119125
- `ON ERROR { ... }` (full error handler blocks)
120126

121127
## SHOW and DESCRIBE

docs/01-project/MDL_FEATURE_MATRIX.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ When adding a new MDL feature, use this matrix as a checklist to ensure complete
1313
| **Associations** | Y | Y | Y | N | Y | Y | 01 | Y | N | Y | Y | Y | Y | Y | Y | Y | N |
1414
| **Enumerations** | Y | Y | Y | Y | Y | Y | 01 | Y | Y | N | Y | Y | Y | N | Y | Y | Y |
1515
| **Microflows** | Y | Y | Y | Y | Y | N | 02 | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
16-
| **Nanoflows** | Y | Y | Y | Y | Y | N | N | N | Y | Y | Y | Y | Y | Y | P | N | N |
16+
| **Nanoflows** | Y | Y | Y | Y | Y | N | N | Y | Y | Y | Y | Y | Y | Y | P | N | N |
1717
| **Pages** | Y | Y | Y | N | Y | Y | 03 | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
1818
| **Snippets** | Y | Y | Y | N | Y | Y | 03 | Y | Y | Y | Y | Y | Y | N | Y | Y | Y |
1919
| **Layouts** | Y | Y | N | N | N | N | N | N | Y | Y | Y | N | Y | N | Y | N | N |

docs/01-project/MDL_QUICK_REFERENCE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ authentication basic, session
207207
| Drop nanoflow | `drop nanoflow Module.Name;` | |
208208
| Create nanoflow | `create [or modify] nanoflow Module.Name (params) returns type [folder 'path'] begin ... end;` | Same body syntax as microflows |
209209
| Move nanoflow | `move nanoflow Module.Name to folder 'path';` | |
210+
| Nanoflow restrictions | N/A | No Java actions, REST calls, download file, workflow actions, import/export mappings, show home page |
210211

211212
## Microflows - Supported Statements
212213

@@ -225,6 +226,8 @@ authentication basic, session
225226
| Retrieve (Assoc) | `retrieve $list from $Parent/Module.AssocName;` | Retrieve by association |
226227
| Call microflow | `$Result = call microflow Module.Name (Param = $value);` | |
227228
| Call nanoflow | `$Result = call nanoflow Module.Name (Param = $value);` | |
229+
| Call JS action | `$Result = call javascript action Module.Name (Param = $value);` | JavaScript action (nanoflow/microflow) |
230+
| Call Java action | `$Result = call java action Module.Name (Param = $value);` | Java action (microflow only) |
228231
| Show page | `show page Module.PageName ($Param = $value);` | Also accepts `(Param: $value)` |
229232
| Close page | `close page;` | |
230233
| Download file | `download file $FileDocument [show in browser];` | Streams a `System.FileDocument` |

docs/03-development/MDL_PARSER_ARCHITECTURE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,11 +515,11 @@ The `microflowValidator` struct walks the body and checks:
515515
4. **Variable scope** — Variables declared inside IF/ELSE branches or ON ERROR bodies cannot be referenced after the branch ends. The `checkBranchScoping()` method collects variables declared inside branches and checks if subsequent statements reference them.
516516
5. **Validation feedback** — VALIDATION FEEDBACK must have a non-empty message template (CE0091).
517517

518-
This is separate from `ValidateMicroflowBody()` (in `cmd_microflows_builder.go`), which checks undeclared variable usage and runs during `--references` validation.
518+
This is separate from `ValidateMicroflowBody()` and `ValidateNanoflowBody()` (in `cmd_microflows_builder_validate.go`), which check undeclared variable usage and run during `--references` validation. Both delegate to the shared `validateFlowBody()` helper that accepts `[]ast.MicroflowParam` and `[]ast.MicroflowStatement`.
519519

520520
## Microflow Builder Architecture
521521

522-
The microflow builder (`cmd_microflows_builder.go`) converts MDL microflow AST nodes into Mendix microflow objects. A key aspect is **variable type tracking**.
522+
The microflow builder (`cmd_microflows_builder.go`) converts MDL microflow AST nodes into Mendix microflow objects. A key aspect is **variable type tracking**. The `flowBuilder` also maintains `microflowsCache`/`nanoflowsCache` (with `Loaded` bool flags) for lazy-cached return type lookups, and `allNames()` includes nanoflows for forward-reference detection in multi-statement scripts.
523523

524524
### Variable Type Tracking (`varTypes`)
525525

docs/11-proposals/PROPOSAL_nanoflow_support.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ Nanoflows execute client-side (browser or native app). In the Mendix metamodel,
3131

3232
### Action Restrictions
3333

34-
**Allowed in nanoflows** (25 actions): ChangeVariable, AggregateList, CreateVariable, Rollback, Retrieve, Delete, CreateChange, Commit, Cast, Change, LogMessage, ListOperation, CreateList, ChangeList, MicroflowCall, ValidationFeedback, ShowPage, ShowMessage, CloseForm, **NanoflowCall**, **JavaScriptActionCall**, **Synchronize**, **CancelSynchronization**, **ClearFromClient**.
34+
**Allowed in nanoflows**: ChangeVariable, AggregateList, CreateVariable, Rollback, Retrieve, Delete, CreateChange, Commit, Cast, Change, LogMessage, ListOperation, CreateList, ChangeList, MicroflowCall, ValidationFeedback, ShowPage, ShowMessage, CloseForm, NanoflowCall, JavaScriptActionCall, Synchronize, CancelSynchronization, ClearFromClient, and others not explicitly denied.
3535

36-
**Disallowed** (32+ actions): All Java actions, REST calls, workflow actions, import/export, external object ops, download file, push to client, show home page, email, document generation, metrics, ML model calls.
36+
**Disallowed** (enforced by `checkDisallowedNanoflowAction` in `nanoflow_validation.go`, ~16 case branches): JavaActionCallAction, RestCallAction, SendRestRequestAction, ImportFromMappingAction, ExportToMappingAction, CallExternalActionAction, DownloadFileAction, ShowHomePageAction, TransformJsonAction, ExecuteDatabaseQueryAction, CallJavaActionStmt, and 9 workflow action types (CreateWorkflow, OpenWorkflow, OpenUserTask, CompleteUserTask, etc.).
3737

3838
## Supported Commands
3939

@@ -87,7 +87,7 @@ revokeNanoflowAccessStatement
8787

8888
## Validation Rules
8989

90-
1. **Disallowed actions** — Type-switch rejects 21 microflow-only action types with descriptive error messages
90+
1. **Disallowed actions** — Type-switch rejects ~16 case branches of microflow-only action types with descriptive error messages (workflow actions collapsed into multi-type case)
9191
2. **ErrorEvent forbidden**`ErrorEvent is not allowed in nanoflows`
9292
3. **Binary return type rejected**`Binary return type is not allowed in nanoflows`
9393
4. **Recursive validation** — Checks compound statements (IF/LOOP/WHILE bodies) and error handling blocks
@@ -118,11 +118,16 @@ revokeNanoflowAccessStatement
118118
| Feature | Priority | Notes |
119119
|---------|----------|-------|
120120
| Roundtrip tests with real `.mpr` baselines | P2 | CREATE → DESCRIBE → re-CREATE verification against App Gallery demos |
121-
| JavaScriptActionCall syntax | P2 | `call javascript action` in nanoflows |
122121
| SynchronizeAction | P3 | `synchronize` action for offline nanoflows |
123-
| ELK layout | P3 | Visual layout (low priority) |
124122
| Web/Native platform mixing check | P3 | CE6051 validation |
125123

124+
### Completed (formerly Future Work)
125+
126+
| Feature | Status | Notes |
127+
|---------|--------|-------|
128+
| JavaScriptActionCall syntax | Done | `call javascript action Module.ActionName(params)` fully supported in grammar, parser, builder, serializer, and roundtrip |
129+
| ELK layout | Done | `describe nanoflow --format elk` produces valid JSON layout |
130+
126131
## Testing
127132

128133
Test plan: `docs/15-testing/nanoflow-test-cases.md` (19 sections, 100+ test cases covering all commands, validation, BSON round-trip, catalog, and edge cases).

0 commit comments

Comments
 (0)