v0.1.14: fix flaky tui::theme tests racing on process env#24
Merged
Conversation
PR #23 (Homebrew v0.1.13 bump) tripped a pre-existing race in `tui::theme::tests` on macOS. The two tests shared a process-global env var: dark_is_default_when_env_unset: remove_var("MERLION_THEME") light_kicks_in_when_env_is_light: set_var("MERLION_THEME","light") `cargo test` runs tests on parallel threads; the env var is per-process, not per-thread, so when scheduling interleaved them the "default" test saw the "light" value left over from the other thread and panicked. The ordering had been benign on Ubuntu but flipped on macOS. Fix: extract a pure `ThemeKind::parse(Option<&str>)` from `from_env()`. Tests now call `parse(None)` / `parse(Some("light"))` and never touch process env. Three tests instead of two — added an "unknown value / empty string falls back to Dark" case for free. Note: v0.1.13 itself shipped fine (the tagged release workflow on a fresh checkout passed; this race is `cargo test` order-dependent). This patch just cleans up CI signal for future PRs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pre-existing race surfaced by PR #23's macOS CI run. Two tests mutated process-global
MERLION_THEMEenv from parallel test threads. Refactor extracts a pureThemeKind::parse()so tests don't touch env.cargo test --workspacegreen;cargo clippy --workspace --all-targets -- -D warningsclean.🤖 Generated with Claude Code