Skip to content

fix(review): observe cancellation inside direct test matching - #14169

Merged
EffortlessSteven merged 8 commits into
mainfrom
codex/review-evidence-cancel
Nov 21, 2026
Merged

EffortlessSteven merged 8 commits into
mainfrom
codex/review-evidence-cancel

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Review guidance can run past its budget inside direct-owner test matching. This candidate checks every 32 direct candidates and rejects interrupted full and compact evidence before classification or return.

Governing issue or accepted claim: #12940, #1699.

Acceptance delta (one sentence): direct-owner matching observes cancellation within its candidate loop, and interrupted evidence cannot cross the changed publication boundaries.

Candidate: b00d963d13b7ace0fea0a34807dd052dbc4f52e8. Integration basis: main abf2c72db29b8717348596d9034d18af66479b10. Existing #13919 narrowing and #13900 instrumentation remain separate. This partial path does not establish a hard overall deadline or bound other expensive relation/oracle operations.

Validation and review

The independent Windows review reports exact-head lib/tests checks and both original regression tests executed and passed on Rust 1.95.0 at 24b991673. Those tests witness periodic matching and EvidencePass discard. Removing the periodic check or making it entry-only fails the revised 65-candidate test by independent source inspection; an executed mutation result remains missing.

Current head adds compact_classification_refuses_deadline_before_publication: a complete single-seam control followed by synthetic deadline expiry must return Err rather than classified output. Independent source review found that removing the publication checkpoint makes this test fail even if calibration changes. Deeper checkpoint counts can vary with warm caches, so the precise internal expiry location is not established. This added test has not executed.

Local Linux default/Rust-only test builds, including one job with incremental compilation and test debug information disabled, exhausted the unchanged 6 GiB per-process virtual-memory cap before execution. Rust-only production library checking passed before the latest test-only addition. Formatting and diff checks passed. External timeout guards remain mandatory and were separately verified using a five-second probe terminated at one second with exit 124.

Remaining proof: execute the new compact test and removal control, add/execute dedicated reporting_failure publication coverage, refresh review on the current head, and obtain required hosted qualification. Disposition: REVIEW_INCOMPLETE. No source-ready marker, full qualification request, or final merge judgment is earned yet.

Changelog: changelog.d/review-direct-owner-cancellation.md, canonical Fixed marker/bullet/issue reference. Rollback: revert this bounded source/tests change. No persisted format, dependency, limit, workflow, protection, or release change.

Source review: REVIEW_READY 50b3702


Generated by Claude Code

@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 11, 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 49 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 147 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: 7b3ce8f5-04ec-4f21-bb4c-0f6b28c58c11
Commits

Reviewing files that changed from the base of the PR and between bcc5e7d and 50b3702.

Files selected for processing: 6

  • .ripr/traceability.d/12940-direct-owner-cancellation.toml
  • changelog.d/review-direct-owner-cancellation.md
  • crates/ripr/src/analysis/seam_inventory.rs
  • 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
Pre-merge checks: Inconclusive 2

Failed Failed checks: 2 inconclusive

Check name Status Explanation Resolution
Title check Pending This assessment has not completed. The check will be retried on the next pre-merge check run.
Description check Pending This assessment has not completed. The check will be retried on the next pre-merge check run.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Exact-head review (head 24b9916)

Reviewed the full 5-file diff plus surrounding source at this exact head (git fetch origin pull/14169/head; git rev-parse FETCH_HEAD = 24b9916). Verdict: coherent and safe at every production consumer I traced; no blocking findings. 4 non-blocking findings below. The body's honesty about unexecuted proof was accurate at publication; this review partially closes that gap with executed evidence.

Verified (all executed this session, Windows host, toolchain 1.95.0)

  • No drift: merge-base(origin/main, head) == origin/main == abf2c72; the head sits directly on current origin/main.
  • cargo check -p ripr --lib at head: Finished dev profile in 1m53s, exit 0 (5 warnings, all in untouched lsp/backend.rs). The body's lib check had run only on the prior source commit e5d3f91; this verifies the exact published head including its merge.
  • cargo check -p ripr --tests at head: Finished dev profile in 4m34s, exit 0 — the new test code compiles. (The body reported test builds exhausting a 6 GiB cap; this host's check-level build stayed under it.)
  • The two new tests EXECUTED and PASSED at the exact head: cargo test -p ripr --lib -- direct_candidate_walk_observes_cancellation evidence_pass_discards_seam_when_deadline_expires_during_relation_walk → "2 passed; 0 failed ... 18714 filtered out" in 0.04s (binary built from this head at target/debug/deps/ripr-5c21f4830d3e60a7.exe). The exact-count oracles — 32 admitted candidates, clock calls == 2, empty evidence, clock calls == 3, observed abort DeadlineExceeded — are now observed behavior, not source arguments.
  • Cancellation semantics behind those counts: AnalysisCancellationToken::checkpoint consults the budget clock only while abort_kind() is None (crates/ripr-contract/src/analysis/cancellation.rs:213) and records the abort as handed-to-work at :223, so post-abort checkpoints stop consulting the clock; counts 2 and 3 are internally consistent, and the run confirms them.
  • Oracle shape is genuinely discriminating: an every-16 cadence would make 3 clock calls; every-64 would admit 64 candidates; removing the in-loop check or making it entry-only admits all 65 (ne 32). The body's red/green claim holds by source argument, and the green side is now executed.
  • Silent-empty-on-cancel contract is safe at every production consumer: find_related_tests_with_context returns Vec::new() on abort (related_tests.rs:28, 37, 59, 71, 81, 145) and every publication path checkpoints between computation and use — EvidencePass after the walk and after the evidence build (test_grip_evidence.rs:645-648); evidence_for_seams_reporting_failure after the batch (test_grip_evidence.rs:331), covering its callers at seam_inventory.rs:1097, 1430, 1894, 4214; all four production compact_evidence_for_seam callers between compute and classify/return (seam_inventory.rs:1285-1286, 1336-1337, 3619-3620, 4665-4666). The only unguarded consumer is the cfg(test) helper evidence_for_seam (test_grip_evidence.rs:746-747), unreachable from production. No path publishes truncated relations as evidence.
  • Behavior-preserving for non-cancelled runs: the only semantic restructure moves the find_related_tests_with_context call from inside evidence_for_seam_with_context to its callers (test_grip_evidence.rs:871-877); matcher order, retain rules, and dedupe are untouched. No unsafe, no dependency change, no golden/output-shape change. The changelog fragment matches the marker/bullet/issue format of its 1128 siblings (unprefixed names have precedent).
  • Names/visibility compile as written: pub(super) OwnerContext::resolve and match_direct_owner_call reach tests.rs via its existing glob imports (tests.rs:9-11); BTreeMap resolves via the parent's private std::collections import exactly as pre-existing tests at tests.rs:20946 already do.
  • Platform: tests use a synthetic clock (no real-time flake) and no fs/symlink behavior; both pass on Windows here.

Findings

  1. [medium, process] Required body markers are absent: the body contains no "Governing issue or accepted claim:" label and no "Acceptance delta" label (checked: 0 occurrences each; it only says "Refs #12940, #1699."). Add both labeled sections in a body update before merge convergence.
  2. [medium, oracle gap, author-disclosed] The checkpoints added in seam_inventory.rs (1286, 1337, 3620, 4666) and test_grip_evidence.rs:331 have no discriminating test of their own — the two new tests witness only the direct-matcher cadence and the EvidencePass discard. The body states this ("Consumer-level regression proof for compact publication and reporting_failure guards is still missing"). A compact-path test (cancel mid-walk; assert the class-count loop returns Err and stores nothing) would close it; the shared walk mechanism is at least exercised indirectly.
  3. [low, nit] The seam_inventory checkpoints sit after compact_evidence_for_seam rather than before it, so an aborted walk still pays the computation and only discards the result — exactly what the body claims ("discards interrupted full and compact evidence before it can be classified or returned"), so there is no claim-vs-enforcement gap; a pre-computation checkpoint would additionally save the work.
  4. [low, nit] Exact clock-call assertions (tests.rs:3330 calls == 2, tests.rs:3376 calls == 3) couple to the current number of budget consultations in the pass preamble; a legitimate future checkpoint added before the parallel batch would fail the second test without a behavior change. Acceptable — that coupling is also what makes the tests discriminators for the consult-only-while-live property.

Residuals: hosted CI remains the required merge-gate authority; this local run does not replace it. The body's bounded-claim statements (no hard overall deadline; #13919/#13900 separate) match the diff. Draft PR, in flight.

… with per-seam cost trace

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVdGzVD7jnRWsX2VUqRAeJ
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review November 20, 2026 09:27

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

SOURCE_REVIEW_READY

Head: 50b3702

Exact-head source review of #14169 at d9c4501 (main merged forward; conflicts were in test_grip_evidence.rs and related_tests.rs).

Checkpoint inventory against the original PR commit (b00d963), compared with this head. In related_tests.rs, find_related_tests_in, which now owns the walk that main split into a shared function plus a pool variant, carries all six intended checkpoints: entry, after the direct-owner match, after the inaccessible-direct retain, after the helper and target-affinity matches, after the same-file, same-module and fallback fill, and immediately before dedupe. The periodic check every 32 candidates inside match_direct_owner_call survives, and OwnerContext::resolve is visible to the test module. In test_grip_evidence.rs the evidence worker keeps its pre-existing entry checkpoint and gains one after the relation walk and one after evidence construction, and the reporting-failure entry point checks once more before reading limitations. In seam_inventory.rs all four sites survive: the uncached count walk, the compact classification walk, the cached-state count walk, and the field-seam admission guard, each checking after computing evidence and before using it. The entry checkpoint re-added during conflict resolution also covers the pool variant used by relates_to_pool_test; that returns an empty answer only once a token has already aborted, and every production caller of the evidence path discards or errors on an aborted token, so no interrupted evidence can be published or credited.

Main's per-seam cost tracing (trace.record with the worker index, the progress chunk reporting and the memo stats) is intact in the worker block; only the related-test lookup was hoisted ahead of evidence_for_seam_with_context, whose new related-tests parameter is passed by both callers (the worker and the test helper). Every production caller of compact_evidence_for_seam and the related-test finder was enumerated and none can skip the guard.

Tests: a 65-candidate periodic-walk test asserting a live first batch of 32 and exactly two clock reads, a worker test showing an expired deadline during the relation walk yields no evidence, and a compact classification test that derives the expiry point from a live run so the post-computation guard is the one that rejects. These are tied to the new checkpoints; removing them would change the asserted counts or results.

Compilation against current main: cargo clippy -p ripr --all-targets -- -D warnings finished clean. The new lib tests could not be executed here (the lib test build is killed by the memory limit on this box); their clock-count assertions were checked by reading the sticky-abort checkpoint implementation instead, so hosted CI should qualify the runtime result.

An older review of the PR on a prior head is a clean pass and there are no open threads. The PR body carries the governing-issue and acceptance-delta lines. Body text still names candidate b00d963 and basis abf2c72, and says the review is incomplete with execution of the compact test and removal control remaining; it is stale for this head.

Lead follow-up 50b3702 (Devin thread on test_grip_evidence/tests.rs:3416): the three new cancellation tests (direct_candidate_walk_observes_cancellation, evidence_pass_discards_seam_when_deadline_expires_during_relation_walk, compact_classification_refuses_deadline_before_publication) now extend RIPR-SPEC-0012's cooperative analysis budget behavior through .ripr/traceability.d/12940-direct-owner-cancellation.toml. Local proof on this head: cargo xtask check-traceability (with a bogus-id negative control that refuses) and cargo xtask check-spec-format.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit 439c0f4 Nov 21, 2026
19 checks passed
@EffortlessSteven
EffortlessSteven deleted the codex/review-evidence-cancel branch November 21, 2026 08:18
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