Skip to main content
← Back to list
01Issue
BugShippedSwamp CLIPublic
Assigneesskunk-ape

Relationships

#2313 deno task test fails on main: shared-env home writes, TTY assumptions, and two flaky tests

Opened by skunk-ape · 9/21/2026· Shipped 9/21/2026

deno task test failed on main (bcaa9695). Investigation found five distinct defects. Three only reproduce in particular environments, which is why CI stayed green.

1. ENOTEMPTY race (the reported failure)

deno test --parallel runs every test file in ONE process with ONE shared Deno.env (verified: two files, same pid, each observing the other's env writes). RepoService.init/upgrade resolved their user-level write targets from that environment, so a repo init in one file installed bundled skills into whatever HOME another file had momentarily assigned. user_identity_repository_test's temp HOME received a skill tree mid-teardown and its recursive delete failed with "Directory not empty (os error 66)". Timing-dependent, so it looked environmental.

2. Developer home clobbering

The same writes overwrote the real ~/.claude/skills, ~/.agents/skills and ~/.kiro/skills on every deno run test. Also ~/.config/swamp/telemetry, via the legacy spool migration in RepoService.upgrade — that path is gated on the repo's telemetryDisabled marker rather than SWAMP_NO_TELEMETRY, by design, so the env var never suppressed it.

3. TTY-dependent test

useTerminalSize_test failed 3/3 whenever the suite ran from a terminal, on any branch, since 9ab44400. All three cases targeted the fallback branch but relied on Deno.consoleSize() throwing for ambient reasons instead of forcing it, so in a terminal they compared the real pane size against the 80x24 defaults. Invisible in CI and piped runs. The primary branch had no coverage at all.

4. Zero-size console

Deno.consoleSize() succeeds on a 0x0 pty (bare script, some CI runners), returning zeros rather than throwing. Both call sites treated "did not throw" as "usable" and passed the zero into layout, where callers divide by it and hand it to String.repeat. The ?? 80 fallback cannot catch it either, since 0 is not nullish.

5. Two nondeterministic tests

  • deferred_expression_property_test failed roughly 1 run in 6. Its dictionary generator can produce the prototype key, which zod drops when rebuilding a parsed record, because Deno disables assignment to that property.
  • source_fetch_test really fetched github.com, so it failed whenever GitHub was slow — observed as an HTTP 504 where the 404 test expected a missing tag.

Fix

Inject the directories and the console-size probe rather than reading them from ambient state; require a positive dimension before accepting a console reading; exclude the prototype key from the generated keys; serve the source archive from a port-0 localhost server. All defaults fall back to the previous lookups, so production behaviour is unchanged.

Verification

Full suite green piped and under a 204x50 pty (12298 passed, 0 failed), repeatedly, with zero writes to the real home. Regression coverage includes a pinned-ratchet fitness test that fails on any test constructing RepoService without explicit user dirs. Each new test was confirmed to fail without its fix.

02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED+ 1 MOREASSIGNED+ 2 MOREREVIEW+ 6 MOREPR_MERGED+ 2 MORESESSION_SUMMARIZED

Shipped

9/21/2026, 6:13:03 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
skunk-ape assigned skunk-ape9/21/2026, 5:02:53 PM
Editable. Press Enter to edit.

skunk-ape commented 9/21/2026, 6:15:39 PM

Shipped. Merged as PR https://github.com/swamp-club/swamp/pull/2520, commit [REDACTED-SECRET-1].

Verification attestation 4d6fed48-f15c-42bf-9cbf-5de4b14b1888 for commit 174d8c0e: 22 steps, 19 succeeded, 3 guard-skipped, 0 failed. Code, adversarial and UX reviews all returned a pass verdict; CI security and skill reviews were guard-skipped as no workflow or skill files changed.

Follow-ups filed: swamp-club#2320 covers two ordering deadlocks in the issue-lifecycle model hit while shipping this. Two smaller items were noted and not actioned — the test suite also writes into the repository's own .swamp directory, and the new dependency-injection convention for tests is enforced by a fitness test but not yet documented in AGENTS.md.

skunk-ape commented 9/21/2026, 6:15:50 PM

Correction: the merge commit redacted above is 8ef40537 (the full 40-character hash tripped the automatic secret redactor, which reads it as high-entropy hex). The commit that was verified and attested is 174d8c0e.

Sign in to post a ripple.