Repository navigation
fix: check -p applies exec's version gates (mendixlabs/mxcli#1434) - #1385
Merged
Merged
Conversation
`mxcli check -p` passed scripts that `mxcli exec` then refused for the project's Mendix version (e.g. `create view entity` on a 9.24 project), after running the statements before the refused one. Every version gate lived inline in its handler as a checkFeature call, which neither check nor exec's pre-flight ever reaches. The gates now come from one statement-to-feature table, statementVersionGates (mdl/executor/version_gates.go). The handlers refuse through checkVersionGates(ctx, stmt); Executor.CheckVersionGates reports the same refusals as MDL-VERSION01, run by `check -p` and by exec's pre-flight, so exec refuses before anything is written. A test fails on any new direct checkFeature call outside the table. Still exec-only: gates that depend on stored state (drop/alter of a message definition document that is not there) and the write-time property floor. The issue's own StableId/CaseValues refusal was the latter and is already cured by #1410; the flows now pass both check and exec on 9.24. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W3x8Fyvir8kLyPgJs1BDmF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes mendixlabs#1434.
The bug
mxcli check script.mdl -p app.mprpassed scripts thatexecthen refused because of the project's Mendix version.The issue's own error was the write-time property floor (StableId / CaseValues on 9.24), which #1410 already fixed. The gap that remained, reproduced on the 9.24.30 fixture
modelsdk/mpr/testdata/v1-project/App.mpr:create view entitypasses check.Root cause
Every version gate was an inline
checkFeature(ctx, …)call inside a statement handler: about two dozen calls across 17 files, several conditional on the statement's contents. Neither check nor exec's pre-flight runs handlers, so neither could see a gate. This is the check-versus-exec case indocs-wiki/bug-patterns/duplicate-resolver-drift.md.The fix
mdl/executor/version_gates.go.statementVersionGates(stmt)is now the one mapping from a statement to the features it needs. The minimum versions stay insdk/versions/*.yaml.checkVersionGates.Executor.CheckVersionGates(prog)reports the same refusals as MDL-VERSION01, numbered by statement, with exec's own message and hint.cmd_check.gocalls it once the project is connected, read-only.exec_preflight.gocalls it too, soexec(anddiff) now refuse before writing anything.-pnothing changes. There is no version to check against.Gates covered:
SupportsGraphQLsend emailand deep-link URLsynchronize unsynchronizedTests (written first)
TestCheck_RefusesWhatTheProjectVersionCannotStore:TestExecPreflight_AgreesWithCheckOnVersionGates: the pre-flight refuses the gated script ("Nothing was written"). The ungated flows pass the pre-flight and write on 9.24.TestCheckVersionGates_ReportsEveryHandlerGate: every gate is reported below its minimum version with the handler's exact text, and none is reported at 11.99.TestCheckVersionGates_UngatedFormsPass.TestCheckFeatureIsOnlyCalledFromTheGateTable: a source scan that fails on a directcheckFeaturecall outside the table, so a new gate can't bypass check.Revert check: with only the check and pre-flight wiring reverted, both cmd tests fail with the reported symptom. They pass with it restored.
Also in this PR
mdl-examples/bug-tests/1434-check-version-gates.mdl.check-syntax/reference/references-resolved.md, with a one-line pointer from the skill so it stays under 700 lines, plusdocs-site/src/tutorial/validation.md.make build,make lintandmake check-findingspass. The executor andcmd/mxclitests pass on the current base.Behaviour changes
execnow refuses a version-gated script before writing, instead of mid-way with a rollback.alter workflow, the agent-task and notification gates run before the completion-rule check. This only changes which error appears when both apply.Not done (exec-only; check cannot know these from the script)
checkFeature: showpage args, notify, contract, the 11.15 message-definition collection removal, workflow handler/ref checks, the pluggable database source.workflows.basichas a 9.0.0 minimum in the registry while the hint says 9.12+. This mismatch was already there and is left alone.🤖 Generated with Claude Code
https://claude.ai/code/session_01W3x8Fyvir8kLyPgJs1BDmF
Generated by Claude Code