Report a stale client and refuse an unreadable newer server

Exchange a build/protocol identity so an older CLI can no longer talk to a
newer native server silently:

- protocol carries ProtocolVersion and every server frame (including the
  unsolicited welcome) is stamped with the server build and protocol, so a
  client that never pings still learns the server identity.
- buildinfo.Compare classifies the relationship as InSync/Warn/Refuse and
  names both builds; the client Watch reports one warning per connection and
  returns a hard error when the server speaks a newer, uninterpretable
  protocol so the caller never acts on the frame.
- client.ReceiveNotice decodes the raw frame so an unmodeled top-level field
  produces a one-time "unrecognized field(s)" notice instead of being dropped
  silently (the case that hid the artifacts field).
- CLI routes warnings to stderr, keeps machine JSON stdout clean and fails
  non-zero on a refused mismatch; ping/connection print the client/server
  relationship. The TUI surfaces the same notices through the shared log.
- scripts/setup-native.py now warns when an older `pipelines` earlier on PATH
  shadows prefix/bin/pipelines, naming both paths and versions, without
  installing or modifying anything else.
- Docs, the packaged debugging skill reference and README no longer imply the
  installed CLI always matches the server.

Tests cover the comparison table, unknown-field detection and caching, the
server identity stamping on pong and welcome, the CLI/TUI reporting paths and
the installer PATH shadowing warning.
This commit is contained in:
2026-10-16 18:37:01 +01:00
parent 98bbc2deac
commit 8c1eea53a9
25 changed files with 1239 additions and 81 deletions
+26 -2
View File
@@ -23,10 +23,23 @@ running server's compiled `build.version`, full Git `build.commit`, and
`build.dirty`. Uncommitted builds have a `-dirty` suffix. Missing metadata is
explicit (`commit: "unknown"`, `dirty: null`); older servers omit `build`.
This identifies the server binary, not the CLI or files mounted into the container.
Plain `ping` also prints the server version/commit. `pipelines version --json`
Plain `ping` also prints the server version/commit and, beside the local client
build, the client/server relationship. `pipelines version --json`
(or `pipelines --version`) identifies the local client without connecting to a
server. Include both identities when reporting a problem; they can differ.
`ping`, `connection`, `status` and every server command now check that relationship.
The server stamps its `build` and integer `protocol` onto each response (the
unsolicited welcome envelope too). The client compares this build against the
server: a same-protocol build mismatch prints exactly one `warning:` on stderr
(stdout JSON stays parseable) and a server speaking a newer protocol fails the
command non-zero before it acts on the frame. If a response carries a top-level
field this client does not model — for example an `artifacts` field from a newer
server — the client prints a one-time `server sent unrecognized top-level field(s)
...` notice instead of silently appearing to have no data. Rebuild or reinstall the
CLI so it matches the server; the installer also warns when a different `pipelines`
resolves earlier on PATH than the freshly installed binary.
Home's `r` opens **all** runs, not only failures or the newest 50. Inside a pipeline,
`r` and `:runs` show only that pipeline's runs across its versions. In any run list,
@@ -34,6 +47,14 @@ press `/` for fuzzy search, type to filter, and Enter to return to the results.
Search includes pipeline name, version, status, outcome, stage and diagnostic;
`#123` searches run-ID prefixes. Esc while searching clears the filter without
closing the list. The filter survives inspection/back and live list refreshes.
Home's `/` instead opens the omni popup, which searches pipelines, versions, runs,
stages/visits, artifact names, and the text of stage inputs, outputs and evidence.
A bare status word (`queued`, `running`, `succeeded`, `failed`, `canceled`,
`interrupted`) or a date (`today`, `yesterday`, `this week`, or `YYYY-MM-DD`
interpreted in UTC) selects runs, and a leading `pipeline:`/`version:`/`run:`/
`step:`/`field:`/`artifact:`/`match:` prefix narrows the result kind. Enter opens
the matched pipeline, run, stage visit, artifact or field; unrecognised words
remain text.
Wide terminals
show runs and pipelines side by side, with stacked panels on narrow terminals.
Home run cards prioritize reported results, status, completed visits and duration;
@@ -219,7 +240,10 @@ printf '%s' '{"type":"get_pipeline","pipeline_id":1,"version":1}' | pipelines rp
Existing protocol commands: `ping`, `list_pipelines`, `get_pipeline`,
`list_templates`, `validate`, `submit`, `run_pipeline`, `list_runs`, `get_run`,
`cancel_run`, `retry_run`, `decide_run`, `set_run_title`, `get_run_evidence`, `get_status`. `list_runs` also returns all-history `usage`
`cancel_run`, `retry_run`, `decide_run`, `set_run_title`, `get_run_evidence`,
`get_status`, `search`. `search` takes `query` and an
optional `kind` and `limit` and returns ranked typed `matches`, each with a stable
`target` the client can open. `list_runs` also returns all-history `usage`
aggregates. See `internal/protocol/message.go` for JSON envelopes. Mutating RPCs
have real effects; they are not previews. TUI-only animation, scrolling, and
transient client logs are presentation, not separate server capabilities.