Repository navigation
Conversation
…th whitespace mxcli v0.27.0's `alter entity ... rename attribute` rewrote 135 units in 20 modules of a Mendix 10.24.18 app that never referenced the attribute. The only change in each was the line breaks between bracketed XPath conditions; `mxcli diff-local` showed nothing (mendixlabs/mxcli#1596). project-bin/model-scope.py: `report` sorts changed units into real and noise, `restore` checks the noise out of HEAD and updates its ContentsHash rows through mxpatch.py, `check --staged` exits 1 on staged noise (MODEL_SCOPE_OK=1 overrides once). Not wired into exec.sh or the hook yet; that is the next PR. Fixture tests/wave2/test-model-scope.sh, including a golden before/after capture of a real v0.27.0 rename on a public model (fixtures/model-scope/golden-v0.27.0/, CAPTURE.md).
Owner
|
Thanks @saingge! Independent review: MERGE. We moved your commit unchanged, with your authorship, into #559, plus one docstring line: it said Generated by Claude Code |
MendixMau
added a commit
that referenced
this pull request
Oct 22, 2026
…th whitespace (#559, from #535) mxcli v0.27.0's `alter entity ... rename attribute` rewrote 135 units in 20 modules that never referenced the attribute; only XPath line breaks changed (mendixlabs/mxcli#1596). project-bin/model-scope.py: `report` sorts changed units into real and noise, `restore` checks the noise out of HEAD and rehashes its ContentsHash rows via mxpatch.py, `check --staged` exits 1 on staged noise (MODEL_SCOPE_OK=1 overrides once). Not wired into exec.sh or the hook yet; the docstring now says so. Golden input is a real v0.27.0 capture; field run restored 146 of 149 units, mx check 0 errors. Contributed by @saingge in #535. Review: MERGE — field-proven, captured golden input, nothing calls it yet; docstring corrected. Security review: safe (git/sqlite3 via argument lists, no shell). Co-authored-by: saingge <262679532+saingge@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013jQvaonym9V1wKKfAEPmRr
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.
Branch
new/model-scope, 1 commit (487c390) on origin/master 393d253. First of two stacked PRs;fix/exec-model-scopewires it in.Direct lane
What changed and why (one paragraph):
On a Mendix 10.24.18 app (MPR v2), one mxcli v0.27.0
alter entity … rename attributerewrote 135 units in 20 modules that never referenced the attribute. The only change in each unit was the line breaks between bracketed conditions in XPath constraint strings.mxcli diff-localshowed nothing, because the MDL it renders is identical, so the reviewer met all 135 in the branch diff (mendixlabs/mxcli#1596). Newproject-bin/model-scope.pycompares each changed unit file with a git ref (defaultHEAD). A unit is noise when every differing field is anXpathConstraint/XPathConstraintthat is equal once whitespace outside string literals is removed; anything else is real.report [-v]prints the counts and the real changes per module.restorechecks the noise units out of the ref and updates their ContentsHash rows throughmxpatch.py; if the checkout stops part-way, it still re-indexes every listed file, so the index matches the files, and exits 2 asking for a re-run.check --stagedexits 1 when staged unit files are noise and names the remedy;MODEL_SCOPE_OK=1lets one commit through, out loud. Nothing calls it yet; the next PR adds it toexec.shand the pre-commit hook.Impact
bin/lib/install-manifest.sh(one name inMXTK_PROJECT_BINplus a comment). Importsmxpatch.pyandmxunit_bson.pyfrom its own directory (both already installed). Python 3 and git only. Open draft #311 also editsinstall-manifest.sh; a trial merge (git merge-tree) gives the same conflicts with this branch as with origin/master alone, so this PR adds none. The canvas stack also adds a line toinstall-manifest.sh; whichever merges second keeps both.reporton the golden capture, 0.19 s wall (/usr/bin/time -p, macOS arm64)Field evidence: the incident above (mxcli v0.27.0, Mendix 10.24.18, 135 units / 20 modules), found in branch review. Reproduced on a public model:
tests/wave2/fixtures/model-scope/golden-v0.27.0/is a real mxcli v0.27.0 rename on the toolkit's ownmxpatchfixture model (Mendix 11.14.0). mxcli printed "Updated 2 XPath constraint(s) in 2 document(s)"; one of the two was in moduleOther, which the script never named.CAPTURE.mdrecords every step, including how the two-line XPaths were written (throughmxpatch.py, since mxcli stores XPaths on one line, mendixlabs/mxcli#1542). Field run (T2): on a copy of a Mendix 10.24 enterprise app, see Verification.LEAKGUARD_BASE=origin/master; new words are synthetic fixture names and code identifiers)model-scope.py410,test-model-scope.sh179, manifest 4. The instrument is one file that cannot be split without splitting its single rule, and it ships with its test. The wiring is already split off into the stacked PR.tests/wave2/test-model-scope.sh, 39/39) plus T0 for the manifest (test-manifest-clean-checkout.sh, 1/1).mprat the root and underapp/, section C); macOS only, Git Bash/Windows not run (paths go throughos.path, git throughsubprocesswith argument lists)CHANGELOG.mdline, creditedVerification
Run in an isolated worktree on 393d253 + this commit, macOS arm64, Python 3.
bash tests/wave2/test-model-scope.sh→PASS: 39 FAIL: 0. Sections: G golden capture (report "3 unit file(s) changed, 1 real, 2 noise", "real changes by module: MyFirstModule 1"; restore makes both noise units byte-equal tobefore/, the real domain-model change stays,mxpatchverify shows no mismatch), A whitespace rule, B classification (whitespace inside a literal = real, XPath whitespace plus another field = real, key order = real, added/deleted = real, a page'sXPathConstraint, a unit in a folder), C restore (second run writes nothing,.mprbyte-identical;--against; model underapp/; clean tree; unknown ref exits 2; a checkout that stops part-way, forced by a read-only unit directory, exits 2 with the restored unit re-indexed and the index matching every file), Dcheck --staged.FAIL literal not real(37/1).restore(no re-index after a failed checkout) fails the part-way case (FAIL partial restore, 38/1).restoreon the capturedafter/state, realmxcli fix hashes -p TestApp.mpr(v0.27.0) exited 0 and reported the index matches every unit file (fix-hashes-after-restore-v0.27.0.out).reportshows 0 noise; mx check (mxbuild 10.24.18, Docker) on the restored model: exit 0, 0 errors.bash tests/wave2/test-manifest-clean-checkout.sh→1 passed, 0 failed("project-bin/ is fully named by the manifest").bin/check-portability.sh→ clean, 306 files.bin/check-scripts.shreportsproject-bin/script-owners.sh: line 295: syntax errorunder macOS bash; that file is unchanged from origin/master.bin/check-no-client-data.sh→ no client data, 1155 files; withLEAKGUARD_BASE=origin/master→ no new capitalised words.mx checkon the restored 11.14 capture (11.14 mxbuild not available); the field run above covers it on 10.24.18. The full suite (CI).