Skip to main content
← Back to list
01Issue
BugShippedSwamp CLIPublic
Assigneesstack72

Relationships

#2658 Flaky test: resolve_datastore_test sets SWAMP_DATASTORE process-wide and breaks parallel workflow_recover_test

Opened by stack72 · 9/28/2026· Shipped 9/29/2026

Problem

The test 'resolveDatastoreConfig: resolves env expression in SWAMP_DATASTORE env var' (src/cli/resolve_datastore_test.ts:509) sets the process-global SWAMP_DATASTORE env var to a test-only datastore type (@test/ds-expr-env) and restores it in a finally block. deno test runs files in parallel in one process, so any test that resolves the repo datastore while it is set picks up the test value.

Observed in verify-build run ea3db741-b336-4f02-bfad-4e0bcfebd5c8 (commit 6359bb15, branch 2602, swamp-club#2602):

workflowRecoverCommand: recovers a run of a workflow with an inputs expression, and refuses once the definition changes (src/cli/commands/workflow_recover_test.ts:415) failed with: UserError: Unknown datastore type: @test/ds-expr-env. Available types: filesystem, thrown from parseDatastoreEnvVar (src/cli/resolve_datastore.ts:242) via requireInitializedRepoUnlocked.

The same suite passed on the previous commit, and neither file was touched, so this is an ordering race, not a code change.

Expected

AGENTS.md says unit tests must not mutate process-global state such as Deno.env, because it races across parallel test files. The resolve_datastore tests that set SWAMP_DATASTORE (and the SWAMP_TEST_DS_INTEG_TOKEN* vars) should inject the env value instead of setting it: pass it through a parameter or seam on resolveDatastoreConfig / parseDatastoreEnvVar, or mock the env read. Other tests in that file that set SWAMP_DATASTORE should be checked for the same pattern.

02Bog Flow
✓OPEN✓TRIAGED✓IN PROGRESS✓SHIPPED+ 1 MOREASSIGNED+ 7 MOREREVIEW+ 10 MOREPR_MERGED+ 2 MORESESSION_SUMMARIZED

Shipped

9/29/2026, 12:16:04 AM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack729/28/2026, 11:25:17 PM

Sign in to post a ripple.