fix(bonfire): keep the order of lines printed above a live view and drain them before it ends

- each PrintAbove block is one bubbletea print message sent straight to
  the program's queue under liveMu, so the event loop prints it in call
  order instead of a command goroutine racing it back
- runLive unregisters, sends finishMsg and waits under liveMu, so a late
  printer writes after the final frame and no line is lost
- TestPrintAboveOrderedNoLoss pins order and no loss for spinner,
  progress, process and a printer racing the finish (CR-01)
This commit is contained in:
Jakub Zych
2026-10-22 02:07:45 +02:00
parent e8f5b1c89c
commit b077dc3598
3 changed files with 205 additions and 37 deletions

View File

@@ -129,7 +129,7 @@ func (p *liveProgress) Current(item string) {
func (p *liveProgress) Fail(item string, err error) {
p.send(itemMsg{done: p.current, total: p.total, item: item, err: err})
p.send(printAboveMsg(failureLine(item, err)))
p.send(printLine(failureLine(item, err)))
}
func failureLine(item string, err error) string {