Skip to content

fix(docker): preserve MPRv2 storage format across docker check#764

Merged
ako merged 1 commit into
mendixlabs:mainfrom
dimenus:fix/763-preserve-mprv2-storage-format
Jul 19, 2026
Merged

fix(docker): preserve MPRv2 storage format across docker check#764
ako merged 1 commit into
mendixlabs:mainfrom
dimenus:fix/763-preserve-mprv2-storage-format

Conversation

@dimenus

@dimenus dimenus commented Jul 17, 2026

Copy link
Copy Markdown

Closes #763

What does it do?

mxcli docker check runs mx update-widgets before mx check to 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 .mpr and deletes the mprcontents/ directory. A command named check should 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/*.mxunit files 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 .mpr and mprcontents/ 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/... — passes
  • go vet ./cmd/mxcli/docker/... — passes
  • go test ./cmd/mxcli/docker/... — unit tests pass, including the new TestSnapshotStorageFormat_RestoresV2AfterConversion. Mutation-checked: the test fails when the restore is disabled.
  • Integration test TestCheck_PreservesMPRv2StorageFormat (build tag integration): scaffolds a real MPRv2 project with mx create-project, runs the real Check(), and asserts the project is still MPRv2. Verified green in a Linux container with the same mx version the CI integration job installs (11.9.0). Mutation-checked: it fails (project ends MPRv1) when the fix is disabled.
  • Root cause confirmed on both mx 11.9.0 and 11.12.1: mx update-widgets performs the v2 to v1 conversion.

Mendix validation

Verified against a real MPRv2 project (Mendix 11.12.1): before the fix, mxcli docker check left the project MPRv1 with mprcontents/ deleted; after the fix, the project stays byte-for-byte MPRv2 and git reports no model changes.

Agentic Code Testing

N/A — this changes the behavior of docker check, not an MDL command surface.

🤖 Generated with Claude Code

`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 was referenced Jul 18, 2026
@ako
ako merged commit 88077af into mendixlabs:main Jul 19, 2026
1 check passed
ako pushed a commit to ako/mxcli that referenced this pull request Jul 19, 2026
CE0463 remediation in the synced skills told agents to run `mx update-widgets`
directly. On an MPRv2 project (an `mprcontents/`-folder project — everything
`mxcli new` creates) that command silently rewrites the project to single-file
v1 and deletes `mprcontents/`, corrupting a git working tree, breaking a running
`mxcli run --local` loop, and sometimes leaving Studio Pro unable to open the
project. This actually bit a warm-loop app-generation run (CE0463 on Image
widgets → agent ran `mx update-widgets` per the skill).

With PR mendixlabs#764 (issue mendixlabs#763) merged, `mxcli docker check`/`build` snapshot and
restore the v2 storage around the widget normalization, so they are the safe
remediation. Point every CE0463/update-widgets mention at those commands and
warn that bare `mx update-widgets` is only safe on a v1 project or a throwaway
diagnostic copy.

- create-page.md, custom-widgets.md, migrate-design-prototype.md,
  download-marketplace-content.md (user-synced): steer to docker check/build,
  warn about the v2->v1 deletion.
- debug-bson.md (dev): fix the "safety net"/"quick workaround" framing; add a
  "use a COPY" caution to the reference-extraction blocks.
- fix-issue.md: add a symptom-table row for the mprcontents/ data-loss class
  (issue mendixlabs#763 / PR mendixlabs#764).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JXnEgoc2NQP1Y2TWMCMXC4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mxcli docker check silently converts MPRv2 projects to MPRv1 (via mx update-widgets), deleting mprcontents

3 participants