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
@@ -87,12 +87,18 @@ Each playbook is *symptom → how to confirm → what to do*.
- **Symptom** `inspect --json` or `ping --json` is missing fields this skill
describes, or a flag is rejected as unknown.
- **Confirm** `ping --json` for the server build identity and `version --json` for the
client. An older server omits `build`; an older client may not send newer fields.
- **Confirm** The client now reports this itself. A server response carrying a
top-level field this client does not model prints a one-time
`server sent unrecognized top-level field(s) ...` notice; a same-protocol build
mismatch prints one `warning:` naming both builds on stderr; and a server
speaking a newer protocol fails the command non-zero. `ping --json` shows the
server build identity and `version --json` the client; `ping`/`connection`
also print the client/server relationship. An older server omits `build`.
- **Do** Treat it as a version mismatch, not a run failure. State both versions and
the mismatch. **Do not infer** that a source fix or an updated skill is deployed.
Use only flags the installed help shows; do not restart or reinstall a service to
"fix" it without the operator (`references/operations.md`).
"fix" it without the operator (`references/operations.md`). Rebuild or reinstall
the CLI so it matches the server; never hand-edit an installed binary.
## A server restart killing in-flight runs