Repository navigation
perf(review): decide second-stage pool relations without resolving every test (#12940) - #16096
Conversation
…ery test (#12940) review-comments on a 53-file ripr-swarm diff that edited 22 tests timed out at the 600 s default inside the second-stage narrowing. For each of 45,207 caller-file seams the narrowing computed the complete relation against every candidate test and only then filtered to the 22 edited tests. - Resolve owner calls for pool tests only. Every other reason admits a test on that test's own facts, except the crowded assertion-token ranking, which gives no slot to a test an owner-call reason admitted. The pool pass is therefore exact unless that ranking truncates, and a truncating pass is answered by the complete relation. - Answer a pool with no test in the owner's package without matching. - Keep each owner's pool direct-call answer across its seams. - Memoize the imported enum-variant receiver lookup per index. It reparsed and walked the declaring file on every call and was about two thirds of the samples under the pool check. The narrowing now finishes in 347 s on that diff (pool 22, rest 45,207, kept 4,803). The run still ends in limited_timeout, because evaluating the kept seams does not fit the remaining budget. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmmv8ne82Ko6vufDhTN
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 4 minutes. View limit details
|
There was a problem hiding this comment.
Code Review
This pull request optimizes the performance of the test relation check in ripr by introducing a 'pool-first' evaluation strategy. It caches enum variant lookups via CallIdentityMemos and caches per-owner direct-call answers using a new PoolDirectCalls struct. By resolving owner calls only for tests within the target pool first, it avoids redundant parsing and analysis of unrelated tests. Unit tests have been added to verify the correctness of this optimized pool relation logic. No review comments were provided, so I have no additional feedback.
#12940) The first run of these tests (reduced feature set, 15 GB container) showed the fixture produced no helper_owner_call relation: a helper in a test file is not credited. Use the in-file helper shape the existing helper tests use, and check the direct and helper scoped walks separately. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmmv8ne82Ko6vufDhTN
|
Proof update on head
CodeRabbit was rate-limited and Gemini posted a summary with no findings; neither is a review of this diff. Generated by Claude Code |
…anking truncates (#12940) The pool-relation fixture indexed 7 tests, below the crowded limit's floor of 64, so the ranking never truncated and a pool-first pass that always claimed exactness passed every committed test. The new fixture indexes 81 tests: the complete relation admits the pool test by assertion affinity (forty owner callers take no ranking slot), the pool-first pass ranks all 81 and cuts it, and only the fallback gives the complete answer. related_tests_in becomes pub(super) so the test can read the pool-first pass's own exactness flag. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmmv8ne82Ko6vufDhTN
EffortlessSteven
left a comment
There was a problem hiding this comment.
SOURCE_REVIEW_READY
Independent source and oracle review of head 71eb688, by a session that did not write this change.
Inspected: the complete diff against base e7eff2a (8 files), and the delta 2eb3025..71eb688.
Exactness of the pool-first check, read in related_tests_in:
- Every admission goes through
insert_related_candidate: the first reason wins and the package-prefix predicate is the one the new early return uses, so a pool with no test in the owner's package cannot relate. - Owner-call stages (direct, helper, target-affinity) decide each test on that test's own facts, so resolving them for pool tests only leaves every pool test's candidacy and reason unchanged.
match_assertion_target_affinityis the one cross-test step. It skips existing candidates before counting, so the pool-first ranked set is a superset of the complete one; a pass that does not truncate admits the same pool tests, and a pass that truncates is answered byRelationScope::Pool.- The later proximity stages, the three retains and the dedupe are per-test.
OwnerContextderives only from the owner function, so keyingPoolDirectCallsby that function's address is sound within one pass; the cache holds the pre-retain direct answer and does not store a cancelled walk.- The
enum_variant_valuememo reads only index sources and releases its lock before computing.
Stimulus and oracle grip: the 7-test fixture realizes six relation reasons and compares the pool check with the complete relation for every seam, 9 pools and both reason filters, requiring both answers to occur. The earlier head never reached the truncation fallback (the crowded limit has a floor of 64). pool_check_falls_back_to_the_complete_relation_when_the_ranking_truncates now does: 81 tests under a limit of 64, where the complete relation admits the pool test by assertion affinity, the pool-first pass alone reports inexact with no related test, and relates_to_pool_test returns true. A pass that always reported exact fails its second and third assertions.
Not run by this reviewer: any test or build on this head. The author reports the pool_relation filter 4 of 4 and all-targets Clippy exit 0 locally.
Missing evidence: hosted qualification has not run on this head, and the four owner_pin json_construction tests that failed in the author's reduced-feature run are unsettled until it does. The 5,000-seam comparison used temporary code that is not in the PR. Observation, unchanged by this PR: the seams_kept_by_scope doc says a cancelled lookup keeps its seam, while a cancel inside the lookup returns false.
Generated by Claude Code
|
Exact restack preflight: On the owner’s refreshed head, run all-targets/all-features Clippy and the focused Current-base preflight ( Refreshed after #16155 ( |
EffortlessSteven
left a comment
There was a problem hiding this comment.
REVIEW_READY for head 71eb688
Independent native-Windows review of perf(review): decide second-stage pool relations without resolving every test (#12940) at 71eb688.
Source review (verified against source)
-
The problem is measured, not speculative:
ripr review-commentson a 53-file, 22-edited-test diff timed out at 600 s in the second-stage narrowing, computing the complete relation for each of 45,207 caller-file seams against every candidate test before filtering to the 22 edited tests. -
The exactness argument is the load-bearing part and it holds: every relation reason admits a test on that test's own facts, except the crowded assertion-token ranking, which gives no slot to a test an owner-call reason already admitted. The pool pass therefore resolves owner calls for pool tests only; a non-truncated pass is exact (unresolved other tests can only lengthen the ranking), and a truncated pass falls back to the complete relation — the same answer as before, at the old cost, never a different answer.
-
The memoization is honestly bounded:
PoolDirectCallskeys per-owner answers by the owner's index address for one narrowing pass only, with the doc comment stating the lifetime constraint explicitly; a pool with no test in the owner's package is answered without matching since every admission already applies the package prefix. -
The framing is the product-contract kind: this PR makes the narrowing finish, does not claim the diff completes (4,803 seams remain and the run still ends
limited_timeout), and the 0.11 release notes now state that bound — exit 2, no guidance written,ripr checkthe supported route. -
imported_enum_variant_valuememoized in the per-index call-identity memos addresses the measured hotspot (about two thirds of stack samples under the pool check). -
Native proof (native Windows, worktree wt-16096 at head 71eb688):
cargo test -p ripr --lib pool_relation(exit 0) - including the exactness pinspool_check_matches_the_complete_relation_for_every_seam_and_pooland the owner-call scope testsdirect_owner_call_scope_resolves_only_pool_tests/helper_owner_call_scope_resolves_only_pool_tests;cargo test -p ripr --lib related_tests(exit 0) - the existing relation suites stay green;cargo xtask goldens checkdrifts only on the known pre-existing native-Windows fixturepython_parent_collected_test_shadow(merge-base control reproduces it; #16425);cargo xtask check-evidence-promotion-honesty(exit 0);cargo xtask check-traceability(exit 0).
Residuals
The residual 4,803-seam evaluation on diffs that edit tests related to thousands of seams remains a documented bounded limitation, disclosed in the release notes rather than silently slow.
…tcut (#12940) main now credits a direct call from a test in another package when it settles on a unique free owner (#15278). The pool shortcut that answered 'unrelated' when no pool test sat in the owner's package would have dropped that test, so it now applies only to owners that cannot be credited that way. OwnerContext::cross_package_direct_owner is the one condition both the direct-call walk and the shortcut read. pool_check_preserves_cross_package_direct_call_identity builds a two-package workspace through the production index and requires the pool check to equal the complete relation for the outside-package caller, a call spelled through another crate, and a test with no call. Conflict: tests.rs module list (kept both declarations). The release note now says the timeout names the ripr check command, which #16106 landed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmmv8ne82Ko6vufDhTN
… check (#12940) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmmv8ne82Ko6vufDhTN
|
Restack onto current main, head What changed since
Proof on this head (15 GB container)
Not established
Reporting limit. 347 s and 370 s are the narrowing step only. The whole command still reaches the 600 s default and writes no review guidance. The remaining cost is tracked in #16521 (ranking memos) and #16523 (owners named Generated by Claude Code |
EffortlessSteven
left a comment
There was a problem hiding this comment.
SOURCE_REVIEW_READY
Independent source review of exact head 2a7d40f against base dd8cc26 (8 files, +719/-35). I am not the author of this PR. This covers source and oracle by reading; I did not build or run this head, and hosted qualification has not run on it.
Read in full: the production diff in related_tests.rs, test_grip_evidence.rs, call_identity.rs, owner_pin.rs; related_tests_in and OwnerContext::resolve at the head; match_direct_owner_call; insert_related_candidate; imported_enum_variant_value_uncached; the call site seams_kept_by_scope; tests/pool_relation.rs; the changelog and release-note lines.
Claims checked
- Pool-first equals the complete relation unless the crowded ranking truncates. Holds by construction. With owner calls resolved for pool tests only, every pool test enters each matcher with the same facts as in the complete walk, because each owner-call matcher, the visibility record and both later
retainpasses read one test at a time. The only cross-test step ismatch_assertion_target_affinity. Tests whose owner calls were skipped are absent fromcandidates, so they can only add entries to the ranking; tests the complete walk drops again (inaccessible, renamed-import, local-binding) are in the ranking on both routes. So the pool-first ranking is a superset of the complete one, a pass that did not truncate implies the complete one did not, and a truncated pass is answered byRelationScope::Pool. The crowded fixture exercises exactly that fallback. - The package shortcut is sound. Every candidate insert in the file goes through
insert_related_candidate, which refuses a test outside the prefix. The single place the guard is lifted is the cross-package branch ofmatch_direct_owner_call, and it readsowner.cross_package_direct_owner(), the same method the shortcut tests. A pool with no test under the prefix therefore cannot relate unless that method isSome. PoolDirectCallsmay key on the owner function. EveryOwnerContextfield is derived from the owner function and the context, never from the seam, andmatch_direct_owner_calltakes no seam. One instance serves one pool, one overlay and one pass (seams_kept_by_scopecreates it locally). An owner with no function is not kept. A walk cut short by cancellation is not kept, since the checkpoint is read after the walk.- The enum-variant memo is a pure function of its key. The uncached body reads only the three names and indexed sources, and the memo lives beside
sole_type_declarerwith the same lifetime and the same clear path.
Oracle grip. pool_check_preserves_cross_package_direct_call_identity asserts the fixture first (owner package wscore/, pool test outside it, complete relation equal to exactly one DirectOwnerCall), then anchors the expected answer to that unscoped relation, so an unconditional shortcut fails it even though the reference helper shares the shortcut.
Non-blocking suggestion. complete_answer uses RelationScope::Pool, which now carries the package shortcut too. In the every-seam-and-pool test the reference and the subject therefore share that rule. Deriving the reference from RelationScope::All filtered to the pool and the counted reasons would keep the shortcut out of its own oracle. The cross-package test already has the independent anchor, so this does not hold the head.
Missing evidence, recorded as missing: hosted qualification on this head; cargo xtask precommit, cargo clippy -p xtask and verdict-corpus check-all (the author reports them not run); CodeRabbit is neutral, which is absent review, not a clean one. No mutation run of the new test.
Public claim. The changelog and release-note lines state the narrowing time and that the run still ends in the typed timeout receipt; that matches the author's replay and does not claim completion.
Generated by Claude Code
|
Reading correction for the replay numbers on this PR (no source change, head still
What this PR establishes is unchanged: narrowing now finishes (347 s and 370 s) and keeps the same 4,803 seams, and the run still ends Generated by Claude Code |
EffortlessSteven
left a comment
There was a problem hiding this comment.
REVIEW_READY
Final published-head pass on exact head 2a7d40f, by a session that did not author this PR. The source and oracle review is 6100379631 on the same head; the head has not moved, so that inspection stands and this pass covers what it recorded as missing.
Hosted evidence read on this head
- Rust gates: success. Its log shows
verdict-corpus: 4 corpora checked, which covers the corpus check the author could not run locally. - Rust tests shard 1 of 2: 17,169 run, 17,169 passed. Shard 2 of 2: 17,218 run, 17,218 passed. Shards verify: success. All five
pool_relationtests appear as PASS across the two shards, includingpool_check_preserves_cross_package_direct_call_identityand the truncation fallback test, so the new oracle ran in the hosted suite. - Ripr Rust Small Result, vscode surface, candidate admission: success.
- Skipped by routing, not run: the docs gate, the self-hosted Small variants and the vscode e2e job.
Review state
- Unresolved review threads: 0 (read through the review-threads endpoint).
- CodeRabbit is neutral because of its rate limit. That is absent review from that provider, not a clean one.
- Conversation since the source review: the author's reading correction for the cumulative
evaluated_Ncounter (comment 7247243187). No source change. - Mergeable against base dd8cc26, state clean.
Public claim. The changelog states the narrowing time from two replays and that the diff still ends in the typed timeout receipt. The "did not finish before" side was measured on an earlier main and not re-measured on current main; the author records that limit on the PR. The claim does not say the command completes.
Carried forward, not holding this head: the reference helper in pool_relation.rs shares the package shortcut with its subject in one test; the author has taken that into #16523. No mutation run of the new test was made; its failure under the old shortcut follows from the independent anchor in the test.
Generated by Claude Code
Requested by Steven · project thread
Summary
ripr review-commentson ripr-swarm main7cf9cd6d, diff52844de5..7cf9cd6d(the last 4 commits, 53 files, 22 edited tests), default settings, timed out at 600 s with alimited_timeoutreceipt. The run stalled in the second-stage narrowing that fix(review): stop review-comments running out of memory on large workspaces (#12940) #13919 added: for each of 45,207 caller-file seams it computed the complete relation against every candidate test and only then filtered to the 22 edited tests.limited_timeout.imported_enum_variant_valueis memoized in the per-index call-identity memos. It reparsed and walked the declaring file on every call and was about two thirds of the stack samples under the pool check.2withlimited_timeout, writes no guidance, andripr checkis the supported route for it.Swarm / Source Boundary
ripr-swarmSource-of-truth Links
Proposal: #12940 profile comment (item 3, relation cost)
Spec: n/a (no rule change; RIPR-SPEC-0010 selection is unchanged)
ADR: n/a
Plan item: n/a
Governing issue or accepted claim: #12940
Acceptance delta (one sentence): the second-stage narrowing on the 53-file self-host diff finishes in 347 s instead of not finishing inside the 600 s default, with the same kept set as the complete relation on a 5,000-seam sample.
Candidate Relationships
Candidate branch (GitHub PR head is authoritative after publication): claude/project-thread-xgnffs
Stack parent or prerequisite PR (if any): none. Merge waits on the coordinator's
analysis/**hold for import #16016.Proposed replacement of PR (if any; not yet accepted): none
Acceptance retained from a replaced candidate (if any): n/a
Accepted winner and losing candidate disposition (when decided): n/a
#13900 (trace counters, open, conflicting) is a different claim and is untouched.
Scope
analysis/test_grip_evidencepool relation check and its caller, one per-index memo inanalysis/classify, a changelog fragment, one release-notes sentence.Scope Classification
Production delta:
Evidence/support delta:
test_grip_evidence::tests::pool_relation), changelog fragment, release-notes bound.Single acceptance criterion:
Non-goals:
Support-tier Impact
Claim/proof notes:
Policy Impact
Proof
Host: 4-core, 15 GB Linux cloud container, release builds, default limits (5,000 files, 600 s),
RIPR_REPO_EXPOSURE_LATENCY_TRACE=1. Subject for every row: root at swarm7cf9cd6d,--base 52844de5 --head 7cf9cd6d.7cf9cd6dlimited_timeout, 178 seams evaluatedc055046c)pool_22_rest_45207_kept_4803, 347 slimited_timeout, 352+ seams evaluatedripr check --mode draft --format json --committedon the same diff: exit 0, 121 s, 1.63 GB, 46 findings.3d3f19d7..a9bf95a6) on main7cf9cd6d: exit 0, 57 s, 0.97 GB,second_stage_narrowed_pool_1_rest_2932_kept_41, receiptcomplete. Not re-run on this head.Result, failures, or skipped proof:
riprlib-test binary does not build in this 15 GB container (rustc is killed at 13.8 GB, twice). They type-check under Clippy. Hosted qualification is their first execution.modline incall_identity.rs.Claim Boundary
review-commentscompletes on a large-workspace diff that edits tests related to thousands of seams, or any memory or time bound.Rollback
Spec-Test-Code Traceability
analysis::test_grip_evidence::tests::pool_relation::{pool_check_matches_the_complete_relation_for_every_seam_and_pool, owner_call_scope_resolves_only_pool_tests}analysis/test_grip_evidence/related_tests.rs,analysis/test_grip_evidence.rs,analysis/classify/{call_identity,owner_pin}.rsStatic Language Check
killed,survived,untested,proven, andadequate.CI Economics
n/a
Engineering Check
panic,unwrap,expect,todo, orunimplementedin production code.panic,unwrap,expect,todo, orunimplementedin tests.Generated by Claude Code