Repository navigation
feat(xtask): add targeted rerun benchmark receipt - #1531
Conversation
|
Warning Review limit reached
Next review available in: 22 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (17)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Code Review
This pull request introduces a new benchmark command, cargo xtask targeted-rerun-benchmark, along with a controlled benchmark fixture workspace to measure the performance of the targeted rerun feature (SPEC-0123). It updates the project's policies, traceability records, and documentation to integrate this benchmark. Feedback on the implementation suggests using an RAII drop guard to guarantee cleanup of the temporary cache directory on early returns or panics, removing the redundant manual cleanup once the guard is in place, and explicitly verifying that the parity run passes for a more robust threshold check.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| let cache_dir = benchmark_cache_dir(); | ||
| clear_cache(&cache_dir)?; | ||
| let envs = [(CACHE_ENV, cache_dir.to_string_lossy().into_owned())]; |
There was a problem hiding this comment.
The temporary cache directory cache_dir is currently only cleaned up at the very end of the targeted_rerun_benchmark function. If any of the benchmark runs fail or time out, the function returns early via the ? operator, leaving the temporary directory on disk.
Using an RAII drop guard ensures that the temporary directory is reliably cleaned up under all exit paths, including early returns and panics.
let cache_dir = benchmark_cache_dir();
struct CleanupGuard<'a>(&'a Path);
impl Drop for CleanupGuard<'_> {
fn drop(&mut self) {
let _ = fs::remove_dir_all(self.0);
}
}
let _guard = CleanupGuard(&cache_dir);
clear_cache(&cache_dir)?;
let envs = [(CACHE_ENV, cache_dir.to_string_lossy().into_owned())];| crate::write_report("targeted-rerun-benchmark.md", &benchmark_markdown(&report))?; | ||
| let _ = fs::remove_dir_all(&cache_dir); | ||
| println!("Wrote target/ripr/reports/targeted-rerun-benchmark.json"); |
There was a problem hiding this comment.
With the CleanupGuard active, the manual cleanup of cache_dir is redundant and can be removed.
| crate::write_report("targeted-rerun-benchmark.md", &benchmark_markdown(&report))?; | |
| let _ = fs::remove_dir_all(&cache_dir); | |
| println!("Wrote target/ripr/reports/targeted-rerun-benchmark.json"); | |
| crate::write_report("targeted-rerun-benchmark.md", &benchmark_markdown(&report))?; | |
| println!("Wrote target/ripr/reports/targeted-rerun-benchmark.json"); |
| let threshold_pass = warm_targeted_p50 <= WARM_P50_TARGET_MS | ||
| && cold_full_p50 >= warm_targeted_p50.saturating_mul(SPEEDUP_TARGET) | ||
| && parity_state == "matched" | ||
| && all_pass(cold_full) | ||
| && all_pass(cold_targeted) | ||
| && all_pass(warm_targeted) | ||
| && all_pass(invalidation); |
There was a problem hiding this comment.
The threshold_pass check currently verifies that cold_full, cold_targeted, warm_targeted, and invalidation series all passed, but it does not explicitly check all_pass(parity).
While a failed parity run would result in parity_state being "unavailable" (which fails the "matched" check), explicitly verifying all_pass(parity) is more robust and self-documenting.
let threshold_pass = warm_targeted_p50 <= WARM_P50_TARGET_MS
&& cold_full_p50 >= warm_targeted_p50.saturating_mul(SPEEDUP_TARGET)
&& parity_state == "matched"
&& all_pass(cold_full)
&& all_pass(cold_targeted)
&& all_pass(warm_targeted)
&& all_pass(invalidation)
&& all_pass(parity);
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c9c3de3871
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -0,0 +1,1004 @@ | |||
| pub fn target(value: i32) -> bool { | |||
There was a problem hiding this comment.
Keep benchmark fixture out of repo scans
Adding this controlled fixture under benchmarks/.../src makes it visible to ordinary repo-wide Rust discovery: DEFAULT_IGNORED_DIRS skips fixtures but not benchmarks, and is_production_rust_path excludes fixtures, benches, xtask, etc. but not benchmarks. When ripr check --root . --format repo-exposure-json, cargo xtask dogfood, or repo metrics run from this repository root, these 1000 unrelated benchmark functions are treated as ripr production seams, corrupting counts and latency; move the fixture under an ignored surface or add a benchmark-fixture exclusion and validate with the repo-wide scan/report commands.
Useful? React with 👍 / 👎.
| && all_pass(cold_full) | ||
| && all_pass(cold_targeted) | ||
| && all_pass(warm_targeted) | ||
| && all_pass(invalidation); |
There was a problem hiding this comment.
Require invalidation samples before passing
When the explicit cache-reset sample exits successfully but reports /cache/reuse_state: reused_file_facts, this line still allows threshold_pass to become true because it checks only the process status via all_pass(invalidation). That can publish a status: "pass" benchmark while the SPEC-0123 invalidation case did not actually recompute facts; require the invalidation sample to report recomputed_file_facts (and consider pinning cold/warm cache states) before setting the receipt status to pass.
Useful? React with 👍 / 👎.
|
Addressed the Gemini review points in the latest head: cache cleanup now uses a Drop guard so early-return paths remove the isolated benchmark cache, and the benchmark status requires the parity sample to be a passing sample in addition to parity.state == matched. Focused tests, Clippy, and the full cargo xtask check-pr pass; the receipt was refreshed on the final head. |
Summary
cargo xtask targeted-rerun-benchmarkfor a checked cold/full versus targeted rerun receipt.Swarm / Source Boundary
This PR targets
EffortlessMetrics/ripr-swarm, the normal development trunk for trusted same-reporiprwork.ripr-swarmNo release, signing, marketplace, or publishing surfaces are changed.
Source-of-truth Links
Proposal: n/a
Spec:
docs/specs/RIPR-SPEC-0123-targeted-rerun.mdADR: n/a
Plan item:
perf/targeted-rerunActive goal:
rust-one-shot-evidence-to-repairIssue: #1424
Scope
Scope Classification
This PR is scoped by:
Production delta:
Evidence/support delta:
Single acceptance criterion:
Non-goals:
Support-tier Impact
Claim/proof notes:
Policy Impact
Ledger or exception notes:
Proof
Result, failures, or skipped proof:
matched, andrecomputed_file_factsafter explicit cache reset.Claim Boundary
This supports the named benchmark fixture, revision
938eb56, configuration, and local Windows x86_64 runner class. It does not support universal latency, runtime mutation behavior, correctness, coverage adequacy, complete test quality, or broader invalidation attribution.Rollback
Revert this PR; it removes only the benchmark command, fixture, receipt documentation, and associated policy/traceability entries. The targeted-rerun implementation remains unchanged.
Spec-Test-Code Traceability
docs/specs/RIPR-SPEC-0123-targeted-rerun.mdxtask/src/reports/targeted_rerun.rsunit tests; controlled fixture underbenchmarks/targeted_rerun_benchmark/inputxtask/src/reports/targeted_rerun.rs, command registration and dispatchtarget/ripr/reports/docs/handoffs/2026-07-11-targeted-rerun-benchmark.mdStatic Language Check
killed,survived,untested,proven, andadequate.CI Economics
check-prstill required.Engineering Check
Gates
cargo fmt --checkcargo check --workspace --all-targetscargo test --workspacecargo clippy --workspace --all-targets -- -D warningscargo doc --workspace --no-depscargo xtask check-pr