Skip to content

test: keep drop-in temp workspaces distinct on Darwin - #16568

Merged
EffortlessSteven merged 2 commits into
mainfrom
claude/project-thread-4kusnz
Nov 29, 2026
Merged

EffortlessSteven merged 2 commits into
mainfrom
claude/project-thread-4kusnz

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Fixes analysis::facts::test_styles::tests::binary_root_alias_refuses_unresolved_intermediate_paths, which failed on main's scheduled macOS run 46231253682 (job 141254080028). Its assertion read [] where it expected ["aliased"].
  • Cause (inferred from code and the failure shape): drop_in::temp_workspace names fixture roots ripr-drop-in-{label}-{pid}-{nanos}. Darwin's clock reports microseconds, so parallel tests with the same label can get the same root. The whole binary-test-alias family shares one label, so when one test runs remove_dir_all it deletes the other test's manifest, and the alias stays uncredited. The same class hit imported_call_operator_tests in fix(macos): settle zombie-only process groups and clear the native library test failures (#16104) #16149; that run's directory name ended in ...000.
  • Fix: an in-process AtomicU64 serial in the root name, which covers all 61 temp_workspace call sites. The tests still run in parallel.
  • Not in this PR: git::tests::poll_child_returns_promptly_for_a_fast_exiting_child (54 ms against a 50 ms bound) failed in the same run. It passed in the three previous macOS runs, and this run took 895 s where the last green one took 548 s, so I classify it as runner load, not a source regression.

Swarm / Source Boundary

Swarm-only test-helper change.

Source-of-truth Links

Governing issue or accepted claim: #16104 (macOS native lib-test failures; follow-up from the first post-merge main macOS run)
Acceptance delta (one sentence): binary_root_alias_refuses_unresolved_intermediate_paths no longer loses its fixture to a same-timestamp temp_workspace root collision, and a host-independent test proves two roots with one label and one timestamp differ.

Candidate Relationships

Scope Classification

Test-only. No production code changes.

Support-tier Impact

None.

Policy Impact

None.

Proof

cargo fmt --check
CARGO_INCREMENTAL=0 cargo clippy -p ripr --lib --tests -- -D warnings   # clean
# hosted macos-15: workflow_dispatch of macos-advisory.yml on this branch (result posted when complete)

The lib-test binary cannot be built in the cloud container, so the hosted macOS run is the behavioral proof.

Claim Boundary

Removes one cause of flaky macOS fixture collisions in tests that use temp_workspace. Other test helpers that name directories by pid and nanoseconds alone are not changed.

Rollback

Revert the commit.

Spec-Test-Code Traceability

  • Code: crates/ripr/src/analysis/facts/drop_in.rs (test-only helper)

Static Language Check

No user-facing text.

CI Economics

One macOS dispatch.

Engineering Check

Smallest change at the shared owner.


Generated by Claude Code

binary_root_alias_refuses_unresolved_intermediate_paths failed on main's
macOS run 46231253682 with [] instead of ["aliased"]. The shared test
helper drop_in::temp_workspace names roots ripr-drop-in-{label}-{pid}-{nanos};
Darwin's clock reports microseconds, so parallel tests with the same label
(the binary-test-alias family uses one label) could share a root and one
test's remove_dir_all deleted the other's manifest. An in-process serial
makes each root unique for all 61 call sites.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SvmPmoZMC5G2yepsLm5mr2
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

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

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 51 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 139 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 33f58442-3845-4b1f-bc83-3b23ac592c0b
Commits

Reviewing files that changed from the base of the PR and between 4fba199 and 1f622cc.

Files selected for processing: 1

  • crates/ripr/src/analysis/facts/drop_in.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Copy link
Copy Markdown
Member Author

Independent read of the other failure, kept out of this PR: the raw macOS result records 21,930 passed / 2 failed / 4 ignored. The Git timing test's Instant starts before OwnedProcess::spawn(command), so 54.448542 ms covers spawning sh, starting sleep, scheduler time and polling. It does not measure polling alone or establish a production regression. For a separate follow-up, #11855 is a useful precedent: keep a deadline-bounded real-child smoke, but have a deterministic poll-loop probe record the requested delays on an explicitly running→exited script. Require the old fixed-50 ms wait to fail the deterministic probe rather than just loosening the wall-clock threshold or increasing retries. This does not block the separate workspace-collision fix; its Darwin cause remains an inference until exercised.

Copy link
Copy Markdown
Member Author

macOS proof, run 46235940730 on 33e06a6d: 21,934 passed, 1 failed, 4 ignored.

  • binary_root_alias_refuses_unresolved_intermediate_paths ... ok, along with the other 7 binary_root_alias_* tests. That test was already intermittent, so one pass is consistent with the collision fix but does not prove it. The Darwin cause is still an inference.
  • 1 failure is not this PR's: python_tests::source_fact_extraction_stays_linear_on_a_large_module, growth exceeded 3x plus 2ms after remeasure: 2.30s -> 7.29s. The test parses an in-memory module and does not call temp_workspace, so this diff cannot reach it. It passed in each of the 4 previous macOS runs, including main's 11-29 run 46231253682. Absolute times of 1 to 7 seconds for a 2,500 to 5,000 line parse point to CPU contention on the runner. I'm not retrying the advisory lane for it.

Generated by Claude Code

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review November 29, 2026 07:46
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SOURCE_REVIEW_READY

Independent source review of head 33e06a6de1c1220b489e59994df494d869502419 against base 4fba199abc978025f0cbcd808d0463faea632015, by a session that did not write this branch. One file, +5/−1, test-only.

Inspected

  • crates/ripr/src/analysis/facts/drop_in.rs::temp_workspace (#[cfg(test)]): the root name gains a process-wide AtomicU64 serial after the nanosecond stamp. fetch_add hands each call a distinct value, so two calls in one process cannot produce the same name whatever the clock resolution; the pid already separates processes. Relaxed is sufficient because only uniqueness of the returned value matters. No production path changes and the tests keep running in parallel.
  • Failure being repaired: main run 46231253682, job 141254080028, test_styles/tests.rs:1744, left: [], right: ["aliased"]. Every binary_root_alias_* test builds its fixture through alias_test_names_with_manifest with the single label binary-test-alias, and members of that family write different app/Cargo.toml contents and remove the root when done. A shared root therefore lets a sibling either delete the manifest or replace it with one that must not credit the alias, and both produce an empty list at that assertion. The mechanism fits the observed value.
  • The fix sits in the shared helper, so every temp_workspace caller gets it rather than this one family.

Evidence read

  • macOS run 46235940730 on this exact head, job 141270412047: running 21939 tests, 21934 passed; 1 failed; 4 ignored. binary_root_alias_refuses_unresolved_intermediate_paths ... ok.
  • The one failure is python_tests::source_fact_extraction_stays_linear_on_a_large_module (2.30 s to 7.29 s after remeasure). It is a timing ratio on an in-memory parse and does not reach temp_workspace, so this diff cannot have caused it. It is a separate open item for the lane.
  • No review threads exist on this PR.

Limits

  • The collision is an inference from the code and the failure value; the failing run's directory names were not retained. One passing run of an intermittent test is consistent with the repair and does not prove the cause. The change is correct on its own terms either way, since the old name was not unique by construction.
  • git::tests::poll_child_returns_promptly_for_a_fast_exiting_child (tracked in #16574): I accept load as the trigger, with one addition. The test takes the best of 20 attempts, and the backoff of 1, 2, 4, 8, 16, 32, 50 ms observes the child at roughly 1, 3, 7, 15, 31 and then 63 ms. A child whose spawn plus sleep 0.01 runs past about 31 ms cannot be seen under the 50 ms bound, so a loaded runner fails all 20 attempts together instead of occasionally. That is a cliff in the test's bound, worth recording on #16574.
  • No Linux, Windows or required qualification result exists on this head yet.

Generated by Claude Code

@devin-ai-integration devin-ai-integration 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.

Devin Review found 1 potential issue.

Devin Review

Extract temp_workspace_root and test that two calls with the same label
and the same clock value get different roots. Removing the serial makes
the test fail on any host, so the repair no longer depends on a macOS run
happening to reproduce the collision (Devin review).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SvmPmoZMC5G2yepsLm5mr2

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SOURCE_REVIEW_READY

Independent source review of head 1f622cc51cbe2360d31ca0e71746cff73464c963, refreshing the review of 33e06a6d for what moved.

What changed since 33e06a6d

One commit, crates/ripr/src/analysis/facts/drop_in.rs only (+23/−8), all under #[cfg(test)].

  • The naming moves into temp_workspace_root(label, nanos), which holds the same AtomicU64 serial and the same format string. temp_workspace reads the clock and calls it, so every existing caller gets an identical name shape to the head the macOS run tested.
  • New test temp_workspace_roots_stay_distinct_for_one_timestamp calls the function twice with one label and one fixed timestamp and asserts the roots differ.

Inspected

  • The test goes through the function temp_workspace actually uses, so it grips the retained path and not a copy of the format string.
  • It discriminates: without the serial the two names are byte-identical on every host, so the assertion fails on Linux and Windows as well as Darwin. That closes the gap Devin raised, where the earlier head relied on a host clock to exercise the collision.
  • Other tests incrementing the same counter in parallel cannot make it pass or fail wrongly, since any two fetch_add results differ.
  • The one review thread (Devin) is replied to and resolved.

Evidence

  • macOS run 46235940730 (21,934 passed, 1 failed, 4 ignored; the alias test ok) ran on 33e06a6d. This head differs from it by the refactor and the added test above; no macOS run exists on this exact head, and the new test has not run on a hosted runner yet.
  • The author reports lib-test clippy clean on this head. I did not build it; the lib test binary does not fit the cloud container.

Limits

  • Hosted qualification on this head is the proof for compilation and for the new test.
  • The earlier limits stand: the Darwin collision remains an inference from code and the failure value.

Generated by Claude Code

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants