Skip to content

fix(rust): reveal side does not read an interior-mutable let or static mut as its initializer (#8112) - #8533

Merged
EffortlessSteven merged 3 commits into
mainfrom
claude/issue-8112
Oct 18, 2026
Merged

EffortlessSteven merged 3 commits into
mainfrom
claude/issue-8112

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Requested by Steven · project thread

Before: expected_operand_value followed an immutable let of Cell/RefCell/Mutex/atomic type, or a static mut, to its initializer. The reveal side then wrongly weakened an assertion that compares against a value the test had since changed.

After: both are refused (immutable_let_value rejects interior-mutable initializers; single_constant_value rejects a constant declared static mut). Plain immutable let and const/static keep their existing behavior. Block-scope gap from the issue is not addressed here.

Proof: cargo check -p ripr --lib passes. New refusal rows added to the_reveal_side_reads_an_expected_name_only_through_one_readable_let_or_constant (Cell, Rc, static mut, Mutex, AtomicUsize); existing positives in that test are the controls. NOT run locally: the lib test target OOM-kills rustc in this shared container, so cargo xtask precommit and the unit test need hosted CI before merge.

Closes part of #8112 (interior-mutable let and static mut; block scope remains).

Source-of-truth Links

Governing issue or accepted claim: #8112
Acceptance delta (one sentence): The reveal side no longer follows an interior-mutable let or a static mut to its initializer as the expected value.


Generated by Claude Code

…c mut as its initializer (#8112)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0193fZVBGjXWpxEYFUzBGCYt
@EffortlessSteven EffortlessSteven self-assigned this Oct 17, 2026
@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 17, 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 29 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 80 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: d1784292-c00e-434d-935a-a43b019378e3
📥 Commits

Reviewing files that changed from the base of the PR and between e90f562 and c0ac0f5.

📒 Files selected for processing: 3
  • changelog.d/8112-interior-mutable-expected.md
  • crates/ripr/src/analysis/classify/owner_pin.rs
  • crates/ripr/src/analysis/classify/owner_pin/tests.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@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.

Confirmed findings

  • declares_static_mut scans the entire masked source for any 'static' token then walks forward to check 'mut name'; O(file_length) per expected name. Acceptable since classify is invoked once per test summary, but worth noting if the file ever grows very large.
  • PR changelog claims the reveal-side bug is fixed for both interior-mutable let and static mut, but the changelog entry and the diff omit any mention that allowlist scope is closed (e.g. user-defined UnsafeCell<X> wrappers, parking_lot::Mutex, tokio::sync::Mutex). A reader cannot tell whether the allowlist is intentional or temporary.
  • Lane ub-active-view (resizable buffer / ArrayBuffer / TypedArray resize-detach-transfer / stale length) is out of scope for this Rust-only source-classifier PR; no JS, WASM memory, or buffer abstraction is touched by the diff. Active-view invariants cannot be violated by string-slicing over masked source.

Verification questions

  • Confirm body method let e = std::rc::Rc::new(RefCell::new(weight(2))); assert_eq!(weight(2), e); compares weight(2) (i64-like) against Rc<RefCell<...>>. Equality almost certainly fails at runtime; this is a reach-only structural refusal test, not value-equivalent. Acceptable as oracle since it asserts None from value() regardless of runtime type, but readers may mistake it for a runnable example.
  • Confirm test row for Rc<RefCell> does not actually mutate e before the assertion; without a .borrow_mut() write, the refusal still holds trivially and does not exercise the would-be bypass.
  • Confirm has_interior_mutability uses whole-word substring match on the masked initializer, so Atomic * weight(2)-style expressions and user-defined wrappers (e.g. Counter(Cell::new(...))) are not detected, leaving a same-class bypass.
  • Confirm tests are the legitimate refusal rows called out in PR body (Cell, Rc, static mut). ToC spans diff hunks at owner_pin.rs ~9308-9369 and tests.rs ~2531. Underlying heuristic is name-list matching (contains_as_whole_word) and static mut parser, not a typed interior-mutability analysis.
  • Confirm block-scope gap from #8112 explicitly out-of-scope per PR body; 'interior mutable static' (e.g. static CELL: Cell<u32> = Cell::new(0)) is also not addressed by this diff.

Refuted

  • A static mut E declaration in the same file as pub static EXPECTED could be mis-detected as the in-scope target and incorrectly trigger refusal of EXPECTED.; refuted because: declares_static_mut requires static mut <name> where <name> is the operand looked up, so a generic static mut E does not match the binding EXPECTED. False premise.

Evidence gaps

  • Issue thread says cargo xtask precommit and lib tests were not run locally due to container OOM; hosted CI receipt is the real proof.
  • AST-grep + diff show only immutable_let_value and single_constant_value changed; ripr binary failed (exit 2) but is downstream consumer, not invoked by these classify helpers.
  • Model proof intent was rejected by deterministic validation.

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 17, 2026 21:43
@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!

Copy link
Copy Markdown
Member Author

Ripr Rust Small Result failed with REASON: runner_api_failed / RUNNER_QUERY: failed: the runner-availability query failed and every lane was skipped, before any test ran. That is infrastructure, not this diff. I re-ran the failed jobs once, and I'm keeping the PR watched.


Generated by Claude Code

@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!

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