Skip to content

perf(analysis): compute owner reach once per seam in sort_related_tests_for_seam (Closes #12478) - #12537

Merged
EffortlessSteven merged 2 commits into
mainfrom
cursor/owner-reach-once-per-seam-8f08
Nov 4, 2026
Merged

EffortlessSteven merged 2 commits into
mainfrom
cursor/owner-reach-once-per-seam-8f08

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Governing issue or accepted claim: #12478
Acceptance delta (one sentence): match-arm ranking builds owner reach once per seam instead of once per related test, with unchanged credited-view oracles.

Closes #12478

Summary

sort_related_tests_for_seam now calls credited_related_tests once with the whole related set of a match-arm seam, so the reverse owner_reach walk (and its lazy unbounded closure) is built once per seam instead of once per related test.

Swarm / Source Boundary

This PR targets EffortlessMetrics/ripr-swarm, the normal development trunk for
trusted same-repo ripr work. Confirm the change belongs here:

  • ordinary feature, analyzer, editor, docs, spec, fixture, badge,
    dependency, or repo-ops development for ripr-swarm
  • repair or follow-up for a same-repo swarm PR
  • swarm-only CI, runner, routing, source-of-truth, or agent-operating
    surface
  • other swarm-scoped work:

Source-of-truth Links

Proposal: none
Spec: RIPR-SPEC-0094 (credited-view / other-function oracle refusal)
ADR: none
Plan item: none

Candidate Relationships

Candidate branch (GitHub PR head is authoritative after publication): cursor/owner-reach-once-per-seam-8f08 at d0afb792a41b34de5d12e1fbb1e11b174cb6b7be
Stack parent or prerequisite PR (if any): none
Proposed replacement of PR (if any; not yet accepted): none
Acceptance retained from a replaced candidate (if any): none
Accepted winner and losing candidate disposition (when decided): not decided

#12464 is a different claim (#12434, predicate-boundary oracle refusal) and deferred this optimization; this PR does not take that work.

Scope

Repo-seam ranking (sort_related_tests_for_seam) batched the #12060 credited-view filter so credited_related_tests sees the whole related set on a match-arm seam.

Scope Classification

This PR is scoped by:

  • One production behavior
  • One public contract
  • One architectural seam
  • Docs/spec/test-only evidence package
  • Other:

Production delta:

  • sort_related_tests_for_seam calls credited_related_tests once with every related test of a match-arm seam, then ranks from those credited views.
  • credited_related_tests still owns the MatchArm-only reverse walk; callers must not pass a one-element slice per test.

Evidence/support delta:

  • Regression match_arm_owner_reach_is_computed_once_for_many_related_tests counts owner-reach builds (must equal sort count, not related-test count) and pins reduce_over = None, consume_and_reduce = Strong.
  • Changelog fragment and RIPR-SPEC-0094 traceability extend.

Single acceptance criterion:

Non-goals:

Support-tier Impact

  • none
  • updates docs/status/SUPPORT_TIERS.md
  • changes a README, release, docs, CLI, JSON, editor, CI, or package claim

Claim/proof notes:

  • Ranking cost changes; published oracle strengths do not.

Policy Impact

  • none

Ledger or exception notes:

  • none

Proof

# before (HEAD ranking, local-only test_stub arity workaround, then reverted)
cargo test -p ripr --lib match_arm_owner_reach_is_computed_once_for_many_related_tests -- --nocapture
# related=50 repeats=200 owner_reach_builds=10000 elapsed=333.17247ms
# FAIL: expected 200, saw 10000

# after (this head, same local-only compile workaround, then reverted)
cargo test -p ripr --lib match_arm_owner_reach_is_computed_once_for_many_related_tests -- --nocapture
# related=50 repeats=200 owner_reach_builds=200 elapsed=73.561118ms
# ok

cargo test -p ripr --lib pinning_another_function -- --nocapture
# proximity_test_pinning_another_function_cannot_grade_a_match_arm_up ok
# match_arm_proximity_test_pinning_another_function_cannot_confirm ok

cargo xtask check-evidence-promotion-honesty
# pass

./target/debug/xtask check-changelog-fragments
# pass

./target/debug/xtask check-traceability
# pass

Measurement (debug, unoptimized libtest, same 50-related-test match-arm fixture, 200 ranking repeats after one warmup):

owner_reach builds wall-clock
before 10000 (50 per sort) 333.17 ms
after 200 (1 per sort) 73.56 ms

About 50× fewer reverse walks and about 4.5× faster on this debug microbench. Not a release-mode benchmark.

Result, failures, or skipped proof:

Claim Boundary

Rollback

Revert the commit. Ranking returns to one credited_related_tests call per related test. No schema, cache generation, or public JSON change.

Spec-Test-Code Traceability

  • Spec: RIPR-SPEC-0094
  • Tests: match_arm_owner_reach_is_computed_once_for_many_related_tests; existing proximity_test_pinning_another_function_cannot_grade_a_match_arm_up
  • Code: crates/ripr/src/analysis/test_grip_evidence/related_tests.rs (sort_related_tests_for_seam); credited_related_tests in test_grip_evidence.rs
  • Golden outputs: honesty corpus unchanged
  • Metrics: owner_reach build count; debug ranking wall-clock in the PR body
  • ADR/learning: none

Static Language Check

  • Static output avoids killed, survived, untested, proven, and adequate.
  • Unknowns include stop reasons where applicable.

CI Economics

n/a (no workflow or lane change)

Engineering Check

  • No new panic, unwrap, expect, todo, or unimplemented in production code or tests.

Gates

Local precommit could not compile the crate because of inherited E0061 in app/test_stub.rs (#12466). Targeted tests above ran against a local-only compile workaround that is not on this branch.


Opened on behalf of cloud agent bc-e2219029 (bc-e2219029-842a-518c-8c07-28fd1a228f08).


Devin Review

@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 Nov 2, 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 54 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 151 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: 056771a8-9d8e-44b4-8dde-2aeecfcf3e56
Commits

Reviewing files that changed from the base of the PR and between da6c9c1 and 7ab1b39.

Files selected for processing: 5
  • .ripr/traceability.d/12478-credited-owner-reach-once-per-seam.toml
  • changelog.d/12478-credited-owner-reach-once-per-seam.md
  • crates/ripr/src/analysis/test_grip_evidence.rs
  • crates/ripr/src/analysis/test_grip_evidence/related_tests.rs
  • crates/ripr/src/analysis/test_grip_evidence/tests.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@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

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Triage: wheel/package lanes (plus source-of-truth/spec-digest where present) fail while main itself does not compile with the known E0061 rust_test_stub arity break; none of this diff touches the stub files. No candidate action: rebase past the main fix (#12466) once it lands and re-qualify.

…12478)

sort_related_tests_for_seam now calls credited_related_tests once with the
whole related set so the reverse owner-reach walk is not rebuilt per test.

Co-authored-by: Steven Zimmerman, CPA <EffortlessSteven@users.noreply.github.com>
@cursor
cursor Bot force-pushed the cursor/owner-reach-once-per-seam-8f08 branch from d0afb79 to d75cc0a Compare November 2, 2026 14:00

@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 build-count regression is not independently red/green-distinguishing against the pre-change implementation because CREDITED_OWNER_REACH_BUILDS was added in this same change.

Parked follow-ups

  • Full and compact evidence retain separate credited owner-reach walks for stage scoring; these are pre-existing sibling paths, not regressions from the once-per-seam ranking optimization.

Evidence gaps

  • The regression fixture validates the one-build-per-sort invariant and credited oracle strengths, but the packet contains no completed cargo-test receipt.
  • The PR's red/green proof depends on a local-only rust_test_stub arity workaround, so hosted execution of this exact head is still unverified.
  • Executed test evidence for this candidate is incomplete because the scheduled cargo-test receipt is absent and the ripr sensor failed.
  • Execution evidence for the new regression and unchanged oracle behavior is incomplete because cargo-test has no receipt and ripr failed.
  • No hosted cargo-test receipt is available; current-head compilation remains unverified because of the inherited rust_test_stub arity break documented in the PR and prior thread.
  • Independent execution evidence for the new test is currently unavailable despite the PR reporting targeted local runs with a temporary workaround.
  • Model proof intent was rejected by deterministic validation.
  • The remaining evidence gap is the absent scheduled cargo-test receipt, not a demonstrated defect in the batching logic.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

merge-ready was requested, but this PR conflicts with main (head d75cc0aa), 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.

…12434's refuse gate

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

Copy link
Copy Markdown
Member Author

Decision (reversible fork): port, don't close.

Main's #12434 changed the same gate (refuse computed once per seam via refuses_other_function_oracle), but sort_related_tests_for_seam on main still calls credited_related_tests with a one-element slice per related test, so owner reach is still rebuilt per test. #12434 did not cover the #12478 batching.

Pushed 7ab1b39: merged main, took main's versions of the three conflicted files, and re-applied the delta on top of #12434's signature (credited_related_tests(context, owner_fn, related, refuse)): one batched call when refuse holds, views.get(i) per test, the build counter, and the ported regression test match_arm_owner_reach_is_computed_once_for_many_related_tests.

Not yet proven: I did not compile the ripr lib tests locally (memory floor). Hosted CI on this head is the proof; review of record still needed before merge.


Generated by Claude Code

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

merge-ready is set, but no qualification run exists for head 7ab1b39f: it was pushed after the label was applied, or the label event was dropped. Remove and re-apply merge-ready to request it again.

@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 the regression compares full and compact propagate state plus selected oracle strengths, but does not exhaustively compare every ranked oracle against the pre-change implementation.
  • Confirm the new regression is not independently red/green capable against the pre-change implementation because its build counter was introduced in this same change.
  • Confirm the new regression is not independently red/green-distinguishing against the pre-change implementation because its build counter was introduced in the same change.

Evidence gaps

  • The new regression checks the once-per-sort build count and representative credited-view strengths, but the exact-head test receipt is missing.
  • The claimed once-per-seam owner-reach invariant is exercised by a new build counter test, but no completed cargo-test receipt is available in the packet.
  • No completed cargo-test receipt is available for the changed Rust paths, leaving runtime behavior and inherited main compilation unresolved.
  • The regression fixture verifies one owner-reach build per sort and representative credited oracle strengths, but its execution is not evidenced by a completed cargo-test receipt.
  • Current-head execution evidence is incomplete because the cargo-test receipt is absent and the ripr sensor failed.
  • Exact-head compilation and execution are not established by the available evidence.
  • Exact-head execution of the new oracle regression and existing #12060 behavior remains unverified.
  • Model proof intent was rejected by deterministic validation.
  • Execution evidence for the exact candidate head is incomplete.

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REVIEW_READY — head 7ab1b39

Review against current main (merge base da6c9c1; git diff origin/main...head is 5 files: test_grip_evidence.rs, related_tests.rs, its tests, a changelog fragment and a traceability fragment).

Equivalence of the batched call to the per-test calls (read from source):

  • credited_related_tests is a 1:1 .map over its input, so the returned views are in input order and views.len() == related.len(). Its per-test logic reads only the owner reach (a function of context and owner_fn, identical for every call), the test and its reason, so a view does not depend on which other tests share the slice. Building the owner reach once and indexing by position therefore gives the same view as a one-element call.
  • The refuse gate still applies to each test: the batched call keeps refuse_other_function_oracle and the is_proximity_only() || AssertionTargetAffinity plus assertion_pins_other_function check inside the per-test closure. refuse && !related.is_empty() only skips work when nothing would be credited. With refuse false or no owner_fn, every view is a borrowed original, as before.
  • Release-mode fallback: views.get(i) falls back to the uncredited test on a length mismatch, which would silently skip the refusal; the debug_assert! that guards it is compiled out in release. Not reachable today given the 1:1 map, so non-blocking, but a plain assert_eq! or zipping the two would remove the silent path.

Executed on a detached worktree of this exact head:

  • cargo clippy -p ripr --lib --all-targets -- -D warnings: exit 0.
  • cargo test -p ripr --lib: 18036 passed, 1 failed. The failure is cli::interrupt::tests::isolated_child_signal_before_checkpoint_is_rejected, which fails under the full-suite load on this host, passes when run alone, and also failed the same way on #12811, whose diff does not touch it. Not attributed to this PR.
  • The new match_arm_owner_reach_is_computed_once_for_many_related_tests passes: exactly one owner-reach build per sort over 200 sorts of 50 related tests, with the #12060 credited view held (other-function None, owner+other Strong, extras None) and full/compact propagate agreeing. The counter is #[cfg(test)]-gated like MASK_BUILD_COUNT, so there is no unused static in a normal build. The test asserts the build count, not wall time, so it is not timing-flaky.

Not run: the Rust verdict-corpus and goldens on this head (the diff changes no output by construction, but I did not execute them), and the hosted Ripr Rust Small Result. Owner reads that Result green on this exact head before merging.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven merged commit 2d4a197 into main Nov 4, 2026
74 checks passed
@EffortlessSteven
EffortlessSteven deleted the cursor/owner-reach-once-per-seam-8f08 branch November 4, 2026 02:38
EffortlessSteven pushed a commit that referenced this pull request Nov 4, 2026
Keeps #12478's single owner-reach walk for the whole related set and adds the
claims view to it: the walk runs when the other-function refusal or an
established claims pin needs a view.

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

perf: compute owner reach once per seam in sort_related_tests_for_seam

3 participants