test: serialize TestServerEnvOverlay to kill global-cache flake#143
Merged
Conversation
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>
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.
What
TestServerEnvOverlay: add@@ TestAspect.sequential(+ import, corrected suite comment). It was the lone global-state-mutating suite without it.TestChessComClientThrottling(suiteTimingStats): widen recoverytimeoutFail5s → 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 listshows only the latest attempt).Root cause: the suite mutates process-global state (JVM system properties + the global Typesafe
ConfigFactorycache).Test / parallelExecution := falseserializes only across suites; ZIO Test runs tests within a suite in parallel by default, so a sibling test'sinvalidateCaches()/defaultOverrides()could land between a test's overlay-set and itsresolve(). ProductionServerEnvOverlaywas already correct — purely test-harness isolation.Testing
sbt testfull suite: 997 passed, 0 failed (also via the pre-push hook).TestServerEnvOverlay5× standalone: 7/7, noConfigException.TestChessComClientThrottling:suiteTimingStatsgreen with the widened timeout.Systemic note
The
gh run rerun --failedhabit 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