From 3de598fa6fcbec7c5bded96327be8d6b7d25013e Mon Sep 17 00:00:00 2001 From: khymerao Date: Sat, 5 Sep 2026 09:45:05 +0200 Subject: [PATCH] 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. --- tests/test-native-points.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/test-native-points.sh b/tests/test-native-points.sh index a5897de5..8ef4132a 100755 --- a/tests/test-native-points.sh +++ b/tests/test-native-points.sh @@ -848,10 +848,15 @@ PRECOMPACT="${PRECOMPACT_SRC:-$REPO/hooks/precompact-snapshot.sh}" npc_proj="$WORK/projPC" mkdir -p "$npc_proj/scripts" "$npc_proj/docs/superpowers/execution/2026-01-01-x" cp "$REPO/scripts/compound-v-dashboard.py" "$npc_proj/scripts/" 2>/dev/null || true -cat >"$npc_proj/docs/superpowers/execution/2026-01-01-x/state.json" <<'JSON' -{"run_id":"2026-01-01-x","phase":"DISPATCHED","updated_at":"2026-09-02T00:00:00Z", - "jobs":{"a":{"status":"pending"},"b":{"status":"done"}}} -JSON +# `updated_at` MUST be generated, never hardcoded. `dashboard resume` filters on +# DEFAULT_RESUME_MAX_AGE_HOURS (72h), so a literal date is a time bomb: it passes +# while the clock is near it and starts failing the day wall-clock drifts past the +# window — silently, and nowhere near the code that broke. The other three run +# fixtures in this file already use now_ts(); this one did not. +jq -n --arg ts "$(now_ts)" \ + '{run_id:"2026-01-01-x", phase:"DISPATCHED", updated_at:$ts, + jobs:{"a":{status:"pending"},"b":{status:"done"}}}' \ + >"$npc_proj/docs/superpowers/execution/2026-01-01-x/state.json" # A run dir is only a run dir to the dashboard when it carries a manifest as well # as a state file — found by probing the real scanner, not by reading it. printf 'run_id: 2026-01-01-x\n' >"$npc_proj/docs/superpowers/execution/2026-01-01-x/manifest.yaml"