Repository navigation
fix(analysis): give a name-only comparison tail and path-valued tail-if arms their return sink (#15274) - #16017
Conversation
…if arms their return sink (#15274) A returned comparison whose operands are all names (`n >= LIMIT`) spells no literal, call or arithmetic, so its return_value probe fell through `is_obvious_return_expression` to the unknown sink and stayed `propagation_unknown` whatever the tests asserted. Its predicate twin on the same line already read the return sink through `predicate_as_owner_tail`. The return_value probe now asks the same reader first. A tail `if` whose arms are paths (`Level::High`) had no return sink for the same reason: an arm had to be an obvious return expression, a bare identifier or a quoted literal. A `::` path of plain identifiers is now a plain branch value. Only the sink moves. A far-input pin still reads `weakly_exposed` and a smoke call `reachable_unrevealed`, as the literal twins do. Covers repros 1 and 2 of the issue; repros 3 to 7 are separate readers. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmpjxCU5DuWyfHiiPiS
|
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 50 minutes. View limit details
|
EffortlessSteven
left a comment
There was a problem hiding this comment.
SOURCE_REVIEW_READY
Source and oracle review of head a6cedc2, by the authoring session. Hosted checks and bot reviews are not part of this record.
Inspected
- The whole diff: 14 production lines in
crates/ripr/src/analysis/classify/flow.rs, 5 unit tests, 4 new fixtures, 1 re-blessed fixture, 3 honesty-corpus rows, changelog and traceability fragments. return_value_sink: the comparison-tail reader is asked only inside the branch that used to return the unknown sink, so every expression that already had a sink keeps its sink text.predicate_as_owner_tailrequires the probe's own owner, a non-unit return type, the probe text to be the changed text, and the tail to be one single-line comparison (or the appended-equality||form it already admits).tail_if_branch_value:is_plain_pathis a superset ofis_plain_identifier. Arms with generics, a leading::, a qualified path, a cast or a field access are still refused, and the existing equal-arms refusal applies to paths.- Consumers:
propagation_evidence_with_witnessstill demands a complete owner-bound witness for areturn_valuesink, so the new sink alone promotes nothing.
Oracle grip
- Positive and negative fixtures for each shape: a boundary pin reads
exposed; a far-input pin staysweakly_exposedand is held bymust_not_promotecorpus rows. - Before and after on 21 scratch crates with main 7cf9cd6 as the baseline.
n >= LIMITreads whatn >= 1000reads on main in four test shapes. - The first cut asked the reader before the literal check and moved
rust_predicate_appended_str_arm_truth_assertfromexposedtoweakly_exposed.cargo xtask goldens checkcaught it;literal_comparison_tail_keeps_its_own_return_sink_textnow pins the repair. - One existing golden moves,
binding_value_counterpart_width: propagation stageyes, class unchanged atinfection_unknown.
Local proof on this head
cargo xtask precommit: exit 0, 41 gates.cargo clippy -p ripr --all-targets -- -D warnings: exit 0.cargo test -p ripr --lib classify::flow: 85 passed, run from a scratch copy with unrelated test modules compiled out, because the full lib-test binary exceeds the 15 GB authoring container.
Not established here
- The full
riprlib-test suite and the integration suites on this head. The hosted run is their first execution. - Bot review. None had reported when this was written.
Scope: repros 1 and 2 of #15274. Repros 3 to 7 are unchanged.
Generated by Claude Code
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
…same-named path arms (#15274) A returned comparison over a local is computed inside the owner, so the name-only tail reading now holds only for parameters the body does not rebind, fields and items (RIPR-SPEC-0158 example 5). A tail if that is an operand of a wider expression, and path arms that end in the same name, keep the unknown sink. binding_value_counterpart_width returns to its main golden. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmpjxCU5DuWyfHiiPiS
…inst items (#15274) The verdict corpus showed the wider reading credits what no reader pairs: an equality over names under a reflexivity loop, and two parameters under far rows. The return sink now needs an ordering comparison of exactly one unrebound parameter against items. Two corpus rows move, both discriminated cases whose return_value finding leaves propagation_unknown for exposed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmpjxCU5DuWyfHiiPiS
EffortlessSteven
left a comment
There was a problem hiding this comment.
SOURCE_REVIEW_READY
Source and oracle review of head 2028c25, by the authoring session. It replaces the record on a6cedc2, whose hosted qualification failed on a defect of this PR. Hosted checks on this head are outside this record.
What changed since a6cedc2
- The name-only tail reading in
return_value_sinkis narrowed to an ordering comparison of exactly one unrebound parameter against items. An equality over names, two parameters, a field and a local keep the unknown sink. tail_if_branch_valuerefuses path arms that end in the same segment, and anifwhose preceding code line does not end a statement. The second refusal applies to literal arms too.binding_value_counterpart_widthis back at its main golden.
Why the first cut was wrong
cargo xtask verdict-corpus check-allis outsideprecommit. Run locally, it showed the wide reading creditingspec-b-0158-dynamic-default(a local operand; RIPR-SPEC-0158 example 5 requires abstention),grid-equality-property(a == bunder a reflexivity loop), and thereturn_valuefinding of two far-row cases with two parameters. The returned-value readers hold a test to a boundary only where a literal twin exists, which is one parameter against a constant.
Inspected
- The whole diff against main 7cf9cd6, production and tests.
compares_one_parameter_to_items: a field access refuses; a lowercase name that is no parameter refuses; a parameter or item bound by anyletpattern in the body refuses; the count of parameter uses must be one.is_ordering_comparison: needs<or>and refuses shifts, arrows and turbofish.- Consumers:
propagation_evidence_with_witnessstill demands a complete owner-bound witness, so a sink alone promotes nothing. - Devin's three findings: two repaired, one answered in the changelog; all three threads replied to and resolved.
Oracle grip
- Verdict corpus: 0 false verdicts in all four corpora. Two rows move, both runtime-labelled
discriminatedcases of a parameter against a constant, whosereturn_valuefinding leavespropagation_unknownforexposed. - Fixtures: boundary pin
exposed, far-input pinweakly_exposedwithmust_not_promotecorpus rows, for both shapes. - Scratch crates on this head: a loop of far values reads
weakly_exposedfor both findings; the RIPR-SPEC-0158 local case readsinfection_unknownandpropagation_unknown, as on main. - Refusal tests for each excluded shape, with a positive control beside them.
Local proof on this head
cargo xtask precommit: exit 0.cargo clippy -p ripr --all-targets -- -D warnings: exit 0.cargo xtask goldens check: exit 0.cargo xtask verdict-corpus check-all: clean after blessing the two rows.cargo test -p ripr --lib classify::flow: 87 passed, from a scratch copy with unrelated test modules compiled out.
Outside this record
- The full lib-test and integration suites on this head. Hosted shards passed on a6cedc2 and have had no run on this one.
- CodeRabbit and Gemini were rate-limited, so their review is missing. Devin reviewed a6cedc2 only.
Scope: repros 1 and 2 of #15274. Repros 3 to 7 are unchanged.
Generated by Claude Code
|
Native evidence for |
Requested by Steven · project thread
Summary
n >= LIMIT) had no return sink, so itsreturn_valuefinding stayedpropagation_unknownwhatever the tests asserted. Itspredicatetwin on the same line already read the return sink andexposed. Thereturn_valueprobe now reads the same whole-tail comparison its twin reads.ifwhose arms are paths (if n > 10 { Level::High } else { Level::Low }) had no return sink either, because an arm had to spell a literal, a call, arithmetic or a bare identifier. A::path of plain identifiers is now a plain branch value, when the arms end in different names and theifopens its own statement.a == b), two parameters (width <= limit), a field and a local keep the unknown sink: the verdict corpus showed each of those wider readings credits a test that no reader pairs to the boundary.Swarm / Source Boundary
dependency, or repo-ops development for
ripr-swarmSource-of-truth Links
Proposal: n/a
Spec: RIPR-SPEC-0001
ADR: n/a
Plan item: n/a
Governing issue or accepted claim: #15274 (repros 1 and 2)
Acceptance delta (one sentence): an exact boundary pin now moves the
return_valuefinding of a name-only comparison tail, and thepredicatefinding of a tailifwith path arms, frompropagation_unknowntoexposed.Candidate Relationships
Candidate branch (GitHub PR head is authoritative after publication):
claude/project-thread-z2ojbt-15274Stack parent or prerequisite PR (if any): none
Proposed replacement of PR (if any; not yet accepted): none
Acceptance retained from a replaced candidate (if any): none
Accepted winner and losing candidate disposition (when decided): n/a
Related, not duplicated: #15322 (#14821) lets
verifyfinish when only analyzer limits remain; it upgrades no finding. #15927 (#13037) credits a crate-qualified pin on a computed tail. Neither touchesflow.rssinks.Scope
crates/ripr/src/analysis/classify/flow.rs:return_value_sinkaskspredicate_as_owner_tailbefore falling back to the unknown sink, and takes the tail only when it is an ordering comparison (is_ordering_comparison) of exactly one unrebound parameter against items (compares_one_parameter_to_items).tail_if_branch_valueacceptsis_plain_patharms, refuses arms that end in the same segment, and refuses anifwhose preceding line does not end a statement.Scope Classification
Production delta:
flow.rs, each with its refusals.Evidence/support delta:
Single acceptance criterion:
rust_return_value_name_only_comparison_tailreads both findingsexposedandrust_predicate_tail_if_path_armsreadsexposed; with a far-input pin, the two_far_inputfixtures stayweakly_exposed.Non-goals:
return), 4 (Some(x)toNone), 5 (struct field), 6 (compound assign), 7 (compound bool onself), and the missing stub hint incheckoutput.Support-tier Impact
Claim/proof notes:
changelog.d/15274-name-only-tail-return-sink.md.Policy Impact
Proof
Result, failures, or skipped proof:
propagation_unknowntoexposed; repro 2'sreturn_valuefinding moves frompropagation_unknowntoexposed. Repros 3 to 7 read the same before and after.n >= LIMITreads whatn >= 1000reads on main: boundary pinexposed, far exact pinweakly_exposed, farassert!weakly_exposed, smoke callreachable_unrevealed, and a loop of far valuesweakly_exposed.checkout-daily-limit-imported-constandcheckout-minimum-same-file-const. Both are runtime-labelleddiscriminatedcases ofparam OP CONST; theirreturn_valuefinding leavespropagation_unknownforexposed, and the case verdict stayscredited.cargo xtask verdict-corpus check-all(not part ofprecommit) showed three wrong credits:spec-b-0158-dynamic-default(a local operand, where RIPR-SPEC-0158 example 5 requires abstention),grid-equality-property(a == bunder a reflexivity loop, a false verdict), and thereturn_valuefinding ofmacro-table-far-rowsandmacro-module-child-far-rows(two parameters, far rows, readexposed). Each shape now keeps the unknown sink and is pinned inname_only_comparison_tail_over_a_local_keeps_the_unknown_sink.Level::Highandcrate::Level::High) and a tailifthat is an operand of a wider expression (force ||on the line above) keep the unknown sink. The second refusal also covers literal arms, which had the same gap on main.binding_value_counterpart_widthis back at its main golden: its tail compares a local.riprlib-test binary does not build in the 15 GB authoring container. The 87classify::flowtests were run from a scratch copy of this tree with unrelatedmod testsblocks compiled out. Hosted shards passed on a6cedc2; they have not run on this head.Claim Boundary
May be claimed: an ordering comparison of one parameter against items, and a one-line tail
ifwith distinct path arms, reach the return sink and are then judged by the existing infection and oracle readers, as their literal twins are. Must not be claimed: that #15274 is resolved, or thatverifynow completes on the issue's other five repros.Rollback
Revert the squash commit. No schema, config or output-contract change.
Spec-Test-Code Traceability
flow.rs::tests::{name_only_comparison_tail_reaches_the_return_sink, literal_comparison_tail_keeps_its_own_return_sink_text, name_only_comparison_off_the_owner_tail_keeps_the_unknown_sink, tail_if_with_path_branches_flows_to_the_returned_value, tail_if_with_unread_or_equal_path_branches_fails_closed, tail_if_that_is_an_operand_of_a_wider_tail_fails_closed, name_only_comparison_tail_over_a_local_keeps_the_unknown_sink}crates/ripr/src/analysis/classify/flow.rsfixtures/rust_return_value_name_only_comparison_tail{,_far_input},fixtures/rust_predicate_tail_if_path_arms{,_far_input}Static Language Check
killed,survived,untested,proven, andadequate.CI Economics
n/a
Engineering Check
panic,unwrap,expect,todo, orunimplementedin production code.panic,unwrap,expect,todo, orunimplementedin tests.https://claude.ai/code/session_01SvmPmpjxCU5DuWyfHiiPiS
Generated by Claude Code