Repository navigation
docs: ADR 0253 — SDK mocking testkit - #875
Conversation
samuv
left a comment
There was a problem hiding this comment.
Reviewed against the code on main (a1f987db) and against the sources the ADR cites. The survey discipline is the best part of this — "checked directly rather than assumed" is accurate, and I verified the #618 precedent does substantively say what the ADR claims. Decision 4's refusal to build a shared package before a second consumer exists is well-argued and matches the repo's stated anti-premature-abstraction posture.
Four findings, one of which I think inverts the cost/benefit of the central decision.
Findings, severity order
- L70 — the day-one coverage claim is a transport category error. The vendored artifact is a Connect-RPC/gRPC automocker that validates protobuf request bytes and encodes protobuf responses. The four endpoints it claims to cover "over HTTP" are hand-written JSON on that transport (
approveBody,cancelBody,GET /v1/compatibility). This matters beyond pedantry: the licensing-sensitive vendoring buys coverage for the transport #821 says browsers never speak, while the coverage actually claimed belongs to the already-Apache-2.0 REST mocker. - L5 — the Scope names a tree that does not exist, and no gate would cover it. No
sdk/, no rootpackage.json/tsconfig.json, and no TypeScript CI job onmain. - L57-62 — the #618 precedent is real but is cited in the wrong tense, and its enforcement mechanism (a CI guard) is the part worth adopting.
- L97 — the confidentiality/provenance assertion is the one claim in the ADR that can't be checked from this repo, and it is carrying the licensing decision.
Plus a mechanical note on the README line: this collides with #874 by construction.
None of this disputes the shape of the decision — vendor the unary pattern, defer streaming, don't build a shared package yet. Finding 1 is the one I'd want resolved before this becomes the spec for #872, because it changes which code needs vendoring and therefore how much licensing surface the decision actually touches.
Vendor (not npm-depend on) the proven unary Connect-RPC handler pattern + AutoAPIMock core; defer streaming/bidi mocking (Converse, the stale-run-control race) as a named residual. Lives inside mecatl's own SDK tree for now, no shared package yet. Docs only; implementation tracked separately. Refs #872. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Per samuv's review: fix the "over HTTP" transport category error (the vendored automocker covers unary gRPC, not the hand-written JSON HTTP endpoints), name the sdk/typescript/ ordering dependency on #821 and the missing TS CI gate, correct #618's tense (open, not merged) and adopt its SPDX-guard pattern scoped to sdk/, and record the header rewrite as an authorized relicense (Stacklok holds copyright on both sides) rather than a bare header edit. Also reframes scope explicitly: the SDK's own testability (near-term deadline) and Studio's eventual HTTP/JSON mocking needs (later, architecture undecided) are separate, coexisting concerns. This ADR only needs to unblock the former. Rebased onto main (#874 merged) and regenerated llms.txt. Fully or partially written by an AI agent. Co-Authored-By: Claude <[email protected]>
ba3e96e to
ad8993e
Compare
What
The decision record for issue #872's mocking testkit. Docs only — no production code.
Adds ADR 0253 and its index entry.
Why
Neither #761 nor #821 describes a client-side SDK mocking story — only a real
mecated --mockdaemon, useful for the SDK's own test suite but not for a downstream app's unit/e2e tests. #872 tracks closing that gap; this ADR is the decision record for how.What was actually surveyed (checked directly, not assumed)
stacklok/toolhive-studio/stacklok/toolhive-cloud-ui(public, Apache-2.0): mature MSW/OpenAPI auto-mocker, zero Connect-RPC/gRPC support.stacklok/frontend-platform's@stacklok/mocks(public, Apache-2.0, real npm package): extracts that same REST auto-mocker per its own ADR 0014. ItsAutoAPIMock<T>core is schema-agnostic; itsbuildServerHandlers()/codegen half is OpenAPI-route-shaped and doesn't fit Connect-RPC at all.buildGrpcServerHandlers()+grpcResponse()— walks a realGrpcServiceDescriptor, validates request bytes against the protobuf schema, resolves a hand-authored fixture, encodes a real protobuf-binary response. Its own thrown error is explicit: "streaming gRPC methods aren't supported by the automocker yet."The decision
buildGrpcServerHandlers/grpcResponsepattern intosdk/typescript/, reconfigured for mecatl's actual services. No npm dependency on@stacklok/mocksin this iteration — the code becomes mecatl's own.Proprietary; mecatl is Apache-2.0. Same fix class PR feat(studio): Web UI workspace #618's vendor-drop already established.Converse(bidi) and any futureWatchSessionEvents, plus modelingrun_id/expected_run_idrace semantics (the state needed to reproduce the stale-control bug PR feat(engine,server): durable run identity — a host-minted run_id #827/feat(server): expected_run_id on controls, and strict steer #828 fixed), are unsolved anywhere surveyed, not just here. Named honestly rather than silently dropped, mirroring ADR 0250's own residual-disclosure discipline.Verification
go test ./docs/lint/...— green.task testis unaffected.Refs #872.
Fully or partially written by an AI agent.