Skip to content

fix(analysis): bind implicit effect credit to the ordered shared-sink assertion (#7794) - #8740

Closed
EffortlessSteven wants to merge 2 commits into
mainfrom
claude/7794-effect-authority
Closed

EffortlessSteven wants to merge 2 commits into
mainfrom
claude/7794-effect-authority

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Requested by Steven · project thread

Governing issue or accepted claim: #7794
Acceptance delta (one sentence): Production authority so a proximity-only or implicit-dispatch effect oracle confirms observation only through the ordered shared-sink assertion of the dispatched receiver (RIPR-SPEC-0094), with fail-closed refusal that preserves independent token/collection confirmation.

Before / After

  • Before: a SideEffect/CallDeletion oracle related only by file/module proximity (or any test with indexed implicit dispatch) could confirm observation from its oracle kind alone, so an unrelated sibling parser equality counted as observing an aggregation effect.
  • After: kind-only credit requires an assertion-local, bounded implicit-dispatch witness (implicit_effect.rs); refused rows stay visible as observation_unconfirmed yet keep independently confirmed token/collection-read confirmation (the refused gate also honours collection_argument_read).

How

New classify/implicit_effect.rs plus wiring in reveal.rs, related_tests.rs, transitive_reach.rs, context.rs, classifier/{evidence,finding}.rs; SPEC-0094 text, traceability, changelog fragment (#7794). In-crate unit tests ship here; fixtures, goldens, honesty corpus and the integration matrix follow in stacked PRs (split from #7817 because it exceeded the admission scope limit).

Proof run

  • cargo fmt --check; cargo test -p ripr --lib classify:: (1327 passed)
  • cargo xtask precommit (exit 0); check-traceability, check-spec-format, check-fixture-contracts, goldens check pass on this branch alone (no existing golden shifted)

Supersedes the combined candidate #7817 (to be closed unmerged; proof PRs stack on this one).


Generated by Claude Code

… assertion (#7794)

Production authority for sibling/implicit effect observation under
RIPR-SPEC-0094: proximity-only effect oracles no longer confirm from kind
alone, implicit trait dispatch credit is assertion-local, refused kind rows
keep independently confirmed tokens/collection reads. Fixtures and the
integration matrix follow in stacked PRs. Supersedes #7817.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SXuWr9byCWqYZ9wHRTEcSy
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 18, 2026 04:27
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 57 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 85 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: f4f7c73e-7adb-440d-8b7e-68d5f4490c80
📥 Commits

Reviewing files that changed from the base of the PR and between e54499e and 1dd36eb.

📒 Files selected for processing: 12
  • .ripr/traceability.toml
  • changelog.d/7794-sibling-effect-oracle.md
  • crates/ripr/src/analysis/classifier.rs
  • crates/ripr/src/analysis/classifier/evidence.rs
  • crates/ripr/src/analysis/classifier/finding.rs
  • crates/ripr/src/analysis/classify/context.rs
  • crates/ripr/src/analysis/classify/implicit_effect.rs
  • crates/ripr/src/analysis/classify/mod.rs
  • crates/ripr/src/analysis/classify/related_tests.rs
  • crates/ripr/src/analysis/classify/reveal.rs
  • crates/ripr/src/analysis/classify/transitive_reach.rs
  • docs/specs/RIPR-SPEC-0094-observation-unverified-guard-generalization.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

…on scan (#7794)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SXuWr9byCWqYZ9wHRTEcSy

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verification questions

  • Confirm local_dispatch_type refuses any module-level macro call (including benign mod foo { ... } style emissions and fixture macro_rules! already vetted by ExpansionSurface::scan), but the gate does not distinguish expansion positions: a receiver file with one top-level mod tests { ... } carrying a #[cfg(test)] item-macro inside the nested module still vetoes the bounded exception even though the receiver type itself is bounded.
  • Confirm IMPLICIT_DISPATCH_METHODS referenced by transitive_reach.rs::test_has_known_implicit_dispatch and assertion_has_known_implicit_observer is not defined in the diff hunk visible here. The seeded thread cites line ~30 of implicit_effect.rs but not the constant. Without a constant restricting method names, the reverse-path reaching.iter() branch could accept any single-function method, defeating the trait-method bind.
  • Confirm in classify/reveal.rs::analyze_related_assertions the new effect_kind_confirms gate is !(is_effect_family && owner_reaching_related && (is_proximity_only \|\| implicit_observer.is_some()) && !invokes_opaque_macro && implicit_observer != Some(true)). That string is hard to follow and the pre-existing _not_opaque_macro local is left dangling — its semantics are now duplicated rather than reused, which raises the chance of a future drift where effect_kind_confirms and the surrounding observation_confirmed/token branch fall out of sync.
  • Confirm standard_handles matches the imported canonical path for Rc/Cell/RefCell/Vec. Nested globs (e.g. use std::rc::*;) pass the rename/path check by relying on the parent's name while keeping the nested children globbed. Confirm: does named[0].path() ancestor walk read the full chain or a single-segment chain, so use std::rc::*; Rc::new(...) produces the required std::rc::Rc path? If the nested use flattens to *, the canonical join fails and the bounded form refuses, but a partial glob like use std::rc::{Rc, Weak}; could still parse while pretending a different module path. Add a fixture proving nested-glob Rc still passes the canonical-path bind (or refuses it, by design). (crates/ripr/src/analysis/classify/implicit_effect.rs:437).
  • Confirm standard_handles allows Vec to be imported from std::vec::Vec only, but #[derive(Default)] (and other derives) commonly construct Vec<T> through vec![]/Vec::new() without any use std::vec::Vec; import (it is a path, not a type alias). A receiver type whose file uses Vec purely through paths in a use std::vec; glob (or relies on prelude) will be rejected as non-standard, even though it is the std handle.
  • Confirm receiver-type attribute veto and reverse-path-length cap are documented in spec lines 674-680 but lack a dedicated reveal/transitive_reach test; assertion_observes_dispatch uses receiver_types[0].attrs().next().is_none() and signature_parameters==[root], but only implicit_effect.rs covers local-dispatch-type exclusion, not an end-to-end red/green test that confirms an attribute-decorated receiver refuses the bounded observer while a token match still confirms.
  • Confirm standard_handles lexical match binds Rc/Cell/RefCell/Vec to the exact std::* canonical paths; wildcard imports are vetoed but a use std::rc::*; glob still keeps the local Vec constructor. The use all predicate only refuses globs at the item-level, so nested use std::rc::* allows Rc::new(...) while a same-file use std::cell::Cell path passes. Check that this combined path stays bounded.

Refuted

  • The new implicit_effect.rs module adds an attacker-controlled DoS sink by reading arbitrary .rs files in the workspace during classification.; refuted because: The scan iterates over RustIndex.files().values() that the classifier already loaded for the same analysis run; ExpansionSurface stores only short identifier strings in excluded_receivers (no source copies retained), uses OnceLock for once-per-index memoization, and the gh-runner profile trusts the input repo. No new filesystem read or network call is opened.
  • Implicit-dispatch observer authority could be lost or detached across a worker/async boundary between source indexing, memo caching, and the assertion check.; refuted because: There is no worker or async hop. The memo is a OnceLock populated lazily from the already-built immutable RustIndex, and assertion_observes_dispatch consumes the same Arc source bytes plus the parsed test body within a single synchronous reveal_evidence call. No transferable/detachable handle crosses any boundary.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

Parked follow-ups

  • The Drop workspace veto is enforced through three independent surfaces (UseTree with as Destructor rename, Drop trait impl by name in any file, complete-compact join of use Drop as …) but the comment-driven macro_rules! veto uses MacroRules::can_cast only; item macros that expand to a Drop impl would escape this static detection, which is why local_dispatch_type additionally refuses any module-level MacroCall. Same risk also applies to cargo xtask precommit ‘tickled’ builders — parked.
  • related_tests.rs adds test_dispatches_trait_impl with reverse For/while/for_each/operator walkers gated by compact_impl_type_name and dispatch_operand_has_type (with let_binding_mentions_type + bracketed_expr_has_type); the only sibling concern not unified is machine-only owner-parameter aliasing where the impl's self_ty and the owner parameter share a non-identifier symbol — parked rather than broadened.

@EffortlessSteven
EffortlessSteven marked this pull request as draft October 18, 2026 07:19
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 18, 2026 07:19

Copy link
Copy Markdown
Member Author

Reply to review 5561544139 (leads, checked against source at 1dd36eb): (1) nested use std::rc::* — refuted by source: the scan requires !use_text.contains('*'), so any glob import (nested included) sets bounded=false and the whole bounded exception refuses (fail-closed, by design); only the canonical single-path imports admit. I verified this locally with a throwaway test (use std::rc::*; and use std::{rc::*, cell::Cell}; refuse, use std::rc::Rc; stays bounded) but did not push it, to avoid restarting hosted proof for a behavior already enforced. (2) Vec via prelude/path-only construction is refused rather than guessed — fail-closed, no false credit; widening is out of scope here. (3) IMPLICIT_DISPATCH_METHODS/effect_kind_confirms/attribute-veto questions are structure and naming concerns, not defects; the attribute veto and reverse-path cap have in-crate coverage and the integration matrix lands in the stacked fixture PRs. No code change.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

Claimed for the open-PR sweep by the "Editor refresh latency" thread (2026-10-22). Plan: check the head against current main, repair and land it (via a successor PR from my branch if I cannot push to this one), or close only on the sweep's "we do not want this" / "fundamentally different" bar with evidence.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

Released: the "Editor refresh latency" thread is dropping this sweep slice. No changes were made to this PR or its branch. The open-PR sweep will route it to a thread that can push to its branch. Last required check on 1dd36eb was a failure on 2026-10-18 and the base (e54499e) is old, so it needs a merge of main and a look at that failure first.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

Picked up by the "Editor refresh latency" thread (re-claimed after the coordinator re-routed it). #8740 is the production-only split of #7817, and #7817 has now been brought current with main (merge plus re-bless, pushed), all four open review threads answered and resolved, and a review of record posted at head ef15493. Required CI on #7817 is running now.

Plan, so the two do not both go through qualification: if #7817's required check passes, it lands with its fixtures and matrix and this PR is closed as superseded by merged value. If #7817 is refused at admission for size, this PR takes over: I merge main here and open the proof PRs that were meant to stack on it. No changes to this branch yet.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

Closing as superseded: #7817 itself merged on 2026-10-22 (12:20Z), so the split into stacked PRs is no longer needed. The deferred fixture, corpus and matrix recovery is tracked in #9543.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants