Skip to content

Commit 3de598f

Browse files
committed
fix(tests): un-hardcode the PreCompact fixture timestamp (time bomb)
tests/test-native-points.sh failed on main from 2026-09-05 with: FAIL PRECOMPACT: takes a snapshot when work is unfinished FAIL THE CALLER: PostCompact reports the SNAPSHOT, not the changed disk Root cause: the PreCompact run fixture hardcoded updated_at: "2026-09-02T00:00:00Z". The chain under test goes precompact-snapshot.sh -> compound-v-dashboard.py resume, and resume filters on DEFAULT_RESUME_MAX_AGE_HOURS = 72.0. Once wall-clock passed 72h after that literal date, resume returned empty, so the hook wrote no snap-* file and the PostCompact reader had nothing to read. Both assertions then failed - not a flake, a date-triggered break that would have stayed broken. Proof: same fixture with --max-age-hours 100000 prints 'UNFINISHED COMPOUND V WORK ... updated 3d ago'; with the default window it prints nothing. Fix: generate updated_at with now_ts(), which the file's three other run fixtures (lines 119, 395, 461) already do. This one was the only literal. tests/test-native-points.sh: 128 passed, 0 failed.
1 parent ce4cb19 commit 3de598f

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

tests/test-native-points.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -848,10 +848,15 @@ PRECOMPACT="${PRECOMPACT_SRC:-$REPO/hooks/precompact-snapshot.sh}"
848848
npc_proj="$WORK/projPC"
849849
mkdir -p "$npc_proj/scripts" "$npc_proj/docs/superpowers/execution/2026-01-01-x"
850850
cp "$REPO/scripts/compound-v-dashboard.py" "$npc_proj/scripts/" 2>/dev/null || true
851-
cat >"$npc_proj/docs/superpowers/execution/2026-01-01-x/state.json" <<'JSON'
852-
{"run_id":"2026-01-01-x","phase":"DISPATCHED","updated_at":"2026-09-02T00:00:00Z",
853-
"jobs":{"a":{"status":"pending"},"b":{"status":"done"}}}
854-
JSON
851+
# `updated_at` MUST be generated, never hardcoded. `dashboard resume` filters on
852+
# DEFAULT_RESUME_MAX_AGE_HOURS (72h), so a literal date is a time bomb: it passes
853+
# while the clock is near it and starts failing the day wall-clock drifts past the
854+
# window — silently, and nowhere near the code that broke. The other three run
855+
# fixtures in this file already use now_ts(); this one did not.
856+
jq -n --arg ts "$(now_ts)" \
857+
'{run_id:"2026-01-01-x", phase:"DISPATCHED", updated_at:$ts,
858+
jobs:{"a":{status:"pending"},"b":{status:"done"}}}' \
859+
>"$npc_proj/docs/superpowers/execution/2026-01-01-x/state.json"
855860
# A run dir is only a run dir to the dashboard when it carries a manifest as well
856861
# as a state file — found by probing the real scanner, not by reading it.
857862
printf 'run_id: 2026-01-01-x\n' >"$npc_proj/docs/superpowers/execution/2026-01-01-x/manifest.yaml"

0 commit comments

Comments
 (0)