Skip to content

fix(doctor): keep the model's real basename in the gate self-test scratch dir - #128

Merged
MendixMau merged 1 commit into
masterfrom
claude/adoring-bell-lqrlpr
Sep 22, 2026
Merged

MendixMau merged 1 commit into
masterfrom
claude/adoring-bell-lqrlpr

Conversation

@MendixMau

Copy link
Copy Markdown
Owner

Direct lane (changes to skills/, bug-logs/, bin/, project-bin/, project-tests/, pipelines)

What changed and why (one paragraph):

bin/doctor.sh's gate_selftest() copied the project model into its scratch dir under a
hardcoded name — cp "$MPR" "$scratch/model.mpr" — and then copied mprcontents/ beside it
verbatim. mprcontents/ carries an internal record of the model's real basename (e.g.
App.mpr), so the renamed copy is a mismatched pair: mxbuild bails before writing any error
file
, mxtk_mxbuild_error_count returns ?, and the self-test prints
gate self-test: gate cannot read mxbuild's error file (baseline run) with
GATE_SELFTEST_LINE="fail (unreadable error file)". That is the F-042-class string meaning
the gate itself is broken — so the symptom is a false FAIL on a perfectly healthy gate,
and it sends people hunting a problem that does not exist. The fix preserves the real basename
(scratch_mpr="$scratch/$(basename "$MPR")") and threads it through all four later references
to the scratch model: the baseline mxtk_mxbuild_error_count, the mxcli injection's
exec … -p, and the known-bad mxtk_mxbuild_error_count. scratch_mpr joins the function's
existing local list (bash 3.2-compatible, no namerefs). A comment at the copy site records
why the name must not change, so the next reader does not "tidy" it back.

Reported by Yvann during Mac/sandbox onboarding, 2026-09-22.

Field evidence — which real project this ran against / was observed in, and what it measured
or fixed there (CLAUDE.md → "Shipping an instrument", rule 4; required for any instrument change):

This has NOT been field-run, and the PR should not be merged as if it had. The authoring
environment is a Linux container with no .mpr, no mprcontents/, no mxbuild and no Studio
Pro, so the fix is reasoned from the code plus inspected, nothing more. The observation
itself is field evidence (Yvann, macOS, real project, 2026-09-22: healthy gate reporting
fail (unreadable error file)).

The run that would prove it: on a macOS machine with Studio Pro 11 and a real project,
bin/doctor.sh --gate-selftest <project-dir> must now print
baseline: gate read 0 error(s) off the scratch copy followed by the known-bad control
reading ≥ 1, instead of fail (unreadable error file). Reverting just the basename line on
the same machine should bring the false FAIL straight back — that revert is the proof, not
the pass alone. Please do not tell the team to pull until someone has done that.

  • No client data anywhere in the diff
  • Size cap: 2 files, ~20 lines changed (one of them CHANGELOG.md)
  • Test tier reached: T0 inspection. tests/wave2/test-doctor-gate-selftest.sh is the
    only fixture covering this code. Its assertions are not greps over doctor.sh — it
    executes doctor.sh against a fake project ($P/Fixture.mpr + mprcontents/), a stub
    mxcli and five stub mxbuild behaviours. Read in full and checked against the change: the
    mxbuild stub takes the last non-flag argument as the model and looks for its
    .gate-selftest-bad-applied marker beside it, and the mxcli stub writes that marker
    beside whatever -p path it is given — both are basename-agnostic, so every case
    (healthy / no-file / always-clean / constant-nonzero / slow, plus the two-tree case)
    behaves identically before and after. bash -n bin/doctor.sh is clean. T2 is the
    outstanding tier, per the Field evidence box. Running the fixture would confirm no
    regression in the stubbed paths but cannot exercise the real-mxbuild/mprcontents
    interaction that is the actual bug — I have not run it; say the word and I will.
  • For a new/changed instrument: golden input captured (not hand-written), both layouts
    (single-tree and .mpr-under-app/), both platforms (macOS + Git Bash/Windows) considered
    both layouts are covered by the fixture's two-tree case and are unaffected (the change
    derives the name from $MPR, whatever resolved it); both platforms are unaffected
    (basename only). Golden input is the box above: not captured, and that is the gap.
  • For a new skill: routing row added — n/a
  • CHANGELOG.md line appended in this PR, crediting Yvann (CI-checked)
  • New bug entries headed ## BUG-DRAFT-<slug>:n/a, deliberately. bug-logs/mxcli-bugs.md
    is scoped by its own header to "Issues encountered … using mxcli + MDL. Collected for
    reporting to the mxcli team."
    This is a defect in this toolkit's own instrument, not in
    the mxcli CLI, so filing it there would send the mxcli team a bug they cannot act on. The
    CHANGELOG.md line is the record.

Related check performed (no change made, scope discipline): grepped bin/ and project-bin/
for other places that copy an .mpr to a scratch/temp location under a fixed name alongside
mprcontents/. None founddoctor.sh held the only $scratch/model.mpr, and
project-bin/snapshot-mpr.sh already does the right thing (cp "$f" "$DEST/$(basename "$f")"
plus mprcontents/ verbatim), with restore-mpr.sh as its mirror.

🤖 Generated with Claude Code

https://claude.ai/code/session_0187r9bQWkZAEppyEqrDevjK


Generated by Claude Code

…atch dir

gate_selftest() copied the project model to a hardcoded "$scratch/model.mpr"
while copying mprcontents/ beside it verbatim. mprcontents/ carries an internal
record of the model's real basename, so the renamed copy is a mismatched pair:
mxbuild bails before writing any error file, mxtk_mxbuild_error_count returns
"?", and the self-test prints

  gate self-test: gate cannot read mxbuild's error file (baseline run)
  GATE_SELFTEST_LINE="fail (unreadable error file)"

which is the F-042-class string meaning "the gate itself is broken" - a false
FAIL on a perfectly healthy gate, sending people hunting a nonexistent problem.

The scratch copy now keeps basename "$MPR", threaded through all four later
references (baseline count, the mxcli injection's -p, the known-bad count);
scratch_mpr is declared in the existing bash 3.2-compatible local list.

NOT FIELD-RUN. This environment has no .mpr, no mxbuild and no Studio Pro, so
the fix is reasoned and inspected only. One run of
`bin/doctor.sh --gate-selftest <project>` on a macOS machine with Studio Pro 11
against a real model is what would prove it; do not tell the team to pull until
that run exists.

Found by Yvann during Mac/sandbox onboarding, 2026-09-22.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0187r9bQWkZAEppyEqrDevjK
@MendixMau
MendixMau merged commit c0ea53c into master Sep 22, 2026
1 check passed
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.

2 participants