Skip to content

proposal: add a test, race and goroutine leak CI lane #385

Open

Description

@JeremySNR

Following the CONTRIBUTING guidance to talk before building anything sizable, so here's a proposal before I write a line of it.

The short version

There's currently no automated test gate on the repo. docker.yml only fires on push to main and doesn't run tests, and nothing runs on pull requests at all. No go test, no lint, no race detector. The "CI validates this repo with GOWORK=off" line in CONTRIBUTING refers to the SDK module resolution check in the Docker workflow, which is the only Go validation that exists today.

I'd like to fix that with a two lane CI setup: a fast test lane on every PR, and a race + goroutine leak lane alongside it. I'm offering to do the work in small, independently reviewable PRs, and you can stop the series at any point.

Why I think it's worth it

The bug class this catches is the bug class this project actually has. The four fixes I've got open right now (#381, #382, #383, #384) are all concurrency or resource lifetime bugs: a lock held across slow teardown that froze playback, two registries and a codec map growing forever, and an unbounded goroutine spawn per API request. Your own design docs record a fair few more of the same shape (the ffmpeg two-writers race, the semantic coverage map race, the login refresh race). None of these need exotic tooling to catch. They need contention tests running under -race, and leak checks on the long lived singletons.

Some of the highest concurrency code also has the least coverage right now. nodesessions.Tracker (session map plus a background refresh ticker) has no test file at all, logstream.Hub has none either, and events.Hub is untested. Meanwhile the playback lifecycle lock tests are genuinely good, so there's already a house style to extend rather than something new to invent.

One more small thing I'd fix in passing: DEVELOPMENT.md says Go tests use testcontainers, but testcontainers isn't in go.mod. DB tests actually skip on a missing SILO_TEST_DATABASE_URL.

The proposed shape

  1. Fast test lane. A test.yml workflow on pull_request and push to main, GitHub hosted runners (free for public repos, stays off your self hosted box). apt-get install libvips-dev on ubuntu-latest so the full suite runs, GOWORK=off go test ./... with module caching. Plus a make test target so local and CI match. DB gated tests keep self skipping.
  2. goleak + first tests for the untested singletons. Promote go.uber.org/goleak to a direct dep (it's already in go.sum transitively), add the three line TestMain to the packages that own goroutines, and write lifecycle tests for Tracker, events.Hub and logstream.Hub. These alone would have caught two of my four open fixes before they shipped.
  3. The race lane. A parallel job running go test -race, advisory at first. I've already identified the tests most likely to flake under the race detector's slowdown (the 25 to 50ms time.After deadlines in admin_intro_test, the sleeps in playback session_test, and a few others). I'd soak the lane ten times locally before it lands, and anything flaky gets fixed or skipped with a linked issue rather than blocking the launch.
  4. Deflake with testing/synctest. It's stable on Go 1.25+ and the repo is on 1.26. Converting the wall clock timing tests to synctest bubbles makes them deterministic and near instant, so the suite gets faster while getting stricter. The subprocess based ffmpeg tests stay as they are since bubbles can't contain external processes.
  5. Contention tests for the remaining hot spots, one small PR per subsystem: jellycompat session stores, the downloads config lock, notification workers, adminjob heartbeat loops, and a regression test for the exact force reload race from fix(transcodenode): stop force reload blocking playback on the node #382.
  6. Optional extras if you want them: a Postgres service container to unlock the 28 self skipping DB test files, a golangci-lint job (the make target exists but CI never runs it), and a nightly deeper race run.

The main risk is flaky timing tests souring people on the lane, which is why the deflake work is a proper phase and the race lane starts advisory. A gate that cries wolf gets deleted, so I'd rather land it slowly and have it trusted.

Happy to adjust the shape, start with just phase 1, or drop it entirely if you'd rather keep CI minimal while things are moving fast. But given the codebase is mostly AI written and your CONTRIBUTING calls out silent regressions as the thing you care about most, an automated gate feels like the highest value thing I could contribute.

Built with AI assistance on the research and drafting. The findings are all verified against the repo and I'm happy to own the work.

Activity

  1. added
    triaged
    and removed
    triaged
    on Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions