Skip to content

test(explain): merge racing CSHIP_ACCOUNT tests into one - #206

Merged
stephenleo merged 3 commits into
mainfrom
fix/explain-account-env-test-race
Sep 6, 2026
Merged

stephenleo merged 3 commits into
mainfrom
fix/explain-account-env-test-race

Conversation

@stephenleo

Copy link
Copy Markdown
Owner

Fixes the flaky Test (windows-latest) failure on main (run 34024827695).

test_error_hint_account_malformed_env_names_env_as_cause and test_error_hint_account_empty_env_falls_back_to_credential_probe both mutate the process-global CSHIP_ACCOUNT. Cargo runs them on separate worker threads, so the empty-env test's set_var(" ") / remove_var can land between the malformed test's set_var("{not json") and its assertion — the hint then omits CSHIP_ACCOUNT and the assert fails. The stale comment claiming "no other test in this file touches CSHIP_ACCOUNT" was the tell.

Merged both cases into a single test, which makes them sequential by construction — no mutex or serial_test dependency.

fmt / clippy / 605 tests green locally.

🤖 Generated with Claude Code

stephenleo and others added 3 commits September 6, 2026 17:37
`std::env::set_var` is process-global, so the malformed-env and empty-env
tests clobbered each other when cargo scheduled them concurrently — the
empty test's "   " (or its remove_var) could land between the malformed
test's set_var and its assertion, dropping CSHIP_ACCOUNT from the hint.
Failed on Windows CI for main (run 34024827695); passes on reruns.

Merging both cases into one test makes them sequential by construction, no
mutex or serial-test dependency needed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
test_render_passthrough_returns_none_for_nonexistent_module resolves
`starship` from PATH but did not hold PATH_MUTEX. Sibling tests point
PATH at mock starship scripts that print output, so an overlap made
render_passthrough return Some(...) and the assert fail (ubuntu CI).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@stephenleo
stephenleo force-pushed the fix/explain-account-env-test-race branch from a482c73 to 43c804c Compare September 6, 2026 10:14
@stephenleo
stephenleo merged commit c49ce19 into main Sep 6, 2026
3 checks passed
@stephenleo
stephenleo deleted the fix/explain-account-env-test-race branch September 6, 2026 10:16
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