Skip to content

Commit d7804c5

Browse files
committed
fix(doctor, sync-project): property-set check errors get their own exit code; sync announces its bound
Confirmation review of #314: 1. Sync captures doctor's output, so it now prints "checking property sets (read-only, up to Ns)…" first. Sync uses its own shorter default: MXTK_PROPSETS_TIMEOUT=${MXTK_PROPSETS_TIMEOUT:-120}. 2. A check that could not run is exit 4 now, not exit 1. That covers an error, unclassified output, a crashed `fix --help` probe or no Mendix version. Exit 1 is only NEEDS/FAILED rows. On exit 4, sync prints a neutral "could not check property sets: <reason>" line, with no warning and no --fix-property-sets advice, because the repair would fail the same way. 3. When the probe crashed, --quick says "could not probe", not that the mxcli "predates" the command. 4. The fixture stub's slow state now execs sleep, so a timeout kills the process itself and leaves no child behind. test-property-sets.sh: 61 passed. New cases: exit 4 for errors, --quick on a crashed probe, sync's bound announcement, and sync's neutral line on exit 4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VJgWP5vEoAsNsJYqCDMGNw
1 parent 232883a commit d7804c5

5 files changed

Lines changed: 43 additions & 20 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Sections dated before 2026-09-19 predate the cycle and stay as they are.
1717

1818
## Unreleased
1919

20-
- feat(doctor, sync-project): **`mxcli fix property-sets` is wired into the upgrade path, report first: the Studio Pro merge break no gate could see.** mxcli up to v0.25 wrote units without Studio Pro's full property set. `mx check`, the build and the runtime stay green, and Studio Pro's merge/diff throws ("Objects with ID … do not have the same properties") once it has saved such a document. New `bin/doctor.sh --property-sets <project>` runs the read-only `--dry-run` and records the result with the mxcli version in `.claude/.property-sets-receipt` (machine-local, gitignored). It exits 0 clean, 1 needs repair or could not classify (never green by absence), 2 not run, 3 for an mxcli before v0.26.0. `sync-project.sh` runs it with `--if-stale`, which skips only a recorded clean or unsupported result for the installed mxcli (errors and timeouts are never recorded; the dry-run is bounded by `MXTK_PROPSETS_TIMEOUT`, default 300 s), and `doctor --quick` (which exec.sh runs when the mxcli version changes) warns while it is owed. The repair is `bin/doctor.sh --fix-property-sets <project>`, which runs `mxcli fix property-sets` only through `exec.sh --patch` (snapshot, mxbuild gate, restore). It refuses on an exec.sh without `--patch`. Support is probed from `mxcli fix --help`, because `mxcli fix property-sets --help` exits 0 on v0.24/v0.25 too, printing the parent's help. New row in `learned-detection-gaps.md`; `platform-link.md` gains "Before a Team Server merge", covering `fix property-sets`, `fix hashes` and `git note`. Golden input is captured from the v0.24.0/v0.25.0/v0.26.0 release binaries. The clean/NEEDS/FAILED reports follow mxcli's source format strings, because no model was run. `tests/wave2/test-property-sets.sh` (58 cases). Field run still owed. `fix hashes` as an `exec.sh --patch` post-step is pending (Refs #295) — jopterhorst
20+
- feat(doctor, sync-project): **`mxcli fix property-sets` is wired into the upgrade path, report first: the Studio Pro merge break no gate could see.** mxcli up to v0.25 wrote units without Studio Pro's full property set. `mx check`, the build and the runtime stay green, and Studio Pro's merge/diff throws ("Objects with ID … do not have the same properties") once it has saved such a document. New `bin/doctor.sh --property-sets <project>` runs the read-only `--dry-run` and records the result with the mxcli version in `.claude/.property-sets-receipt` (machine-local, gitignored). It exits 0 clean, 1 needs repair, 2 not run, 3 for an mxcli before v0.26.0, and 4 when the check itself failed or its output could not be classified (never green by absence; a repair would not help). `sync-project.sh` runs it with `--if-stale`, which skips only a recorded clean or unsupported result for the installed mxcli (errors and timeouts are never recorded; the dry-run is bounded by `MXTK_PROPSETS_TIMEOUT`, default 300 s, 120 s under sync, which announces the bound first), and `doctor --quick` (which exec.sh runs when the mxcli version changes) warns while it is owed. The repair is `bin/doctor.sh --fix-property-sets <project>`, which runs `mxcli fix property-sets` only through `exec.sh --patch` (snapshot, mxbuild gate, restore). It refuses on an exec.sh without `--patch`. Support is probed from `mxcli fix --help`, because `mxcli fix property-sets --help` exits 0 on v0.24/v0.25 too, printing the parent's help. New row in `learned-detection-gaps.md`; `platform-link.md` gains "Before a Team Server merge", covering `fix property-sets`, `fix hashes` and `git note`. Golden input is captured from the v0.24.0/v0.25.0/v0.26.0 release binaries. The clean/NEEDS/FAILED reports follow mxcli's source format strings, because no model was run. `tests/wave2/test-property-sets.sh` (61 cases). Field run still owed. `fix hashes` as an `exec.sh --patch` post-step is pending (Refs #295) — jopterhorst
2121
- fix(sync-project): **sync names a `bin/model-stamp.sh` that predates the worktree hook blind-spot fix.** `known_fix_note` gains the `model-stamp.sh` arm from the #236 patch, keyed on `GIT_WORK_TREE`, which the fixed script pins. The arm says to upgrade `model-stamp.sh` and `_common.sh` together. `tests/wave2/test-model-stamp.sh` T9 adds the unstaged worktree `commit -a` and `commit -- app` cases. The silent rc 1 half of #236 landed earlier. The new note is asserted by `test-property-sets.sh` P10, which fails on master. — MendixMau (card-disbursement requirements-driven build, field task 21)
2222
- chore(context): **baseline word budget freed — 79,997 → 76,259 words (−3,738) without dropping a rule.** The always-on tier sat 3 words under its 80,000 cap, so three open PRs could not all merge. Long incident narratives in `conversion-runbook.md`, `source-triage.md` and `interview-protocol.md` became one-line failure examples pointing at new on-demand `process/baseline-incident-history.md`, where the original text is kept verbatim per section (R1–R20, AR1, ST1–ST4, IP1–IP3); the runbook's copy of the open-questions status table now defers to `interview-protocol.md` §4; `agent-roles.md`'s six template shapes (setup-only, ~2,300 words) moved verbatim to `agents/README.md`, which the installers never copy (explicit `MXTK_AGENTS` list). Every STOP, rule, denominator and gate cell stays in place; files touched by open PRs were left alone. — MendixMau
2323
- learn(testing-shape, test-result-audit): **three test-strength rules, each with a denominator: refusals probed on the server, every undeclared 4xx a failure, one clean-database final run** ([#172](https://github.com/MendixMau/mxcli-project-toolkit/issues/172)). A field comparison of two builds against one frozen spec found the toolkit build checked permission refusals only in the client (a hidden menu item), logged unexpected 400/422 responses as information, and reached 20/20 by stitching three runs. `testing-shape.md` §7 gains three report lines (`N of N restricted pairs probed server-side`, `undeclared 4xx/5xx: 0 of M requests — each fails its step`, `one clean-DB run <id>: N of N scenarios incl. timers, not stitched`); `test-result-audit.md` gains check 2e, which carries the reasons and the field evidence and asks for those numbers. Both baseline skills stay inside the 80,000-word baseline budget (79,997): the reasons live in the on-demand audit skill, and two redundant sentences in `testing-shape.md` §4's verdict paragraphs were folded (the empty-set corollary is stated in the Trace row, `harness-architecture.md` and `report-schema.md`). The backing inbox note is trimmed to its unpromoted "Keep" items. — MendixMau

‎bin/doctor.sh‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@
4747
# # and records the result. Add --if-stale to skip
4848
# # the run when it already ran for this mxcli
4949
# # version (sync-project.sh does). Exit 0 clean,
50-
# # 1 units need repair or the run failed, 2 not run,
51-
# # 3 this mxcli predates the command (v0.26.0).
50+
# # 1 units need repair (NEEDS/FAILED rows), 2 not run
51+
# # (incl. timeout), 3 this mxcli predates the command
52+
# # (v0.26.0), 4 could not check (error, unclassified
53+
# # output, a crashed probe) — a repair would not help.
5254
# bin/doctor.sh --fix-property-sets <dir> # the same check, then the repair — and only
5355
# # through bin/exec.sh --patch (snapshot, mxbuild
5456
# # gate, restore on failure). See "Property sets".
@@ -330,7 +332,7 @@ ps_apply() {
330332
ps_check
331333
}
332334
ps_exit_code() {
333-
case "$PS_RESULT" in clean) echo 0 ;; not-run) echo 2 ;; unsupported) echo 3 ;; *) echo 1 ;; esac
335+
case "$PS_RESULT" in clean) echo 0 ;; not-run) echo 2 ;; unsupported) echo 3 ;; needs|failed) echo 1 ;; *) echo 4 ;; esac
334336
}
335337

336338
# --property-sets / --fix-property-sets: only this check, then exit. Stands alone so
@@ -1191,12 +1193,13 @@ if [ -n "$PROJECT_DIR" ]; then
11911193
elif [ -n "${MPR:-}" ] && [ -n "${PMXCLI_PROBE:-}" ]; then
11921194
PS_VER="$(ps_version "$PMXCLI_PROBE")"
11931195
if ps_stale; then
1194-
if ps_supported "$PMXCLI_PROBE"; then
1195-
warn "property sets not checked for this mxcli (${PS_VER:-?}) — Studio Pro merge/diff can throw on units an older mxcli wrote"
1196-
note "read-only check: bin/doctor.sh --property-sets $PROJECT_DIR"
1197-
else
1198-
note "${PS_VER:-this mxcli} predates 'mxcli fix property-sets' (v0.26.0) — upgrade before a Team Server merge"
1199-
fi
1196+
_psq_rc=0; ps_supported "$PMXCLI_PROBE" || _psq_rc=$?
1197+
case "$_psq_rc" in
1198+
0) warn "property sets not checked for this mxcli (${PS_VER:-?}) — Studio Pro merge/diff can throw on units an older mxcli wrote"
1199+
note "read-only check: bin/doctor.sh --property-sets $PROJECT_DIR" ;;
1200+
1) note "${PS_VER:-this mxcli} predates 'mxcli fix property-sets' (v0.26.0) — upgrade before a Team Server merge" ;;
1201+
*) warn "property sets: could not probe this mxcli for 'fix property-sets' ('mxcli fix --help' failed)" ;;
1202+
esac
12001203
else
12011204
_psq="$(sed -n 1p "$(ps_receipt)")"
12021205
case "$_psq" in

‎bin/sync-project.sh‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,19 +1464,26 @@ if [ "$WIRED" -eq 1 ] && [ -x "$SCRIPT_DIR/doctor.sh" ] \
14641464
echo "Would run: bin/doctor.sh --property-sets --if-stale (read-only model check; skipped when it already ran for this mxcli)"
14651465
else
14661466
_ps_rc=0
1467-
_ps_out="$("$SCRIPT_DIR/doctor.sh" --property-sets --if-stale "$PROJECT_DIR" 2>&1)" || _ps_rc=$?
1468-
# rc 3 (an mxcli before v0.26 cannot check) is informational here, not a sync warning, so
1469-
# doctor's own WARN line for it is relabelled rather than shown as one.
1470-
if [ "$_ps_rc" -eq 3 ]; then
1467+
# Sync's own, shorter bound (doctor's default is 300 s): the output is captured, so say
1468+
# up front how long this may sit quiet.
1469+
_ps_t="${MXTK_PROPSETS_TIMEOUT:-120}"
1470+
echo " checking property sets (read-only, up to ${_ps_t}s)…"
1471+
_ps_out="$(MXTK_PROPSETS_TIMEOUT="$_ps_t" "$SCRIPT_DIR/doctor.sh" --property-sets --if-stale "$PROJECT_DIR" 2>&1)" || _ps_rc=$?
1472+
# rc 3 (an mxcli before v0.26 cannot check) and rc 4 (the check itself failed) are not
1473+
# findings about the model, so doctor's WARN line for them is relabelled, not shown as one.
1474+
if [ "$_ps_rc" -eq 3 ] || [ "$_ps_rc" -eq 4 ]; then
14711475
printf '%s\n' "$_ps_out" | grep -v '^[[:space:]]*$' | sed -e 's/^ WARN / info /' -e 's/^/ /'
14721476
else
14731477
printf '%s\n' "$_ps_out" | grep -v '^[[:space:]]*$' | sed 's/^/ /'
14741478
fi
14751479
case "$_ps_rc" in
14761480
0|2) ;;
14771481
3) echo " (the project's mxcli predates 'fix property-sets', v0.26.0 — upgrade it before a Team Server merge)" ;;
1478-
*) warn "property sets: Studio Pro's merge/diff can throw on this model (see above). Repair, gated:" \
1482+
4) _ps_why="$(printf '%s\n' "$_ps_out" | sed -n 's/^ WARN property sets: //p' | head -1)"
1483+
echo " could not check property sets: ${_ps_why:-see above} — not recorded; the next sync re-checks" ;;
1484+
1) warn "property sets: Studio Pro's merge/diff can throw on this model (see above). Repair, gated:" \
14791485
"bin/doctor.sh --fix-property-sets '$PROJECT_DIR'" ;;
1486+
*) echo " property-set check exited $_ps_rc — see above" ;;
14801487
esac
14811488
fi
14821489
fi

‎skills/platform-link.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ so a project upgraded mid-flight still carries the old ones until the repair run
473473
for the installed mxcli. After that it runs again only when mxcli changes. Errors and timeouts
474474
are never recorded, so the next run re-checks. `doctor --quick`, which exec.sh runs when the mxcli
475475
version changes, warns while the check is owed. The check reads every unit, so it is bounded by
476-
`MXTK_PROPSETS_TIMEOUT` (default 300 s), and a timeout reports NOT RUN. A unit the
476+
`MXTK_PROPSETS_TIMEOUT` (default 300 s, 120 s under sync), and a timeout reports NOT RUN. A unit the
477477
check reports `FAILED` has a value in a key the project's Mendix version does not declare. mxcli
478478
leaves such units alone, and its exit 1 makes `exec.sh --patch` roll the whole repair back, so
479479
resolve those units first. An mxcli older than v0.26.0 cannot run this check: upgrade it first.

‎tests/wave2/test-property-sets.sh‎

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ case "${1:-}" in
7979
echo "1 unit(s) could not be normalized and were left as they are."; exit 1 ;;
8080
notfound) cat "$F/dry-run-not-found-v0.26.0.txt"; exit 1 ;;
8181
noversion) echo "$b has no readable Mendix version; nothing is normalized without one."; exit 0 ;;
82-
slow) sleep 6; echo "Checked 3 unit(s) in $b against the Mendix 11.12.1 property sets."; exit 0 ;;
82+
slow) exec sleep 6; echo "Checked 3 unit(s) in $b against the Mendix 11.12.1 property sets."; exit 0 ;;
8383
esac ;;
8484
esac ;;
8585
esac
@@ -131,7 +131,8 @@ echo "== P4 failed / error / no version — never clean =="
131131
for st in failed notfound noversion; do
132132
P="$(mkproj st-$st)"; echo "$st" > "$P/.stub-state"
133133
OUT="$("$DOCTOR" --property-sets "$P" 2>&1)"; RC=$?
134-
[ "$RC" -eq 1 ] && ! printf '%s' "$OUT" | grep -q "ok property sets" && ok "$st: exit 1, no ok line" || bad "$st: rc=$RC" "$OUT"
134+
want=4; [ "$st" = failed ] && want=1
135+
[ "$RC" -eq "$want" ] && ! printf '%s' "$OUT" | grep -q "ok property sets" && ok "$st: exit $want, no ok line" || bad "$st: rc=$RC (want $want)" "$OUT"
135136
done
136137
printf '%s' "$OUT" | grep -q "no Mendix version" && ok "noversion: says nothing was checked" || bad "noversion wording" "$OUT"
137138
for st in notfound noversion; do
@@ -141,8 +142,11 @@ P="$WORK/st-notfound"; "$DOCTOR" --property-sets --if-stale "$P" >/dev/null 2>&1
141142
[ "$(grep -c -- '--dry-run' "$P/.stub-log")" -eq 2 ] && ok "notfound: --if-stale re-checks after an error" || bad "notfound: --if-stale skipped after an error"
142143
P="$(mkproj helpfail)"; touch "$P/.stub-helpfail"
143144
OUT="$("$DOCTOR" --property-sets "$P" 2>&1)"; RC=$?
144-
[ "$RC" -eq 1 ] && printf '%s' "$OUT" | grep -q "support is unknown" && [ ! -f "$P/.claude/.property-sets-receipt" ] \
145-
&& ok "failed 'fix --help' probe: error (exit 1), not unsupported, not recorded" || bad "helpfail rc=$RC" "$OUT"
145+
[ "$RC" -eq 4 ] && printf '%s' "$OUT" | grep -q "support is unknown" && [ ! -f "$P/.claude/.property-sets-receipt" ] \
146+
&& ok "failed 'fix --help' probe: error (exit 4), not unsupported, not recorded" || bad "helpfail rc=$RC" "$OUT"
147+
OUT="$("$DOCTOR" --quick "$P" 2>&1)"
148+
printf '%s' "$OUT" | grep -q "could not probe this mxcli" && ! printf '%s' "$OUT" | grep -q "predates 'mxcli fix property-sets'" \
149+
&& ok "--quick, crashed probe: says 'could not probe', not 'predates'" || bad "quick helpfail" "$(printf '%s' "$OUT" | grep -i property)"
146150

147151
echo "== P5 --if-stale: once per mxcli version =="
148152
P="$(mkproj stale)"; echo clean > "$P/.stub-state"
@@ -247,6 +251,15 @@ psl="$(printf '%s\n' "$OUT" | grep -i 'property' )"
247251
printf '%s' "$psl" | grep -q "info property sets: .*arrived in v0.26.0" && ! printf '%s' "$psl" | grep -q "WARN \|⚠️" \
248252
&& ok "sync, mxcli < v0.26: informational line, no WARN, no sync warning" || bad "sync old mxcli" "$psl"
249253

254+
printf '%s' "$OUT" | grep -q "checking property sets (read-only, up to 120s)" && ok "sync announces the check and its 120 s bound" || bad "no announcement" "$(printf '%s' "$OUT" | grep -i property)"
255+
S4="$WORK/syncerr"; mkdir -p "$S4"; : > "$S4/App.mpr"
256+
MXTK_NO_GUIDE=1 "$TK/bin/init-project.sh" "$S4" >/dev/null 2>&1
257+
mkstub "$S4"; echo notfound > "$S4/.stub-state"
258+
OUT="$("$SYNC" "$S4" 2>&1)"
259+
psl="$(printf '%s\n' "$OUT" | grep -i 'property')"
260+
printf '%s' "$psl" | grep -q "could not check property sets: could not classify" && ! printf '%s' "$psl" | grep -q "fix-property-sets\|⚠️\|WARN " \
261+
&& ok "sync, check errored (exit 4): neutral line, no repair advice, no warning" || bad "sync error case" "$psl"
262+
250263
echo "== P10 (#236) sync names a pre-fix bin/model-stamp.sh =="
251264
grep -v 'GIT_WORK_TREE' "$TK/project-bin/model-stamp.sh" > "$S/bin/model-stamp.sh"; chmod +x "$S/bin/model-stamp.sh"
252265
OUT="$("$SYNC" "$S" --dry-run --no-refresh 2>&1)"

0 commit comments

Comments
 (0)