fix(docker): preserve MPRv2 storage format across docker check#764
Open
dimenus wants to merge 1 commit into
Open
fix(docker): preserve MPRv2 storage format across docker check#764dimenus wants to merge 1 commit into
dimenus wants to merge 1 commit into
Conversation
`mxcli docker check` runs `mx update-widgets` before `mx check` to avoid false
CE0463 ("widget definition changed") errors. On an MPRv2 project that step
rewrites the project into the self-contained MPRv1 format: it inlines every unit
into the .mpr and deletes the mprcontents/ directory. A command named `check`
should not change the on-disk storage format. On a project under Git this
desyncs the working tree from the tracked mprcontents/ files and can leave
Studio Pro unable to open the project (it crashed in its Git version-control
provider in the case that motivated this).
## Changes
- Detect the storage format before running update-widgets. When the project is
MPRv2, snapshot the .mpr and mprcontents/ to a temp directory and restore them
after the check. The check still runs against the widget-normalized model, so
CE0463 false positives stay suppressed; only the on-disk format is preserved.
MPRv1 projects are single-file and left untouched.
- If the snapshot cannot be taken, skip update-widgets rather than risk an
unrecoverable v2 to v1 conversion.
## Tests
- Unit regression test for the snapshot/restore round-trip (deletes mprcontents/
to mimic the conversion, asserts a byte-for-byte restore).
- Integration test (build tag `integration`) that scaffolds a real MPRv2 project
with `mx create-project`, runs the real `Check()`, and asserts the project is
still MPRv2 afterwards.
## Benefits
- `docker check` no longer mutates the storage format of the project it checks.
- Removes the Git working-tree desync and the Studio Pro open failure that
followed from it.
## Statistics
- 3 files changed: 1 fix, 2 tests.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Closes #763
What does it do?
mxcli docker checkrunsmx update-widgetsbeforemx checkto prevent false CE0463 ("widget definition changed") errors. On an MPRv2 project, that step rewrites the project into the self-contained MPRv1 format: it inlines every unit into the.mprand deletes themprcontents/directory. A command namedcheckshould not change the on-disk storage format.On a project under Git this is damaging. After the conversion the working tree no longer matches the
mprcontents/*.mxunitfiles tracked in the repository. If the project is then opened in Studio Pro (which auto-converts back to MPRv2) or the state is committed, the history and the on-disk format drift apart. In the case that motivated this, Studio Pro then failed to open the project, crashing in its Git version-control provider.The fix detects the storage format before running update-widgets. When the project is MPRv2, it snapshots the
.mprandmprcontents/to a temp directory and restores them after the check. The check still runs against the widget-normalized model, so CE0463 false positives stay suppressed; only the on-disk format is preserved. MPRv1 projects are single-file and left untouched. If the snapshot cannot be taken, update-widgets is skipped rather than risk an unrecoverable conversion.Testing
go build ./cmd/mxcli/...— passesgo vet ./cmd/mxcli/docker/...— passesgo test ./cmd/mxcli/docker/...— unit tests pass, including the newTestSnapshotStorageFormat_RestoresV2AfterConversion. Mutation-checked: the test fails when the restore is disabled.TestCheck_PreservesMPRv2StorageFormat(build tagintegration): scaffolds a real MPRv2 project withmx create-project, runs the realCheck(), and asserts the project is still MPRv2. Verified green in a Linux container with the samemxversion the CI integration job installs (11.9.0). Mutation-checked: it fails (project ends MPRv1) when the fix is disabled.mx update-widgetsperforms the v2 to v1 conversion.Mendix validation
Verified against a real MPRv2 project (Mendix 11.12.1): before the fix,
mxcli docker checkleft the project MPRv1 withmprcontents/deleted; after the fix, the project stays byte-for-byte MPRv2 andgitreports no model changes.Agentic Code Testing
N/A — this changes the behavior of
docker check, not an MDL command surface.🤖 Generated with Claude Code