cloudaxe-opencode/packages/opencode/test/server
Kit Langton a2bc535367 sketch: typed SessionNotFound (design validation)
Demonstrates the typed-errors-at-the-service-layer pattern on a single
method (`Session.Service.get`):

- Define `Session.SessionNotFound` as `Schema.ErrorClass` with
  `httpApiStatus: 404` and a body shape that matches the existing Hono
  `NamedError` envelope (`name: "NotFoundError"`, `data: { message }`).
- Update `Session.Service.Interface.get` and the implementation to fail
  in the E channel via `yield* new SessionNotFound(...)`.
- HttpApi endpoint declares the typed error directly. The handler drops
  its `mapNotFound` wrapper for `get` — Effect HttpApi auto-routes the
  404 status from the schema annotation and serializes the body fields.
- Hono adapter (`runRequest`) bridges the typed error back to the
  legacy `NotFoundError` defect so the existing `ErrorMiddleware` keeps
  rendering 404 + body until that adapter is retired.

End-to-end validation: the unskipped parity test
(`Error JSON shape parity > HttpApi 404 body matches NamedError shape`)
now passes against the HttpApi adapter.

This is a sketch, not for merge — most cascading consumers are
absorbed via `Effect.orDie` (legacy never-E surface preserved). Real
rollout migrates each method/handler explicitly.
2026-05-03 00:07:01 -04:00
..
AGENTS.md test: cover HttpApi instance context middleware (#25032) 2026-04-29 21:24:45 -04:00
global-bus.ts test(httpapi): add route exerciser 2026-05-02 20:31:21 -04:00
global-session-list.test.ts Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
httpapi-authorization.test.ts refactor: use Effect config for HttpApi authorization (#25035) 2026-04-29 22:22:32 -04:00
httpapi-bridge.test.ts Refactor v2 session events as schemas (#24512) 2026-05-02 22:09:48 -04:00
httpapi-config.test.ts test(httpapi): add route exerciser 2026-05-02 20:31:21 -04:00
httpapi-cors.test.ts chore: generate 2026-05-01 01:28:37 +00:00
httpapi-event.test.ts Refactor v2 session events as schemas (#24512) 2026-05-02 22:09:48 -04:00
httpapi-experimental.test.ts Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
httpapi-file.test.ts Replace Instance.disposeAll/load with fixture helper (#25418) 2026-05-02 10:56:15 -04:00
httpapi-instance-context.test.ts Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
httpapi-instance.legacy.test.ts test(httpapi): add route exerciser 2026-05-02 20:31:21 -04:00
httpapi-instance.test.ts Replace Instance.disposeAll/load with fixture helper (#25418) 2026-05-02 10:56:15 -04:00
httpapi-json-parity.test.ts Replace Instance.disposeAll/load with fixture helper (#25418) 2026-05-02 10:56:15 -04:00
httpapi-mcp-oauth.test.ts chore: generate 2026-04-30 15:08:03 +00:00
httpapi-mcp.test.ts Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
httpapi-parity.test.ts sketch: typed SessionNotFound (design validation) 2026-05-03 00:07:01 -04:00
httpapi-provider.test.ts Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
httpapi-pty-websocket.test.ts test: port instance HttpApi path/vcs read coverage to Effect 2026-04-30 11:07:00 -04:00
httpapi-pty.test.ts Replace Instance.disposeAll/load with fixture helper (#25418) 2026-05-02 10:56:15 -04:00
httpapi-raw-route-auth.test.ts Replace Instance.disposeAll/load with fixture helper (#25418) 2026-05-02 10:56:15 -04:00
httpapi-sdk.test.ts Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
httpapi-session.test.ts chore: generate 2026-05-03 02:10:52 +00:00
httpapi-sync.test.ts Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
httpapi-tui.test.ts test(httpapi): add route exerciser 2026-05-02 20:31:21 -04:00
httpapi-ui.test.ts Avoid request-time HttpApi layer provisioning (#25179) 2026-04-30 19:36:57 -04:00
httpapi-workspace-routing.test.ts refactor: rename workspace adapters (#25272) 2026-05-01 07:36:52 -04:00
httpapi-workspace.test.ts Replace Instance.disposeAll/load with fixture helper (#25418) 2026-05-02 10:56:15 -04:00
project-init-git.test.ts Delete Instance.dispose and Instance.reload (#25427) 2026-05-02 11:44:16 -04:00
proxy-util.test.ts Refactor HttpApi workspace routing and proxy boundaries (#25006) 2026-04-29 16:50:54 -04:00
session-actions.test.ts Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
session-list.test.ts Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
session-messages.test.ts Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
session-select.test.ts Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
trace-attributes.test.ts refactor(server): align route-span attrs with OTel semantic conventions (#23198) 2026-04-18 00:29:26 +00:00
workspace-proxy.test.ts chore: generate 2026-04-30 23:37:58 +00:00
workspace-routing.test.ts Refactor HttpApi workspace routing and proxy boundaries (#25006) 2026-04-29 16:50:54 -04:00