Skip to content

Commit 41f5b70

Browse files
authored
Merge pull request #461 from ako/claude/mxcli-unit-test-perf-n7ggx8
feat(describe): Mode 3 normalized DESCRIBE, and a warning for merges it silently deleted
2 parents 8667e2a + d3e7273 commit 41f5b70

26 files changed

Lines changed: 2160 additions & 30 deletions

‎.claude/skills/fix-issue/findings/mdl-executor.jsonl‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,4 +607,6 @@
607607
{"area": "mdl/executor", "date": "2026-09-13", "symptom": "A workflow with `boundary event timer '\u2026'` (no interrupting / non interrupting) passes check and builds at 0 errors; the runtime then fails to start: `Class 'Workflows$TimerBoundaryEvent' could not be found`", "cause": "The bare form maps to `Workflows$TimerBoundaryEvent`, which exists in no cached 11.x runtime (only Interrupting/NonInterruptingTimerBoundaryEvent). mxbuild tolerates the unknown type. It was the documented syntax example", "file": "`mdl/executor/validate_workflow_refs.go` (`bareTimerBoundaryEventErrors`, MDL-WF07), `cmd/mxcli/syntax/features_workflow.go`", "insight": "**A type mxbuild accepts is not a type the runtime has.** Found only because a verification boot of an unrelated fix loaded it. When a grammar has a default branch that maps to a storage type, check that type against the runtime's class list, not against `mx check`", "fix": "Refuse the bare form on 11+ at check and exec, CREATE and every ALTER op that can carry a boundary event; update syntax help, skill table and the ako/mxcli#415 bug-test script to name the kind"}
608608
{"area": "mdl/executor", "date": "2026-09-13", "symptom": "A view entity whose association column is also declared as an attribute (`MeterRef: Trends.Meter` or `MeterRef: Trends.Meter.ID` beside `select m.ID as MeterRef`) passes `mxcli check`; `check -p` says 'OQL select has 1 columns but 2 attributes declared'; exec writes `Enumeration(Trends.Meter)` and mx check reports CE1613, or throws 'An error occurred when trying to set the Enumeration property' for the three-part form", "cause": "A bare qualified name parses as TypeEnumeration (the entity/enum ambiguity), and execCreateViewEntity converted it with convertDataType without asking what it names. The alias-to-attribute alignment skips association columns, so the declared attribute had no column and was compared against the next one", "file": "`mdl/executor/oql_view_associations.go` (`ValidateViewAttributeDeclarations` MDL080, `viewAttributeEntityTypeErrors`), `mdl/executor/cmd_entities.go` (`execCreateViewEntity`), `mdl/executor/validate.go`, `mdl/executor/validate_program.go`, `cmd/mxcli/lsp_diagnostics.go`", "insight": "**The TypeEnumeration/TypeEntity ambiguity has a consumer wherever a data type becomes a stored type, and view entity attributes were one nobody had listed.** Split the refusal by what it needs: an association column's alias and a three-part name are decidable from the script, so they belong in the no-project phase that exec's pre-check also runs; entity-vs-enum needs the project, so it goes in check -p AND the handler, because exec --no-check skips both phases. Verify the handler refusal by counting changed files, not by the error text", "fix": "Refuse in ValidateProgram/LSP (MDL080) and at the top of execCreateViewEntity before any backend call; report an attribute once"}
609609
{"area": "mdl/executor", "date": "2026-09-13", "symptom": "Three new MDL-WIDGET27 tests passed locally and failed in CI on the same commit: two reported the fallback remedy (\"move the entries into the widget body as container blocks\") instead of naming the container keyword, and the third found 0 violations where it wanted 1", "cause": "The tests resolved the widget through `LoadWidgetRegistry(fixtureProject(t))`, which reads `.def.json` files from `testdata/expr-checker/.mxcli/widgets/`. That directory is GITIGNORED — the definitions are derived, not tracked — so they exist for any developer who has ever run `mxcli widget docs` against the fixture (I generated them earlier in the same session, while investigating) and never exist on the runner. With no definition, `containerKeyword` returns \"\" and the two definition-dependent branches degrade exactly as designed: fallback wording, and silence for the scalar case", "file": "`mdl/executor/validate_widget_object_property_test.go` (`fixtureProjectWithDefs`)", "insight": "**A gitignored fixture makes a test environment-dependent in the one direction nobody checks** — the developer's tree is a superset of the runner's, so the test is green exactly where it is not being tested. The fix is to DERIVE the artifact from tracked inputs inside the test (`RefreshWidgetDefinitions` over the fixture's tracked `.mpk` files, into a temp copy, after removing any `.mxcli` the developer's tree carries), so local and CI see identical inputs. Reproduce by moving the gitignored directory aside before believing any diagnosis. **The sibling lesson is why this was not caught by the existing suite**: #999's test asserted `strings.Contains(msg, \"attribute\")` on a widget whose property is named `attributes`, so the property name alone satisfied it and the assertion passed with NO definition loaded — a substring assertion whose needle is a substring of the data it is meant to distinguish from proves nothing. Tightened to the remedy shape (`` `attribute <name> (…)` blocks ``) and verified with the derivation stubbed: all four then fail, where before only the three new ones did", "refs": []}
610+
{"area": "mdl-executor", "date": "2026-09-13", "symptom": "DESCRIBE silently deletes an ExclusiveMerge: describe -> exec leaves the microflow with fewer merge nodes than the stored graph, with no warning, no MDL-FLOW01 and mx check clean", "cause": "The nested describer walks straight through a merge with a single incoming path without emitting anything for it, so the rebuild has no reason to create it. Only two merge shapes were represented: a split's join point (rendered by `end if`) and a labelled error rejoin (`merge <label>`).", "file": "mdl/executor/cmd_microflows_show_merge.go", "fix": "droppedMergeWarnings() emits a describe-time warning for any ExclusiveMerge that is neither a split join point, nor a labelled error rejoin, nor has in-degree >= 2. Wired into both describe paths beside irreducibleGraphWarnings.", "insight": "The obvious rule (represented == the join point findSplitMergePoints pairs with a split) is WRONG on real code and produces a false positive on ordinary Marketplace microflows. findMergeForSplit needs a join common to ALL branches, so a split where one branch returns pairs with nothing -- yet its merge is still emitted as the continuation after `end split` and survives with its $ID intact (Administration.ManageMyAccount). The in-degree clause is what separates the two. Establish the rule by CORRELATING survival with structure over a corpus rather than reasoning from the describer's code: measuring merge $IDs before and after a round trip over 21 microflows gave in-degree=1 deleted 7 of 7, in-degree>=2 survived 6 of 7. The one exception is a merge lost to flattening in an irreducible graph, which MDL-FLOW01 already owns with a stronger message. Also: count-based comparison cannot tell 'preserved' from 'deleted and recreated' -- compare $IDs. And when scanning describe output for your own warning, grep a string unique to it: MDL-FLOW01's text also contains 'is not represented', which faked a false positive for one round of measurement."}
611+
{"area":"mdl-executor","date":"2026-09-13","symptom":"DESCRIBE renders a microflow whose branches cross as `c1 and c2` when the activity actually runs on `not(c1) or c2` — a program that always logs described as one that never does, with mx check clean","cause":"Nested if/then/else is single-entry/single-exit; a Mendix microflow is an arbitrary digraph. When an inner split's branch lands where an outer split's branch lands, the describer walks the graph as a tree and emits the conjunction of the guards along one path.","file":"mdl/executor/cmd_microflows_normalize.go","fix":"DESCRIBE MICROFLOW ... NORMALIZED (Mode 3): fold the branch guards into one condition via mdl/microflownorm and rewrite a COPY of the graph into the equivalent nested one, then let the existing describer render it. Refuses per-decision when the region holds an activity, a rule-based split, or genuinely interleaved branches.","insight":"Do not write a second describer for a second rendering mode — rewrite the GRAPH and reuse the one describer, or the two drift and every activity renderer is implemented twice. Two verification lessons. (1) A boolean simplifier needs a truth-table equivalence test over generated formulas, not per-rule unit tests: an unsound rewrite produces a pretty WRONG guard, which is the original bug from the other direction. Run it with a rule deliberately broken as the control — mine caught it at the first assignment. (2) Algebra is not behaviour: build the original and the microflow rebuilt from its normalized description side by side and compare return values over the whole input truth table on a real runtime. The rows that matter are the ones the OLD rendering got wrong, so make the fixture's return value distinguish them (a `log` activity is invisible to a test; a `$Result` string is not). Also: the fold leaves the entry merge with in-degree 1, which describe->exec would then silently delete, so splice it out in the transform — otherwise Mode 3's output does not describe the graph its own re-execution builds."}
610612
{"area":"mdl/executor","date":"2026-09-13","symptom":"CATALOG.GRAPH_CYCLES returns 0 rows on a project whose CATALOG.GRAPH_MODULE_COUPLING lists mutual Source/Target module pairs, so a user reads 'no circular dependencies' from a table that was never computed (mendixlabs/mxcli#1060)","cause":"graph_cycles_data is written only by the graph-analysis pass (REFRESH CATALOG COMMUNITIES), while graph_module_coupling is a plain SQL view over refs that any full-mode catalog answers. GRAPH_CYCLES and its four siblings appeared in neither fullOnlyTables nor sourceOnlyTables, so no warning fired; and the recorded build mode is only fast/full/source, so a communities-augmented cache is indistinguishable from a plain full one — which also let a later `refresh catalog full` drop the graph tables silently","file":"`mdl/executor/cmd_catalog.go` (`communitiesOnlyTables`, `warnIfCatalogModeInsufficient`, `tableRequiredMode`, `carryGraphAnalysis`, `cachedCatalogInfo`), `mdl/catalog/catalog.go` (`MetaGraphAnalysis`), `mdl/catalog/builder_graph.go`, `mdl/catalog/builder.go`","insight":"**An empty analytic table is only an answer once something distinguishes 'computed and empty' from 'never computed'.** The mode ladder could not carry that bit: fast/full/source is a LEVEL, and the graph pass is orthogonal to it (it augments any level), so folding it in makes 'source' and 'full+graph' incomparable — it has to be a flag, not a rank. Guard it by MEASUREMENT, not a second hand-written list: run the pass on a synthetic refs graph and diff which tables went from empty to non-empty, then compare that set to the classification map. Shape the fixture so every table fills — two clusters for the community split and the integration surface, one MUTUAL pair for cycles — or the guard silently skips the very table the bug was about","fix":"Record MetaGraphAnalysis/MetaGraphResolution when the pass runs; classify the six tables in communitiesOnlyTables and warn 'requires refresh catalog communities (not run for this catalog)'; report it in SHOW CATALOG STATUS; re-run the pass when a full rebuild replaces a cache that had it"}

‎cmd/mxcli/lsp_completions_gen.go‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎cmd/mxcli/syntax/features_microflow.go‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,51 @@ func init() {
155155
SeeAlso: []string{"microflow.control-flow"},
156156
})
157157

158+
Register(SyntaxFeature{
159+
Path: "microflow.normalized-describe",
160+
Summary: "DESCRIBE MICROFLOW ... NORMALIZED: fold crossed branches into one condition",
161+
Keywords: []string{
162+
"normalized", "normalize", "describe", "fold", "recombinable",
163+
"irreducible", "crossed branches", "guard", "mode 3",
164+
},
165+
Syntax: "DESCRIBE MICROFLOW Module.Name NORMALIZED;\n\n" +
166+
"-- Opt-in rendering for a graph whose branches cross. Nested IF cannot\n" +
167+
"-- describe one faithfully, so the DEFAULT rendering flattens it and warns\n" +
168+
"-- (MDL-FLOW01). NORMALIZED instead folds the branch guards into a single\n" +
169+
"-- condition, which is equivalent and duplicates nothing.\n" +
170+
"--\n" +
171+
"-- The graph from mxcli #923:\n" +
172+
"-- split1: true -> split2 false -> merge1\n" +
173+
"-- split2: true -> merge1 false -> merge2\n" +
174+
"-- The activity on merge1 runs on `not(c1) or c2`. Default DESCRIBE renders\n" +
175+
"-- it as `c1 and c2` -- with the reporter's expressions, a program that\n" +
176+
"-- always logged described as one that never did.\n" +
177+
"--\n" +
178+
"-- WHY OPT-IN. The output re-executes to a DIFFERENT graph: same behaviour,\n" +
179+
"-- fewer nodes, different layout. Describing a microflow to change one\n" +
180+
"-- activity must not rebuild the canvas, so this is never the default and\n" +
181+
"-- the output carries a NOTE saying so.\n" +
182+
"--\n" +
183+
"-- WHAT IT REFUSES, rather than guessing:\n" +
184+
"-- * an activity between the decision and the shared part -- folding\n" +
185+
"-- would move a side effect;\n" +
186+
"-- * a rule-based decision -- a rule call cannot go inside an expression;\n" +
187+
"-- * genuinely interleaved branches -- nesting those needs a duplicated\n" +
188+
"-- activity or an invented boolean (Boehm-Jacopini), neither of which\n" +
189+
"-- is a description.\n" +
190+
"-- A refusal leaves that decision rendered as-is and says why.\n" +
191+
"--\n" +
192+
"-- Folding is safe because Mendix `and`/`or` SHORT-CIRCUIT -- measured, see\n" +
193+
"-- mdl-examples/bug-tests/923-short-circuit-semantics.test.mdl. Were they\n" +
194+
"-- eager, the folded form could evaluate a guard the original skipped.",
195+
Example: "DESCRIBE MICROFLOW MyModule.MF_Reporter NORMALIZED;\n\n" +
196+
"-- emits, for the crossed graph above:\n" +
197+
"-- if $B or not($A) then\n" +
198+
"-- log info node 'NODE' 'Do something';\n" +
199+
"-- end if;",
200+
SeeAlso: []string{"microflow.merge-join", "microflow.control-flow"},
201+
})
202+
158203
Register(SyntaxFeature{
159204
Path: "microflow.merge-join",
160205
Summary: "Named join points: MERGE <label> and JOIN <label>",

‎docs/01-project/MDL_QUICK_REFERENCE.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@ rather than updating the first.
467467
| Show microflows | `show microflows [in module];` | List all or filter by module |
468468
| Show nanoflows | `show nanoflows [in module];` | List all or filter by module |
469469
| Describe microflow | `describe microflow Module.Name;` | Full MDL with activities |
470+
| Describe microflow (normalized) | `describe microflow Module.Name normalized;` | Folds crossed branches into one condition instead of flattening them. Opt-in: the output re-executes to an equivalent graph with fewer nodes and a different layout |
470471
| Describe nanoflow | `describe nanoflow Module.Name;` | Full MDL with activities |
471472
| Rename microflow | `rename microflow Module.Old to New;` | Updates all references |
472473
| Rename nanoflow | `rename nanoflow Module.Old to New;` | Updates all references |

0 commit comments

Comments
 (0)