Skip to content

test(perry): serialize the two sandbox_buildrs tests that race on PERRY_SANDBOX_BUILDRS - #11345

Merged
proggeramlug merged 2 commits into
mainfrom
fix/sandbox-buildrs-env-race
Sep 25, 2026
Merged

proggeramlug merged 2 commits into
mainfrom
fix/sandbox-buildrs-env-race

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

wrap_cargo_falls_through_when_sandbox_disabled removes PERRY_SANDBOX_BUILDRS and asserts the plain cargo path, while its sibling wrap_cargo_falls_through_when_package_exempt sets it to 1 at the same time on another test thread. When the two interleave, the first one sees the sandbox enabled and fails at sandbox_buildrs.rs:254 (seen in a local cargo test -p perry --bin perry stack check, 1202/1).

Both tests now take crate::test_env_lock::env_lock(), the crate's shared env mutex. Test-only change. cargo test -p perry --bin perry sandbox_buildrs passed 5/5.

Summary by CodeRabbit

  • Tests
    • Prevented parallel sandbox build tests from racing while modifying the process environment.

@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 1cbb0c1c-a9cd-418b-85a1-e660fbfa7a8b

📥 Commits

Reviewing files that changed from the base of the PR and between 5b85630 and bb312c6.

📒 Files selected for processing (2)
  • changelog.d/11345-sandbox-buildrs-env-race.md
  • crates/perry/src/commands/compile/sandbox_buildrs.rs

Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

Both sandbox buildrs tests now acquire the shared environment lock before changing PERRY_SANDBOX_BUILDRS. A changelog entry records this change.

Changes

Sandbox buildrs test environment

Layer / File(s) Summary
Lock environment changes in tests
crates/perry/src/commands/compile/sandbox_buildrs.rs, changelog.d/11345-sandbox-buildrs-env-race.md
The sandbox-disabled and package-exemption tests acquire the shared environment lock before changing PERRY_SANDBOX_BUILDRS. The changelog records the change.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to bb312

Both tests now serialize changes to PERRY_SANDBOX_BUILDRS, preventing their parallel environment race. The change is limited to tests and a changelog entry, with no actionable merge risk identified.

Architecture Summary

Architecture risk: 🔵 Low · up to bb312

The change affects 2 systems.

Changed systems: crates, changelog.d

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — crates (service) was modified; 1 changed file maps to changed impact.
  • observed — changelog.d (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in changelog.d/11345-sandbox-buildrs-env-race.md: Adds a changelog entry describing the shared environment lock used by the two tests that remove or set PERRY_SANDBOX_BUILDRS.
  • observed — Modified behavior in crates/perry/src/commands/compile/sandbox_buildrs.rs: The sandbox-disabled test now acquires the shared environment lock before removing the opt-in variable and checking the unsandboxed command.
  • observed — Modified behavior in crates/perry/src/commands/compile/sandbox_buildrs.rs: The package-exemption test now acquires the shared environment lock before setting the sandbox opt-in and checking the unsandboxed command.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description provides a clear technical summary and reports a focused test result, but it does not use the required Summary, Changes, Related issue, Test plan, Screenshots / output, and Checklist s… Rewrite the description using the repository template. Add the required section headings, list the concrete changes, state the related issue or "n/a", document the test commands and results, complete the applicable checklist items, and incl…
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. (1 skipped: 1 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the two sandbox_buildrs tests and the PERRY_SANDBOX_BUILDRS race that the change fixes.
Full details: Description check

Explanation

The description provides a clear technical summary and reports a focused test result, but it does not use the required Summary, Changes, Related issue, Test plan, Screenshots / output, and Checklist sections.

Resolution

Rewrite the description using the repository template. Add the required section headings, list the concrete changes, state the related issue or "n/a", document the test commands and results, complete the applicable checklist items, and include screenshots or output when applicable.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

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.

❤️ Share

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

@proggeramlug
proggeramlug merged commit 2f2c872 into main Sep 25, 2026
34 of 36 checks passed
@proggeramlug
proggeramlug deleted the fix/sandbox-buildrs-env-race branch September 25, 2026 21:31
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.

1 participant