Repository navigation
perf(cold): index target-affinity evidence candidates - #3839
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning Review limit reachedNext included review available in 58 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Current exact-head qualification stateCandidate head: Current hosted observations: #3838 is now marked Any head movement invalidates these run identities. No merge/candidate/qualification/source/publication state is implied while required runs and measurement handoff remain nonterminal. |
Review finding — implementation has no discriminating index regression proofThe production change is appropriately small, but this PR changes only the context/index implementation and slice declaration; it adds no focused test or structural guard. The existing semantic related-test fixtures can pass under both implementations: They therefore show output parity but do not establish the new acceptance proposition that the reverse index contains all and only the intended test indexes, preserves deterministic order/deduplication, or that this matcher no longer regresses to a per-seam full-corpus scan. Before merge, add a focused discriminator that would fail when the index is missing, incomplete, duplicated, or misordered. A suitable unit fixture can build multiple tests with: and assert the exact reverse-index vector plus unchanged final related-test output/order. Also add the least brittle available guard that the target-affinity matcher consumes This is a |
There was a problem hiding this comment.
Confirmed findings
- Sibling memory-shape concern: tests_by_target_affinity_owner_call_name stores Vec with the same per-key growth and zero-trim behavior as tests_by_call_name and tests_by_helper_owner_call_name. If those siblings carry no documented pruning contract, neither does the new index; a per-test BTreeSet membership blob is duplicated by value into the index (owner_name.clone() per emit) and again into tests_by_helper_owner_call_name for tests whose helper set non-empty, so total cold-path memory doubles only on the owner-name union. Not a blocker for a refactor slice, but worth tracking before activation/oracle work reuses this index.
- CompactGripContext::new now performs an extra BTreeMap insert loop per owner name on every cold construction; PR claims this is net-positive but does not bound new allocation cost for very large owner-name sets.
Refuted
- replacement index could drop tests whose owner-call name appears multiple times due to Vec dedup; refuted because: the diff uses .or_default().push(test_index) inside the per-test BTreeSet loop; duplicates per test do not exist (BTreeSet dedupes) and tests with the same owner name each appear once in the order they appear in context.tests.
- get(&owner.name) returning Some would skip tests whose target_affinity_owner_call_names did not contain owner.name before; refuted because: Both prior scan and new lookup gate on the same contains-equality; the index is built from the same BTreeSet so membership is identical.
- Borrowing &target_affinity_owner_call_names while extending tests_by_target_affinity_owner_call_name could create a self-referential BTreeMap entry that aliases the source vector; refuted because: owner_name.clone() inserts an owned String key; the pushed usize is Copy. No reference into the source set is retained in the map, so no self-referential aliasing or later invalidation is possible.
- Relation reason, priority, or RelationReason::HelperOwnerCall classification might drift due to index refactor.; refuted because:
insert_related_candidatecall site is unchanged in arguments:candidates, context, prefix, *test_index, RelationReason::HelperOwnerCall. Only the candidate enumeration source changed; downstream logic untouched. - If Rust tests do not cover the cold-path target-affinity evidence phase, the refactor could regress behavior undetected by goldens.; refuted because: PR body and tokmd receipts enumerate target-affinity evidence guards (positive/negative multi-owner, module-qualified, crate-qualified, direct-import, wrong-target, ambiguity). Slice TOML forbids golden/output/classification changes, and
cargo test -p ripr test_grip_evidence -- --test-threads=1is listed as protected proof. Coverage for the changed path already exists.
Evidence gaps
- artifact-verifier exited 2; claimed output/golden/fixture contracts preserved but no verifier receipt attests this.
- build/cargo-test receipts are scheduled-late; oracle strength cannot be finalized until sensor-cargo-test lands.
- Model proof intent was rejected by deterministic validation.
Parked follow-ups
- Sibling helper-owner-call matcher (match_helper_owner_call) still uses context.tests_by_helper_owner_call_name, confirming this PR does not regress the analogous indexed path; no shared caller of the removed scan exists elsewhere.
- Broader evidence-parallelism (Rayon over seams, semantic-unit caching) is a real sibling but explicitly parked as non_goal in the slice; not in scope for this PR.
Fixes #3838
Parent: #3794
Measurement authority: #3795
Warm/incremental sibling: #3796
What changed
The repo-evidence target-affinity matcher no longer scans every indexed test for every eligible seam.
CompactGripContextnow builds one deterministic reverse index:and
match_target_affinity_owner_callresolves candidates from that index before applying the existing target-token predicate.Why this is cold-path work
On the large whole-repo path, evidence construction is a dominant cold phase. The old matcher retained an
O(seams × tests)candidate-selection term even though target-affinity owner-call names were already materialized per test.Rust file parsing is already Rayon-parallel, and classified-seam cache sharding already exists. This PR removes a demonstrated redundant whole-test scan before considering broader evidence parallelism.
Semantics preserved
Unchanged:
The reverse-index vectors preserve test enumeration order, and each test's owner names come from a
BTreeSet, so candidate membership/order matches the prior scan.Governance
Adds
.allow/spec-system/slices/ripr.slice.cold-target-affinity-index.v1.tomlas a refactor slice under RIPR-SPEC-0005. It explicitly forbids golden/output/classification-decision changes.Proof
Existing target-affinity evidence coverage includes positive and negative multi-owner, module-qualified, crate-qualified, direct-import, wrong-target, and ambiguity guards.
Expected protected proof:
cargo test -p ripr test_grip_evidence -- --test-threads=1 cargo xtask goldens check cargo xtask check-output-contracts cargo xtask check-static-language cargo xtask check-pr git diff --checkAfter #3795's phase/reuse receipts are available, the cold self-dogfood replay should compare the evidence phase at this exact head. This PR alone does not make a universal wall-clock claim.
Non-goals