Repository navigation
fix(classify): count a boundary literal as infection only when it feeds the owner - #3983
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke 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 |
There was a problem hiding this comment.
Decision
- Needs one test-proof clarification before upstream.
Verification questions
- Confirm new unit tests in activation.rs (let_bound_owner_argument_is_an_owner_input, let_bound_owner_argument_fails_closed_on_mut_shadowed_or_computed_bindings, owner_input_values_exclude_assertion_expected_values) and infection.rs are positive/negative controls that prove red/green separation. Without cargo-test receipt this is unverified in this lane.
Refuted
- The new
test_let_bound_literalreturns the wrong literal when the let RHS contains multiple scalar tokens (e.g.let pair = (10, 20);) and a tuple-typed owner takes one element; refuted because: RHS throughextract_let_bindingskeeps the raw textual RHS; subsequentscalar_valueswould still extract both10and20, but the call site filters down to a single-element match andowner_call_parameter_valuesalready iterates per index. Tuples are an unsupported corner and thelet_bound_owner_argument_fails_closed_on_mut_shadowed_or_computed_bindingstest does not assert tuple behavior, so this is an unforced concern.
Parked follow-ups
- Seam-path let rule in value_resolution remains permissive per PR body; only the new strict check-path entry fails closed.
- Adjacent #3982 (named-constant cache generations) is not exercised here; author notes seam-path let rule is still permissive and the strict entry covers check-path only — sibling seam cache is not invalidated by this PR.
- owner_argument_values filter
scalar_values(value) == [value]plus strip-quotes guard is redundant for numeric/boolean inputs since strip_comments_and_strings already strips string contents and extract_let_bindings only keeps literals; the only values that survive are already scalar. Mild duplication of guard logic. - Strict let scan
test_let_bound_literalrejectsmut, multi-let (shadow), and computed RHS, but still returns raw RHS for numeric bool; string RHS filtered later inowner_argument_values.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
- cargo-test receipt is scheduled-late (not yet landed); this lane cannot independently verify the new unit tests pass without it.
|
Disposition for review 5290508943. No code change was needed. The review asked for proof that the new tests separate red from green. I ran two mutants on head 4c0ba96, each on its own:
Unmutated, 364/364 pass and the golden holds at 1 exposed / 1 weak. Parked items:
Generated by Claude Code |
4c0ba96 to
aab1b47
Compare
# Conflicts: # crates/ripr/src/analysis/classify/infection.rs # crates/ripr/src/analysis/value_resolution.rs # docs/specs/RIPR-SPEC-0001-static-exposure-loop.md
… main's base-field removal Main's fixture harness no longer injects the synthetic base field into check.json (compare main's own boundary_named_constant golden). The drift was formatting_only: summary, counts and findings are unchanged (1 exposed, 1 weakly_exposed with the oracle-only infection-weak message intact). Blessed with the RIPR-SPEC-0001 reason recorded in the fixture's golden CHANGELOG as entry (2).
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Decision
- Needs reviewer attention before upstream: findings remain.
Confirmed findings
- fixtures/infection_expected_value_literal/expected/human.txt:1 — Golden only renders the
weakly_exposedblock and lists '1 lower-priority finding(s) omitted'. The CHANGELOG admits two pending regenerates (initial fixture + post-main-harness format fix). The second regenerate's blessed human.txt must include theexposed bulky_feeblock in some form (or explicitly pin the hidden count to 1) so a future fixture harness regression that drops the second finding is caught.
Verification questions
- Confirm strict entry test_let_bound_literal refuses 'mut' and shadows, but its
extract_let_bindings(body).remove(ident)runs on rawbodywhile the existence check runs onstrip_comments_and_strings(body). A let inside a commented-out block survives the check; the remove then returns None regardless because the live bindings map is empty. Net is correct (None), but the asymmetry between the two passes is a small smell.
Refuted
- owner_argument_values might let a string RHS leak a numeric owner input (
let amount = "10"; score(amount)); refuted because: filter strips leading '"' and\''; scalar_values on the trimmed RHS does not return a number. Negative control test asserts owner_input_values is empty for that body. - Tuple-typed owner argument (
let pair = (10,20); owner(pair)) would over-credit both literals; refuted because: owner_argument_values can yield [10,20] but owner_call_parameter_values takes .next() per index and per-parameter filtering keeps a single slot; tuple is not asserted in the strict test but the seam scan's permissive shape is not the check path.
Parked follow-ups
- test_let_bound_literal strict entry fails closed on mut/shadow/computed/string but does NOT assert tuple behavior; reviewer thread already refuted the multi-scalar-RHS concern as unforced, but no test pins it.
- Seam-path let scan in value_resolution remains permissive per PR body; cache generations not bumped, conflicts with #3984 parked, named-constant follow-up #3984 owns seam bump.
- Seam-path let rule in value_resolution remains permissive; this PR only adds a strict check-path entry. Author explicitly parks it; warm-cache could still mask a future classification change in named-constant seam usage.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
Review — head aab1b47 (rebased onto current main)Surfaces. What this PR does. Counts a boundary literal as infection only when it feeds the changed owner — a same-file literal used by an unrelated path no longer inflates infection evidence for the owner under change. Stimulus/oracle. Classifier tests pin both directions: literal feeding the owner counts; literal on a sibling path does not. Keeps evidence-promotion honesty (no credit without the feed edge). Validation. Ripr Rust Small Result: SUCCESS on aab1b47. Clean squash-rebase. Disposition: REVIEW_READY. |
Requested by Steven · project thread
Summary
Before: in a two-crate workspace, a new function
fragile_fee(weight_grams > 2_000) that no test calls was reportedexposed (warning, confidence 1.00), withinfection yes: Detected test input literal matching changed boundary: 2000. The only 2000 in the tests is the expected value inassert_eq!(tax_bps("EU"), 2000), which is an oracle on a different function.After:
fragile_feeisweakly_exposed (confidence 0.92), withinfection weak: Related tests contain the changed boundary literal [2000] only outside the changed owner's inputs (for example as an expected value); no test input at the changed boundary was detected. A test that passes the boundary value to the owner, directly or throughlet x = 50; owner(x), is still credited.How: predicate infection in
analysis/classify/infection.rsnow readsactivation::owner_input_valuesinstead of every literal in the related tests. That set holds owner-call arguments, table rows and builder arguments, never assertion arguments. It reuses the activation authority rather than adding a parallel rule. A bare-identifier argument resolves through a new strict entry in the shared let scan,value_resolution::test_let_bound_literal. That entry refusesmutand shadowed bindings and accepts only numbers or booleans.Found in the onboarding thread's new-user re-walk (F15-13, infection half).
Swarm / Source Boundary
ripr-swarmSource-of-truth Links
Spec: RIPR-SPEC-0001, which states the rule.
Issue: none filed. The re-walk evidence is F15-13.
Scope Classification
Single acceptance criterion:
Non-goals:
eu_taxlook like it reachesfragile_fee. That is fix(rust): an uncalled owner cannot be exposed through same-file tests #3947. Together,fragile_feeisweakly_exposed 0.66, with both the proximityreach weakline and thisinfection weakline. fix(rust): an uncalled owner cannot be exposed through same-file tests #3947 alone keeps the falseinfection yes.no_static_pathfor a function no test calls. Neither PR reaches it.Support-tier Impact
Policy Impact
Proof
At 4c0ba96:
New tests:
predicate_infection_ignores_boundary_literal_used_only_as_expected_valueis the negative case: the literal is used only as an expected value.predicate_infection_credits_the_same_literal_when_it_is_an_owner_inputis its positive control.predicate_infection_credits_table_row_inputs_but_not_enum_variants.let_bound_owner_argument_is_an_owner_inputchecks that a let-bound argument is credited.let_bound_owner_argument_fails_closed_on_mut_shadowed_or_computed_bindingscoversmut, shadowed, computed and string bindings.owner_input_values_exclude_assertion_expected_values.New fixture
infection_expected_value_literal:fragile_feeisweakly_exposed, andbulky_fee(let volume = 50;) staysexposed.On the re-walk
wsrepo the summary goes from1 exposed, 1 weakto0 exposed, 2 weak. Thepricingandpricing-litoutput is unchanged.Not established:
value_resolutionis still permissive; the strict entry covers the check path only. Seam cache generations were not bumped here. Named-constant PR fix(classify): resolve named-constant boundaries so a boundary test can close them #3984 bumps them, and its test shows a warm cache can hide a classification change.infection.rs,value_resolution.rsand SPEC-0001, all adjacent insertions that keep both sides. A trial merge passes 5321 lib tests and the goldens.Claim Boundary
May claim: an expected-value literal no longer earns
infection yes. Must not claim: infection evidence is data-flow precise.Rollback
Revert the commit. The fixture and spec text revert with it.
Spec-Test-Code Traceability
analysis/classify/infection.rs,analysis/classify/activation.rs,analysis/value_resolution.rsfixtures/infection_expected_value_literal/Static Language Check
killed,survived,untested,proven, andadequate.CI Economics
n/a
Engineering Check
panic,unwrap,expect,todo, orunimplementedin production code or tests.🤖 Generated with Claude Code
https://claude.ai/code/session_018QP9k41E538Xgytw8QCSfM