test(golden): cross-language parity-oracle characterization tests (#225 item 2)#227
Merged
Conversation
This was referenced Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements item 2 of #225 — golden / characterization tests that capture what the Node backend actually returns across REST, MCP, WebSocket, and audit, as committed normalized JSON fixtures. These are the cross-language parity oracle for the Go rewrite (#210): the Go server replays the same requests, applies the same normalization, and diffs against the identical files. They complement the hand-authored spec from #226 (spec = what the shape should be; goldens = what it is, byte-for-byte).
What's included
Harness —
src/test/helpers/golden.ts: a normalization layer that folds per-run volatile values to stable placeholders (<TS>,sess_<ID>,<UUID>,<CURSOR>,<FINGERPRINT>,<PORT>,<BASE_URL>,<REDACTED>) and anexpectGolden()matcher (assert, or rewrite underUPDATE_GOLDENS=1).4 suites / 21 cases / 28 fixtures under
src/test/integration/:golden-http— OAuth + RFC 9728 discovery docs, REST success envelopes, and the 401/404/400 matrix (incl. the/mcp401resource_metadatahint).externalUrlis pinned so discovery bodies are port-independent.golden-mcp— every tool's JSON payload + theisError/message error shape;read_outputis asserted structurally only (echo-shell output is non-deterministic).golden-ws— connect-timesessions:changedsnapshot + theterminal:attachreply sequence (terminal:status→terminal:mode, ui→control).golden-audit— the highest-value target: DB-backed seed rows exercising paged{ rows, nextCursor }, keyset pagination across two pages, single-row lookup, all nullable columns, and the invalid-filter 400.Plumbing
startTestAppgains optionalsessionLifecycleRepo/signingRequestsRepopassthrough so the audit routes (otherwise unmounted) can be wired with a seeded in-memory DB.pnpm test:golden(assert) andpnpm test:golden:update(regenerate). Goldens also run insidepnpm test:integration(CI).__goldens__/README.mddocuments the normalization contract and how the Go harness consumes the fixtures.Characterization findings (surfaced while capturing)
POST /api/endpointsdoes not validatelabel/hostpresence — a host-only body still returns{status:"created"}, though the OpenAPI marks them required. A spec-vs-handler gap worth reconciling (not fixed here — goldens capture reality).Validation
pnpm test:golden→ 21/21 ✓; stable across repeated runs (fresh SSH keys + ports each time).pnpm test:integration→ 144/144 ✓ (thestartTestAppchange is additive).pnpm typecheck✓,pnpm spdx:check✓.Not in this cut (follow-ups)
Deliberately deferred, each needs extra wiring: passkey/step-up ceremonies (needs the fake authenticator from #162), Hydra login/consent provider bodies,
/agent-proxyframing, and pending-action/push routes. Easy to add once those harnesses land.Relates to #210, #225 (item 2); builds on #226.