Skip to content

fix: turn CI on main green (unprotected record race, stale Strata fixture) - #269

Merged
T-Crypt merged 2 commits into
mainfrom
T-Crypt/run-waits-for-lost-record
Oct 30, 2026
Merged

T-Crypt merged 2 commits into
mainfrom
T-Crypt/run-waits-for-lost-record

Conversation

@T-Crypt

@T-Crypt T-Crypt commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

CI on main is red, and two tests cause it.

1. TestParkedEngineReattachesParked: a record left behind

Run 40968557417 failed after the v0.4.0 merge. The test passed, then its temp dir cleanup failed with this error:

TempDir RemoveAll cleanup: unlinkat .../berth-unprotected: directory not empty

When berthd goes away mid-run, the berth run listener writes a record to berth-unprotected/ and waits to re-attach. If the engine exits during that wait, Run closes done and returns right away. The listener removes the record a moment later, on its own goroutine. In the test, the daemon stops before the engine is killed, so RemoveAll sometimes ran inside that window.

Run now hangs up its first connection when the engine exits, as it already does for a re-attached connection. It then waits for the listener goroutine to return before it returns itself. The listener can block only on calls that end when the engine exits or that time out (lendCallTimeout), so the wait cannot hang.

TestRunReturnsWithItsLostRecordGone stops the daemon, waits for the record, kills the engine, and checks that berth-unprotected/ is empty once Run returns. Before the fix, it failed 12 of 20 runs with records left after Run returned: [<pid>.json]. After the fix, it and TestParkedEngineReattachesParked passed 20 of 20 runs each.

2. TestStrataRequestsReachTheLeaderboard: a fixture past the 24h window

The test pinned its requests to 2026-10-28 21:35 MDT. The engine watcher keeps 24 hours of requests (keepRequests), so from 2026-10-30 03:35 UTC it drops both rows. The test fails on main, on next, and on every open PR, #221 included. The fixture now sits an hour before the test runs, with the same MDT zone and microseconds. It passes with TZ set to UTC, America/Denver and Asia/Kolkata.

Proof

go build, gofmt, go vet, the Windows build and vet, golangci-lint v2.14.0 (0 issues) and go test -count=1 ./... all pass locally. The -count=1 matters here. A cached run reported the Strata test as passing after it had started to fail.

next needs the same two changes. I'll merge main into next after this lands.

When berthd went away mid-run, the listener wrote an unprotected-run
record and then waited to re-attach. If the engine exited in that wait,
Run returned before the listener removed the record. A test that removed
its temp dir right after Run returned failed with "directory not empty",
which turned CI red on main after the v0.4.0 merge.

Run now hangs up the first connection when the engine exits and waits
for the listener to finish before it returns.
The test pinned its requests to 2026-10-28 21:35 MDT. The watcher keeps
24 hours of requests, so from 2026-10-30 03:35 UTC it dropped both rows
and the test failed on every branch. The fixture now sits an hour before
the test runs, with the same zone and microseconds.
@T-Crypt T-Crypt changed the title fix(run): return only after the listener removes its unprotected record fix: turn CI on main green (unprotected record race, stale Strata fixture) Oct 30, 2026
@T-Crypt
T-Crypt merged commit 1a4dac5 into main Oct 30, 2026
2 checks passed
T-Crypt added a commit that referenced this pull request Oct 30, 2026
Merge main into next: v0.4.0 and the CI fixes from #269
@T-Crypt
T-Crypt deleted the T-Crypt/run-waits-for-lost-record branch October 31, 2026 02:57
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