fix(fight): a commented-out signature header silently deletes a scanner - #79
Conversation
`parse_signatures` split the directive with
raw.split(SIGNATURE_TABLE).skip(1)
which matches the literal `[[gate-triage.detection.signatures]]` anywhere in
the file — including inside a `#` comment and inside prose. The directive it
parses documents its own table name in a comment at
`.machine_readable/bot_directives/gate_triage.a2ml:174`, inside the
`[gate-triage.detection]` section that opens at line 171, well above the three
real headers at 258 / 265 / 272.
Two distinct failures, both now covered by tests that fail against the old
parser:
- a prose or commented mention OPENS a phantom scanner
left: 2 right: 1
- a commented-out header CLOSES the live table above it and opens a body
the section-header scan then discards, so BOTH halves are dropped
left: 0 right: 1
The second is the serious one: it does not add noise, it removes a real
scanner, and it does so silently.
The fix is line-oriented. `signature_bodies` walks `split_inclusive('\n')`,
strips each line's trailing comment with `code_of`, and only treats a line as
a header when the CODE part is exactly the table name — so a comment can
neither open nor close a table. `until_next_header` is retained because
`section_of` still uses it.
Note that `extract_array` in context.rs has the same comment-blindness once it
is collecting; that is not touched here.
Stacked on #78 because `main` does not currently compile.
cargo test --workspace --all-features 130 passed, 0 failed
cargo clippy --workspace --all-features --all-targets -- -D warnings rc=0
cargo fmt --all --check gate_triage.rs clean (3 pre-existing diffs remain
in crates/squabble-core/src/polarity.rs, unrelated and untouched)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0178nN4Nm3neFRy5K9StZKnB
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
3626792
into
fix/restore-workspace-build



What is wrong
parse_signaturessplits the directive on the bare literal:SIGNATURE_TABLEis[[gate-triage.detection.signatures]]. The split matches thattext anywhere — in prose, and inside a
#comment.The directive this parser reads documents its own table name in a comment:
.machine_readable/bot_directives/gate_triage.a2ml:174, inside the[gate-triage.detection]section that opens at line 171 — well above the three realheaders at 258 / 265 / 272.
Two failures, both now covered by tests that are RED against the old parser
Grafting the two new tests onto the current parser, unchanged:
left: 2, right: 1.left: 0, right: 1. This is theserious one. The stray match closes the live table above it and opens a body which
the section-header scan then discards, so both halves are dropped and the scanner
vanishes. It does not add noise; it silently removes enforcement.
The fix
Line-oriented.
signature_bodieswalkssplit_inclusive('\n'), strips each line'strailing comment via
code_of, and treats a line as a header only when the codepart is exactly the table name. A comment can then neither open nor close a table.
until_next_headeris retained —section_ofstill calls it, so removing it wouldtrip
unused_imports/dead-code under-D warnings.Two pre-existing
assert_eq!calls in this file are reflowed byrustfmt; that is theonly churn outside the new code.
Not fixed here, but adjacent
extract_arrayincrates/squabble-fight/src/context.rs:152has the samecomment-blindness: once
collecting, it pushes quoted strings from every subsequentline, comments included, until
]. Out of scope for this PR; worth a follow-up.Verification
cargo fmt --all --checkstill exits 1 for three diffs incrates/squabble-core/src/polarity.rs— those are pre-existing onmain, unrelatedto this change, and deliberately untouched.
Two things a reviewer should know
maindoes not compile (duplicateEvidenceimport), so thisbranch is based on the build repair. Base retargets to
mainautomatically when fix(cli): remove duplicate Evidence import that broke the workspace build #78merges.
Rust CIworkflow in this repo isstartup-dead — runs are created with
jobs.total_count == 0and emit no check run atall, so the required context never reports. The evidence above is local.
🤖 Generated with Claude Code
https://claude.ai/code/session_0178nN4Nm3neFRy5K9StZKnB