fix: silent-revert canary keeps the last row and rejects a trailing comma - #3081
Conversation
…omma verify_known_incidents treated an empty or comments-only incident file as a green replay, and both file readers dropped a last line with no trailing newline. parse_attribution_field accepted a trailing comma that the file's own grammar forbids. Co-authored-by: Kyle Sexton <kyle-sexton@users.noreply.github.com>
|
Claude finished @kyle-sexton's task in 57s —— View job Security review — no findings
Skip gate hit: condition 2 — no security-relevant surface. This PR only touches two bash read loops and a comma-grammar check in
None of No CRITICAL / IMPORTANT / SUGGESTION findings. |
|
Last security-reviewed head: |
|
Claude finished @kyle-sexton's task in 3m 52s —— View job Claude finished the code review
This repo also carries a Note on verification: the sandbox for this lane only allows FindingsOne inline comment posted on
Everything else checked out
|
|
Claude has reviewed this PR 3 times. The lane skips further automatic reviews after 5; deleting this comment resets the count. |
Command substitution strips trailing newlines, so the two-row fixture pair was comparing the no-newline case to itself. Write both files with printf. Also add the default case arm shellcheck SC2249 required. Co-authored-by: Kyle Sexton <kyle-sexton@users.noreply.github.com>
|
Claude finished @cursor[bot]'s task in 1m 27s —— View job Code review — no new findings
This push ( The fix (lines 1178–1183) now writes both fixtures directly with The Not independently verified: this lane's sandbox only permits No CRITICAL / IMPORTANT / SUGGESTION findings on this diff. |
…ry-rows-cfcf Co-authored-by: Kyle Sexton <kyle-sexton@users.noreply.github.com>
|
Claude finished @cursor[bot]'s task in 46s —— View job Code review — no new findings (skip gate)
Skip gate hit: condition 4 — this head already has a successful review from this lane that still applies. The current HEAD ( The prior review pass on
That review found one issue (the No CRITICAL / IMPORTANT / SUGGESTION findings. |
Closes #2874
Closes #2875
Summary
The silent-revert canary's self-proof lane could report a green replay after verifying nothing.
verify_known_incidentsusedwhile readwithout keeping a last line that lacks a trailing newline, and it had no row-count floor, so an empty file, a comments-only file, or a one-row file whose only row was dropped all printed "Canary reproduces every recorded incident" and exited 0. The same read idiom dropped the last acknowledgment-file row (fail-closed). Attribution grammar from #2843 is already on main; a trailing comma in[sha=n,]was still accepted because word splitting underIFS=','drops a trailing empty field, against the file's own "exactly that grammar / exit 2" doctrine.Fix
In
scripts/check-silent-revert.sh:verify_known_incidentsandack_reasonnow usewhile read … || [[ -n "$var" ]]so a final unterminated row is processed rather than dropped.verify_known_incidentscounts verified rows and dies (exit 2) when the count is zero — an empty or comments-only incident file is a broken input, not a pass.parse_attribution_fieldrejects a field that starts with, ends with, or contains a doubled comma before splitting, so a trailing comma is exit 2 like every other empty-entry position.Test plan
bash scripts/check-silent-revert.test.sh— 112 passed, 0 failed. New cases pin the empty-file / comments-only floor, newline vs no-newline two-row parity (fixtures written with printf so the trailing newline is real), a one-row file with no trailing newline, an unterminated last ack row, and all four comma positions.Verification
bash scripts/check-silent-revert.test.sh— 112 passed, 0 failedshellcheck -x scripts/check-silent-revert.sh scripts/check-silent-revert.test.sh— clean[sha=n,],[,sha=n],[sha=n,,sha=m],[,]) exit 2Related
Refs #2843 (attribution grammar already merged; this PR only closes the remaining reader defects).
Refs #2833 (why the attribution field exists).
Refs #2808 (canary and incident corpus).