docs(review): note why a pump Send racing program exit is safe · Entire
docs(review): note why a pump Send racing program exit is safe
c78a8c5→main·
peyton-alt·1w ago·1 file·+4 added/-1 removed
Review asked whether the pump can Send after the Bubble Tea program exits (select picking a queued msg after done closes). It can — and it's a no-op by construction: tea.Program.Send is a context-guarded select and the msgs channel is never closed, so a post-exit Send returns immediately rather than panicking or blocking. Recorded at the pump so the next reader doesn't re-derive it from the tea source.
Co-Authored-By: Claude Fable 5 noreply@anthropic.com
Sessions
01KX0Z9J512Y4QA9MHEGY042RTView transcript
Changes
1
cmd/entire/cli/review
Mtui_sink.go+4/-1
151 unmodified lines
152
153
154
155
155
156
157
158
159
160
161
151 unmodified lines
// Pump: the only goroutine allowed to block on Program.Send. When the
// program exits (done closes), a blocked Send unblocks via the program's
// context and the pump drains out.
// context and the pump drains out. A Send that races program exit (done
// closes while a queued msg is in hand) is equally safe: Bubble Tea's
// Send is a context-guarded select and the msgs channel is never closed,
// so a post-exit Send is an immediate no-op — not a panic, not a block.
go func() {
defer close(s.pumpDone)
for {
Mcmd/entire/cli/review/tui_sink.go+4/-1