Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ Sections dated before 2026-09-19 predate the cycle and stay as they are. Named m
`docs/RELEASE-PROCESS.md` §8.

## Unreleased
- fix(app-restart, exec): **`app-restart.sh` logs to the project, and exec's watch / change-class lines mark a blanked literal `'…'`**: the restart log went to `${TMPDIR:-/tmp}/<mpr name>-run-local.log`, one file for every project whose model shares a name (several field apps were all `ProbeApp.mpr`); it is now `<project>/.claude/loop/app-restart/run-local.log` beside `start.cmd` (self-gitignored, created only when written; `LOGDIR` still overrides). The advisory lines printed a statement head with its string literals blanked to `''` — `create or modify demo user '' ( Password: '', …` read as an empty user name; a blanked literal now reads `'…'`, and the literal itself (a password, here) is still never printed. Fixtures `test-app-restart.sh` (master 120/123, branch 123/123) and `test-exec-lock-watch.sh` (master 126/128, branch 128/128) — field run on a real Mendix 11.8 app (2026-11-20)
- fix(design-audit): **the #891 guard names the unnamed `controlbar {` mxcli writes**: `readCompleteness()` matched only `controlbar <name>`, so on a DataGrid2 page with New/Edit buttons the guard FAULTed the page correctly (the buttons are unread) while its message said "controlbars: none". Unnamed control bars are now reported as `(unnamed, mdlSource line N)`; named ones keep their name; the verdict is unchanged. Fixture `tests/wave2/test-design-audit-controlbar.sh` over a captured `describe --format elk` of a real Mendix 11.8 page (master 4/5, branch 5/5) — field run 2026-11-20
- fix(design-audit, e2e-harness-base): **a design-audit that cannot launch its browser no longer leaves the last run's `design-audit.json` reading as current, and the install doc names axe-core**: `e2e-harness-base.md` named only Playwright; followed literally in a container with a global Playwright, `npm i -D playwright` shadowed it with a version whose browser was not downloaded, design-audit crashed at `chromium.launch` (exit 1) and wrote nothing, so the previous run's artifact stayed in place unchanged. A browser that does not launch is now a FAULT row per rung-7 check (the artifact is rewritten, exit 2); any other crash removes the stale artifact and says so (report-normalize then reads design-audit as `fault`). The doc now says to probe for a working Playwright before installing one, and to `npm i -D axe-core`. Fixture `tests/wave2/test-design-audit-stale-artifact.sh` (master 1/5, branch 6/6; Playwright's launch message captured verbatim from the field log) — field run on a real Mendix 11.8 app under `mxcli run --local` (2026-11-20)
- new(doctor, bug ledger): **a guard for mxcli's silent MxBuild fallback**: when the project's Mendix version is not in `~/.mxcli/mxbuild/` (and no Studio Pro of that version exists), `mxcli docker build` / `docker check` fall back to the newest cached MxBuild and print its path but no version warning (`run --local` is exact-or-refuse); `bin/doctor.sh` now warns, naming the model version, the cached ones and `./mxcli setup mxbuild -p <app>.mpr` (`mxtk_mxbuild_cache_gap`, warning only, never changes a gate). Ledger entry `BUG-DRAFT-mxbuild-silent-version-fallback`; upstream issue not filed. — a four-app Mendix build (field run), independent review
- fix(gate-check): **a fresh clone no longer FAILs Stage 3 as "stale render"**: `blueprint.html` / `process-map.html` freshness used `[ render -ot source ]`, a nanosecond mtime compare, and a checkout stamps files in directory order (`process-map.html` lands before `process-model.json`), so an unedited project read stale on every clone (reproduced: 200-wireframe checkout, 10 of 10 clones). New `bin/lib/render-fresh.sh` keeps `-ot` as the first test (a pass never flips, no git call) and, only where `-ot` would FAIL, asks git once per render (one `log`, one `status`) whether the source was committed after the render's commit; measured 0.19 s for 200 sources all `-ot`-stale on a 300-commit history (a per-source git version cost 12.9 s). Limit: a depth-1 clone cannot see a genuinely stale render. Field run: a four-app Mendix build checked out on a second machine. — a four-app Mendix build (field run), independent review
- fix(test-stack-up, e2e-harness-base): **the app port follows the app's configured port, and a multi-app start is no longer pinned to 8080**: with no `APP_PORTS`, `test-stack-up.sh` puts `RUN_LOCAL_APP_PORT`, then `APP_PORT` from the `.docker/.env` beside the `.mpr` (`apps/<App>/.docker/.env`; the project-root one as fallback) first, ahead of the old fixed `8080 8081 8084` tail. A fresh `run --local` start for a model under `apps/` with no handshake and no configured port used to fall back to 8080 for every app (`--app-port 8080`); it now exits 4 naming `RUN_LOCAL_APP_PORT`. `e2e-harness-base.md` states that a PAD/Docker runtime listens on 8080 *inside* the container only. Fixtures T28–T32 added. Field run: a four-app Mendix build on 8081–8084 whose fresh start failed with every app pinned to 8080. — a four-app Mendix build (field run), independent review
Expand Down
11 changes: 9 additions & 2 deletions project-bin/app-restart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,13 @@ fi
REC_ADMIN="$(hs_num adminPort "$HS")" # the probe uses only a recorded admin port, never a guess
ADMIN_PORT="$REC_ADMIN"; [ -n "$ADMIN_PORT" ] || ADMIN_PORT=$((PORT + 10))
REC_DIR="$PROJECT_ROOT/.claude/loop/app-restart"; REC="$REC_DIR/start.cmd"
LOG="${LOGDIR:-${TMPDIR:-/tmp}}/$(basename "$MPR" .mpr)-run-local.log"
# The start log is this project's: <project>/.claude/loop/app-restart/run-local.log (self-gitignored,
# beside start.cmd). It was ${TMPDIR:-/tmp}/<mpr name>-run-local.log, one file for every project whose
# model shares a name (field run 2026-11-20: several apps called ProbeApp.mpr wrote into one log).
# LOGDIR still overrides. Created only when something is written, so --probe / --dry-run touch nothing.
LOG="${LOGDIR:+$LOGDIR/$(basename "$MPR" .mpr)-run-local.log}"; LOG="${LOG:-$REC_DIR/run-local.log}"
log_dir() { [ -n "${LOGDIR:-}" ] && return 0
mkdir -p "$REC_DIR" 2>/dev/null && { [ -f "$REC_DIR/.gitignore" ] || printf '*\n' > "$REC_DIR/.gitignore"; }; }

# ── 1b. --probe / --if-client-gone: look before touching anything ───────────
if [ "$MODE" = probe ]; then
Expand Down Expand Up @@ -328,7 +334,7 @@ if [ "$MODE" = client ]; then
_mx="$(find_project_mxcli 2>/dev/null || command -v mxcli 2>/dev/null || true)"
if [ -n "$_rs" ] && [ -n "$_mx" ]; then
echo " mxcli run restart -p $(basename "$MPR") (a --detach run: mxcli restarts it with its own arguments)"
"$_mx" run restart -p "$MPR" >>"$LOG" 2>&1 </dev/null || echo " ! mxcli run restart exited $? — see $LOG; checking the app anyway"
log_dir; "$_mx" run restart -p "$MPR" >>"$LOG" 2>&1 </dev/null || echo " ! mxcli run restart exited $? — see $LOG; checking the app anyway"
wait_ready
fi
# No run-state.json (not a --detach run) or no mxcli here: the recorded-pid restart below.
Expand Down Expand Up @@ -454,6 +460,7 @@ fi

# ── 4. Start it the same way, detached, and remember how ────────────────────
rm -f "$HS" 2>/dev/null || true # a SIGKILLed mxcli leaves its record behind; the new one must be new
log_dir
if command -v setsid >/dev/null 2>&1; then
( cd "$START_CWD" && exec setsid nohup "${ARGV[@]}" >>"$LOG" 2>&1 </dev/null ) &
else
Expand Down
13 changes: 8 additions & 5 deletions project-bin/exec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,10 @@ _MXTK_MDL_LEX='
start_depth = depth
tmp = clean; o = gsub(/[({]/, "", tmp); tmp = clean; cl = gsub(/[)}]/, "", tmp)
depth += o - cl; if (depth < 0) depth = 0
}'
}
# For DISPLAY only: a blanked literal reads as "\047…\047", not as an empty string. The text
# is never shown — a statement head can carry a password (`demo user ... Password: ...`).
function shown(s) { gsub("\047\047", "\047…\047", s); return s }'
mxtk_change_class() { # $1 = MDL script; prints "<class>\t<why>"
awk "$_MXTK_MDL_LEX"'
function head_class(w1, w2, w4, obj) {
Expand All @@ -267,7 +270,7 @@ mxtk_change_class() { # $1 = MDL script; prints "<class>\t<why>"
if (k == "ui") ui++
else if (k == "logic" && logic == "") {
h = t; if (length(h) > 60) h = substr(h, 1, 60) "..."
logic = "line " NR ": " h
logic = "line " NR ": " shown(h)
}
}
}
Expand Down Expand Up @@ -440,7 +443,7 @@ mxtk_watch_compat() { # $1 = MDL script; prints "restart\t<reasons>" | "unknown
else if (v == "CREATE" && o1 == "PAGE" && j == 2)
add("new page", NR)
else if (v == "CREATE" && o1 == "PAGE") {
if (maybe == "") maybe = "line " NR ": " substr(t, 1, 60)
if (maybe == "") maybe = "line " NR ": " shown(substr(t, 1, 60))
}
# The watch-safe list (skills/ui-loop.md "What watch picks up", left column): an
# ALTER PAGE / ALTER SNIPPET edit, a new or changed snippet. Everything else that is
Expand All @@ -454,7 +457,7 @@ mxtk_watch_compat() { # $1 = MDL script; prints "restart\t<reasons>" | "unknown
;
else if (nunk < 3) {
h = t; if (length(h) > 50) h = substr(h, 1, 50) "..."
unk = unk (nunk++ ? "; " : "") "line " NR ": " h
unk = unk (nunk++ ? "; " : "") "line " NR ": " shown(h)
} else nunk++
}
}
Expand All @@ -470,7 +473,7 @@ mxtk_watch_compat() { # $1 = MDL script; prints "restart\t<reasons>" | "unknown
if (lc ~ re_act) add("widget action changed (the runtime registers actions at boot)", NR)
else if (!ui_unk && lc ~ re_ds) {
ui_unk = 1
if (nunk < 3) { h = t; if (length(h) > 50) h = substr(h, 1, 50) "..."; unk = unk (nunk++ ? "; " : "") "line " NR ": " h " (microflow/nanoflow data source)" }
if (nunk < 3) { h = t; if (length(h) > 50) h = substr(h, 1, 50) "..."; unk = unk (nunk++ ? "; " : "") "line " NR ": " shown(h) " (microflow/nanoflow data source)" }
else nunk++
}
}
Expand Down
62 changes: 48 additions & 14 deletions project-tests/e2e/design-audit.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,9 @@ function readCompleteness(doc) {
// must span the whole `column X ( … )` head, not one line of it.
const customContentCols = [...mdl.matchAll(/^\s*column\s+("?)([A-Za-z_][\w]*)\1\s*\(([^)]*)\)/gm)]
.filter((m) => /ShowContentAs:\s*customContent/.test(m[3])).map((m) => m[2]);
const controlbars = [...mdl.matchAll(/^\s*controlbar\s+([A-Za-z_][\w]*)/gm)].map((m) => m[1]);
// mxcli writes a data grid's control bar unnamed (`controlbar {`); a name is optional.
const controlbars = [...mdl.matchAll(/^[ \t]*controlbar\b[ \t]*([A-Za-z_]\w*)?/gm)]
.map((m) => m[1] || `(unnamed, mdlSource line ${mdl.slice(0, m.index).split('\n').length})`);

// An empty group in the tree where the MDL has a body is the accordion/object-list
// shape from #891 verbatim.
Expand Down Expand Up @@ -767,23 +769,31 @@ async function appSweep(pages, navMap, controlNotes) {
return { checks, ran: false, reason: '--static-only' };
}

const faultAll = (why) => {
for (const qn of pages) for (const [k, title] of Object.entries(titles)) {
checks.push(row({
id: `design-audit/rung7/${k}/${qn}`, module: moduleOf(qn), page: qn, title,
verdict: 'fault', detail: why,
}));
}
return { checks, ran: false, reason: why };
};
let helpers, cfg, chromium, axeSource;
try {
helpers = require('./helpers');
cfg = require('./config').cfg || require('./config');
({ chromium } = require('playwright'));
axeSource = fs.readFileSync(require.resolve('axe-core/axe.min.js'), 'utf8');
} catch (e) {
for (const qn of pages) for (const [k, title] of Object.entries(titles)) {
checks.push(row({
id: `design-audit/rung7/${k}/${qn}`, module: moduleOf(qn), page: qn, title,
verdict: 'fault', detail: `harness dependency missing: ${e.message}`,
}));
}
return { checks, ran: false, reason: e.message };
return faultAll(`harness dependency missing: ${e.message}`);
}

const browser = await chromium.launch({ headless: true });
// A Playwright whose browser was never downloaded (a project-local `npm i -D playwright`
// shadowing a global one) throws here. That is "rung 7 did not run", a FAULT row per page —
// not a crash that leaves the previous run's design-audit.json in place.
let browser;
try { browser = await chromium.launch({ headless: true }); }
catch (e) { return faultAll(`browser did not launch: ${String(e.message).split('\n')[0]}`); }
const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } });
const page = await ctx.newPage();
let loggedIn = false;
Expand Down Expand Up @@ -1038,7 +1048,14 @@ async function runControls(pages, css, wf) {
fs.writeFileSync(p, wrap(v)); files[k] = p;
}

const browser = await chromium.launch({ headless: true });
let browser;
try { browser = await chromium.launch({ headless: true }); }
catch (e) {
for (const n of ['rung7-a11y', 'rung7-overflow', 'rung7-structure']) {
out.push(ctlRow(n, `rung 7 ${n}`, false, `browser did not launch: ${String(e.message).split('\n')[0]}`));
}
return out;
}
const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } });
const pg = await ctx.newPage();
const measure = async (file) => {
Expand Down Expand Up @@ -1204,6 +1221,12 @@ async function main() {
write({ startedAt, checks, instruments, pages, perPage: st.perPage, stats: st.stats, controlRows });
}

function outFile() {
return OPT.out
? path.resolve(ROOT, OPT.out)
: path.join(ARTIFACTS, OPT.positiveControl ? 'design-audit-control.json' : 'design-audit.json');
}

function write({ startedAt, checks, instruments, pages, perPage, stats, controlRows = [] }) {
const tally = {};
for (const c of checks) tally[c.verdict] = (tally[c.verdict] || 0) + 1;
Expand Down Expand Up @@ -1231,9 +1254,7 @@ function write({ startedAt, checks, instruments, pages, perPage, stats, controlR
instruments,
checks,
};
const out = OPT.out
? path.resolve(ROOT, OPT.out)
: path.join(ARTIFACTS, OPT.positiveControl ? 'design-audit-control.json' : 'design-audit.json');
const out = outFile();
fs.writeFileSync(out, JSON.stringify(doc, null, 2));

// console: short, honest, no green where there is none
Expand Down Expand Up @@ -1270,4 +1291,17 @@ function write({ startedAt, checks, instruments, pages, perPage, stats, controlR
}
}

main().catch((e) => { console.error('design-audit crashed:', e); process.exit(1); });
// A crash writes no artifact, so the previous run's would be read as this run's: a stale green.
// Remove it — report-normalize then reads design-audit as `fault` ("did not run"), which it is.
main().catch((e) => {
console.error('design-audit crashed:', e);
try {
const out = outFile();
if (fs.existsSync(out)) {
fs.unlinkSync(out);
console.error(`design-audit: removed the previous run's ${path.relative(ROOT, out)} — this run wrote none, `
+ 'and the old file would read as current.');
}
} catch (e2) { console.error(`design-audit: could not remove the stale artifact: ${e2.message}`); }
process.exit(1);
});
9 changes: 7 additions & 2 deletions skills/e2e-harness-base.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@ Build after completing a module build phase:
## Prerequisites

- Node.js available
- Playwright installed: `npm init -y && npm i -D playwright`
- `npx playwright install chromium`
- Playwright, once: first try `node -e "require('playwright').chromium.launch().then(b => b.close())"`
from the project root. If it exits 0, a Playwright with its browser is already there (a global
install, a container image): **do not** `npm i -D playwright` — a project-local copy shadows it
with a version whose browser is not downloaded, and every browser instrument then fails with
`Executable doesn't exist`. Otherwise: `npm init -y && npm i -D playwright && npx playwright install chromium`.
- axe-core: `npm i -D axe-core` — `tests/e2e/design-audit.js` rung 7 (accessibility) needs it; without
it every rung-7 row is a FAULT ("harness dependency missing").
- App running at `http://localhost:8080` — or, when this session cannot reach that host (a
cloud container, a devcontainer, a phone), at the public URL from `mxcli run --local --hub`.
Point the harness `BASE_URL` at whichever one actually answers; never assume `localhost:8080`.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"format":"wireframe","type":"page","name":"Tasks.Task_Overview","title":"Tasks","layout":"Atlas_Core.Atlas_Default","root":[{"id":"wf-0","widget":"datagrid","name":"dgTasks","datasource":"database Tasks.Task","columns":[{"caption":"Title","binding":"Title"},{"caption":"Done","binding":"Done"}]}],"mdlSource":"create or modify page Tasks.Task_Overview (Title: 'Tasks', Layout: Atlas_Core.Atlas_Default) {\n datagrid dgTasks (DataSource: database from Tasks.Task, Selection: Single) {\n -- Context: $currentObject (Tasks.Task), $dgTasks (selection)\n controlbar {\n actionbutton btnNew (\n Caption: 'New task',\n Action: create object Tasks.Task then show page Tasks.Task_NewEdit,\n ButtonStyle: Primary\n )\n actionbutton btnEdit (Caption: 'Edit', Action: show page Tasks.Task_NewEdit(Task = $dgTasks))\n }\n column (Attribute: Title, Caption: 'Title')\n column (Attribute: Done, Caption: 'Done')\n }\n};\n\ngrant view on page Tasks.Task_Overview to Tasks.User;\n","sourceMap":{"wf-0":{"startLine":1,"endLine":1}}}
12 changes: 12 additions & 0 deletions tests/wave2/test-app-restart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,18 @@ has "says there was nothing to stop" "$OUT" "nothing — recorded pid $D is not
has "uses the remembered command" "$OUT" "remembered from the last restart"
KILL_LIST="$KILL_LIST $(hs_pid "$P") $(cat "$P/.fakechild" 2>/dev/null)"

echo "-- the start log is this project's, not a /tmp file shared by every model of the same name"
# Field run 2026-11-20: several experiments' models were all ProbeApp.mpr, so they all wrote
# ${TMPDIR:-/tmp}/ProbeApp-run-local.log. Without LOGDIR the log now lives beside start.cmd.
mkdir -p "$WORK/tmpd"
OUT="$( ( cd "$P" && env -u LOGDIR TMPDIR="$WORK/tmpd" FAKE_GOLDEN="$GOLDEN" ./bin/app-restart.sh --timeout 30 ) 2>&1)"; RC=$?
[ "$RC" -eq 0 ] && ok "exit 0" || bad "exit $RC: $(printf '%s' "$OUT" | tail -4)"
PLOG="$P/.claude/loop/app-restart/run-local.log"
[ -f "$PLOG" ] && ok "the start log is <project>/.claude/loop/app-restart/run-local.log" || bad "no per-project start log" "$(ls "$P/.claude/loop/app-restart" 2>&1)"
has "and the output names it" "$OUT" "log: $PLOG"
[ ! -e "$WORK/tmpd/Fixture-run-local.log" ] && ok "nothing written to \$TMPDIR/<mpr>-run-local.log" || bad "the shared TMPDIR log was written"
KILL_LIST="$KILL_LIST $(hs_pid "$P") $(cat "$P/.fakechild" 2>/dev/null)"

echo "-- #304 review: a stale record whose pid now belongs to another process → that process is never stopped"
# A SIGKILLed mxcli leaves its record; the OS reuses the pid. With --cmd the start command no longer
# comes from the pid, so only a check on the pid itself can tell. The old code sent it TERM.
Expand Down
Loading
Loading