Repository navigation
fix(xtask): cap covered_by lock-wait retry by wall clock and prove v2 deferral end to end (#8939) - #8941
Conversation
… deferral end to end (#8939) Add a 90-minute total ceiling, summed from recorded attempt durations, to the covered_by cargo lock-wait retry sequence. Exhausting it stops retrying and reports the same covered_by_lock_wait_timeout instrument failure naming the ceiling; a real non-lock timeout is unchanged. Inject the policy gate and command runner into the precommit-v2 composition (production passes the real ones) and add end-to-end tests: a deferred instrument failure yields infrastructure_failure after the diff checks and selected Clippy ran, and a real policy failure alongside it is not classified as infrastructure. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019KJRFj19yBcxVrsuTFe4Y2
|
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 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 5 minutes. View limit details
Summary by CodeRabbit
WalkthroughThe policy gate now limits cumulative covered-by lock-wait retries to 90 minutes and reports ceiling-triggered termination. Precommit composition now accepts injected policy and status runners. New tests cover how deferred instrument failures and combined policy and instrument failures affect execution and reporting. ChangesPolicy timeout and precommit classification
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Merge Risk: 🟡 Moderate · up to
|
There was a problem hiding this comment.
Decision
- Needs reviewer attention before upstream: findings remain.
Confirmed findings
- LOCK_WAIT_CEILING uses Duration::from_mins which is not a stable API in std; requires either the duration_from_mins unstable feature or Duration::from_secs(90*60) substitution. The diff is silent on the feature gate.
Verification questions
- Confirm statusRunner<'a> lifetime ties the caller to a higher-ranked stack callback; verify no hidden ergonomic or ownership penalty beyond the two existing call paths.
- Confirm codeRabbit flagged that fixture.path is not canonicalized before run_composition_in is invoked. drive_composition passes fixture.path directly, while production uses repository_root(). Risks symlink-relative path divergence in real check outputs.
- Confirm duration::from_mins requires a type alias or import; the diff uses Duration::from_mins(90) at module scope without an explicit use. Need to confirm Duration is in scope or imported.
- Confirm xtask/src/precommit_v2.rs:1973 — In drive_composition,
call.starts_with("cargo clippy")shadows the closure bindingcallsbecausecalls.iter().any(...)reads the outercallsVec; verify the assertion sites (contains("-p a ")and the later-stage-any check) use the samecallsVec and not a different binding, otherwise the stand-inif program == "cargo"branch (which returns git --version) would skip recording the cargo clippy invocation entirely and 'cargo clippy' would never appear in calls.
Refuted
- The composition-with-instrument-failure test might pass spuriously because the deferred result is reported even if the runner is never called (composition short-circuits on policy failure).; refuted because: Test pins
diff_checks == 3andcalls.iter().any(c => c.starts_with("cargo clippy") && c.contains("-p a ")). With the runner injected only at the clippy slot and diff_checks assertion, a short-circuit would faildiff_checks == 3and surface as a test failure, so this concern is refuted. - CodeRabbit suggested canonicalizing fixture.path before run_composition_in. The injected runner is the only filesystem-affecting dependency; root is read once and not used as a cwd by the runner closure. Real production path uses repository_root(). Source-route impact is null.
- CodeRabbit finding at precommit_v2.rs:1967 claims root must be canonicalized before run_composition_in.; refuted because: In the new fixture, root is only used for path display strings through format_command; the injected status runner doesn't chdir or canonicalize. The documented fix would not change test behavior. Already answered in PR claims; current diff does not reopen.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
- PR body states 'Full cargo xtask precommit not run locally; CI is the exact-head proof'; cargo-test receipt is still scheduled-late so exact-head CI witness is not yet on disk.
…tion fixture root (#8939) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019KJRFj19yBcxVrsuTFe4Y2
|
Re the Generated by Claude Code |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Governing issue or accepted claim: #8939
Acceptance delta (one sentence): The covered_by lock-wait retry now has a documented 90-minute wall-clock ceiling that fails closed with the distinct
covered_by_lock_wait_timeoutinstrument failure naming the ceiling, andprecommit_v2::run_compositionhas end-to-end proof that a deferred instrument failure isinfrastructure_failure(diff checks and selected Clippy still run, run returns Err) while a real policy failure plus an instrument failure is not infrastructure.Follow-up to #8905.
Changes
xtask/src/policy/file_policy.rs:LOCK_WAIT_CEILING(90 min).capture_past_lock_waitsums the recorded durations of lock-wait attempts (no clock read, no sleeping). Once the sum reaches the ceiling it stops retrying even with attempts left, and prepends a history line thatenumeration_resultfolds into thecovered_by_lock_wait_timeout:message. The ceiling is checked after each attempt, so overshoot is at most one spawn timeout. Real non-lock timeouts and the attempt bound are unchanged.xtask/src/precommit_v2.rs:run_compositionnow delegates torun_composition_in, which takes the policy gate and the command runner (diff checks, Clippy) as injected closures. Production passesprecommit()/precommit_policy(true)andrun_status; behavior is unchanged.test_covered_by_lock_wait_ceiling_stops_retrying_and_names_the_ceiling,composition_with_deferred_instrument_failure_is_infrastructure_after_remaining_stages,composition_with_real_policy_failure_and_instrument_failure_is_not_infrastructure. The composition tests use a real temp git repo and real cargo metadata; only the policy gate and the runner are injected (Clippy is stood in for by a harmless git call).changelog.d/8939-covered-by-lock-wait-ceiling.md.Proof
ceiling did not stop the retries: 7); restored, passes.source_or_policy_failure); restored, passes.cargo fmt --check,cargo clippy --locked -p xtask --all-targets -- -D warnings,cargo test --locked -p xtask --bin xtask -- covered_by composition_with(40 passed),check-no-panic-family,check-allow-attributes,check-local-contextall pass locally. Fullcargo xtask precommitnot run locally (shared disk nearly full); CI is the exact-head proof.Not touched: ripr crate classification (#8600).
Generated by Claude Code