fix(14.2): WR-07 gate restarts a stale stack and requires fresh

--e2e reused any running stack, so Playwright and the go.log scan could
exercise a binary built before the commits under review. A running stack
that dev-stack.sh fresh refuses is now stopped and started again (and left
running), and fresh must pass after up --detach. The self-test plants an
app and framework tree: a newer source or a missing stamp must be
refused, docs, planning files and tests ignored.
This commit is contained in:
2026-10-12 11:27:12 +02:00
parent bb5c2d32fa
commit 3159bc109b

View File

@@ -21,7 +21,9 @@
# must print "refuse:" and exit non-zero; a fake SummerCMS
# marker must pass (control case)
# --e2e the running local stack (started with up --detach when it
# is not up), the guard on the real env file, the Go-gate
# is not up, restarted when dev-stack.sh fresh finds a source
# newer than its binary, and refused unless fresh passes
# after up), the guard on the real env file, the Go-gate
# Playwright specs through dev-stack.sh e2e (any skip,
# unexpected, flaky or zero expected fails), the D-15
# report-only specs (counts printed, never blocking) and the
@@ -305,6 +307,31 @@ run_self_test() {
return 1
fi
# dev-stack.sh fresh on a planted app and framework tree (WR-07): a
# stack whose stamp is newer than every source passes; a newer source,
# or no stamp, is refused; docs, planning files and tests are ignored.
local tree
tree="$(mktemp -d)"
mkdir -p "$tree/app/scripts" "$tree/app/tmp/dev-stack" "$tree/app/.planning" "$tree/fw/modules/a" "$tree/fw/docs"
cp "$DEV_STACK" "$tree/app/scripts/dev-stack.sh"
touch -d '2 minutes ago' "$tree/app/scripts/dev-stack.sh" "$tree/app/main.go" "$tree/fw/modules/a/a.go"
touch -d '1 minute ago' "$tree/app/tmp/dev-stack/build.stamp"
fresh_case() {
env -i PATH="$PATH" HOME="$HOME" DEV_STACK_FRAMEWORK_DIR="$tree/fw" bash "$tree/app/scripts/dev-stack.sh" fresh
}
expect_status fresh-clean 0 fresh_case
touch "$tree/fw/docs/page.md" "$tree/app/.planning/STATE.md" "$tree/fw/modules/a/a_test.go"
expect_status fresh-ignored 0 fresh_case
touch "$tree/fw/modules/a/a.go"
expect_status fresh-stale-framework 1 fresh_case
touch -d '2 minutes ago' "$tree/fw/modules/a/a.go"
touch "$tree/app/main.go"
expect_status fresh-stale-app 1 fresh_case
touch -d '2 minutes ago' "$tree/app/main.go"
rm -f "$tree/app/tmp/dev-stack/build.stamp"
expect_status fresh-no-stamp 1 fresh_case
rm -rf "$tree"
# Go log scan (T-14.2-20) and summaries.
local dir
dir="$(mktemp -d)"
@@ -531,11 +558,18 @@ run_e2e() {
if bash "$DEV_STACK" status >/dev/null 2>&1; then
was_up=1
echo "e2e: the local stack is already up; it is left running"
# A stack started before the latest source change would test old
# code (WR-07): restart it.
if ! bash "$DEV_STACK" fresh 2>&1 | sed 's/^/e2e: /'; then
echo "e2e: the running binary is older than its sources; restarting the stack"
bash "$DEV_STACK" down
fi
fi
if ((was_up == 0)); then
trap 'bash "$DEV_STACK" down || true' EXIT
fi
bash "$DEV_STACK" up --detach
bash "$DEV_STACK" fresh
seed_out_private
bash "$DEV_STACK" guard
bash "$DEV_STACK" e2e "${GATE_SPECS[@]}"