Skip to content

test(owner-pin): a shared OwnerPinSyntax names each test's own covering macro site (#6967) - #6969

Merged
EffortlessSteven merged 3 commits into
mainfrom
claude/fix-6967-macro-site-memo
Oct 7, 2026
Merged

EffortlessSteven merged 3 commits into
mainfrom
claude/fix-6967-macro-site-memo

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Summary

Before: #6658 landed the test-file macro-site memo for #6967 on main (2045792). No test checked that one shared OwnerPinSyntax still gives each test its own covering assert_eq! rebinding site once the per-file sites are memoized.

After: a_shared_owner_pin_syntax_names_each_tests_own_covering_site builds one test file with two inline modules, each rebinding assert_eq! (lines 3 and 9). It checks that a shared OwnerPinSyntax returns the same refusals as a fresh one per test, and that the sites are lines 3 and 9. A memo that cached the selected site per (name, file) instead of the whole site list would fail it.

This PR first carried the memo itself so main would be fixed even if #6658 slipped. #6658 merged first with the identical change, so the merge of main leaves only the test.

Swarm / Source Boundary

  • ordinary feature, analyzer, editor, docs, spec, fixture, badge, dependency, or repo-ops development for ripr-swarm

Source-of-truth Links

Governing issue: #6967
Acceptance delta (one sentence): the memo's per-test site selection has a regression test.

Scope Classification

  • Test only

Non-goals: no production change.

Support-tier Impact

  • none

Proof

  • cargo test -p ripr --lib owner_pin: 70 passed (69 plus the new test).
  • cargo xtask precommit passes.
  • Main at 2045792: cargo xtask verdict-corpus check-all reports no drift (204 cases).

Closes #6967.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q9Bgpf8hhaUiZESbgRnEvG

…6967)

#5416 names the macro binding behind a refused assertion for every
(probe, related test, assertion), and the local-site lookup re-parsed the
test's file on each call. A diff touching xtask's command catalog took
`ripr check` from 52 s to over 15 minutes and timed out #6658's PR-evidence
gate. The sites now come from a (name, test file) memo on OwnerPinSyntax,
beside the existing workspace-site memo; they depend only on the name and
the immutable index. The same input runs in 94 s.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9Bgpf8hhaUiZESbgRnEvG
@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

Review of record: head fb1c68a

The production diff is byte-identical to the owner_pin.rs change in #6658's bd3e211. An independent reviewer agent checked that code at bd3e211 from three angles. No blockers were found.

  • Behavior preservation: macro_binding_sites reads only the name, the path, the file's indexed source, macro_scope_crates(), drop_in_manifests and module_resolved. module_resolved comes from a OnceCell on the same OwnerPinSyntax. site_covers(site, test) runs after the memo lookup. An OwnerPinSyntax is built once per index, by RelatedTestCandidateIndex::new or a per-call Default, and with_withheld runs before any query. The memos already in place (by_file, workspace_macro_sites, resolved_modules) rely on the same one-index assumption.
  • RefCell safety: the or_insert_with closure reaches only resolved_module_declarations and pure syntax functions, and never touches test_file_macro_sites. The workspace_macro_sites borrow is released before the local lookup runs.
  • Remaining cost: no other re-parse on this path. Each assertion now costs map lookups plus one site.clone().

Proof:

  • bisect plus gdb samples point at 77e733d;
  • the bisect input runs in 94 s, down from over 900 s;
  • the verdict corpus's 204 rows are unchanged against main;
  • owner_pin lib tests pass (69), and so do the owner_pin_execution runtime controls (18);
  • cargo xtask precommit passes.

Disposition: ready. This merges once the required check is green on this head.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 7, 2026 05:36
@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 7, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: e2501dbe-9f8c-4b4f-9f07-2a694c5899d0
📥 Commits

Reviewing files that changed from the base of the PR and between fb1c68a and ff91b20.

📒 Files selected for processing (1)
  • crates/ripr/src/analysis/classify/owner_pin/tests.rs
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Limit details: You’ve used all 10 included reviews currently available.


Summary by CodeRabbit

  • Performance
    • ripr check completes large-catalog diff checks substantially faster, reducing a reported run from over 15 minutes to 94 seconds.
    • Related test files are no longer repeatedly scanned when reporting a refused macro binding.
  • Bug Fixes
    • Refused macro bindings are associated with the relevant test’s own assertion.
    • The PR-evidence gate no longer times out during this check.

Walkthrough

OwnerPinSyntax caches test-file macro-binding scans by macro name and file. The lookup reuses cached sites and selects one that covers the test. A regression test checks that shared and fresh instances report the same refusal and the correct site. The changelog reports timing and PR-evidence gate outcomes.

Changes

Test-file macro scan cache

Layer / File(s) Summary
Cache and reuse macro-binding sites
crates/ripr/src/analysis/classify/owner_pin.rs, crates/ripr/src/analysis/classify/owner_pin/tests.rs, changelog.d/owner-pin-test-file-macro-memo.md
OwnerPinSyntax stores macro-binding sites by macro name and test file. test_macro_binding_site reuses the cached scan and selects a site covering the test. The test compares shared and fresh instances and checks the reported sites. The changelog reports timing and PR-evidence gate outcomes.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to ff91b

No issue requiring a change before merge was identified. Merge after the normal checks pass.

Architecture Summary

Architecture risk: 🔵 Low · up to ff91b

The change affects 2 systems.

Changed systems: crates, changelog.d

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — crates (service) was modified; 2 changed files map to changed impact.
  • observed — changelog.d (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in changelog.d/owner-pin-test-file-macro-memo.md: Added a fixed changelog entry describing the ripr check parsing change and reported timing and PR-evidence gate outcomes.
  • observed — Modified behavior in crates/ripr/src/analysis/classify/owner_pin.rs: Added a test_file_macro_sites cache to OwnerPinSyntax, keyed by macro name and test file, to retain per-file macro-binding scans.
  • observed — Modified behavior in crates/ripr/src/analysis/classify/owner_pin.rs: equality_assertion_refusal now passes the shared test-file cache to test_macro_binding_site; the previous call scanned the test file without caching.
  • observed — Modified behavior in crates/ripr/src/analysis/classify/owner_pin.rs: Added the TestFileMacroSites alias for cached macro-binding sites keyed by (String, PathBuf).
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the test and reports proof, but it says the PR contains only a test and no production change. The file summary includes a production memo change, and the objectives describe t… Align the description with the actual changes: clarify whether the production memo is included or already landed, and update the scope and acceptance delta accordingly. Complete the relevant template sections, especially Candidate Relations…
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files.
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.
Title check ✅ Passed The title clearly describes the regression test for shared OwnerPinSyntax selecting each test’s own covering macro site.
Full details: Description check

Explanation

The description explains the test and reports proof, but it says the PR contains only a test and no production change. The file summary includes a production memo change, and the objectives describe that memo as part of the PR. The description also omits several template sections, including candidate relationships, rollback, claim boundary, traceability, and engineering checks.

Resolution

Align the description with the actual changes: clarify whether the production memo is included or already landed, and update the scope and acceptance delta accordingly. Complete the relevant template sections, especially Candidate Relationships, Scope, Claim Boundary, Rollback, Spec-Test-Code Traceability, Engineering Check, and Gates. Mark CI Economics as n/a if the PR does not affect CI.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks each macro trail,
Then saves the scan in cache’s vale.
Two tests each find their proper line,
While timings fall and gates run fine.
The rabbit hops through files with glee.

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

@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 found 1 potential issue.

Devin Review

…ring site

Two inline modules rebind assert_eq! at different lines; the memoized
lookup must pick the site covering each test, matching a fresh
OwnerPinSyntax (Devin review on #6969).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9Bgpf8hhaUiZESbgRnEvG
@EffortlessSteven
EffortlessSteven marked this pull request as draft October 7, 2026 07:11
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 7, 2026 07:11
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-07T08:00:47.342364Z 35714ff Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

…regression test

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9Bgpf8hhaUiZESbgRnEvG

@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

  • Return-path now clones the site tuple (site.clone()) because the memo stores Vec values; this is a small extra allocation per refusal but is bounded by memo cardinality.

Refuted

  • Memo caches the selected site per (name, file), causing both tests to see the same line.; refuted because: Memo value is Vec<(String, MacroBindingSite)>; the per-test site_covers filter runs after the lookup, so each test gets its own covering site. The new test would fail if this were true.
  • Memo is keyed by (name, file) so per-test site_covers filter still runs per call - test should be red on old code and green on new; refuted because: Existing 69 owner_pin tests + new shared-syntax test still pass; old behavior would re-parse but produce same site, so the test alone cannot distinguish old vs new by outcome - the distinction is performance, asserted by bisect/timing in PR body, not by the unit test.
  • RefCell re-entrancy or borrow panic because the memo closure touches self/OwnerPinSyntax; refuted because: closure captures only index-derived data; module_resolved reads OnceCell resolved_modules, not the new RefCell; or_insert_with is a one-shot miss path.
  • The memo closure could borrow the memo recursively and panic via RefCell.; refuted because: Closure only calls macro_binding_sites with name, file, facts.source, index, module_resolved; memo is not captured. The existing workspace_macro_sites memo on the same struct uses the same pattern without issue.
  • Closure inside or_insert_with only reads test.file.source via index.files(), plus pure macro_binding_sites args (name, file, source, index, module_resolved) — it never re-enters self or memo, so no RefCell aliasing and no cross-test contamination possible. Memo is keyed on (name, file) so different test files never share entries.

Evidence gaps

  • PR-body timing claim (94 s vs >15 min) and unchanged-verdict claim (#6658 corpus 204 rows) are not reproducible in this lane; cargo-test receipt is scheduled-late.
  • Model proof intent was rejected by deterministic validation.

@EffortlessSteven EffortlessSteven changed the title perf(owner-pin): parse each test file's macro sites once per index (#6967) test(owner-pin): a shared OwnerPinSyntax names each test's own covering macro site (#6967) Oct 7, 2026
@EffortlessSteven
EffortlessSteven marked this pull request as draft October 7, 2026 07:58
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 7, 2026 07:58

@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

  • PR is test-only and reviews rely on seeded thread's byte-identical claim about the production change in #6658. Without cargo-test receipt yet (scheduled-late), green-on-PR cannot be independently verified.

Verification questions

  • Confirm test source string has assert_eq! rebinds at lines 3 and 9 when interpreted as a full Rust file; need to confirm site line semantics match the indexed-file view used by macro_binding_sites.

Refuted

  • Test distinguishes old vs new: shared OwnerPinSyntax across two inline modules must return distinct sites (3 and 9); a file-only or single-site cache would collapse to one line and fail.
  • Test cannot distinguish old from new because old behavior would also produce the same sites; refuted because: The memo value is Vec<(String, MacroBindingSite)> per (name, file); site_covers filters after lookup, so each test gets its own covering site. Old code without memo would still resolve the same sites per test - so the test by outcome alone does not separate old vs new. However, the PR body explicitly states the distinction is performance (bisect/timing), not unit-test outcome; the unit test is a regression guard against a wrong memo key, which is exactly what it asserts.
  • Shared OwnerPinSyntax memo caches the selected site per (name,file), so both tests get the same line; refuted because: macro_binding_sites returns the full Vec per (name,path) lookup; equality_assertion_refusal filters via site_covers per call after the memo. The new test asserts lines == [3,9], which a per-file cache would fail.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

Copy link
Copy Markdown
Member Author

Review of record (update): head 35714ff

#6658 landed the memo on main (2045792) with byte-identical production code. Merging main into this PR leaves one change: the regression test a_shared_owner_pin_syntax_names_each_tests_own_covering_site (ff91b20), plus main's copy of the changelog fragment.

  • Angles: the memo review recorded above for fb1c68a. The test change was checked by:

    • CodeRabbit on ff91b20 (no actionable comments);
    • Codex on 35714ff (no findings);
    • ub-review on this head.

    ub-review refuted its own candidate concerns: a memo keyed per (name, file) that cached the selected site would collapse to one line, and the test fails on that because it asserts [3, 9]. Its "no cargo-test receipt" note is covered by the required gate below.

  • Local: cargo test -p ripr --lib owner_pin passes (70) and cargo xtask precommit passes. On main 2045792, verdict-corpus check-all shows no drift.

  • CI: Ripr Rust Small Result is green on 35714ff.

Disposition: ready. Merging. This closes #6967.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven merged commit 58caf7a into main Oct 7, 2026
33 of 34 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/fix-6967-macro-site-memo branch October 7, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf(check): #5416 re-parses a test file per probe × test × assertion; PR-evidence gate times out

2 participants