Skip to content

test(xtask): serialize recommendation fixture cwd access (#2186) - #2194

Merged
EffortlessSteven merged 1 commit into
mainfrom
codex/recommendation-cwd-2186
Jul 22, 2026
Merged

EffortlessSteven merged 1 commit into
mainfrom
codex/recommendation-cwd-2186

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

Prevent the recommendation-calibration fixture tests from racing concurrent with_temp_cwd tests after the shared CWD lock became parallel-safe.

  • The two tests that read the checked recommendation-calibration fixtures now hold the existing CWD write guard for the duration of the read.
  • No production behavior, report shape, fixture content, or golden output changes.
  • The guard covers both the summary-count test and the checked-report golden test.

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.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@EffortlessSteven, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 1 minute

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

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 165b99bd-12e1-4c51-a3af-6d4ca5f67db9

📥 Commits

Reviewing files that changed from the base of the PR and between 4085f44 and eee555c.

📒 Files selected for processing (1)
  • xtask/src/reports/recommendation.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/recommendation-cwd-2186

Comment @coderabbitai help to get the list of available commands.

@EffortlessSteven
EffortlessSteven merged commit 27c71f9 into main Jul 22, 2026
23 of 24 checks passed
@EffortlessSteven
EffortlessSteven deleted the codex/recommendation-cwd-2186 branch July 22, 2026 05:10

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

EffortlessSteven added a commit that referenced this pull request Jul 22, 2026
…_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

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(xtask): recommendation_calibration test reads ./fixtures relative to cwd — races parallel with_temp_cwd tests since the #2132 RwLock change

1 participant