Skip to content

fix(parser): merge gemini env-var tests to avoid cargo-parallel race#148

Merged
mag123c merged 1 commit into
mainfrom
fix/issue-144-env-race
May 14, 2026
Merged

fix(parser): merge gemini env-var tests to avoid cargo-parallel race#148
mag123c merged 1 commit into
mainfrom
fix/issue-144-env-race

Conversation

@mag123c
Copy link
Copy Markdown
Owner

@mag123c mag123c commented May 14, 2026

Summary

Main CI broke immediately after #145 merged. test_gemini_cli_home_env_var_overrides_home got \"/home/runner/.gemini/tmp\" instead of the expected /tmp/toktrack-gemini-env-test/... — the sibling test test_gemini_cli_home_empty_string_falls_through (running in parallel) had already restored GEMINI_CLI_HOME via remove_var before case 1 finished asserting.

The reviewer flagged this as P1#1 during /review; I dismissed it because the repo already follows the same pattern in src/services/pricing.rs. The pricing tests have apparently been lucky so far; the gemini pair surfaced the race because both tests touch the same env var with different expected values.

Fix

Combine both scenarios into a single #[test] so they run serially in one thread. No mutex, no extra crate — minimal diff.

Test plan

  • cargo test --lib parsers::gemini — 19 passed (was 20 before, one less because merged)
  • CI green on 3 OS

The two `GEMINI_CLI_HOME` tests ran in parallel under cargo test and
clobbered each other's env state — case 2's `remove_var` ran while
case 1 was mid-assertion, producing intermittent failures on main CI.

Combine both scenarios into a single `#[test]` so they execute serially
within one thread.
@mag123c mag123c merged commit 317ddec into main May 14, 2026
3 checks passed
@mag123c mag123c deleted the fix/issue-144-env-race branch May 14, 2026 13:04
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