cloudaxe-opencode/packages/opencode/test/server
Kit Langton 64937161aa feat(httpapi-exercise): add .viaSdk() to drive scenarios through real SDK
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.
2026-05-09 20:22:55 -04:00
..
httpapi-exercise
AGENTS.md
auth.test.ts
global-bus.ts
global-session-list.test.ts
httpapi-authorization.test.ts
httpapi-compression.test.ts
httpapi-config.test.ts
httpapi-cors-vary.test.ts
httpapi-cors.test.ts
httpapi-event.test.ts
httpapi-experimental.test.ts
httpapi-file.test.ts
httpapi-instance-context.test.ts
httpapi-instance.test.ts
httpapi-listen.test.ts
httpapi-mcp-oauth.test.ts
httpapi-mcp.test.ts
httpapi-promptasync-context.test.ts
httpapi-provider.test.ts
httpapi-pty-websocket.test.ts
httpapi-pty.test.ts
httpapi-query-schema-drift.test.ts
httpapi-raw-route-auth.test.ts
httpapi-sdk.test.ts
httpapi-session.test.ts
httpapi-sync.test.ts
httpapi-ui.test.ts
httpapi-workspace-routing.test.ts
httpapi-workspace.test.ts
project-init-git.test.ts
proxy-util.test.ts
sdk-error-shape.test.ts
session-actions.test.ts
session-diff-missing-patch.test.ts
session-list.test.ts
session-messages.test.ts
session-select.test.ts
workspace-proxy.test.ts
workspace-routing.test.ts
worktree-endpoint-repro.test.ts