Skip to content

Commit fcc9355

Browse files
committed
Merge remote-tracking branch 'origin/main' into work/pr456-action
# Conflicts: # mdl/executor/cmd_microflows_traverse_test.go
2 parents d6f100c + 2991c12 commit fcc9355

71 files changed

Lines changed: 5172 additions & 2123 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/commands/mxcli-dev/review.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ proactively. Add a row after every review that surfaces something new.
3232
| 7 | Skill/doc table references a function that doesn't exist (e.g. `formatActionStatement()` vs `formatAction()`) | Docs quality | Grep function names before writing: `grep -r "func formatA" mdl/executor/` |
3333
| 8 | "Always X" rule is too absolute for trivial edge cases (e.g. "always write failing test first" for one-char typos) | Docs quality | Soften to "prefer X" or add an exception clause; include the reasoning so readers can judge edge cases |
3434
| 9 | Doc comment promises a fallback/feature that doesn't exist in the code (e.g., "raw-map fallback in the client" when no such fallback was implemented) | Docs quality | Grep for function/type names referenced in doc comments to confirm they exist before committing |
35+
| 10 | BSON array items decoded by mongo driver are `primitive.D`, not `map[string]any` — bare type assertion `item.(map[string]any)` always fails silently, causing silent data loss (e.g. Languages not parsed, issue #480) | BSON parsing | Always use `extractBsonMap(item)` instead of `item.(map[string]any)`; write a parser unit test with `primitive.D` items to catch this class of bug |
36+
| 11 | `execShow` switch missing a case for a new `ShowXxx` constant — executor handler is wired but never dispatched, command silently does nothing | Dispatch gap | After adding a new `Show*` constant and handler, grep `executor_query.go` to confirm the case is present; add a mock test that calls the handler directly |
3537

3638
---
3739

.github/workflows/push-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
run: |
2222
FAILED=0
2323
for f in mdl-examples/doctype-tests/*.mdl; do
24-
[[ "$f" == *.test.mdl ]] && continue
24+
case "$f" in *.test.mdl) continue ;; esac
2525
NAME=$(basename "$f")
2626
echo "::group::$NAME"
2727
if ./bin/mxcli check "$f"; then

Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# make build - Build mxcli for current platform
55
# make release - Build mxcli for all platforms (macOS, Windows, Linux)
66
# make test - Run unit tests
7+
# make check-mdl - Check MDL syntax for all doctype example scripts
78
# make test-integration - Run integration tests (requires mx/mxbuild)
89
# make test-mdl - Run MDL integration tests (requires Docker)
910
# make lint - Lint all code (Go + TypeScript)
@@ -143,6 +144,22 @@ release: clean vscode-ext sync-all
143144
test:
144145
CGO_ENABLED=0 go test ./...
145146

147+
# Check MDL syntax for all doctype example scripts
148+
check-mdl: build
149+
@FAILED=0; \
150+
for f in mdl-examples/doctype-tests/*.mdl; do \
151+
case "$$f" in *.test.mdl) continue ;; esac; \
152+
NAME=$$(basename "$$f"); \
153+
if ./$(BUILD_DIR)/$(BINARY_NAME) check "$$f" > /dev/null 2>&1; then \
154+
echo "PASS: $$NAME"; \
155+
else \
156+
echo "FAIL: $$NAME"; \
157+
./$(BUILD_DIR)/$(BINARY_NAME) check "$$f" 2>&1 | grep -v "^WARNING"; \
158+
FAILED=1; \
159+
fi; \
160+
done; \
161+
exit $$FAILED
162+
146163
# Run integration tests (requires mx binary / mxbuild)
147164
test-integration:
148165
CGO_ENABLED=0 go test -tags integration -count=1 -timeout 30m ./...

docs/01-project/MDL_QUICK_REFERENCE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ create or replace navigation Responsive
457457
| Drop configuration | `drop configuration 'Name';` | Remove a configuration |
458458
| Alter language | `alter settings LANGUAGE key = value;` | DefaultLanguageCode |
459459
| Alter workflows | `alter settings workflows key = value;` | UserEntity, DefaultTaskParallelism |
460+
| List languages | `show languages;` | Lists language codes with translation string counts (requires `refresh catalog full`) |
460461

461462
## Business Events
462463

docs/11-proposals/PROPOSAL_microflow_change_refresh_modifier.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The `refresh` modifier maps directly to `ChangeObjectAction.RefreshInClient`. Om
2121

2222
## Tests And Examples
2323

24-
`mdl-examples/doctype-tests/change_refresh_modifier.test.mdl` demonstrates both forms. Go tests cover formatter output, parser behavior, and builder serialization.
24+
`mdl-examples/doctype-tests/change_refresh_modifier.mdl` demonstrates both forms. Go tests cover formatter output, parser behavior, and builder serialization.
2525

2626
## Open Questions
2727

go.mod

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ module github.com/mendixlabs/mxcli
33
go 1.26.0
44

55
require (
6-
github.com/alecthomas/chroma/v2 v2.23.1
6+
github.com/alecthomas/chroma/v2 v2.24.1
77
github.com/antlr4-go/antlr/v4 v4.13.1
88
github.com/charmbracelet/bubbles v1.0.0
99
github.com/charmbracelet/bubbletea v1.3.10
1010
github.com/charmbracelet/lipgloss v1.1.0
1111
github.com/chzyer/readline v1.5.1
12-
github.com/fsnotify/fsnotify v1.9.0
12+
github.com/fsnotify/fsnotify v1.10.0
1313
github.com/jackc/pgx/v5 v5.9.2
1414
github.com/mattn/go-runewidth v0.0.23
15-
github.com/microsoft/go-mssqldb v1.9.8
15+
github.com/microsoft/go-mssqldb v1.10.0
1616
github.com/pmezard/go-difflib v1.0.0
1717
github.com/sergi/go-diff v1.4.0
1818
github.com/sijms/go-ora/v2 v2.9.0
@@ -23,10 +23,10 @@ require (
2323
go.lsp.dev/uri v0.3.0
2424
go.mongodb.org/mongo-driver v1.17.9
2525
go.starlark.net v0.0.0-20260102030733-3fee463870c9
26-
go.uber.org/zap v1.27.1
26+
go.uber.org/zap v1.28.0
2727
golang.org/x/term v0.42.0
2828
gopkg.in/yaml.v3 v3.0.1
29-
modernc.org/sqlite v1.49.1
29+
modernc.org/sqlite v1.50.0
3030
)
3131

3232
require (
@@ -39,7 +39,7 @@ require (
3939
github.com/clipperhouse/displaywidth v0.9.0 // indirect
4040
github.com/clipperhouse/stringish v0.1.1 // indirect
4141
github.com/clipperhouse/uax29/v2 v2.5.0 // indirect
42-
github.com/dlclark/regexp2 v1.11.5 // indirect
42+
github.com/dlclark/regexp2 v1.12.0 // indirect
4343
github.com/dustin/go-humanize v1.0.1 // indirect
4444
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
4545
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
@@ -65,11 +65,11 @@ require (
6565
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
6666
go.lsp.dev/pkg v0.0.0-20210717090340-384b27a52fb2 // indirect
6767
go.uber.org/multierr v1.10.0 // indirect
68-
golang.org/x/crypto v0.48.0 // indirect
68+
golang.org/x/crypto v0.50.0 // indirect
6969
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 // indirect
7070
golang.org/x/sync v0.20.0 // indirect
7171
golang.org/x/sys v0.43.0 // indirect
72-
golang.org/x/text v0.34.0 // indirect
72+
golang.org/x/text v0.36.0 // indirect
7373
modernc.org/libc v1.72.0 // indirect
7474
modernc.org/mathutil v1.7.1 // indirect
7575
modernc.org/memory v1.11.0 // indirect

go.sum

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0 h1:fou+2+WFTib47nS+nz/ozhEBnvU96bKHy6LjRsY4E28=
2-
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0/go.mod h1:t76Ruy8AHvUAC8GfMWJMa0ElSbuIcO03NLpynfbgsPA=
1+
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.1 h1:jHb/wfvRikGdxMXYV3QG/SzUOPYN9KEUUuC0Yd0/vC0=
2+
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.1/go.mod h1:pzBXCYn05zvYIrwLgtK8Ap8QcjRg+0i76tMQdWN6wOk=
33
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 h1:Hk5QBxZQC1jb2Fwj6mpzme37xbCDdNTxU7O9eb5+LB4=
44
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1/go.mod h1:IYus9qsFobWIc2YVwe/WPjcnyCkPKtnHAqUYeebc8z0=
5-
github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 h1:9iefClla7iYpfYWdzPCRDozdmndjTm8DXdpCzPajMgA=
6-
github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2/go.mod h1:XtLgD3ZD34DAaVIIAyG3objl5DynM3CQ/vMcbBNJZGI=
5+
github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0 h1:fhqpLE3UEXi9lPaBRpQ6XuRW0nU7hgg4zlmZZa+a9q4=
6+
github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0/go.mod h1:7dCRMLwisfRH3dBupKeNCioWYUZ4SS09Z14H+7i8ZoY=
77
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.4.0 h1:E4MgwLBGeVB5f2MdcIVD3ELVAWpr+WD6MUe1i+tM/PA=
88
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.4.0/go.mod h1:Y2b/1clN4zsAoUd/pgNAQHjLDnTis/6ROkUfyob6psM=
99
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0 h1:nCYfgcSyHZXJI8J0IWE5MsCGlb2xp9fJiXyxWgmOFg4=
@@ -14,8 +14,8 @@ github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ
1414
github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE=
1515
github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0=
1616
github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
17-
github.com/alecthomas/chroma/v2 v2.23.1 h1:nv2AVZdTyClGbVQkIzlDm/rnhk1E9bU9nXwmZ/Vk/iY=
18-
github.com/alecthomas/chroma/v2 v2.23.1/go.mod h1:NqVhfBR0lte5Ouh3DcthuUCTUpDC9cxBOfyMbMQPs3o=
17+
github.com/alecthomas/chroma/v2 v2.24.1 h1:m5ffpfZbIb++k8AqFEKy9uVgY12xIQtBsQlc6DfZJQM=
18+
github.com/alecthomas/chroma/v2 v2.24.1/go.mod h1:l+ohZ9xRXIbGe7cIW+YZgOGbvuVLjMps/FYN/CwuabI=
1919
github.com/alecthomas/repr v0.5.2 h1:SU73FTI9D1P5UNtvseffFSGmdNci/O6RsqzeXJtP0Qs=
2020
github.com/alecthomas/repr v0.5.2/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
2121
github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ=
@@ -56,14 +56,14 @@ github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6N
5656
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5757
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
5858
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
59-
github.com/dlclark/regexp2 v1.11.5 h1:Q/sSnsKerHeCkc/jSTNq1oCm7KiVgUMZRDUoRu0JQZQ=
60-
github.com/dlclark/regexp2 v1.11.5/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
59+
github.com/dlclark/regexp2 v1.12.0 h1:0j4c5qQmnC6XOWNjP3PIXURXN2gWx76rd3KvgdPkCz8=
60+
github.com/dlclark/regexp2 v1.12.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
6161
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
6262
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
6363
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4=
6464
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM=
65-
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
66-
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
65+
github.com/fsnotify/fsnotify v1.10.0 h1:Xx/5Ydg9CeBDX/wi4VJqStNtohYjitZhhlHt4h3St1M=
66+
github.com/fsnotify/fsnotify v1.10.0/go.mod h1:TLheqan6HD6GBK6PrDWyDPBaEV8LspOxvPSjC+bVfgo=
6767
github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY=
6868
github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE=
6969
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA=
@@ -108,8 +108,8 @@ github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2J
108108
github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88=
109109
github.com/mattn/go-runewidth v0.0.23 h1:7ykA0T0jkPpzSvMS5i9uoNn2Xy3R383f9HDx3RybWcw=
110110
github.com/mattn/go-runewidth v0.0.23/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
111-
github.com/microsoft/go-mssqldb v1.9.8 h1:d4IFMvF/o+HdpXUqbBfzHvn/NlFA75YGcfHUUvDFJEM=
112-
github.com/microsoft/go-mssqldb v1.9.8/go.mod h1:eGSRSGAW4hKMy5YcAenhCDjIRm2rhqIdmmwgciMzLus=
111+
github.com/microsoft/go-mssqldb v1.10.0 h1:pHEt+Qz6YFPWqREq10mqSE524QQo+/QremwTCQht7TY=
112+
github.com/microsoft/go-mssqldb v1.10.0/go.mod h1:mnG7lGa9iYJbzJqGCXyuQCegStKMr3kogDLD6+bmggg=
113113
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI=
114114
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo=
115115
github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA=
@@ -168,17 +168,18 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
168168
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
169169
go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
170170
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
171-
go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc=
172-
go.uber.org/zap v1.27.1/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
171+
go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo=
172+
go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q=
173+
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
173174
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
174-
golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts=
175-
golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos=
175+
golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI=
176+
golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q=
176177
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 h1:mgKeJMpvi0yx/sU5GsxQ7p6s2wtOnGAHZWCHUM4KGzY=
177178
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546/go.mod h1:j/pmGrbnkbPtQfxEe5D0VQhZC6qKbfKifgD0oM7sR70=
178-
golang.org/x/mod v0.33.0 h1:tHFzIWbBifEmbwtGz65eaWyGiGZatSrT9prnU8DbVL8=
179-
golang.org/x/mod v0.33.0/go.mod h1:swjeQEj+6r7fODbD2cqrnje9PnziFuw4bmLbBZFrQ5w=
180-
golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo=
181-
golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y=
179+
golang.org/x/mod v0.34.0 h1:xIHgNUUnW6sYkcM5Jleh05DvLOtwc6RitGHbDk4akRI=
180+
golang.org/x/mod v0.34.0/go.mod h1:ykgH52iCZe79kzLLMhyCUzhMci+nQj+0XkbXpNYtVjY=
181+
golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA=
182+
golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs=
182183
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
183184
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
184185
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -189,10 +190,10 @@ golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI=
189190
golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
190191
golang.org/x/term v0.42.0 h1:UiKe+zDFmJobeJ5ggPwOshJIVt6/Ft0rcfrXZDLWAWY=
191192
golang.org/x/term v0.42.0/go.mod h1:Dq/D+snpsbazcBG5+F9Q1n2rXV8Ma+71xEjTRufARgY=
192-
golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk=
193-
golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA=
194-
golang.org/x/tools v0.42.0 h1:uNgphsn75Tdz5Ji2q36v/nsFSfR/9BRFvqhGBaJGd5k=
195-
golang.org/x/tools v0.42.0/go.mod h1:Ma6lCIwGZvHK6XtgbswSoWroEkhugApmsXyrUmBhfr0=
193+
golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg=
194+
golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164=
195+
golang.org/x/tools v0.43.0 h1:12BdW9CeB3Z+J/I/wj34VMl8X+fEXBxVR90JeMX5E7s=
196+
golang.org/x/tools v0.43.0/go.mod h1:uHkMso649BX2cZK6+RpuIPXS3ho2hZo4FVwfoy1vIk0=
196197
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
197198
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
198199
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
@@ -229,8 +230,8 @@ modernc.org/opt v0.1.4 h1:2kNGMRiUjrp4LcaPuLY2PzUfqM/w9N23quVwhKt5Qm8=
229230
modernc.org/opt v0.1.4/go.mod h1:03fq9lsNfvkYSfxrfUhZCWPk1lm4cq4N+Bh//bEtgns=
230231
modernc.org/sortutil v1.2.1 h1:+xyoGf15mM3NMlPDnFqrteY07klSFxLElE2PVuWIJ7w=
231232
modernc.org/sortutil v1.2.1/go.mod h1:7ZI3a3REbai7gzCLcotuw9AC4VZVpYMjDzETGsSMqJE=
232-
modernc.org/sqlite v1.49.1 h1:dYGHTKcX1sJ+EQDnUzvz4TJ5GbuvhNJa8Fg6ElGx73U=
233-
modernc.org/sqlite v1.49.1/go.mod h1:m0w8xhwYUVY3H6pSDwc3gkJ/irZT/0YEXwBlhaxQEew=
233+
modernc.org/sqlite v1.50.0 h1:eMowQSWLK0MeiQTdmz3lqoF5dqclujdlIKeJA11+7oM=
234+
modernc.org/sqlite v1.50.0/go.mod h1:m0w8xhwYUVY3H6pSDwc3gkJ/irZT/0YEXwBlhaxQEew=
234235
modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0=
235236
modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A=
236237
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
-- ============================================================================
2+
-- Bug #330: Annotations inside loop bodies disappeared after describe/exec
3+
-- ============================================================================
4+
--
5+
-- Symptom (before fix):
6+
-- `@annotation 'note'` attached to a statement nested inside `loop ... end loop;`
7+
-- (or `while ... end while;`) survived the first execution but disappeared
8+
-- on the next describe → exec roundtrip. The annotation existed in the
9+
-- loop's local object collection but the parent microflow graph never
10+
-- saw it, so the next describer pass dropped it. Annotations on nested
11+
-- decisions (IF inside a LOOP) were the most visible casualty — the
12+
-- notes that explain WHY a loop exists were silently lost.
13+
--
14+
-- Root cause:
15+
-- The microflow builder copied nested loop sequence flows back to the
16+
-- parent graph but did not copy nested ANNOTATION flows. The describer
17+
-- then collected annotation captions only from the top-level object
18+
-- collection, ignoring captions stored inside nested loop collections.
19+
--
20+
-- After fix:
21+
-- - Builder: loop/while statement handlers also copy
22+
-- `nested.AnnotationFlows` into the parent graph.
23+
-- - Describer: `collectAnnotationCaptions` walks recursively into
24+
-- nested loop object collections, and `emitLoopBody` merges the
25+
-- loop-local annotation map into the per-body traversal.
26+
--
27+
-- Scope note:
28+
-- The Go-side regression `TestLoopBodyIfAnnotationPromotedToParentFlows`
29+
-- covers the AST→BSON build path. This MDL script reproduces the
30+
-- describer side: after exec, the annotation must appear in the
31+
-- describe output. A full describe → exec → describe FIXPOINT for
32+
-- nested IF inside LOOP additionally depends on the nearest split-merge
33+
-- pairing fix (issue #326 / PR #327); on a branch that includes both
34+
-- fixes, this script round-trips cleanly.
35+
--
36+
-- Usage:
37+
-- mxcli exec mdl-examples/bug-tests/330-preserve-loop-body-annotations.mdl -p app.mpr
38+
-- mxcli -p app.mpr -c "describe microflow BugTest330.MF_LoopWithAnnotations"
39+
-- The describe output must contain `@annotation 'note on nested if'`
40+
-- on the IF inside the loop body.
41+
-- ============================================================================
42+
43+
create module BugTest330;
44+
45+
create entity BugTest330.Item (
46+
Name : string(100)
47+
);
48+
/
49+
50+
-- LOOP body containing an annotated IF — the case that originally lost the
51+
-- annotation. The note on the IF must appear in the describe output.
52+
create microflow BugTest330.MF_LoopWithAnnotations (
53+
$Items: list of BugTest330.Item
54+
)
55+
begin
56+
loop $Item in $Items
57+
begin
58+
@annotation 'note on nested if'
59+
if $Item/Name != empty then
60+
log info node 'BugTest330' 'has name';
61+
end if;
62+
end loop;
63+
end;
64+
/

0 commit comments

Comments
 (0)