Skip to content

docs(wire): catch the wire protocol spec up to what the code actually does - #39

Open
rustyconover wants to merge 1 commit into
mainfrom
worktree-wire-protocol-refresh
Open

docs(wire): catch the wire protocol spec up to what the code actually does#39
rustyconover wants to merge 1 commit into
mainfrom
worktree-wire-protocol-refresh

Conversation

@rustyconover

Copy link
Copy Markdown
Collaborator

docs/WIRE_PROTOCOL.md was last updated at 2505b28 (~v0.36). Nine releases later it had drifted: three request-metadata keys had never been written down, the HTTP half was a release behind on headers and endpoints, and two of its claims would actively mislead someone writing a port.

Corrected

Spec said Code does
Capability discovery is OPTIONS {prefix}/__capabilities__ No such route exists in vgi_rpc/. The reference client probes OPTIONS {prefix}/health (http/_client.py:1788), and so does the cross-language conformance suite. The only __capabilities__ responder in the tree is one tests/serve_conformance_http.py adds for itself.
Implementation error → 500 _set_http_status translates every 500 into 200 + X-VGI-RPC-Error: true (http/server/_responses.py:120-136).
"Type error in implementation → 400" Stale since 58c93a7 — the exception's class no longer picks the status.
(nothing) 413 when the body exceeds VGI-Max-Request-Bytes.

The 200-not-500 correction gets its own subsection rather than a table row, because it has a consequence worth stating outright: a client that classifies by status code alone reads every application failure as a success. The body is where the typed error lives, and intermediaries routinely discard bodies on 5xx — which is the whole reason for the translation.

Newly documented

Each of these is wire-visible and had zero mentions in the spec:

  • vgi_rpc.protocol_version — the enforced cross-language version contract. Exact major+minor rule, patch ignored, __describe__ exempt, ProtocolVersionError carrying error_kind. Includes why this is the cross-language contract and protocol_hash is not.
  • vgi_rpc.error_kind — open set, four well-known values (method_not_implemented, protocol_version_mismatch, session_lost, server_draining).
  • vgi_rpc.cancel — presence-is-the-signal, on both the pipe lockstep exchange and the HTTP /exchange request.
  • vgi_rpc.location.sha256 — optional to emit, mandatory to verify, computed pre-compression and checked post-decompression.
  • Content-encoding negotiationVGI-Supported-Encodings, X-VGI-Accept-Encoding, X-VGI-Content-Encoding. Covers why the custom accept header outranks the generic one (general-purpose HTTP clients inject their own, and gzip measured ~an order of magnitude slower than zstd on large Arrow bodies), and why identity is honourable but never advertised.
  • Sticky sessions — new §17 giving the wire surface (headers, DELETE {prefix}/__session__, failure kinds) and pointing at docs/sticky-sessions-spec.md for the normative contract, matching how the spec already handles proxy-proof and unauthorized.
  • The real endpoint list — split into the Arrow RPC surface, framework endpoints, and the optional human/IdP-facing pages a port may omit.
  • The full response-header set — previously four entries, now the complete capability set plus the 401 and session headers, each with when it is emitted.

Verification

  • mkdocs build --strict — clean.
  • Every in-page anchor checked against id= attributes in the built HTML; all resolve.
  • ruff format --check / ruff check — clean.
  • uv run pytest — 4062 passed, 163 skipped.

Docs-only; no code changes.

🤖 Generated with Claude Code

The wire protocol spec was last touched at 2505b28 and had drifted nine
releases. Three request-metadata keys had never been written down, the
HTTP half was a release behind on headers and endpoints, and two of its
claims would actively mislead a porter.

Corrected:

- Capability discovery is `OPTIONS {prefix}/health`, not
  `{prefix}/__capabilities__`. No such route exists in the library; the
  reference client has never probed it, and neither does the shared
  conformance suite. The only `__capabilities__` responder in the tree is
  one a local test fixture adds for itself.
- A server implementation error is `200` + `X-VGI-RPC-Error: true`, never
  `500` — the body is where the typed error lives, and intermediaries
  discard bodies on 5xx. Stated as its own subsection, because a client
  that branches on status code alone reads every failure as a success.
- The exception's class no longer picks the status (58c93a7), so the
  "TypeError → 400" row is gone.
- Added 413, which the request-size cap has always returned.

Newly documented, each of them wire-visible and none of them mentioned
anywhere in the spec until now:

- `vgi_rpc.protocol_version` — the enforced cross-language version
  contract, including the exact major+minor rule, the `__describe__`
  exemption, and why it is the contract and `protocol_hash` is not.
- `vgi_rpc.error_kind` — open set, with the four well-known values.
- `vgi_rpc.cancel` — presence-is-the-signal, on both pipe and HTTP.
- `vgi_rpc.location.sha256` — optional to emit, mandatory to verify.
- Content-encoding negotiation, including why `X-VGI-Accept-Encoding`
  outranks `Accept-Encoding` and why `identity` is listed but never
  advertised.
- Sticky sessions, as a wire surface plus a pointer to the full spec.
- The real endpoint list and the full response-header set.

Docs-only; `mkdocs build --strict` is clean and every in-page anchor
resolves against the built HTML.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant