Repository navigation
fix: Kani vacuity guards + verification rules - #641
Conversation
Cherry-picked from closed PR #638 (which had broken contracts/stubs). kani::cover!() guards added to existing Kani proofs in: - aggregator.rs (3 proofs: F-only, P+F, P+P+F max size) - byte_search.rs (2 proofs: find_byte, rfind_byte) - cri.rs (2 proofs: reassembler P+F and F-only) - json_scanner.rs (3 proofs: skip_whitespace, skip_bare_value, skip_nested) - scanner.rs (1 proof: scan_all_no_panic) These guards prevent vacuous proofs — where kani::assume() constraints eliminate all interesting paths, making the proof pass trivially without testing the actual property. AGENTS.md: add "Kani Verification Requirements" section documenting when proofs are required, when they're not, and quality standards. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThis PR adds a "Kani Verification Requirements" section to AGENTS.md specifying when Kani proofs are required and the expected proof-quality rules, and it augments existing Kani verification harnesses by inserting Possibly related PRs
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@crates/logfwd-core/src/aggregator.rs`:
- Around line 301-303: The third Kani coverage check is inverted: replace or add
to the current kani::cover!(out.len() < 24, "all parts fit") so it actually
checks the non-truncated case by using out.len() == 24 (or include both ==24 and
<24 explicitly), and ensure these kani::cover!() calls (including the existing
multi-partial and truncation covers referencing out.len() and max_size) remain
placed after the assertions that make the proof meaningful; update the message
string to "all parts fit" for the new ==24 condition so it covers the intended
no-truncation path.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 3981ddd5-cb0a-495e-855d-b214045f2eb6
📒 Files selected for processing (6)
AGENTS.mdcrates/logfwd-core/src/aggregator.rscrates/logfwd-core/src/byte_search.rscrates/logfwd-core/src/cri.rscrates/logfwd-core/src/json_scanner.rscrates/logfwd-core/src/scanner.rs
kani::cover!(out.len() < 24) tests truncation, not the "all three 8-byte parts fit" case. Changed to == 24 to cover the intended non-truncated path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
Cherry-picked the valid parts from closed PR #638 (which had broken contracts and was not compiled/Kani-verified).
What was dropped from #638
#[kani::ensures]contract onparse_cri_line(usedunsafein#![forbid(unsafe_code)]crate)hex_nibblecontract (ensures result <= 15but function returns0xFF)bytes_field_sizescan_stringcontract (no proof harness)What vacuity guards do
kani::cover!()prevents proofs from being vacuously true. Ifkani::assume()constraints are too restrictive, the proof passes without testing any real paths. Cover guards assert that interesting cases are reachable:If Kani reports a cover as unreachable, the proof's assumptions need loosening.
Test plan
cargo check -p logfwd-corepasses🤖 Generated with Claude Code