mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-21 03:15:11 +00:00
The exerciser harness builds requests directly as Request objects, which means it never exercises the SDK client's auto-injection of ?directory= / ?workspace= on GETs. That's structurally how the entire #26569 / #26581 family of regressions slipped through — the SDK was sending requests the typed query schemas didn't accept, but the harness was sending requests directly. Add an opt-in `.viaSdk((sdk, ctx) => sdk.X.Y(...))` builder method that runs the scenario through a real `createOpencodeClient` wired to the in-process exerciser router. The SDK applies its real request transforms so route tests catch the SDK-vs-server-shape drift class at write time. The runner normalizes the SDK's `{data, error, response}` (or thrown Error with `.cause = {body, status}`) back into the existing `CallResult` shape so all the existing assertions (`.json()`, `.status()`, `.ok()`, etc.) continue to work unchanged. Existing `.at(...)` scenarios are not touched. Convert two scenarios as proof: `app.agents.via_sdk` and `command.list.via_sdk` both pass alongside the 139 existing scenarios (141/141 PASS). Subsequent PRs will migrate the standalone `httpapi-query-schema-drift` scenarios into the exerciser using `.viaSdk(...)` and delete that file as the bug class becomes a structural guarantee inside the harness.