fix(cnpg-drill): refuse when the archive scan itself does not complete #152
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/drill-trap-scan-fail-closed"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-on to #151, which landed on trunk but fixed only half the defect. #151 hardened the comment-stripping grep; this fixes the two greps that actually decide the verdict.
grep -qreports absent and failed with the same non-zero status, and theifreads both as "not present". A scan that never ran therefore passed the trap, and the drill would proceed to archive into the PRODUCTION lineage.This is not hypothetical — it is the flake that failed two seanfarm gate runs today. Each run accepted exactly one archiving manifest, at a different case each time:
seanfarm-fb74d162d05b-…space before the colonseanfarm-1ed6ff891438-…single-quoted keyA single failure that moves between runs is a per-invocation transient, not a broken pattern. I confirmed the patterns themselves are sound — GNU grep 3.11 matches every spelling, verified in-cluster. The status handling was the defect. In the 19:37 run, #151's own new test (
a manifest the guard cannot read) passed, which is what ruled out the read path and pointed here.trap_pattern_presentanswers with three outcomes instead of two: present, provably absent, or refuse. Both call sites use it.Red: with the fix stashed, a grep shadowed to fail only during the scan is accepted.
Green: it is refused; 40 consecutive runs pass;
tests/check.shexits 0; shellcheck clean.https://claude.ai/code/session_01LeVatedQ4sCA1u6LHjo7B5
The previous commit hardened the comment-stripping grep and left the two greps that actually decide the verdict: if printf '%s\n' "$body" | grep -qE "$TRAP_BACKUP_RE"; then `grep -q` reports "absent" and "failed" with the same non-zero status, and the `if` reads both as "not present". A scan that never ran therefore passed the trap, and the drill proceeded to archive into the PRODUCTION lineage. This is not hypothetical. Two seanfarm gate runs on the same commit each accepted exactly one archiving manifest, at a DIFFERENT case each time — 18:09 accepted 'space before the colon', 19:37 accepted 'single-quoted key'. A per-invocation transient explains a moving single failure; a broken pattern does not. The patterns are sound: GNU grep 3.11 matches every spelling, verified in-cluster. The status handling was the defect. trap_pattern_present answers with three outcomes instead of two: present, provably absent, or refuse. Both call sites use it. Red: with the fix stashed, a grep shadowed to fail only for the scan is accepted. Green: it is refused, and 40 consecutive runs pass. Claude-Session: https://claude.ai/code/session_01LeVatedQ4sCA1u6LHjo7B5