Skip to content

v0.1.14: fix flaky tui::theme tests racing on process env#24

Merged
lai3d merged 1 commit into
mainfrom
claude/fix-flaky-theme-test
May 22, 2026
Merged

v0.1.14: fix flaky tui::theme tests racing on process env#24
lai3d merged 1 commit into
mainfrom
claude/fix-flaky-theme-test

Conversation

@lai3d

@lai3d lai3d commented May 22, 2026

Copy link
Copy Markdown
Contributor

Pre-existing race surfaced by PR #23's macOS CI run. Two tests mutated process-global MERLION_THEME env from parallel test threads. Refactor extracts a pure ThemeKind::parse() so tests don't touch env.

cargo test --workspace green; cargo clippy --workspace --all-targets -- -D warnings clean.

🤖 Generated with Claude Code

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>
@lai3d lai3d merged commit 89053c6 into main May 22, 2026
2 checks passed
@lai3d lai3d deleted the claude/fix-flaky-theme-test branch May 22, 2026 03:26
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