Skip to content

refactor(analysis): share per-file source snapshot facts across owner-pin queries (split 1 of #9611) - #10380

Merged
EffortlessSteven merged 16 commits into
mainfrom
claude/split-8004-pr1-snapshot
Oct 26, 2026
Merged

EffortlessSteven merged 16 commits into
mainfrom
claude/split-8004-pr1-snapshot

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Source-of-truth Links

Governing issue or accepted claim: #7415 (split of #9611 / #8004 to fit the 3000-line admission cap)
Acceptance delta (one sentence): Owner-pin shadow, async and scope queries read shared immutable per-file source snapshot facts instead of re-parsing, with no verdict change: goldens and all four verdict corpora are identical to main.

Summary

Before: #9611 carried this refactor together with the inherent-receiver identity gate, about 3052 counted lines before the withhold work, over the admission cap.

After: this PR is the verdict-neutral refactor only (1249 counted lines vs main). source_snapshot.rs (new), name_scope.rs, and the call_identity / owner_pin consumers read the shared snapshot; owner_enclosing_module is removed. Nothing is dead code and no #[allow] is added. The identity gate (requires_inherent_receiver_identity and its helpers), parse_fragment, the same-file free-helper identity and the test_grip changes are not in this PR; they land in the next PR of the series, which also contains the reviewed receiver-unestablished withhold so the two serde rows never read gap on main.

How: hunks taken from #9611's head a45614b88, applied onto main with a three-way merge. Three intentional tightenings are included and were measured against the corpus: same-named fns on one line return no scope, fn type params go into defines, and TestKey includes the test name. None moved a row.

Series order: this PR, then identity gate plus withhold (PR2, from #9611 / #10171), then hardening tests and prose (PR3).

Candidate Relationships

Candidate branch: claude/split-8004-pr1-snapshot
Stack parent or prerequisite PR (if any): none (lands first)
Proposed replacement of PR (if any; not yet accepted): replaces part of #9611
Acceptance retained from a replaced candidate (if any): the verdict-neutral snapshot hunks of #9611

Scope Classification

  • One production behavior (internal refactor, no verdict change)

Review

Independent exact-head review of 4c7bd5fce found no blocker or major (record on the PR). Head b3979ddb2c6b12509885a597e11c9a8067ec3d85 (tree 759bac9cde4c50187af0e1539a68b3c99bcef533) is that head plus a merge of main 237fa0aa9; the one conflict (related_tests.rs, main's extracted impl_identity_is_shadowed) was resolved by taking main's side and applying PR1's three call-site changes. The diff of that file against main is exactly those hunks.

Proof

Writer-run on the merged head: cargo fmt --check 0; cargo check -p ripr --all-targets 0; cargo test -p ripr --lib 14612 passed, 1 ignored; cargo xtask goldens check 0; cargo xtask verdict-corpus check-all 0 for all four corpora, with output identical to pristine main (Rust 670 cases, 3 false verdicts, 0 contradictions); cargo xtask precommit 0.

Rollback

Revert the squash commit.

🤖 Generated with Claude Code

https://claude.ai/code/session_017Z4QZYyfpcDLn8oANQJT1z

Move complete-source declaration, name-scope, item-nesting and module-shadow
answers onto an immutable per-file SourceSnapshot owned by the index, and share
the owner-pin file scope table across short-lived syntax owners. Verdict
neutral: verdict-corpus reports are byte-identical to main.

Includes the intentional tightenings from the larger candidate (same-named
functions on one line yield no scope, function type parameters enter `defines`,
the per-test identity memo is keyed by test name); none moves a corpus row.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Z4QZYyfpcDLn8oANQJT1z
@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 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

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 42 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 186 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
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: e483da6a-7292-4cc3-85f4-f59e0ff5d23a
Commits

Reviewing files that changed from the base of the PR and between b3979dd and 5d69310.

Files selected for processing: 11
  • .ripr/traceability.toml
  • changelog.d/8004-source-snapshot-shared-lexical-facts.md
  • crates/ripr/src/analysis/classify/call_identity.rs
  • crates/ripr/src/analysis/classify/owner_pin.rs
  • crates/ripr/src/analysis/classify/owner_pin/tests.rs
  • crates/ripr/src/analysis/classify/related_tests.rs
  • crates/ripr/src/analysis/classify/related_tests/equality_dispatch.rs
  • crates/ripr/src/analysis/facts/index.rs
  • crates/ripr/src/analysis/syntax/mod.rs
  • crates/ripr/src/analysis/syntax/name_scope.rs
  • crates/ripr/src/analysis/syntax/source_snapshot.rs

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 9a164b3e-aa31-47d5-8384-f0589656d1f7
Commits

Reviewing files that changed from the base of the PR and between 237fa0a and b3979dd.

Files selected for processing: 11
  • .ripr/traceability.toml
  • changelog.d/8004-source-snapshot-shared-lexical-facts.md
  • crates/ripr/src/analysis/classify/call_identity.rs
  • crates/ripr/src/analysis/classify/owner_pin.rs
  • crates/ripr/src/analysis/classify/owner_pin/tests.rs
  • crates/ripr/src/analysis/classify/related_tests.rs
  • crates/ripr/src/analysis/classify/related_tests/equality_dispatch.rs
  • crates/ripr/src/analysis/facts/index.rs
  • crates/ripr/src/analysis/syntax/mod.rs
  • crates/ripr/src/analysis/syntax/name_scope.rs
  • crates/ripr/src/analysis/syntax/source_snapshot.rs

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Summary by CodeRabbit

  • Performance

    • Syntax and scope information is reused for unchanged source, reducing repeated analysis.
  • Bug Fixes

    • Same-line declarations with identical names are no longer incorrectly treated as the first matching declaration.
    • Ambiguous or unparsed declarations remain unknown rather than being assigned a potentially incorrect scope.
    • Function type parameters are now recognized when determining names in function bodies.
  • Documentation

    • Updated release notes to describe source-snapshot reuse and ambiguity handling.

Walkthrough

The change adds run-local source snapshots that cache syntax and lexical facts. Owner-pin and call-identity checks use these snapshots and shared scope data. Ambiguous or unavailable declarations return unknown results, and tests cover cache behavior and query identity.

Changes

Source Syntax and Owner Pinning

Layer / File(s) Summary
Source snapshot and scope queries
crates/ripr/src/analysis/syntax/*, crates/ripr/src/analysis/facts/index.rs
RustIndex stores source-syntax memos. Snapshots cache parsed syntax and lexical query results. Name-scope lookup includes function type parameters and rejects ambiguous same-line matches.
Owner-pin snapshot and shadow checks
crates/ripr/src/analysis/classify/owner_pin.rs, crates/ripr/src/analysis/classify/owner_pin/tests.rs
Owner-pin queries use indexed snapshots and shared file-scope tables. Type and trait shadow checks memoize answers and use owner identity in their queries. Tests cover cache reuse, source changes, and ambiguous declarations.
Call identity and shadow-check callers
crates/ripr/src/analysis/classify/call_identity.rs, crates/ripr/src/analysis/classify/related_tests.rs, crates/ripr/src/analysis/classify/related_tests/equality_dispatch.rs, .ripr/traceability.toml, changelog.d/8004-source-snapshot-shared-lexical-facts.md
Call-identity keys include test names, and test scopes use the index’s source-syntax cache. Related-test callers pass owner scopes and the index to shadow checks. The traceability entry and changelog describe the changes.

Priority: Low

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Refactor

Merge Risk: Minimal · up to b3979

No actionable regression was established for this change. It is ready for normal validation before merging.

Pre-merge checks: Passed 3 · Failed 1 · Inconclusive 1

Failed Failed checks: 1 warning · 1 inconclusive

Check name Status Explanation Resolution
Description check Warning The description gives detailed scope, candidate relationships, proof results, and rollback details, but it omits or leaves incomplete many required template sections, including Swarm / Source Boundary… Complete the missing template sections. State the swarm boundary, production and evidence deltas, acceptance criterion, non-goals, support and policy impact, claim boundary, traceability entries, static-language status, CI Economics as n/a …
Docstring Coverage Inconclusive Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 6 files. (5 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: sharing per-file source snapshot facts across owner-pin queries.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description gives detailed scope, candidate relationships, proof results, and rollback details, but it omits or leaves incomplete many required template sections, including Swarm / Source Boundary, Scope, Support-tier Impact, Policy Impact, Claim Boundary, Spec-Test-Code Traceability, Static Language Check, CI Economics, Engineering Check, and Gates.

Resolution

Complete the missing template sections. State the swarm boundary, production and evidence deltas, acceptance criterion, non-goals, support and policy impact, claim boundary, traceability entries, static-language status, CI Economics as n/a if applicable, engineering checks, and each applicable gate result. Add the required source-of-truth links or explicitly mark them as unavailable.

Full details: Docstring Coverage

Explanation

Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 6 files. (5 skipped: 2 unsupported, 3 too large.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

I’m a rabbit with a syntax tree to roam
I cache each snapshot close to home
When names collide, I won’t choose one
I share scope facts, then hop along
Fresh source gets a fresh burrow
And tests keep watch as I go furrow

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

Copy link
Copy Markdown
Member Author

Review of record, head 4c7bd5fce0fb952d4e5a3a73dd8248e6971e55dc (tree 27b4af72d96230e9a720bcec42ab4e2176cde738), read-only reviewer from this session, not a human GitHub approval. Verdict: clear for the source change, with two proof gaps stated below.

Angles: the three declared tightenings, memo/cache soundness, dead code and attributes, leakage from the identity gate, and existing consumers.

Findings: no blocker or major.

  • Tightenings. Same-named fns on one line now return no scope. That only changes same-line duplicates, which main resolved to the first declaration; the code now treats that as unsettled and fails closed. Fn type params in defines are unreachable on valid test code, since #[test] fns can't be generic. TestKey including the test name fixes a latent aliasing of same-line same-named tests and is strictly finer.
  • Counterexample attempt. The reviewer ran ripr check --mode deep --format json on two hand-built crates (same-line mod a/mod b with same-named tests; generic owner, shadowing nested fn, shadowing closure). Output was byte-identical between a merge-base binary and this head. The baseline was the merge-base 1c64d8f9b, not the then-current main.
  • Memo soundness. Memos are per index, and a clone is empty. Stale source is guarded by Arc::ptr_eq against the live source, with a replacement/removal test. Keys cover every input the computations read. Poisoned locks fall back to recompute. A multi-thread test exists.
  • Dead code / attributes. None found, and no new allow or expect.
  • Leaks / consumers. Only the 11 listed files changed, with no identity-gate content. framework_oracle.rs declares_async is unchanged in behaviour.
  • Minors. function_type_param_names can be private. Locks are held while computing, so a cold miss can serialise workers (performance only). operand_pin.rs still calls name_scopes_for_fn unsnapshotted and now gets the same-line refusal, which is fail-closed. Memory is bounded by index lifetime.

Proof (reviewer-run, exit 0): cargo build, full cargo test -p ripr --lib (14520 passed), goldens check, verdict-corpus check --language rust (662 cases, false verdicts 3/662, contradictions 0/840).

Gaps: the perl, python and typescript corpora and precommit were not run by the reviewer (disk filled mid-run, an infrastructure failure). The writer ran check-all and precommit with exit 0, with output identical to main, but the reviewer did not independently reproduce those.

Currentness: main has moved since and a test merge conflicts in classify/related_tests.rs. The merge is being resolved and re-proven now. The conflict dimension is a new head, so the merged head gets its own focused check before merge-ready.


Generated by Claude Code

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Z4QZYyfpcDLn8oANQJT1z
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 25, 2026 18:55
@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!

@devin-ai-integration devin-ai-integration 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

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

Decision

  • Needs one verification check before upstream.

Verification questions

  • Confirm the owner-shadow tests strongly exercise the new cache contract, but do not independently demonstrate that the old implementation produced the opposite shadow verdict.

Refuted

  • The diff introduces an ArrayBuffer/TypedArray resize, detach, transfer, or stale-length vulnerability.; refuted because: No such APIs or analogous mutable backing-store length operations occur in the changed Rust source; this is a source-analysis cache refactor instead.
  • The TestKey change can alias distinct callers sharing a file and start line.; refuted because: The key now includes the test name as well as file and start line, and the snapshot scope key additionally includes end line; tests exercise distinct same-line names through shadow-query identity.
  • The changed owner-pin consumers introduce an unscanned sibling route that still bypasses the shared snapshot.; refuted because: The reviewed changed call sites route file scopes, nesting, async declarations, name scopes, and shadow checks through SourceSnapshot; the related_tests callers were updated to provide the required index and owner identity. This is bounded to the changed helper group, not proof that unrelated future call sites cannot exist.

Parked follow-ups

  • The shared snapshot has sibling consumers for complete-source facts, but owner-pin shadow checks still maintain a separate memo and therefore are not fully consolidated.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.
  • The full red/green verdict-neutrality claim remains dependent on the writer-run corpus receipts because this packet's ripr sensor failed and cargo-test is only scheduled.
  • The PR claims verdict neutrality and identical corpora, but the available review evidence does not independently verify the current head because ripr failed and heavy proof was skipped.
  • Executable confirmation remains dependent on the failed ripr run and the late cargo-test/corpus receipts.
  • Current-host regression evidence is incomplete in the supplied packet.

@github-actions

Copy link
Copy Markdown
Contributor

merge-ready is set, but this PR conflicts with main (head b3979ddb), so GitHub creates no test-merge ref and no qualification run can start. Merge main into the branch and resolve the conflicts, then remove and re-apply merge-ready.

Resolve equality_dispatch.rs against main's type_scope_is_clear extraction by
threading the snapshot index through the extracted helper.

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

Byte-identical to the fix of record in #10351; drops out when that lands.

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

Copy link
Copy Markdown
Member Author

Head moved to 91ea672. The previous required run (88354c2) failed only goldens check on python_caplog_renamed_fixture and python_caplog_builtin_beside_fixtures (formatting_only human.txt drift), the main break from #10444/#10426 crossing, not this PR's change. The fix of record is the re-bless in #10351; this head carries those four expected files byte-identical (fixtures/python_caplog_*/expected/{human.txt,CHANGELOG.md}) so qualification is not blocked on it. Locally on this head: cargo xtask goldens check exit 0, cargo test -p ripr --lib 14670 passed (before the golden port), merge-ready re-applied.

The main merge also resolved a real conflict: main extracted type_scope_is_clear in equality_dispatch.rs; the snapshot index argument is threaded through that helper's test_module_shadows_type call.


Generated by Claude Code

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

Decision

  • Needs reviewer attention before upstream: findings remain.

Confirmed findings

  • Owner-module exemption is now derived from the first matching owner function and its first module, unlike the removed byte-exact owner_enclosing_module logic.

Verification questions

  • Confirm the seeded review question asks whether owner-shadow tests prove the old implementation produced the opposite verdict; current tests prove cache behavior and ambiguity handling but do not directly assert that historical contrast.
  • Confirm the new shadow-answer key includes owner path/name/start-line, but not owner end-line or an unambiguous owner identity.

Refuted

  • The diff introduces an active-view resize, detach, transfer, or stale-length vulnerability.; refuted because: The changed code is Rust source-analysis caching over immutable strings and parsed syntax; it contains no ArrayBuffer/TypedArray APIs, mutable backing-store length operations, or detach/transfer semantics.
  • Sharing immutable source snapshots could alias mutable JS-backed memory across worker, async, GC, detach, or transfer boundaries.; refuted because: The sharing domain is only Rust source strings and immutable parser/lexical facts. No JS object, buffer, task, or ownership-transfer boundary is involved.
  • A missing cargo-test receipt prevents any oracle assessment.; refuted because: The seeded PR body reports exact-head cargo test, goldens, and verdict-corpus success, while the current packet explicitly schedules cargo-test late before the gate; this lane has no contradictory test evidence.
  • The new architecture creates an unbounded or insufficiently scoped shared cache.; refuted because: The snapshot is run/index-local, source identity is checked before reuse, and query memos are keyed by complete relevant identity; no public cross-run or cross-source cache boundary was found.
  • The refactor introduced an exploitable memory-safety or denial-of-service primitive through shared mutable state.; refuted because: The changed code uses immutable Arc-backed snapshots with synchronized memo tables, and no unsafe blocks or unbounded attacker-controlled allocation path was introduced; unsafe-review found no new gaps.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.
  • Broad caller coverage for the changed shared-snapshot routes is not independently demonstrated by the lane packet, despite updated call sites and focused unit tests.

Copy link
Copy Markdown
Member Author

Reply to the github-actions review on 91ea672 ("owner-module exemption is derived from the first matching owner function and its first module"). Checked against source; behavior matches the removed owner_enclosing_module/resolve_owner_fn:

  • Exactly-once is preserved: owner_pin.rs ~13022 takes found.next() and requires found.next().is_none(), the same two-step rule as resolve_owner_fn (owners.next() then owners.next().is_none()); an ambiguous owner resolves to no exempt module, fail-closed as before.
  • "First module" is the nearest enclosing one: FunctionScope.modules is built from f.syntax().ancestors().filter_map(ast::Module::cast) (source_snapshot.rs ~143), which is innermost-first, so .first() equals the old ancestors()...next(). The exemption is compared by byte TextRange, as before.
  • Match criteria are the old ones: de-raw'd name plus start_line <= owner.start_line <= end_line; line numbers come from the same snapshot line table as TestSummary.
  • Cache key: the shadow answer depends on the owner only through (file, name, start_line); end line does not enter owner resolution, so adding it would not change any answer.

The verdict-neutrality proof for this PR is the unchanged goldens, verdict-corpus check-all, and the existing owner-shadow unit rows in owner_pin/tests.rs; no expected output moved except the two python_caplog rows ported from #10351 for main's separate break. I did not add a historical-contrast test (the old implementation no longer exists to compare against); the discriminating rows are the same-line sibling module and nested same-name fn cases already in owner_pin/tests.rs. Not a blocker; no code change.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

Required run on 91ea672 failed one test: analysis::language::typescript::loop_count_guard::tests::binding_names_skip_defaults_and_keys (panic at loop_count_guard.rs:2281, the elapsed < 2s bound on a 20,000-deep nested reduction). This PR does not touch that file or TypeScript analysis, and the goldens gate that failed on the previous head now passes. Locally on this head the test passes in 0.84s and the full lib suite passed 14670/14670. It is a wall-clock assertion, so I read it as a loaded-runner timing miss, not a source failure. Re-running once by cycling merge-ready on the same head; a second failure will be treated as real and root-caused.


Generated by Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

merge-ready is set, but this PR conflicts with main (head 91ea6726), so GitHub creates no test-merge ref and no qualification run can start. Merge main into the branch and resolve the conflicts, then remove and re-apply merge-ready.

Main now carries its own python_caplog golden re-bless; take it over the port.

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

@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 shadow-answer caching appears keyed by all query-dependent inputs, but owner end-line and owner identity beyond name/start-line are not included.
  • Confirm the new owner-module derivation selects the first matching function’s first module rather than directly using byte-exact function ancestry.
  • Confirm the owner-shadow tests prove the new cache contract, but do not establish that the old implementation returned the opposite shadow verdict for the owner-module exemption.
  • Confirm owner-shadow tests establish current cache identity and ambiguity behavior, but do not directly assert that the removed historical owner-module logic produced the opposite verdict.
  • Confirm several snapshot tests are implementation-coupled rather than behavior-discriminating: they assert pointer identity and computation counts, which can pass even if the cached answer differs from the historical verdict.
  • Confirm async declaration answers are cached under (id,name,start,end), but computation resolves only by name and line, so distinct symbol ids at one name/line are not independently disambiguated.
  • Confirm the shared source snapshot is the intended sibling route for lexical facts, but the owner-pin file-scope cache still has a separate source-identity guard and can recompute rather than reuse the snapshot's lexical items.

Refuted

  • The shared snapshot boundary leaks analysis-specific owner semantics into a general syntax layer.; refuted because: The snapshot exposes complete-source lexical facts and typed query inputs while owner_pin retains the owner-specific exemption policy; related_tests now passes the owner explicitly instead of pre-resolving an owner module. This keeps the boundary narrower than the removed owner_enclosing_module implementation.
  • The shadow cache key can alias distinct callers or owners.; refuted because: The key includes caller name, start/end coordinates, declaration base, kind, and owner file/name/start; source replacement is guarded by source pointer identity.

Evidence gaps

  • The advertised architecture refactor lacks a successful current cargo-test receipt; ripr itself failed with exit code 2.
  • The lane cannot establish exhaustive sibling-path coverage or verdict neutrality because the ripr sensor failed and scheduled cargo-test evidence was not supplied.
  • Model proof intent was rejected by deterministic validation.

Keep both module declarations (source_snapshot, constant_return re-export).

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

Copy link
Copy Markdown
Contributor

merge-ready is set, but this PR conflicts with main (head c319187d), so GitHub creates no test-merge ref and no qualification run can start. Merge main into the branch and resolve the conflicts, then remove and re-apply merge-ready.

Drops the stale mocks argument #10488 removed from collect_tests_from_statements; byte-identical to the fix of record, drops out when #10510 lands.

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

@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

  • crates/ripr/src/analysis/classify/owner_pin.rs:13345 — Preserve the old byte-exact owner-module semantics in the shared snapshot path, or add focused parity tests comparing the new first-match/first-module derivation with the removed implementation for nested, same-line, and ambiguous owners. The current tests validate cache behavior and selected outcomes but not this boundary's historical equivalence.

Verification questions

  • Confirm the PR claims verdict neutrality, but no changed test compares the merge-base implementation with HEAD on discriminating inputs.
  • Confirm owner-module exemption is now derived from the first matching function's first module, replacing the removed byte-exact ancestry lookup; the new tests exercise ambiguity and cache keys but do not directly assert parity with the old implementation.
  • Confirm the owner-shadow tests do not independently demonstrate that the removed historical owner-module logic produced the opposite verdict.
  • Confirm owner shadow answers are cached by owner file/name/start-line but not owner end-line, while the prior owner-module resolution depended on the owner function's exact AST ancestry.
  • Confirm the new owner-module exemption depends on the first matching function and its first module range, but the historical implementation used the resolved owner function's nearest enclosing module directly.
  • Confirm the source-snapshot route covers the principal changed lexical consumers, but non-lexical sibling routes remain outside this focused scan.
  • Confirm the PR claims verdict neutrality, but its added tests primarily prove cache identity, ambiguity handling, and current outputs rather than a direct differential against the removed implementation.
  • Confirm the snapshot cache is shared through RustIndex.source_syntax, but owner_pin file scopes retain a separate per-index owner_file_scopes memo keyed by path plus source Arc identity; this duplicates lexical ownership and relies on two cache layers for consistency.
  • Confirm the changed related-test and equality-dispatch callers pass owner identity and index into shared shadow queries, but other sibling call sites are not independently enumerated in the diff packet.
  • Confirm owner-shadow tests assert current cache semantics and ambiguity handling but do not directly establish that the removed byte-exact owner-module logic returned the opposite verdict.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

…s that also pass pre-refactor

The rows (owner shares the type's module, owner in a sibling module, nested owner, ambiguous owner) give identical verdicts on main's byte-exact owner_enclosing_module and on the snapshot derivation.

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

Copy link
Copy Markdown
Member Author

Head 5d69310. Response to the github-actions finding at owner_pin.rs:13345 (owner-module parity with the removed owner_enclosing_module): added module_shadow_exempts_only_the_owners_nearest_module (owner_pin/tests.rs), four rows (owner shares the type's module → exempt; owner in a sibling module → shadow; nested owner → only the nearest module exempt; same-name owner in two modules → ambiguous, no exemption). As a differential, I ran the same four rows against origin/main's pre-refactor test_module_shadows_type (byte-exact ancestry, no index argument) in a detached worktree: they pass there and on this head with identical expected values. Also merged current main (clean).


Generated by Claude Code

@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 owner-module exemption is derived from the first unique matching function's first module rather than byte-exact owner ancestry.
  • Confirm the PR states verdict neutrality, but the new tests primarily prove cache identity, computation counts, and selected current outcomes rather than comparing merge-base and HEAD verdicts on discriminating inputs.
  • Confirm owner-module exemption now derives from the first uniquely matched function's nearest module, while shadow keys omit owner end-line and exact AST identity.
  • Confirm snapshot sharing is used by owner-pin, call-identity, related-test, and equality-dispatch routes, but the scoped review did not establish exhaustive coverage of all legacy parse-and-scope helpers elsewhere in the crate.
  • Confirm owner-module tests are outcome-only, not historical differential oracles.
  • Confirm shadow cache keys omit owner end-line even though owner function lookup uses both start and end coordinates; this can alias distinct owner functions with identical file/name/start-line but different spans.
  • Confirm the owner-module exemption test locks in intended outcomes but cannot itself demonstrate red/green behavior because those expectations are also valid on the old implementation.

Refuted

  • The new snapshot tests are only smoke or pointer-identity assertions and cannot detect stale answers.; refuted because: They change source, clone/remove entries, mutate query keys, count recomputations, and assert opposite outputs for replacement versus original, which is behavior-discriminating.
  • Shared source snapshots can cross JS-backed memory, worker, GC, detach, or transfer boundaries.; refuted because: The changed implementation is Rust-only: it stores immutable Arc source, parsed syntax, and memoized lexical facts in RustIndex. No JavaScript runtime, backing-store ownership, detach/transfer operation, or unsafe mutation is introduced.
  • Sharing an Arc-backed immutable snapshot could introduce lifetime or ownership unsoundness.; refuted because: The changed code shares Arc-owned immutable strings, parsed trees, and memo results; consumers clone Arcs and do not expose mutable interior state.

Evidence gaps

  • The seeded review already supplies differential evidence for the owner-module boundary, but the failed ripr sensor means no new successful ripr receipt independently corroborates the PR's verdict-neutrality claim.
  • Model proof intent was rejected by deterministic validation.

Copy link
Copy Markdown
Member Author

Review of record, head 5d693109983cddc24434dd092bfb161d1baa5f05

Required Ripr Rust Small Result is green on this head (run 40258756055); mergeability is clean; PR diff vs base is the same 11 files / +1006 −284 (the 12th, a one-line tests_extract.rs repair, dropped out when #10506 landed).

Angles and what they covered

  • Correctness and edge cases (independent exact-head review of 4c7bd5fce, earlier on this PR): no blocker or major. The owner-module exemption, TestKey including the test name, and same-line owner ambiguity were each exercised.
  • Tests and regressions: since that review I added module_shadow_exempts_only_the_owners_nearest_module (four rows) and ran those rows against origin/main's pre-refactor code in a detached worktree; identical verdicts, which is the differential the github-actions review asked for.
  • Spec and contract: verdict-neutral by construction and by measurement. On this head: cargo test -p ripr --lib 14748 passed / 1 pre-existing unrelated TS failure that passes on current main (see below), cargo xtask goldens check 0, cargo xtask verdict-corpus check-all 0 for all four corpora (Rust 686 cases 0 false, Python 327/0, TS 353/1, Perl 87/1, all at their blessed counts).

Changed since the reviewed head, and how each was checked

  • Merge resolutions (three main merges): equality_dispatch.rs conflicted with main's type_scope_is_clear extraction; resolved by threading index through that helper's test_module_shadows_type call. git diff origin/main -- related_tests.rs related_tests/equality_dispatch.rs is exactly the four call-site hunks. syntax/mod.rs conflict was two independent module lines (kept both). Python caplog goldens: took main's.
  • Findings from the github-actions reviews (advisory, not blocking): owner-module derivation preserved (found.next() then next().is_none() exactly-once; modules.first() is innermost-first from ancestors(); byte TextRange compare); cache key omits owner end-line because owner resolution depends only on name and start-line. Replied on the PR with source locations.
  • CodeRabbit: rate-limited on every head; treated as missing, not clean.

Failures along the way, not this PR: loop_count_guard::binding_names_skip_defaults_and_keys wall-clock bound (#10483, fixed on main by #10493); main's TS compile break (#10506); python_caplog goldens (main's crossing). None touched this PR's files.

Residuals: none open for this PR. Next in the series is PR2 (identity gate plus the receiver-unestablished withhold), rebased on this squash.


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