package tui import ( "sync" "git.a-wan.net/alan/pipelines/internal/buildinfo" ) // noticeSink collects build/protocol notices from a short-lived client so a TUI // command can surface them through the shared notice path instead of dropping // them. It implements client.Reporter. type noticeSink struct { mu sync.Mutex notices []string } func (s *noticeSink) report(relationship buildinfo.Relationship) { if relationship.Message == "" { return } s.mu.Lock() s.notices = append(s.notices, relationship.Message) s.mu.Unlock() } // drain returns the notices collected so far and resets the sink. func (s *noticeSink) drain() []string { s.mu.Lock() defer s.mu.Unlock() notices := s.notices s.notices = nil return notices } // appendNotices is the single TUI notice path: every server relationship or // unrecognized-field notice is rendered as one warning line, whether it came // from the long-lived read loop or a short-lived command client. func (m *Model) appendNotices(notices []string) { for _, notice := range notices { if notice != "" { m.appendLine("warning: " + notice) } } }