Skip to content

playOut leaves slow work running, and the test reads what it still writes #182

Closed

Description

@ingvarch

TestDispatch_WithAPriority failed with a data race in CI on ubuntu under -race (#179, a branch that changes no Go code): the test read fakeEditor.seen and opened (internal/ui/edit_test.go:42) while the edit command still wrote them in a goroutine playOut started (internal/ui/writes_test.go:148), and the dispatch after the edit never ran.

playOut tells a command that waits on a stream from slow work by time: a command that has not answered lateAnswer (100 ms) after it started is left running when the rest is done. On a slow runner under the race detector, the fake editor (a file read and write) took longer than that, so playOut returned with it running. Any test whose last command is slow work can fail the same way.

Timers are already told apart without time (timersHeld, startTimer). Only three places in internal/ui wait on a stream inside a command: feed.go (events), logs.go (log lines) and watch.go (changes). A fix: playOut knows which running commands wait on a stream, and waits for every other command until it answers (with a bound that fails the test instead of hanging), so no test reads what a command still writes. A guard test keeps every stream wait in the known places, the way TestTimers_StartInOnePlace does for timers.

Activity

  1. added this to the v0.17.0 milestone on Nov 4, 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

    bugSomething isn't workingtestTests only

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions