Merge lane-go: titles, verdicts, human stage, line result format, stale-client guard
Integrates nine commits of reviewed work from the lane-go branch after the automated resolver failed on this merge five times (each attempt dying on the malformed-result defect whose fix is contained in this same merge). Integration decisions: - Search: kept main's shipped design (Store.Search + SearchResponse.Results) and dropped lane-go's parallel, older attempt (an unused Message.Matches field, an absent runs.search, and two partial TUI plumbing blocks). lane-go itself did not compile: protocol.SearchMatch was undefined and model.go referenced searchNav, requestSearch and applyRunNav, which exist nowhere. Those partial TUI blocks are removed; the queued TUI omni-search item will implement the surface properly on main's design. - Both sides' additions are kept where they are independent: run titles and provenance, the human decision stage and its CLI/TUI surface, the derived stage verdict, the stale-client guard, the line-oriented result format, and main's search command. - The search key's help label is now "/ omni search"; the two tests asserting the old label are updated rather than the label reverted. - docs/cli.md and the packaged operations reference carry both sides' text. Verified: go build ./... , go vet ./... and the full go test ./... suite pass.
This commit is contained in:
+32
-9
@@ -24,7 +24,10 @@ import (
|
||||
"git.a-wan.net/alan/pipelines/internal/protocol"
|
||||
)
|
||||
|
||||
type connectedMsg struct{ conn *websocket.Conn }
|
||||
type connectedMsg struct {
|
||||
conn *websocket.Conn
|
||||
watch *client.Watch
|
||||
}
|
||||
type receivedMsg protocol.Message
|
||||
type sentMsg struct{ id string }
|
||||
type errorMsg struct {
|
||||
@@ -34,6 +37,7 @@ type errorMsg struct {
|
||||
type socketMsg struct {
|
||||
conn *websocket.Conn
|
||||
message protocol.Message
|
||||
notices []string
|
||||
}
|
||||
type reconnectMsg struct{}
|
||||
|
||||
@@ -109,6 +113,7 @@ type Model struct {
|
||||
ctx context.Context
|
||||
url string
|
||||
conn *websocket.Conn
|
||||
watch *client.Watch
|
||||
status string
|
||||
nextID uint64
|
||||
lines []string
|
||||
@@ -185,6 +190,13 @@ type Model struct {
|
||||
runGraphFocus bool
|
||||
runGraphTop int
|
||||
runGraphPan int
|
||||
decisionOpen bool
|
||||
decisionRunID int64
|
||||
decisionStage string
|
||||
decisionOptions []string
|
||||
decisionIndex int
|
||||
decisionFeedback textinput.Model
|
||||
decisionFeedbackFocus bool
|
||||
editorOpen bool
|
||||
editorInput textinput.Model
|
||||
editorIndex int
|
||||
@@ -209,7 +221,7 @@ func New(ctx context.Context, url string) Model {
|
||||
runSpinner: spinner.New(spinner.WithSpinner(spinner.Spinner{Frames: []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"}, FPS: time.Second / 12}), spinner.WithStyle(lipgloss.NewStyle().Foreground(themeAccent))),
|
||||
keys: keyMap{
|
||||
commands: key.NewBinding(key.WithKeys(":"), key.WithHelp(":", "commands")),
|
||||
search: key.NewBinding(key.WithKeys("/"), key.WithHelp("/", "search")),
|
||||
search: key.NewBinding(key.WithKeys("/"), key.WithHelp("/", "omni search")),
|
||||
create: key.NewBinding(key.WithKeys("n"), key.WithHelp("n", "new pipeline")),
|
||||
enter: key.NewBinding(key.WithKeys("enter"), key.WithHelp("enter", "continue")),
|
||||
cancel: key.NewBinding(key.WithKeys("esc"), key.WithHelp("esc", "cancel")),
|
||||
@@ -236,17 +248,17 @@ func (m Model) connect() tea.Cmd {
|
||||
<-m.ctx.Done()
|
||||
conn.CloseNow()
|
||||
}()
|
||||
return connectedMsg{conn}
|
||||
return connectedMsg{conn: conn, watch: &client.Watch{}}
|
||||
}
|
||||
}
|
||||
|
||||
func (m Model) read() tea.Cmd {
|
||||
return func() tea.Msg {
|
||||
response, err := client.Receive(m.ctx, m.conn)
|
||||
response, notices, err := client.ReceiveNotice(m.ctx, m.conn, m.watch)
|
||||
if err != nil {
|
||||
return errorMsg{err: err, conn: m.conn}
|
||||
}
|
||||
return socketMsg{conn: m.conn, message: response}
|
||||
return socketMsg{conn: m.conn, message: response, notices: notices}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,6 +317,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
m.conn.CloseNow()
|
||||
}
|
||||
m.conn = msg.conn
|
||||
m.watch = msg.watch
|
||||
m.reconnecting = false
|
||||
m.status = m.url
|
||||
if endpoint, err := url.Parse(m.url); err == nil {
|
||||
@@ -325,6 +338,9 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
if msg.conn != m.conn {
|
||||
return m, nil
|
||||
}
|
||||
// Surface the once-only identity/unrecognized-field notices on the same
|
||||
// connection without corrupting the TUI layout.
|
||||
m.appendNotices(msg.notices)
|
||||
return m.Update(receivedMsg(msg.message))
|
||||
case receivedMsg:
|
||||
if msg.Type == protocol.Status && msg.ID == m.statusRequest {
|
||||
@@ -460,6 +476,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
}
|
||||
return m, m.read()
|
||||
case draftValidationMsg:
|
||||
m.appendNotices(msg.notices)
|
||||
if len(m.draftItems) > 0 && m.draftItems[m.draftIndex].Path == msg.path {
|
||||
m.draftError = "Validation passed (structure only)."
|
||||
if msg.err != nil {
|
||||
@@ -582,6 +599,9 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
if m.runForm != 0 {
|
||||
return m.updateRunForm(msg)
|
||||
}
|
||||
if m.decisionOpen {
|
||||
return m.updateDecision(msg)
|
||||
}
|
||||
if m.runOpen && (msg.String() != ":" || m.runSearchOpen) {
|
||||
return m.updateRuns(msg)
|
||||
}
|
||||
@@ -610,11 +630,11 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
m.commandIndex = 0
|
||||
m.commandInput = newInput()
|
||||
if m.searchOpen {
|
||||
m.commandInput.Placeholder = "Search pipelines…"
|
||||
} else {
|
||||
m.commandInput.Placeholder = ":logs"
|
||||
m.commandInput.SetValue(":")
|
||||
m.commandInput.Placeholder = "Type to search…"
|
||||
return m, m.commandInput.Focus()
|
||||
}
|
||||
m.commandInput.Placeholder = ":logs"
|
||||
m.commandInput.SetValue(":")
|
||||
return m, m.commandInput.Focus()
|
||||
case m.homePage() && key.Matches(msg, m.keys.create):
|
||||
if m.conn == nil {
|
||||
@@ -784,6 +804,9 @@ func (m Model) View() string {
|
||||
if m.actionConfirm != nil {
|
||||
content = m.actionConfirmView(bodyHeight)
|
||||
}
|
||||
if m.decisionOpen {
|
||||
content = m.decisionView(bodyHeight)
|
||||
}
|
||||
if m.mutationCommand != nil {
|
||||
paragraphs := []string{"This opens a new session/editor and may modify a retained draft.", "Published definitions and previous run history are unchanged."}
|
||||
if strings.Contains(m.mutationTitle, "debugging") {
|
||||
|
||||
Reference in New Issue
Block a user