Skip to content

test: serialize TestServerEnvOverlay to kill global-cache flake#143

Merged
Sootopolis merged 1 commit into
mainfrom
wip
Jun 30, 2026
Merged

test: serialize TestServerEnvOverlay to kill global-cache flake#143
Sootopolis merged 1 commit into
mainfrom
wip

Conversation

@Sootopolis

Copy link
Copy Markdown
Owner

What

  • TestServerEnvOverlay: add @@ TestAspect.sequential (+ import, corrected suite comment). It was the lone global-state-mutating suite without it.
  • TestChessComClientThrottling (suiteTimingStats): widen recovery timeoutFail 5s → 12s (live-clock jitter headroom, stays under the suite's 15s timeout so the specific failure message wins).

Fixes

Flaky main CI failure — run 28403494042 attempt 1 (2026-06-29, #142 merge): ConfigException$Missing: No configuration setting found for key 'v' on the optional ${?VAR} test. Passed on rerun, which masked it for ~6 weeks (gh run list shows only the latest attempt).

Root cause: the suite mutates process-global state (JVM system properties + the global Typesafe ConfigFactory cache). Test / parallelExecution := false serializes only across suites; ZIO Test runs tests within a suite in parallel by default, so a sibling test's invalidateCaches()/defaultOverrides() could land between a test's overlay-set and its resolve(). Production ServerEnvOverlay was already correct — purely test-harness isolation.

Testing

  • sbt test full suite: 997 passed, 0 failed (also via the pre-push hook).
  • TestServerEnvOverlay 5× standalone: 7/7, no ConfigException.
  • TestChessComClientThrottling: suiteTimingStats green with the widened timeout.

Systemic note

The gh run rerun --failed habit hid this flake for 6 weeks of false-green. Worth triaging a failed attempt-1 before rerunning so the green record reflects reality. No CI-config change here.

🤖 Generated with Claude Code

TestServerEnvOverlay flaked on main CI (run 28403494042 attempt 1,
2026-06-29) with `ConfigException$Missing: No configuration setting
found for key 'v'` on the optional `${?VAR}` substitution test, then
went green on rerun — masking it for ~6 weeks of false-green, because
`gh run list` only surfaces the latest attempt's conclusion.

Root cause: the suite mutates two pieces of process-global state — JVM
system properties and the global Typesafe `ConfigFactory` systemProperties
cache. `Test / parallelExecution := false` only serializes across suites;
ZIO Test runs the tests WITHIN a suite in parallel by default. It was the
lone global-state-mutating suite missing `@@ TestAspect.sequential` (cf.
TestJobLogSink / TestFileSink, which swap System.setOut/setErr and carry
it), so a sibling test's invalidateCaches()/defaultOverrides() could land
between a test's overlay-set and its resolve(), dropping the value. Adding
`@@ TestAspect.sequential` makes each test's set→invalidate→read flow
deterministic. Production ServerEnvOverlay was already correct; this is
purely test-harness isolation.

Also widen the throttling recovery poll's `timeoutFail` 5s → 12s
(TestChessComClientThrottling, suiteTimingStats). It runs under
`@@ withLiveClock`; 12s sits deliberately under the suite's 15s timeout
so its specific "recovery did not complete" message fires before the
generic suite timeout, with headroom for CI-runner jitter over the 100ms
cooldown.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Sootopolis Sootopolis merged commit b1c5c9c into main Jun 30, 2026
1 check passed
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