Repository navigation
fix(output): base-side count in Summary, Hidden total matches bullets, unknown classes no longer read as a found absence (#8389) - #8493
Conversation
…tch its bullets, stop unknown classes reading as a found absence; memoize source parses (#8389) Refs #8389. Summary appends the base-side count, the selected Hidden line states the total before the mix, the all-no-path footer follows class (no_static_path vs unclassified), and parse_source_file memoizes recent parses per thread keyed by full text. Fixture human goldens blessed under RIPR-SPEC-0122. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nf95NxBDVr2E4EGJVNg76T
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 34 minutes. View limit details
Comment |
There was a problem hiding this comment.
Confirmed findings
- Fixture goldens for owner_return_pin_fallible_literal were left to hosted CI per the PR description; if that fixture exercises the base-side Summary or unknown-class footer it may still need blessing, but the diff shows no other fixture remaining in a 'Pending' state beyond the 51 CHANGELOG entries already updated.
- PR body claims 1827 tests pass and
cargo xtask precommitexit 0; ripr sensor in this packet failed exit 2, cargo-test is scheduled-late (not yet present), and no clippy/fmt/build lease ran in this profile. The 51 fixture goldens are 'blessed' via CHANGELOG append, but no test asserts that blessed mode regenerates outputs — reliance on xtask ritual rather than a CI guard. Hosted CI still needed.
Verification questions
- Confirm crates/ripr/src/output/human.rs:2486 — The
without_basetest asserts the render contains no substring 'base-side evidence' anywhere, but the plain Summary already references 'base-side' as a label class elsewhere in templates when no base findings exist? Confirm that with no BaseDeleted/MovedOrRenamed findings the rendered output really has zero 'base-side' substrings; otherwise relax to 'no(N base-side evidenceparenthetical'. - Confirm existing test in human.rs still asserts old Hidden phrasing '(weak, base-side)' with single bullet count, but fixture diffs show Hidden now lists multiple bullets and uses new 'T finding(s) omitted: L lower-priority, B base-side evidence (not candidate edit targets)' wording. Stale assertion risk.
- Confirm ripr sensor failed with exit code 2; safe to suppress because the PR is output-formatting + parse memo only and PR body explicitly states precommit goldens are correct on main. Re-run
cargo xtask precommitin hosted CI to confirm green. - Confirm test summary_names_base_side_findings_and_hidden_total_matches_bullets asserts exactly 2 '(weak, base-side)' matches, but specimen has 1 weak-base-side bullet + the base_a/base_b selected findings. Mismatch likely.
Refuted
- The Hidden bullet label '(weak, base-side)' in the new test counts is wrong; this is actually a test-gap, not a defect.; refuted because: Investigated: with selected=weak/non-base and base_a,base_b=BaseDeleted and lower=plain, the only
(weak, base-side)-tagged bullets are findings that are BOTH weak AND base-side. None in this scenario, so count==2 fails on the test as written — flagged as candidate high. - An attacker could craft a diff that makes the cache hold many large parses and OOM the process.; refuted because: PARSE_CACHE_MAX_BYTES gates the cache: any text >512 KiB skips cache and goes straight to parse_source_file_uncached. Entries are truncated to 4 with move-to-front; each cache entry holds one source String (capped) and one Parse clone. Worst-case resident text per thread is fixed; Parse clones are sizeable but bounded by the same 512 KiB gate (classification does not attempt cache on over-cap sources). Not a remotely triggerable DoS; the only trigger is the same file being parsed repeatedly by classification, which the PR's own measurements (regex 64ad0b6: 33.4s → 28.8s) show is bounded to a small per-process/cap.
- PARSE_CACHE adds an async/worker-handoff hazard by memoizing Parse; refuted because: Cache is thread_local<RefCell<Vec<(String, Parse)>>> with no Send/Sync impl and no cross-thread sharing. Classification work stays on the thread that owns the file text; the cache never crosses a worker/async boundary, never transfers Parse across a postMessage/transfer, and never reaches into a JS realm.
- The new parse_cache could store mutable interior state via the green-tree Parse and break immutability assumptions downstream (e.g. if a caller caches a node and the next probe mutates the tree).; refuted because: rowan Parse trees are immutable green trees; clone() shares nodes observationally; nesting.rs already returns Parse by value everywhere, so sharing a cached clone is observationally identical to the prior fresh parse. The new test asserts equality of {:#?} for cached vs uncached on interleaved inputs.
Evidence gaps
- Memo's MAX_BYTES bypass (512 KiB) returns parse_source_file_uncached. No test covers a >MAX_BYTES source hitting the cache path; only PARSE_CACHE_ENTRIES*2 small sources are exercised. Correctness of bypass is left to observation, not proved.
- Model proof intent was rejected by deterministic validation.
Keep both numbered golden CHANGELOG entries for the two rust_test_written_expected_file fixtures. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nf95NxBDVr2E4EGJVNg76T
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
Confirmed findings
- PARSE_CACHE_MAX_BYTES=512KiB silently bypasses the memo; the bypass is documented but not unit-tested. A fixture or test that injects a >512KiB file via parse_source_file is not asserted to behave identically to parse_source_file_uncached. Submaterial polish, not an oracle gap.
- Parse cache ceiling 512 KiB and 4 entries is a hardcoded heuristic; the PR comment claims regex 64ad0b6 dropped 118s→33.4s on main and 33.4s→28.8s with memo, so the memo itself saves ~4.6s while cache eviction policy is untested beyond the unit test. No robustness regression; just a hardcoded magic number with no rationale comment beyond the regex example.
- 51 fixture goldens blessed by CHANGELOG append + ripgrep-equivalent xtask ritual; no test asserts that blessed mode regenerates outputs and that PR's ripr sensor in this packet failed exit 2. Hosted CI remains the only guardrail.
- Cache growth bound is text-derived (text.len() > MAX_BYTES ⇒ bypass), not entry-count check-then-parse; a 512 KiB file is parsed uncached but still allowed. No bug, but the spec only documents the bound, not the order of checks. Acceptable for current call sites.
Verification questions
- Confirm pR body claims 'cargo test -p ripr --lib filters nesting/output::human/classify/probes pass (1827)' but cargo-test receipt is scheduled-late and not present in this packet; ripr sensor failed exit 2; no clippy/fmt/build lease ran. Hosted CI must confirm the 1827 count and the goldens check that the PR description flags as incomplete for owner_return_pin_fallible_literal. Without cargo-test proof the claim that Summary/Hidden agreement and the three footer branches are exercised is asserted, not witnessed.
- Confirm no live cargo-test witness in this packet: cargo-test is scheduled-late, ripr sensor failed exit 2, build/clippy/fmt/check/clippy leases disabled by gh-runner profile.
Refuted
- Summary note overcounts by including suppressed findings because base_side_summary_note iterates output.findings without applying the suppression filter that render_header_summary uses for unsuppressed; refuted because: Docstring states 'totals themselves are unchanged' and the note is attached to the 'unsuppressed' summary line as a parenthetical; the number is informational (how many counted findings are base-side), not a recomputation of the unsuppressed total. The unsuppressed count
output.summary.findings - suppressed.len()is unchanged. No semantic conflict. - Hidden total clause in RIPR-SPEC-0122 could disagree with the new selected_hidden_line output for the all-base-side or all-unresolved omitted set, since the spec says 'All N omitted finding(s) are base-side evidence, not candidate edit targets' and the diff rewrote the base-side-mixed arm; refuted because: the all-base-side/all-unresolved arms in selected_hidden_line are not touched in this diff (only the (base_side,0,lower), (0,unresolved,lower), and (base_side,unresolved,lower) arms changed); the untouched All-N clause remains the only path for those pure sets, so the spec and renderer stay aligned.
- Memo could leak or alias parse nodes across threads, causing UAF or type confusion in downstream syntax consumers; refuted because: thread_local storage isolates state per thread; Parse is returned by value with clone() sharing immutable green trees (no interior mutability); no raw pointers escape. Allocation failures cannot occur on the cache hit path because entries are pre-populated clones.
- PARSE_CACHE could detach/resize a buffer aliased by a held Parse and corrupt subsequent parses or lengths; refuted because: Parse is rowan's immutable green tree (Arc-backed) whose SyntaxText borrows the green node, not a heap buffer the cache mutates; clone yields a fresh Parse pointing at the same green tree. Files >PARSE_CACHE_MAX_BYTES (512 KiB) bypass the cache entirely. The cache only stores the owned String key and clones the Parse on insert and on move-to-front; no in-place mutation, no resize of an aliased slice.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
- ripgrep 241b87b (55 omitted) and smallvec 1c3b840 (12 omitted) referenced in PR body are not in this repo's fixtures; PR body's numbers are external to ripr-swarm and cannot be oracle-verified here.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nf95NxBDVr2E4EGJVNg76T
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
Confirmed findings
- No new unsafe surface or native-pointer ownership seam was touched by this PR. The added thread_local RefCell holds owned String + Parse; Parse is an immutable green tree so cloning shares structure observationally. parse_source_file no longer takes &mut and the only allocations are the to_string cache key and the clone of the parse, both bounded by the 512KiB gate and 4-entry LRU. No lifetime, aliasing, or ownership invariant regressed.
- cargo-test sensor is scheduled-late and not present in this packet; the 1827-test claim and cargo xtask precommit exit 0 cannot be independently verified from available receipts (ripr sensor failed exit 2, no clippy/fmt/build lease). Hosted CI is the only remaining guardrail, which the PR description acknowledges.
- The memo ceiling 4 entries / 512KiB and move-to-front policy have no boundary tests: only round 0..3 with 3 sources and a >2*ENTRIES eviction loop are covered, not the exact eviction point or the bypass on >512KiB.
Verification questions
- Confirm pARSE_CACHE_MAX_BYTES=512KiB is a text-length gate, not an entry-count gate; a single >512KiB file parses uncached each call. Bypass is silent and not unit-tested for behavioral equivalence to parse_source_file_uncached.
- Confirm new memo test asserts parse equality but not cache-hit behavior; an always-fresh-parse cache (no-op) would still pass. Coverage of move-to-front and 512KiB bypass is asserted only for correctness, not for hit-rate.
- Confirm memo parse_source_file clones Parse per hit; RAAL semantics for SyntaxNode are not asserted by the test (only Debug fmt and errors().len()) — same Debug output is necessary, not sufficient for green-tree equivalence.
Refuted
- Memo could mutate a shared Parse across threads and corrupt classification; refuted because: thread_local! gives per-thread storage; Parse is a rowan green tree whose APIs take &self; move-to-front only rearranges the Vec and re-clones the (immutable) Parse. No cross-thread aliasing introduced.
- The memo's stored String key plus cloned Parse could double memory or hand back a parse whose green-tree internals were invalidated by re-parse elsewhere.; refuted because: Diff only adds an immutable cache (vec of owned (text,parse) tuples); moves and clones operate on the same immutable green tree that parse_source_file_uncached returned, and the 2021/Edition::CURRENT fallback decision is made before insertion. No back-mutation, resize, or detach surface exists.
- The new
thread_local!parse cache could be weaponized as an oracle or DoS amplifier (growing unbounded across threads, leaking parse-tree differences across security boundaries, surviving thread pool reuse to leak prior inputs).; refuted because: Cache is per-thread (thread_local!), keyed by opaqueStringequality only, truncated to 4 entries with a 512 KiB byte cap; no public visibility of entries, no parser API change, andparse_source_file_uncachedstill drives the actual parse. RefCell cannot leak across threads and entries are dropped when the thread exits. No allocation-failure / Box-from-slice pattern appears in the diff.
Evidence gaps
- All 51 fixture CHANGELOG 'Pending' entries use cargo xtask goldens bless; no test asserts blessed-mode regenerates outputs and the ripr sensor in this packet exit-2 — precommit left owner_return_pin_fallible_literal to hosted CI per PR body.
- Model proof intent was rejected by deterministic validation.
Parked follow-ups
- hosted-CI fixture
owner_return_pin_fallible_literalremains the only golden not blessed by this PR; PR body explicitly defers it. No sibling fixture pattern is left in Pending state inside this diff.
…de Summary note (#8389) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nf95NxBDVr2E4EGJVNg76T
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
Confirmed findings
- PARSE_CACHE_MAX_BYTES=512KiB bypass and the exact 4-entry eviction boundary are untested; submaterial oracle gap (no false-positive risk) but worth a focused boundary test.
- 51 fixture CHANGELOGs all appended a
Pending — <fixture>block rather than a diff entry; blessed mode is human-ritual (xtask) rather than enforced by CI. Acceptance relies on hosted cargo-test sensor.
Verification questions
- Confirm 51 fixtures' CHANGELOG append 'Pending' entries assert blessing but no test confirms blessed-mode regenerates outputs; ripr sensor failed exit 2 and cargo-test scheduled-late in this packet, so the 1827-test claim cannot be independently verified from available receipts.
- Confirm memoization is per-thread and equality-keyed by full source text; LRU evict is move-to-front followed by truncate(4). Test exercises interleaved sources and >2*ENTRIES eviction. No test asserts the >512KiB text bypass path returns the same parse as the uncached path.
- Confirm parse memo unit test asserts memo == fresh parse via format debug + error count; >512KiB bypass path is exercised only by length check, not by an equality test that compares bypass result against parse_source_file_uncached.
- Confirm memo lives only in parse_source_file; parse_clean_source_file still bypasses it. If classification in any sibling path calls the clean variant per probe, the memo savings are partial.
- Confirm summary now names base-side findings; Hidden total equals bullets; without-base render keeps Summary unchanged and hides the suffix.
- Confirm all-no-path footer lead now branches on (unclassified==0, no_static_path==0, mixed); existing test patches assertions rather than rewrites cases.
- Confirm parse memo: equality-keyed LRU of 4 entries, 512KiB byte bypass, move-to-front; test covers correctness and >2*ENTRIES eviction but bypass and exact eviction point are uncovered.
Refuted
- parse_source_file thread-local memo could leak mutable parse state across worker/JS postMessage boundaries; refuted because: The diff is pure Rust synchronous output formatting plus a thread_local cache; no js_bindgen or WASM bridge is touched and no Send/Sync boundary is added. The cache key is full text equality and stores Parse (an immutable rowan green tree), so sharing a clone is observationally identical and remains single-thread owned.
- The new
thread_local!RefCell<ParseCacheEntries>could introduce an aliasing or soundness regression: holding an ownedParse<SourceFile>plusString, mutating viaborrow_mut, and serving clones to callers might extend lifetime past stack frames or share interior mutability.; refuted because: Nounsafewas added;Parse<SourceFile>is an immutable green tree soclone()shares structure observationally;RefCellis confined to the memo and never aliased across threads (thread_local). Calls toparse_source_filereturnParse<SourceFile>directly with no&mutescape; no FFI or pointer indirection exposed.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
…e base-side Summary count #7836 added these fixtures before #8493 changed the Summary line; wording only. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XdFHetzhxrXVMQXg1meaVR
Requested by Steven · project thread
Before:
ripr check --base 7930d93^on bytes printed4 of 4 findings unsuppressedalthough 2 of those were base-side (deleted-line) evidence, andHidden:said1 lower-priority finding(s) omitted; 2 base-side...while listing 3 bullets. On regexc4865a0^the header said0 no path ... 1 unknownbut the footer saidripr found no static test path for any of the 1 changed expression(s). Regex64ad0b6^(human-full) took 118 s with the pre-fix binary, spending most time re-parsing the same file per probe/test pair.After: bytes Summary ends
(2 base-side evidence, not candidate edit targets)and Hidden reads3 finding(s) omitted: 1 lower-priority, 2 base-side evidence (not candidate edit targets).(ripgrep241b87b:55 finding(s) omitted: 26 lower-priority, 29 base-side; smallvec1c3b840:12 omitted: 1 lower-priority, 11 base-side). Regexc4865a0footer now saysripr could not classify any of the 1 changed expression(s)...;found no static test pathis kept only for theno_static_pathclass. Regex64ad0b6output is byte-identical with and without the parse memo; wall time 33.4 s on current main vs 28.8 s with the memo (most of the 118 s to 33 s drop was already on main, not this PR).What it does: makes the human counts and footer agree with the finding classes and trims a repeated-parse cost, without changing any class, probe or classification result.
How:
output/human.rsappends the base-side count to the Summary line (totals unchanged) and rewrites the all-no-path lead from the summary classes (no_static_path vs infection/propagation/static unknown);output/human/triage.rsstates the omitted total before the mix;analysis/syntax/nesting.rsmemoizesparse_source_fileper thread (4 entries, files up to 512 KiB, keyed by full text equality so a hit is exactly a fresh parse). Spec RIPR-SPEC-0122 updated; 51 fixtures' human goldens blessed with reason. Added tests for the memo, the Summary/Hidden agreement and the three footer branches.Refs #8389 (the signature/import-line noise, identical before/after pairing,
source ...evidence lines and the serde_json ambiguous-parent note are not addressed here). Tests:cargo test -p ripr --libfilters nesting/output::human/classify/probes pass (1827);cargo xtask precommitexit 0 (goldens check incomplete for one network-dependent fixture, owner_return_pin_fallible_literal, left to hosted CI).Generated by Claude Code