Repository navigation
test(xtask): serialize recommendation fixture cwd access (#2186) - #2194
Conversation
|
Warning Review limit reached
Next review available in: 1 minute 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 Plus Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Decision
- Needs reviewer attention before upstream: findings remain.
Confirmed findings
- PR body overclaim risk: 'cargo xtask precommit' and full xtask suite green claims are sensitive to the very parallel-scheduling class this PR fixes; with --test-threads=8 on only the two affected tests, broader parallel safety is asserted but not directly demonstrated for adjacent fixture readers.
- artifact-verifier failed (exit 2) is unrelated to this xtask test-change diff, but compiler should still note the trust gap. No clear evidence from this PR that it was caused or resolved by the reviewed change.
Verification questions
- Confirm sibling tests in same module do not read checked calibration fixtures via root=. so guard not required there.
- Confirm proof scope narrower than reviewed change: only --test-threads=8 validated, not the higher parallelism the shared lock now enables.
Refuted
- The guard placement might be too late if cwd is read before the guard is acquired (e.g., fixture macro expansion or test-attribute setup); refuted because: Diff shows the guard is the first statement in the function body, executed before any
argsconstruction or fixture loading; cargo's#[test]attribute does not perform cwd IO. - Guard placement should be in a shared fixture/helper to avoid duplication across two tests; refuted because: Two call sites is well under duplication threshold; extracting a fixture would broaden scope beyond the race fix and conflict with smallest-complete-fix principle.
Evidence gaps
- ast-grep scan needed to confirm no other PathBuf::from(".") + checked-fixture reads exist in xtask.
- artifact-verifier failed (exit 2) with no receipt detail; trust-affecting for any binary/artifact claim but diff is test-only guard acquisition, so impact limited to verification posture not correctness.
…_repo_cwd panic-safe (#2186) (#2204) Follow-up to #2194/#2201. A full audit of the xtask suite (1213 tests, also run green from a foreign cwd) found one remaining test reading repo-relative fixture paths without the cwd write guard: recommendation_calibration_json_and_markdown_are_structured passed only because resolve_root_path falls back to workspace_root() when ./fixtures/... is missing — a concurrent with_temp_cwd test whose temp tree happens to contain a matching relative path would make the fallback pick the wrong tree. Guard it like its two siblings. Also make with_repo_cwd restore the process cwd on panic (catch_unwind, mirroring with_temp_cwd) so a panicking guarded body cannot leak the repo-root cwd into every other cwd-sensitive test in the process.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Summary
Prevent the recommendation-calibration fixture tests from racing concurrent
with_temp_cwdtests after the shared CWD lock became parallel-safe.Closes #2186
Verification
cargo test -p xtask recommendation_calibration -- --test-threads=8— 8 passed, 0 failed.cargo test -p xtask— 1,213 passed, 0 failed.cargo xtask precommit— pass.cargo clippy -p xtask --all-targets -- -D warnings— pass.cargo fmt --all -- --check— pass.git diff --check— pass.The proof establishes that both affected tests pass with parallel scheduling and that the full xtask suite remains green; it does not claim the entire workspace suite beyond xtask.