cloudaxe-opencode/packages/opencode/test
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
..
account refactor: remove module barrels (#24554) 2026-04-27 14:33:33 -04:00
acp Refactor v2 session events as schemas (#24512) 2026-05-02 22:09:48 -04:00
agent Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
auth core: move cross-spawn-spawner to root and remove unused types 2026-04-25 14:30:16 -04:00
bus Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
cli Refactor v2 session events as schemas (#24512) 2026-05-02 22:09:48 -04:00
config Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
control-plane sketch: typed SessionNotFound (design validation) 2026-05-03 00:07:01 -04:00
effect fix(instance): run bootstrap from instance store (#25475) 2026-05-02 19:33:38 -04:00
fake refactor: remove module barrels (#24554) 2026-04-27 14:33:33 -04:00
file Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
filesystem refactor: rename shared package to core (#24309) 2026-04-25 10:59:17 -04:00
fixture Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
format core: move cross-spawn-spawner to root and remove unused types 2026-04-25 14:30:16 -04:00
git feat: restore git-backed review modes (#20845) 2026-04-03 09:54:57 -05:00
ide fix(test): replace structuredClone with spread for process.env (#14908) 2026-02-24 23:16:24 +10:00
installation Refactor npm config handling (#24565) 2026-04-27 03:54:59 +00:00
lib chore: generate 2026-05-03 00:32:24 +00:00
lsp Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
mcp Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
memory feat: enable type-aware no-floating-promises rule, fix all 177 violations (#22741) 2026-04-15 23:27:32 -04:00
patch
permission Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
plugin fix(instance): run bootstrap from instance store (#25475) 2026-05-02 19:33:38 -04:00
project refactor(lifecycle): bootstrap as pure orchestration (#25510) 2026-05-02 22:26:54 -04:00
provider Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
pty Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
question Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
server sketch: typed SessionNotFound (design validation) 2026-05-03 00:07:01 -04:00
session Refactor v2 session events as schemas (#24512) 2026-05-02 22:09:48 -04:00
share refactor: remove module barrels (#24554) 2026-04-27 14:33:33 -04:00
shell refactor: remove module barrels (#24554) 2026-04-27 14:33:33 -04:00
skill refactor: remove module barrels (#24554) 2026-04-27 14:33:33 -04:00
snapshot Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
storage refactor: remove module barrels (#24554) 2026-04-27 14:33:33 -04:00
sync Refactor v2 session events as schemas (#24512) 2026-05-02 22:09:48 -04:00
tool Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
util refactor: remove module barrels (#24554) 2026-04-27 14:33:33 -04:00
v2 Refactor v2 session events as schemas (#24512) 2026-05-02 22:09:48 -04:00
AGENTS.md test(httpapi): add route exerciser 2026-05-02 20:31:21 -04:00
keybind.test.ts refactor: remove module barrels (#24554) 2026-04-27 14:33:33 -04:00
permission-task.test.ts Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
preload.ts Refactor v2 session events as schemas (#24512) 2026-05-02 22:09:48 -04:00