Repository navigation
fix(exec): warn when a script restates from a stale DESCRIBE (#261) - #503
Merged
Merged
Conversation
A script restated from a stale DESCRIBE (#261), or a re-run of an older script that owns the same document (#269), silently reverted newer work: exit 0, every gate green, no warning. - project-bin/script-owners.sh: which mdlsource/ scripts create or restate each microflow/nanoflow/page/snippet; -- supersedes: / -- superseded-by: headers; a last-writer ledger exec.sh appends after every kept write, so an in-order rebuild stays quiet without asking mxcli. - project-bin/describe-baseline.sh: stamp -- baseline: <Doc> sha256=... at draft time, verify at exec (opt-in: only stamped scripts DESCRIBE). - exec.sh: WARN lines + BUILD-LOG detail; never a refusal, exit codes unchanged. Happy path: one grep over mdlsource/, zero mxcli calls. - gate-check.sh: co-owned count (info only). - learned-mdl-preflight.md: STOP 33 and 34. - Fixture tests/wave2/test-restatement-guard.sh; not-found DESCRIBE output captured from mxcli v0.26.0. Rebuilt from master; supersedes draft #311 without its merged #315 and crash-rollback (#424) hunks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VJgWP5vEoAsNsJYqCDMGNw
…d compaction (#269) Review of #498 (MERGE-AFTER-FIXES). This PR is now the #269 part only. - script-owners.sh: run order pads digit runs per path component (2-core before 11-fixes, 9-a before 10-b); a script that has never run, over an owner that never ran either, is new (no message, no DESCRIBE). - A new owner without a supersedes header gets one NOTE line on its first run, out of BUILD-LOG; WARN only when a newer owner's write is live. - restore-mpr.sh appends a RESTORE row; rows before it are ignored, so a replay after a restore asks the model again. exec.sh's own rollback does not mark. - record compacts the ledger (last row per script and document, last RESTORE) through a temp file and mv; the folder self-gitignores. - At most 5 DESCRIBE calls per check; the rest print CONFLICT (not checked). The DESCRIBE existence check now lives in script-owners.sh (live). - Removed: describe-baseline.sh, its exec.sh verify block and the preflight rows 33/34 (the #261 part moves to its own PR; STOP 34 dropped). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VJgWP5vEoAsNsJYqCDMGNw
- project-bin/describe-baseline.sh: stamp writes -- baseline: <Doc> sha256=<hash> and -- baseline-mxcli: <version> from a DESCRIBE at draft time; verify reports DRIFT (with diff), STALEHEADER (now a warn) and RESTAMP after an mxcli upgrade. A re-run by the last recorded writer (script-owners.sh ledger) and a fresh model are SAME. - exec.sh: verify only for a script with a baseline header; WARN lines and a BUILD-LOG cell, never a refusal, exit codes unchanged. - learned-mdl-preflight.md STOP 21: one clause (+21 words). - Fixture tests/wave2/test-describe-baseline.sh; mxcli v0.26.0 --version capture. Lands after #498. With #498, supersedes draft #311. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VJgWP5vEoAsNsJYqCDMGNw
Re-review of #498. The ledger is machine-local, so in a fresh clone or cloud session "neither script has a ledger row" read as "S is new" and a replay over committed newer work was silent. - has-run now also counts a done- file name and a docs/BUILD-LOG.md row naming the script in backticks whose result says applied (the done-drift-check.sh pattern); no mxcli call. Draft-ahead stays quiet. - Header: the ledger cannot see Studio Pro edits or a git pull/checkout of the .mpr. - Fixture: three fresh-clone cases (done-09, BUILD-LOG applied row, never run) and a rolled-back row; exec.sh's own rollback writes no RESTORE row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VJgWP5vEoAsNsJYqCDMGNw
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VJgWP5vEoAsNsJYqCDMGNw
Re-review of #503: the row-21 trigger now reads "`DROP` + `CREATE`, `create or modify` or `create or replace` any document another script also edits". The rule clause is unchanged. Baseline +24 words in total for this PR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VJgWP5vEoAsNsJYqCDMGNw
…-v (#269) check-portability flagged a backslash in an awk -v value (gawk and mawk differ on escapes). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VJgWP5vEoAsNsJYqCDMGNw
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VJgWP5vEoAsNsJYqCDMGNw
Owner
Author
|
Behaviour A/B for the row-21 change (RUNBOOK decision rule: T no worse than M on every scored metric)
Generated by Claude Code |
MendixMau
added a commit
that referenced
this pull request
Oct 21, 2026
…ite (#498) Fixes #269. - project-bin/script-owners.sh: last-writer ledger (exec.sh records after every kept write; machine-local, self-gitignored, compacted under the exec lock). Run order zero-pads digit runs per path component. - exec.sh warns (never refuses, exit codes unchanged) when a script restates a document a newer owner wrote and that write is live; a script counts as run via a ledger row, a done- name, or an "applied" BUILD-LOG row, so a fresh clone still warns. A new owner without a `-- supersedes:` header gets a one-time NOTE outside BUILD-LOG. DESCRIBE capped at 5 per exec; zero on the happy path. MXTK_RESTATE_GUARD=off skips it. - restore-mpr.sh appends a RESTORE marker (exec.sh's own rollback does not); gate-check prints the co-owned count. Review: independent adversarial review over three rounds (8ad0d77, 2a0886b, 292ded7). Round 1 found byte-sort run order (11-fixes before 2-core, a forward exec read as a replay and costing DESCRIBE), a warning on every forward exec, a stale ledger after restore-mpr.sh, an unbounded ledger, uncapped DESCRIBE, an always-loaded STOP 34 whose grep hit 61/68 pedapp pages, and 544 lines over the cap; all fixed (zero-padded order, first-run NOTE, RESTORE marker, compaction, cap of 5, STOP 33/34 dropped, #261 split into #503). Round 2 found that an empty ledger (fresh clone or cloud session) silenced the replay; fixed by counting done- names and "applied" BUILD-LOG rows (no failure wording exec.sh writes contains "applied"). Verified on master c2b9bec merged with this head: test-restatement-guard 58/0 (the 2 new evidence cases fail with the round-1 script), test-exec-gate-retry 52/0, test-restore-mpr-arg 10/0, test-exec-gate-log 24/0 serially; zero DESCRIBE and no extra mxbuild on the happy path; exit codes and BUILD-LOG columns unchanged; check-pr-discipline clean; client grep 0. exec.sh timing on 600 scripts with stub mxcli/mxbuild: ~+90 ms. The occasional gate-log case C failure under parallel load reproduces on master (filed separately). Known limit: the ledger cannot see Studio Pro edits or a git pull/checkout of the .mpr (#504). No always-loaded text changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VJgWP5vEoAsNsJYqCDMGNw
#498 landed as a squash, so its commits on this branch conflicted with master in bin/lib/install-manifest.sh and project-bin/exec.sh. Kept this branch's side of both hunks (describe-baseline.sh in the manifest; the #261 stale-draft block and the shared note comment). The diff against master is now exactly this PR's own change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VJgWP5vEoAsNsJYqCDMGNw
5 of 7 tasks
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.
Direct lane
Lands after #498. This branch was cut from #498's head (2a0886b), so until #498 merges the diff here also shows #498's commits. This PR's own changes are commits 8431714 (the instrument) and 7f91347 (row-21 trigger). #498's head 292ded7 is merged in (a merge, not a rebase). Review this PR's own diff with
git diff 292ded7..1858281.What changed and why (one paragraph):
A script drafted from a DESCRIBE taken before an earlier script of the batch ran put four old messages back, with check, mxbuild and lint green and exit 0 (#261). New
project-bin/describe-baseline.sh stamp <script>writes a header from a DESCRIBE at draft time:-- baseline: <Doc> sha256=<hash>line (orabsent) per document the script restates;-- baseline-mxcli: <version>line.exec.shrunsverifyonly for a script that carries such a header. It printsWARN: stale draft:lines, and DRIFT also goes into the BUILD-LOG detail. It never refuses, and the exit codes (0/1/2/4/5) do not change.verifyreports:exec.shprints it;A re-run by the script itself (it is the last recorded writer in #498's ledger) and a fresh model (document absent) read SAME.
Preflight STOP 21: its trigger now names
create or modify, and the rule gains one clause. There is no new row. It adds the-- supersedes:header,describe-baseline.sh stampwhen drafting ahead, and that exec.sh only warns. The DESCRIBE-visibility row (old STOP 34) is dropped.Fixes #261
Supersedes #311 (with #498)
Behaviour change to check in your project:
exec.shoutput can carryWARN: stale draft: …lines, and the BUILD-LOG detail cellWARN stale baseline: <docs>. SetMXTK_RESTATE_GUARD=offto skip the check. Scripts stamped by this tool carry-- baseline:/-- baseline-mxcli:header comments.Impact
bin/describe-baseline.sh stamp <script>, named in STOP 21).project-bin/exec.sh(one block after #498's co-owner block) andbin/lib/install-manifest.sh(new installed script). New artifact read: the-- baseline:header. Its producer isstamp, which is opt-in; when there is no header,exec.shdoes nothing. It reads #498's ledger throughscript-owners.sh last-writer, so it depends on #498 and must merge after it.skills/learned-mdl-preflight.md(baseline-routed): +24 words in row 21 (+21 for the rule clause, +3 for the trigger), no new row.render-routing.sh --check: baseBaseline: 73804 words (budget 80000)(master 9f3948c reads the same) → headBaseline: 73828 words (budget 80000). Stage 5: mdl 30345 → 30369; nothing else changes.mxcli --version; one DESCRIBE took 0.22 s with real mxcli v0.26.0.Field evidence: no client project was run. Before the split,
exec.shran with real mxcli v0.26.0 on a scratch copy of mxcli's publictestdata/pedappmodel:'OLD wording'.'NEW wording'.WARN: stale draft … Administration.ACT_Probe — changed since the script was drafted, with the real diff (- log node 'Probe' 'OLD wording'; + log node 'Probe' 'NEW wording';).The golden captures in
tests/wave2/fixtures/restatement-guard/come from that model: the not-found output of all four kinds (shipped in #498) and themxcli --versionline (shipped here). A field run on a real project is still owed.Fails on base, passes on head:
tests/wave2/test-describe-baseline.shdescribe-baseline.sh)exec.shwith the newdescribe-baseline.shbeside itexec.shwith the earlier 8ad0d77describe-baseline.shexec.share every exec.sh case: the WARN line, the drifted document, the BUILD-LOG cell.test-restatement-guard.shstill passes 51/0 on this head.Re-review (head 1858281):
test-describe-baseline33/0,test-restatement-guard58/0 (8431714 fails the 2 new fresh-clone cases),test-exec-gate-retry47/0,test-exec-gate-log24/0,test-restore-mpr-arg10/0.check-scripts,check-portability, the leak guard,check-pr-discipline: all clean. The client grep is 0. On 600 scripts: master 9f3948c 1405-1440 ms, this head 1480-1529 ms, 0 DESCRIBE calls.Scoped checks (head 8431714):
Fixtures:
test-describe-baseline33/0test-restatement-guard51/0test-exec-gate-retry47/0test-exec-gate-log24/0test-exec-check-refusal10/0test-exec-crash-rollback13/0test-exec-lock-watch84/0test-exec-step-times7/0test-bug07-0845/0test-manifest-clean-checkout1/0Guards, all clean:
check-scripts,check-portability,render-routing --check, the leak guard,check-no-private-citations,check-pr-discipline. The client-name grep of added lines returns 0.No client data anywhere in the diff
Size cap: this PR's own commit touches 7 files with 226 non-fixture lines (+223 −3).
Test tier reached: T1/T2. A stub-mxcli fixture, plus real mxcli v0.26.0 on a public model. No T3 field project.
For a new/changed instrument:
--version), never hand-written.PROJECT_ROOT(the two-tree case is covered by fix(exec): warn when replaying an older owning script reverts newer work (#269) #498's fixture).For a new skill: n/a
CHANGELOG.mdline, credited to AlvinnYeo ([bug] exec.sh: restating a microflow from a stale DESCRIBE silently reverts an earlier exec #261)New bug entries: none
Generated by Claude Code