The exhaustive test checked length, the per-byte relation and
idempotence, which a scanner that blanks plain code could still pass.
Add `oracle`, the comment grammar as mutually recursive rules over a
char slice (code, line comment, block at depth d), sharing no code with
the scanner, and assert the scanner's full output equals it for every
enumerated input. A planted fault that blanks non-comment code now
fails this test alone. PROOF-NEEDS names the oracle and the fault.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jma5ixtpeZyJRmfoSsC98u
Why
This is the fix for CodeRabbit's finding on #304 (thread
discussion_r4590590229). It was pushed to #304's branch about five minutes after #304 merged, so it never reachedmain.The exhaustive test on
mainchecks length, the per-byte relation ("unchanged, or blanked") and idempotence. A scanner that blanks plain code passes those checks. For example, returning" "for"x"with block markers on is only caught if a targeted regression happens to cover that input. The ledger row claims exhaustive preservation, so the test should establish it.What
oracle: the comment grammar as mutually recursive rules (code, line comment, block at depthd) over a char slice. It shares no code with the index-and-match scanner.oraclefor every enumerated input, on top of the existing checks.PROOF-NEEDS.adoc: thestrip_proof_commentsrow names the oracle and lists the new planted fault.Evidence
main-based branch: blanking non-comment code (out.push_str(&" ".repeat(len))in the code arm) fails the exhaustive test on its own, at the oracle assertion.strip_proof_comments_testsandslash_comment_testspass (13 tests).cargo clippy --all-targets --all-features -D warningsandcargo fmt --checkare clean.PROOF-NEEDS.adocrenders clean.main, and only test code and the ledger change.Tests and docs only; no production code changes.
Generated by Claude Code