Repository navigation
fix(classify): a constant owner tail completes its return propagation witness (#6617) - #7687
Conversation
… witness (#6617) A body that is exactly one literal-only expression returns that value, but a literal has no semantic tokens, so no witness paired it with its sink and an exact pin read as a false weakly_exposed gap. constant_tail_witness completes a DirectReturn witness for that exact shape only. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019DhTE9QaZFAYeqtp9XRAGK
…ghten constant-tail controls The rule-7a fixture's owner is the constant tail `7`, whose propagation is now established on its own (#6617). Refused receipts still grant no observation credit and no exposed verdict, which is what the controls now check. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019DhTE9QaZFAYeqtp9XRAGK
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
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 reachedThe included review limit has been reached and this organization has disabled usage-based review continuation. Wait for reviews to reset or ask a billing admin to change After included review limits. Next included review available in 25 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
Summary by CodeRabbit
WalkthroughA constant-only function tail can now establish direct-return propagation when its expression and line match the return-value probe and sink. The change adds evidence-gathering integration, unit and integration tests, and updates the specification and changelog. ChangesConstant Tail Propagation
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Low Sequence Diagram(s)sequenceDiagram
participant Evidence as ClassifiedProbeEvidence::gather
participant Witness as constant_tail_witness
participant Owner as FunctionSummary
participant Sinks as FlowSinkFact
Evidence->>Witness: pass resolved owner and current flow sinks
Witness->>Owner: inspect function body and tail line
Witness->>Sinks: match owner, line, and normalized return text
Witness-->>Evidence: return direct-return witness or None
Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
Decision
- Needs one verification check before upstream.
Verification questions
- Confirm red/green: 4 positive cases in exact_pin_on_a_constant_owner_tail_is_exposed plus weak_oracle_on_a_constant_owner_tail_keeps_its_gap toggle the classification; fallible_owner_return refusal controls now check discriminate!=yes so the new tail propagation does not silently flip them green.
Refuted
- Adding a fourth fallback in the evidence.rs .or_else chain could extend any previously-borrowed value past its lifetime; refuted because: Each or_else branch is invoked on owned Option values produced by prior branches; the new constant_tail_witness only borrows probe, owner, and flow_sinks, all of which are passed by reference from the surrounding context for the whole call. No new aliasing or lifetime extension is introduced.
- No resizable buffer, ArrayBuffer, TypedArray, Vec/slice resize, or detach/transfer path is touched by this PR; active-view invariants do not apply.
- constant_tail_witness could mis-bind a sink via a stale length snapshot, exposing an active-view-style bug where the sink's stored line/text no longer reflects the current AST region.; refuted because: The witness joins on (owner.id, kind=ReturnValue, line == probe.location.line, normalized text == probe.expression) and re-derives tail_line from owner.body via constant_owner_tail_line. There is no cached length or capacity; the only 'snapshot' is the immutable FunctionSummary.body String and probe.location.line, both freshly read per call. The unit test constant_tail_witness_binds_owner_line_and_sink explicitly asserts that a probe on a different line, of a different family, or against a different owner yields None. Active-view framing does not apply.
- A constant owner tail could mis-bind across a worker handoff because literals have no semantic tokens and any GC or detach could move the sink; refuted because: No worker, no detach, no async boundary exists in the changed code path; sink identity is normalized from the same source text as the probe, lookup keys on owner.id/kind/line/text, and bodies are owned &str. Memory crossing is inapplicable to this Rust analyzer surface.
- constant_tail_witness_binds_owner_line_and_sink positive case is tautological because sinks are derived from the same probe via local_flow_sinks; refuted because: Same test asserts three negative branches (wrong line, wrong family, wrong owner) using distinct probes, so the positive path is not the sole discriminator; the unit test plus four integration cases together cover the witness's truth table.
- Sibling path:
return <literal>;statement form should also complete a DirectReturn witness under the same rule.; refuted because: PR body and SPEC-0197 listreturn <literal>;and multi-line tails as explicit non-goals;constant_owner_tail_linerequireslist.statements().next().is_none()and only the tail expression, so statement form fails closed by construction. - The new constant_tail_witness duplicates the role of current_path_witness and could over-credit when both succeed.; refuted because: constant_tail_witness requires the body to contain only LITERAL/BIN_EXPR/PREFIX_EXPR/PAREN_EXPR nodes — shapes current_path_witness's semantic-token pairing cannot match. Fail-closed on any non-constant shape and on line/text mismatch, so overlap is empty.
Parked follow-ups
- Parked follow-ups are tracked in the PR body:
return <literal>;statements, multi-line tails, relation/activation changes, and oracle-strength work (#6764/#6670) are explicitly out of scope for this PR.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
#6617) fn answer() -> u8 { 7 } is a constant owner tail, so both fixtures now carry a complete return propagation witness. The verdict stays weakly_exposed because the discriminator is still weak; only the propagate stage and the weak verdict's confidence move. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019DhTE9QaZFAYeqtp9XRAGK
|
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
- Lane ub-worker-handoff has no applicable surface in this diff. Logging a no-finding per posture: surface is Rust parser/AST plus golden fixtures; no JS worker, async, GC, detach, or transfer boundary is touched or relevant.
Verification questions
- Confirm fallible owner return controls now assert discriminate!=yes, but the inverted fixture and message-escape fixture still rely on confidence 0.66→0.92 only; no new dedicated test pins the new refuse-discrimination invariant on a non-constant-tail fallible owner.
- Confirm constant_owner_tail_line uses SyntaxKind match on LITERAL/BIN_EXPR/PREFIX_EXPR/PAREN_EXPR; no literal-kind validation, so a
b"bytes"byte string or c-string literal in tail could be accepted if all literals are permitted by SyntaxKind::LITERAL. - Confirm negative integration cases for non-constant-tail shapes (statement/name/call/cast/closure/macro/block/branch) rely on the unit-test matrix in propagation_witness.rs::constant_owner_tail_is_the_whole_literal_only_body, not on a
crates/ripr/tests/...integration test. - Confirm constant_tail_witness's AST whitelist (LITERAL|BIN_EXPR|PREFIX_EXPR|PAREN_EXPR) plus tail-expr/no-statement guard is encoded in constant_owner_tail_line; sibling shapes (return ;, multi-statement, blocks, branches, macros, closures, casts, method calls, names) are not exercised by an integration test in this PR.
Refuted
- Refusal controls in fallible_owner_return.rs migrated from propagate!=yes to discriminate!=yes could be vacuous or non-discriminating because the rule-7a owner is fn answer()->u8{7}, a constant tail, so propagate now flips to yes unconditionally and propagate!=yes would silently fail; refuted because: Rule 7a spec text and inverted-oracle row now say 'receipt-bound propagation witness' and explicitly exclude the constant-tail route. discriminate is the observation-credit channel; refusing a receipt must not credit zero observation; the new assertion targets that exact invariant.
- No sibling helper callers of fallible_literal_witness or current_path_witness exist beyond the evidence fallback chain, so adding constant_tail_witness implies it is the only new witness caller.; refuted because: Substantive search across classify/propagation_witness.rs and classifier/evidence.rs finds constant_tail_witness referenced only at the single new .or_else site; callers of current_path_witness and fallible_literal_witness remain inside the same chain.
- Weak-oracle assertion only exercises
assert!(answer() > 0); other weak-oracle shapes (!= 0,< 100,> 41) could keep their gap differently or even flip classification.; refuted because: The propagation witness is oracle-agnostic; classification is driven by the ripr pipeline whose oracle-strength logic is unchanged per the PR's non-goals. The single> 0case is sufficient to prove the claim that propagation does not silently elevate a weak oracle to exposed. Additional shapes are low marginal value and the spec explicitly excludes general oracle-strength work (#6764/#6670). - A constant owner tail could be weaponized to upgrade a refusal-shaped witness into an exposed verdict, leaking silent state via the JSON output (info disclosure / overclaim).; refuted because: Verdict comes from the existing classifier, not from the propagation witness in isolation. The unit + integration tests assert the verdict stays non-exposed when the discriminator is weak. The witness only flips propagate from weak to yes; discriminate remains weak and overall classification remains weakly_exposed. PR body and spec text explicitly state: 'The witness settles propagation only; relation, activation and oracle strength keep their own rules.'.
- constant_tail_witness could mis-bind a sink via a stale length snapshot or stale source text, exposing an active-view-style bug where the sink's stored line/text no longer reflects the current AST region; refuted because: No resizable buffer, Vec/slice resize, or detach/transfer path is touched. The sink lookup uses FlowSinkFact as provided by the surrounding context for the whole call; line and text are read directly from the sink struct, not snapshotted. The witness requires tail_line==probe.location.line and identity matches both probe and sink text, so a stale sink whose text no longer matches the tail's normalized text is filtered out by the equality check.
Evidence gaps
- Two blocked checks (miri, cargo-allow) remain unrun; ripr ran and failed with exit code 2, so the propagation witness route is unverified at runtime in this packet.
- Model proof intent was rejected by deterministic validation.
Review of recordHead: Angles
Findings and resolutions
Checks: Rust gates passed on this head. Nothing blocking. Generated by Claude Code |
EffortlessSteven
left a comment
There was a problem hiding this comment.
reviewed_head_sha: 96e44a1
integration_basis: 118cdd5
claim_boundary: A constant owner tail completes its return propagation witness (#6617)
changed_surfaces_and_semantic_owners_inspected:
- crates/ripr/src/analysis/classify/propagation_witness.rs (ripr/analysis)
- crates/ripr/src/analysis/classifier/evidence.rs (ripr/analysis)
- crates/ripr/tests/constant_tail_propagation.rs (integration tests)
- crates/ripr/tests/fallible_owner_return.rs (regression assertions)
- docs/specs/RIPR-SPEC-0197-owner-return-pins.md (spec and traceability)
- fixtures (re-blessed rule-7a fixtures)
blocking_findings: none
non_blocking_suggestions: none
refuted_or_stale_findings: none
proof_and_ci_observed: - Ripr Rust Small Result: pass (commit 96e44a1)
- Ripr Rust Small on GitHub Hosted / Rust gates: pass (59m 16s)
- windows-advisory-subset: pass
- Rust-only feature lane: pass
- build and inspect Linux x64 wheel: pass
- All 21 checks passed or skipped cleanly
proof_or_review_missing: none
affected_currentness_dimensions: none
residual_assumptions_and_non_claims: settles propagation only; relation, activation and oracle strength keep their own rules.
disposition: REVIEW_READY
…ed type (#6617) (#7738) * analysis(related_tests): admit inherent type-path calls on a package-narrowed index (#6617) Relation half only; NOT shippable alone: on authored-old-deps it flips no_static_path (limited) to reachable_unrevealed (gap) because of run-wide trusted-macro ambiguity and the missing associated-fn owner pin. * feat(owner_pin): associated-function T::name() owner-return pin (#6617) An inherent associated function `Gauge::reading()` can now be pinned by `assert_eq!(Gauge::reading(), 42)` in a test that imports `Gauge` at file level from the owner's crate. With the constant-owner-tail propagation witness (#7687), `old-deps-type-path-direct-import` moves limited -> credited, its ideal verdict; no other corpus row moves. - PinCall::Associated { type_name } in pin_call for (Inherent, no self): T one CamelCase identifier declared exactly once (struct/enum/union), no mod/trait/type of that name in the index. - CallShape::Associated(T) for `T::name(..)`; disjoint from the #6974 module-path CallShape::Path (path_call_prefix rejects CamelCase). - other_definition_competes takes CallKind plus main's #6544 per-test identity; for Associated, free fns do not compete (RIPR-SPEC-0172), every other fn of the name does. The identity applies to bare calls only. - Test side reuses the RIPR-SPEC-0197 manifest authority (krate_root_names_owner_crate / MemberCrates::import_names); direct file-level `use <krate>::...::T;` only; alias, glob, brace, other roots refuse; library_may_export_other(T) refuses foreign re-exports. - Whole-value field pins stay refused for associated owners. Decision: bare_call_names_only_a_module_level_function's B2 intent (a bare `decode(..)` never pins the associated `Codec::decode`) is asserted directly: the associated pin is established and admits nothing for the bare call; the free-function half is unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019DhTE9QaZFAYeqtp9XRAGK * fix(owner_pin): an associated-function pin admits only `use <krate>::T;` A longer import path was checked only at its root and last segment, so `use meter::fs::Gauge;` through `pub use fastscore as fs;` could credit a test that calls another crate's `Gauge::reading()`. Refuse any middle segment; the corpus case and the spec example both use the direct form. Also: the refusal matrix now asserts an established pin with no admitted assertion (it accepted a pin that never established), Draft admission indexes a `trait`, `mod` or `type` of the owner type's name so Draft matches Full, and the dependent-scope doc names the #6617 type-path exception. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019DhTE9QaZFAYeqtp9XRAGK * test(owner_pin): use ? in the manifest pin helper (clippy::question_mark) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019DhTE9QaZFAYeqtp9XRAGK * docs(changelog): longer import paths refuse the associated pin (#6617) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019DhTE9QaZFAYeqtp9XRAGK * fix(owner_pin): a cfg-gated associated owner refuses its pin (#7724) With the cfg off, `T::name()` can reach an external trait default the index never sees, so the associated branch now applies the bare call's #7082 check: a cfg on the owner fn, its `impl`, an enclosing module or its file refuses. SPEC-0172 now names the #6617 narrowed-index exception in its precondition and implementation mapping. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019DhTE9QaZFAYeqtp9XRAGK --------- Co-authored-by: Claude <noreply@anthropic.com>
Summary
Before:
fn answer() -> u32 { 40 + 2 }withassert_eq!(answer(), 42)readweakly_exposed, a false actionable gap. A literal has no semantic tokens, so no propagation witness paired the changed tail with the owner's return sink, and propagation stayed weak.After: when the owner's whole body is one literal-only expression and that expression is the changed one, a DirectReturn witness completes and the exact pin reads
exposed. Every other shape gets no witness (fail closed).How:
constant_tail_witnessinclassify/propagation_witness.rsis wired intoclassifier/evidence.rsas a fallback aftercurrent_path_witnessand the rule-7a adapter. It requires all of the following:return_valueprobe on the owner;This is the missing piece for #6617, whose rebased patches land in a follow-up PR.
Swarm / Source Boundary
ripr-swarmSource-of-truth Links
Spec: RIPR-SPEC-0197, new "Constant owner tails (#6617)" section; rule 7a text amended.
Governing issue or accepted claim: #6617 (blocker named in issue comment 6139068561)
Acceptance delta (one sentence): an exact pin on a constant owner tail reads
exposedinstead of a false gap.Candidate Relationships
Candidate branch:
claude/project-thread-phlb60. Prerequisite for landing #6617's rebased relation and associated-pin patches.Scope Classification
Production delta:
propagation_witness.rs:constant_tail_witnessandconstant_owner_tail_line.evidence.rs: one fallback in the witness chain.Evidence/support delta:
tests/constant_tail_propagation.rswith two integration tests.tests/fallible_owner_return.rs(see Decision).Non-goals:
return <literal>;and multi-line tails still abstain.current_path_witness,semantic_tokensand the rule-7a receipt are unchanged.Decision (recorded per project rules)
The rule-7a refusal controls in
tests/fallible_owner_return.rsassertedpropagate != yesas a proxy for "a refused receipt grants nothing". Their fixture owner isfn answer() -> u8 { 7 }, which is a constant tail, so its propagation is now established on its own.The controls now assert that a refused receipt grants no observation credit (
discriminate != yes), and they keepclassification != exposed. No verdict changes: every refusal case still reads belowexposed. The SPEC-0197 rule-7a text and its inverted-oracle row now say "receipt-bound propagation witness". These are static acceptance controls, not runtime-execution controls.Support-tier Impact
Policy Impact
Proof
Comparing the same crates with and without this change:
weakly_exposedtoexposed: exact pins on40 + 2,43,-(1 << 3),"ripr", aconst fn, an impl method and a single-line fn.weakly_exposed: a weak> 0oracle, trait-default andcfg-twin pins of another value, and an un-awaitedasync fn.Review of record (pre-publication, head 8f137dd)
An adversarial reviewer agent (correctness and fail-closed soundness) built the candidate and ran 17 crates with and without the change.
&strliterals, so no user operator impl can run.Claim Boundary
May claim: a changed constant owner tail propagates to the owner's return. Must not claim: any oracle credit, any change to relation or activation, or propagation for any other literal shape.
Rollback
Revert the squash commit.
Static Language Check
killed,survived,untested,proven, andadequate.Engineering Check
panic,unwrap,expect,todo, orunimplementedin production code.panic,unwrap,expect,todo, orunimplementedin tests.🤖 Generated with Claude Code
https://claude.ai/code/session_019DhTE9QaZFAYeqtp9XRAGK
Generated by Claude Code