From c2f999a7806d000d05f88527beeacb21a1402321 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 20:33:27 +0000 Subject: [PATCH 1/2] tests: fixtures no longer write .leakguard-deny into the toolkit clone test-mode-contract.sh, test-ci-gates.sh, test-gitignore-crlf.sh and test-must-haves-advisory.sh scaffolded through init-project.sh without MXTK_LEAKGUARD_DENYFILE. run-all.sh sets it, but a scoped run of any of them alone appended its project names (\bhand\b, \bc6\b, \bold\b, ...) to the clone's real .leakguard-deny, and the pre-commit leak guard then flagged nearly every file for the next committer. Each now exports MXTK_LEAKGUARD_DENYFILE into its own scratch dir. New fixture test-fixture-denylist-isolation.sh runs them in a copy of the toolkit with the variable unset and asserts the root denylist is unchanged: 4 FAIL against master, 4 ok on this branch. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HXpQSjXefSNicGGqP4aiSC --- CHANGELOG.md | 1 + tests/wave2/test-ci-gates.sh | 4 ++ .../wave2/test-fixture-denylist-isolation.sh | 59 +++++++++++++++++++ tests/wave2/test-gitignore-crlf.sh | 4 ++ tests/wave2/test-mode-contract.sh | 4 ++ tests/wave2/test-must-haves-advisory.sh | 4 ++ 6 files changed, 76 insertions(+) create mode 100755 tests/wave2/test-fixture-denylist-isolation.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index e9e148df..a3eae8e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ Sections dated before 2026-09-19 predate the cycle and stay as they are. Named m `docs/RELEASE-PROCESS.md` §8. ## Unreleased +- process(tests): **fixtures run alone no longer write `.leakguard-deny` into the toolkit clone**: `test-mode-contract.sh`, `test-ci-gates.sh`, `test-gitignore-crlf.sh` and `test-must-haves-advisory.sh` scaffolded through `init-project.sh` without `MXTK_LEAKGUARD_DENYFILE`, so a scoped run (outside `run-all.sh`, which sets it) registered `\bhand\b`, `\bc6\b`, `\bold\b`, `\bmid\b`, `\bfresh\b` and three `init-*` names in the clone's real denylist, and the pre-commit leak guard then flagged nearly every file for the next committer. Each now points it at its own scratch dir; new fixture `test-fixture-denylist-isolation.sh` runs them in a copy of the toolkit with the variable unset and asserts the root denylist is unchanged (4 FAIL on master, 4 ok on the branch). — several toolkit maintenance sessions in one shared clone, 2026-11-19 - 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 .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//.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 diff --git a/tests/wave2/test-ci-gates.sh b/tests/wave2/test-ci-gates.sh index aaa3366f..a4fc4096 100755 --- a/tests/wave2/test-ci-gates.sh +++ b/tests/wave2/test-ci-gates.sh @@ -20,6 +20,10 @@ ok() { PASS=$((PASS+1)); echo " ok — $1"; } bad() { FAIL=$((FAIL+1)); echo " FAIL — $1"; } WORK="$(mktemp -d "${TMPDIR:-/tmp}/citest.XXXXXX")" || exit 2 trap 'rm -rf "$WORK"' EXIT +# init-project.sh registers each scaffolded project's name in the toolkit clone's .leakguard-deny +# unless told otherwise; run alone (outside run-all.sh) this fixture would leave its project names +# there and the pre-commit leak guard would flag every file for the next committer. +export MXTK_LEAKGUARD_DENYFILE="$WORK/leakguard-deny" echo "== subject: $SUBJECT" [ -f "$SUBJECT" ] && [ -d "$FXS" ] || { echo "FAIL — subject or fixture missing"; echo "PASS=0 FAIL=1"; exit 1; } export GIT_AUTHOR_NAME=t GIT_AUTHOR_EMAIL=t@t GIT_COMMITTER_NAME=t GIT_COMMITTER_EMAIL=t@t diff --git a/tests/wave2/test-fixture-denylist-isolation.sh b/tests/wave2/test-fixture-denylist-isolation.sh new file mode 100755 index 00000000..b81d05ad --- /dev/null +++ b/tests/wave2/test-fixture-denylist-isolation.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash +# test-fixture-denylist-isolation.sh — fixtures that scaffold through init-project.sh, run ALONE (the +# scoped way CLAUDE.md "Testing this toolkit" asks for), leave no .leakguard-deny in the toolkit root. +# +# Usage: bash tests/wave2/test-fixture-denylist-isolation.sh [path-to-init-project.sh] [fixture ...] +# (the toolkit is the one holding that init-project.sh; fixtures default to the four that leaked) +# +# WHY: init-project.sh writes each project's name into $TOOLKIT_ROOT/.leakguard-deny unless +# MXTK_LEAKGUARD_DENYFILE points elsewhere. run-all.sh exports it for every fixture, but a fixture +# run on its own got no such cover: test-mode-contract.sh wrote `\bhand\b`, test-ci-gates.sh `\bc6\b`, +# test-must-haves-advisory.sh `\bold\b`/`\bmid\b`/`\bfresh\b`, and the pre-commit leak guard then +# flagged nearly every file for whoever committed next in that clone (2026-11-19, several sessions). +# +# The fixtures run in a COPY of the toolkit (tracked + untracked, gitignored files excluded), so a +# leaking fixture pollutes the copy and never the developer's real clone. The fixtures' own pass/fail +# is not this test's business and is only reported; the one assertion is the denylist, before vs after. +set -uo pipefail + +SUBJECT="${1:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)/bin/init-project.sh}" +case "$SUBJECT" in /*) ;; *) SUBJECT="$PWD/$SUBJECT" ;; esac +TK="$(cd "$(dirname "$SUBJECT")/.." && pwd)" +shift 2>/dev/null || true +FIXTURES=("$@") +[ "${#FIXTURES[@]}" -gt 0 ] || FIXTURES=(test-mode-contract.sh test-ci-gates.sh test-gitignore-crlf.sh test-must-haves-advisory.sh) + +WORK="$(mktemp -d "${TMPDIR:-/tmp}/deny-iso.XXXXXX")" || exit 2 +trap 'rm -rf "$WORK"' EXIT +PASS=0; FAIL=0 +ok() { PASS=$((PASS+1)); echo " ok — $1"; } +bad() { FAIL=$((FAIL+1)); echo " FAIL — $1"; } + +COPY="$WORK/tk"; mkdir -p "$COPY" +( cd "$TK" && git ls-files -co --exclude-standard -z | tar --null -T - -cf - 2>/dev/null ) | ( cd "$COPY" && tar xf - ) \ + || { echo "could not copy $TK"; exit 2; } +( cd "$COPY" && git init -q . && git add . >/dev/null 2>&1 && git -c user.name=t -c user.email=t@t commit -qm copy ) >/dev/null 2>&1 +[ ! -e "$COPY/.leakguard-deny" ] || { echo "copy already holds a denylist"; exit 2; } + +# The cover run-all.sh gives is exactly what must not be inherited here. +unset MXTK_LEAKGUARD_DENYFILE +export MXTK_NO_GUIDE=1 + +for fx in "${FIXTURES[@]}"; do + f="$COPY/tests/wave2/$fx" + [ -f "$f" ] || { bad "$fx: not in the toolkit"; continue; } + arg="" + case "$fx" in test-must-haves-advisory.sh) arg="$COPY/bin/sync-project.sh" ;; esac + before="$(cat "$COPY/.leakguard-deny" 2>/dev/null)" + ( cd "$WORK" && HOME="$WORK/home" bash "$f" $arg "$WORK/$fx.out" 2>&1 ); rc=$? + after="$(cat "$COPY/.leakguard-deny" 2>/dev/null)" + if [ "$before" = "$after" ] && [ ! -e "$COPY/.leakguard-deny" ]; then + ok "$fx leaves no .leakguard-deny in the toolkit root (fixture rc=$rc)" + else + bad "$fx wrote to the toolkit's .leakguard-deny: $(printf '%s' "$after" | grep -v '^#' | tr '\n' ' ')" + rm -f "$COPY/.leakguard-deny" + fi +done + +echo "PASS=$PASS FAIL=$FAIL" +[ "$FAIL" -eq 0 ] diff --git a/tests/wave2/test-gitignore-crlf.sh b/tests/wave2/test-gitignore-crlf.sh index a76015e0..e8237596 100644 --- a/tests/wave2/test-gitignore-crlf.sh +++ b/tests/wave2/test-gitignore-crlf.sh @@ -18,6 +18,10 @@ bad() { FAIL=$((FAIL+1)); echo " FAIL — $1"; } WORK="$(mktemp -d "${TMPDIR:-/tmp}/gicrlf.XXXXXX")" || exit 2 WORK="$(cd "$WORK" && pwd -P)" trap 'rm -rf "$WORK"' EXIT +# init-project.sh registers each scaffolded project's name in the toolkit clone's .leakguard-deny +# unless told otherwise; run alone (outside run-all.sh) this fixture would leave its project names +# there and the pre-commit leak guard would flag every file for the next committer. +export MXTK_LEAKGUARD_DENYFILE="$WORK/leakguard-deny" CR="$(printf '\r')" nlines() { tr -d '\r' < "$1" | wc -l | tr -d ' '; } ncrlf() { grep -c "${CR}\$" "$1"; } diff --git a/tests/wave2/test-mode-contract.sh b/tests/wave2/test-mode-contract.sh index 1e7bdb9d..02066cd7 100755 --- a/tests/wave2/test-mode-contract.sh +++ b/tests/wave2/test-mode-contract.sh @@ -32,6 +32,10 @@ case "$SUBJECT" in /*) ;; *) SUBJECT="$PWD/$SUBJECT" ;; esac GOLD="$TOOLKIT/tests/wave2/fixtures/entry-mode-plan-rule" WORK="$(cd "$(mktemp -d "${TMPDIR:-/tmp}/mode-contract.XXXXXX")" && pwd -P)" || exit 2 trap 'rm -rf "$WORK"' EXIT +# init-project.sh registers each scaffolded project's name in the toolkit clone's .leakguard-deny +# unless told otherwise; run alone (outside run-all.sh) this fixture would leave its project names +# there and the pre-commit leak guard would flag every file for the next committer. +export MXTK_LEAKGUARD_DENYFILE="$WORK/leakguard-deny" PASS=0; FAIL=0 ok() { PASS=$((PASS+1)); echo " ok - $1"; } bad() { FAIL=$((FAIL+1)); echo " FAIL - $1${2:+: $2}"; } diff --git a/tests/wave2/test-must-haves-advisory.sh b/tests/wave2/test-must-haves-advisory.sh index 5449d9e2..4639f96b 100755 --- a/tests/wave2/test-must-haves-advisory.sh +++ b/tests/wave2/test-must-haves-advisory.sh @@ -17,6 +17,10 @@ OBCHECK="$(dirname "$SYNC")/lib/obligation-check.sh" for f in "$INIT" "$OBCHECK"; do [ -r "$f" ] || { echo "missing $f"; exit 2; }; done WORK="$(mktemp -d "${TMPDIR:-/tmp}/mh-adv.XXXXXX")" trap '[ -n "${KEEP:-}" ] || rm -rf "$WORK"' EXIT +# init-project.sh registers each scaffolded project's name in the toolkit clone's .leakguard-deny +# unless told otherwise; run alone (outside run-all.sh) this fixture would leave its project names +# there and the pre-commit leak guard would flag every file for the next committer. +export MXTK_LEAKGUARD_DENYFILE="$WORK/leakguard-deny" export MXTK_NO_GUIDE=1 PASS=0; FAIL=0 ok() { PASS=$((PASS+1)); printf ' ok %s\n' "$1"; } From 47ebe4b4153791db6bf2460e0fc1ad7135dad7bb Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 20:47:51 +0000 Subject: [PATCH 2/2] tests: run-all.sh sentinel replaces the denylist-isolation fixture Review of #829 (MERGE-AFTER-FIX): the 250 s fixture re-ran four fixtures and guarded only those. run-all.sh now empties its exported scratch MXTK_LEAKGUARD_DENYFILE before each fixture and FAILs, by name, any fixture that leaves it non-empty -- i.e. one that relies on run-all's cover and would write the clone's real .leakguard-deny when run alone. Covers every current and future fixture at ~0 s. Proved with a one-fixture symlink-farm harness of run-all.sh: master's test-mode-contract.sh trips it (\bhand\b), the branch's does not. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HXpQSjXefSNicGGqP4aiSC --- CHANGELOG.md | 2 +- tests/wave2/run-all.sh | 13 +++- .../wave2/test-fixture-denylist-isolation.sh | 59 ------------------- 3 files changed, 13 insertions(+), 61 deletions(-) delete mode 100755 tests/wave2/test-fixture-denylist-isolation.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index a3eae8e9..383d78af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ Sections dated before 2026-09-19 predate the cycle and stay as they are. Named m `docs/RELEASE-PROCESS.md` §8. ## Unreleased -- process(tests): **fixtures run alone no longer write `.leakguard-deny` into the toolkit clone**: `test-mode-contract.sh`, `test-ci-gates.sh`, `test-gitignore-crlf.sh` and `test-must-haves-advisory.sh` scaffolded through `init-project.sh` without `MXTK_LEAKGUARD_DENYFILE`, so a scoped run (outside `run-all.sh`, which sets it) registered `\bhand\b`, `\bc6\b`, `\bold\b`, `\bmid\b`, `\bfresh\b` and three `init-*` names in the clone's real denylist, and the pre-commit leak guard then flagged nearly every file for the next committer. Each now points it at its own scratch dir; new fixture `test-fixture-denylist-isolation.sh` runs them in a copy of the toolkit with the variable unset and asserts the root denylist is unchanged (4 FAIL on master, 4 ok on the branch). — several toolkit maintenance sessions in one shared clone, 2026-11-19 +- process(tests): **fixtures run alone no longer write `.leakguard-deny` into the toolkit clone**: `test-mode-contract.sh`, `test-ci-gates.sh`, `test-gitignore-crlf.sh` and `test-must-haves-advisory.sh` scaffolded through `init-project.sh` without `MXTK_LEAKGUARD_DENYFILE`, so a scoped run (outside `run-all.sh`, which sets it) registered `\bhand\b`, `\bc6\b`, `\bold\b`, `\bmid\b`, `\bfresh\b` and three `init-*` names in the clone's real denylist, and the pre-commit leak guard then flagged nearly every file for the next committer. Each now points it at its own scratch dir, and `tests/wave2/run-all.sh` treats its exported scratch denylist as a sentinel: emptied before each fixture, a fixture that leaves it non-empty FAILs by name, so the next fixture that forgets is caught at ~0 s cost (master's `test-mode-contract.sh` trips it with `\bhand\b`; the fixed one does not). — several toolkit maintenance sessions in one shared clone, 2026-11-19 - 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 .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//.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 diff --git a/tests/wave2/run-all.sh b/tests/wave2/run-all.sh index 9f44a596..23ec1279 100755 --- a/tests/wave2/run-all.sh +++ b/tests/wave2/run-all.sh @@ -22,7 +22,12 @@ FAILED=0; RAN=0; SKIPPED=0 # Belt for the denylist pollution (2026-09-08): fixtures scaffold through init-project.sh, which # registers the project name in the toolkit's gitignored denylist unless told otherwise. Send it # to scratch here for every fixture, and refuse at the end if the real one appeared anyway. +# The scratch path doubles as a SENTINEL: it is emptied before each fixture, and a fixture that +# leaves it non-empty scaffolded without exporting its own MXTK_LEAKGUARD_DENYFILE, so run ALONE +# (the scoped way) it writes its project names into the clone's real .leakguard-deny and the +# pre-commit leak guard flags every file for the next committer (2026-11-19: `\bhand\b`, `\bc6\b`). export MXTK_LEAKGUARD_DENYFILE="${TMPDIR:-/tmp}/mxtk-runall-denylist.$$" +SENTINEL="$MXTK_LEAKGUARD_DENYFILE" # Same idea for the browser: every fixture that scaffolds a fresh project through init-project.sh # would open toolkit-guide.html in the developer's real browser, one tab per fixture, all run long. # test-guide-reopen.sh unsets this and uses a fake `open` to test the opening itself. @@ -72,8 +77,14 @@ for t in "$DIR"/test-*.sh; do fi fi + rm -f "$SENTINEL" out=$(bash "$t" $subject 2>&1); rc=$? RAN=$((RAN+1)) + if [ -s "$SENTINEL" ]; then + printf " FAIL %-34s scaffolds via init-project.sh without exporting its own MXTK_LEAKGUARD_DENYFILE (run alone it writes %s: %s)\n" \ + "$name" "$ROOT_DENY" "$(grep -v '^#' "$SENTINEL" | tr '\n' ' ')" + FAILED=$((FAILED+1)) + fi tail_line=$(printf '%s' "$out" | grep -E 'PASS=|SCORE:|ok,|FAIL' | tail -1) if [ "$rc" -eq 0 ]; then printf " ok %-34s %s\n" "$name" "$tail_line" @@ -87,7 +98,7 @@ done echo "" echo "ran $RAN fixture(s), skipped $SKIPPED, failing $FAILED" -rm -f "$MXTK_LEAKGUARD_DENYFILE" +rm -f "$SENTINEL" if [ "$ROOT_DENY_BEFORE" -eq 0 ] && [ -f "$ROOT_DENY" ]; then echo "FAIL a fixture wrote $ROOT_DENY — the real toolkit denylist (the pollution MXTK_LEAKGUARD_DENYFILE exists to stop)" FAILED=$((FAILED+1)) diff --git a/tests/wave2/test-fixture-denylist-isolation.sh b/tests/wave2/test-fixture-denylist-isolation.sh deleted file mode 100755 index b81d05ad..00000000 --- a/tests/wave2/test-fixture-denylist-isolation.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env bash -# test-fixture-denylist-isolation.sh — fixtures that scaffold through init-project.sh, run ALONE (the -# scoped way CLAUDE.md "Testing this toolkit" asks for), leave no .leakguard-deny in the toolkit root. -# -# Usage: bash tests/wave2/test-fixture-denylist-isolation.sh [path-to-init-project.sh] [fixture ...] -# (the toolkit is the one holding that init-project.sh; fixtures default to the four that leaked) -# -# WHY: init-project.sh writes each project's name into $TOOLKIT_ROOT/.leakguard-deny unless -# MXTK_LEAKGUARD_DENYFILE points elsewhere. run-all.sh exports it for every fixture, but a fixture -# run on its own got no such cover: test-mode-contract.sh wrote `\bhand\b`, test-ci-gates.sh `\bc6\b`, -# test-must-haves-advisory.sh `\bold\b`/`\bmid\b`/`\bfresh\b`, and the pre-commit leak guard then -# flagged nearly every file for whoever committed next in that clone (2026-11-19, several sessions). -# -# The fixtures run in a COPY of the toolkit (tracked + untracked, gitignored files excluded), so a -# leaking fixture pollutes the copy and never the developer's real clone. The fixtures' own pass/fail -# is not this test's business and is only reported; the one assertion is the denylist, before vs after. -set -uo pipefail - -SUBJECT="${1:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)/bin/init-project.sh}" -case "$SUBJECT" in /*) ;; *) SUBJECT="$PWD/$SUBJECT" ;; esac -TK="$(cd "$(dirname "$SUBJECT")/.." && pwd)" -shift 2>/dev/null || true -FIXTURES=("$@") -[ "${#FIXTURES[@]}" -gt 0 ] || FIXTURES=(test-mode-contract.sh test-ci-gates.sh test-gitignore-crlf.sh test-must-haves-advisory.sh) - -WORK="$(mktemp -d "${TMPDIR:-/tmp}/deny-iso.XXXXXX")" || exit 2 -trap 'rm -rf "$WORK"' EXIT -PASS=0; FAIL=0 -ok() { PASS=$((PASS+1)); echo " ok — $1"; } -bad() { FAIL=$((FAIL+1)); echo " FAIL — $1"; } - -COPY="$WORK/tk"; mkdir -p "$COPY" -( cd "$TK" && git ls-files -co --exclude-standard -z | tar --null -T - -cf - 2>/dev/null ) | ( cd "$COPY" && tar xf - ) \ - || { echo "could not copy $TK"; exit 2; } -( cd "$COPY" && git init -q . && git add . >/dev/null 2>&1 && git -c user.name=t -c user.email=t@t commit -qm copy ) >/dev/null 2>&1 -[ ! -e "$COPY/.leakguard-deny" ] || { echo "copy already holds a denylist"; exit 2; } - -# The cover run-all.sh gives is exactly what must not be inherited here. -unset MXTK_LEAKGUARD_DENYFILE -export MXTK_NO_GUIDE=1 - -for fx in "${FIXTURES[@]}"; do - f="$COPY/tests/wave2/$fx" - [ -f "$f" ] || { bad "$fx: not in the toolkit"; continue; } - arg="" - case "$fx" in test-must-haves-advisory.sh) arg="$COPY/bin/sync-project.sh" ;; esac - before="$(cat "$COPY/.leakguard-deny" 2>/dev/null)" - ( cd "$WORK" && HOME="$WORK/home" bash "$f" $arg "$WORK/$fx.out" 2>&1 ); rc=$? - after="$(cat "$COPY/.leakguard-deny" 2>/dev/null)" - if [ "$before" = "$after" ] && [ ! -e "$COPY/.leakguard-deny" ]; then - ok "$fx leaves no .leakguard-deny in the toolkit root (fixture rc=$rc)" - else - bad "$fx wrote to the toolkit's .leakguard-deny: $(printf '%s' "$after" | grep -v '^#' | tr '\n' ' ')" - rm -f "$COPY/.leakguard-deny" - fi -done - -echo "PASS=$PASS FAIL=$FAIL" -[ "$FAIL" -eq 0 ]