cloudaxe-opencode/packages/opencode/test
Kit Langton 98fef45553 fix(httpapi): 404 status + body shape for missing-session errors
Two related divergences from Hono are fixed in one move:

1. Status: many session handlers (todo, diff, summarize, fork, abort,
   init, deleteMessage, command, shell, revert, unrevert) didn't wrap
   with mapNotFound, so a thrown NotFoundError surfaced as a 500 defect
   instead of a 404. The fork/diff endpoints also lacked OpencodeNotFound
   in their declared error union, so handlers couldn't surface 404 even
   if they wanted to.

2. Body shape: the existing mapNotFound rebrand to HttpApiError.NotFound
   produced an empty 404 response. Hono returns the NamedError envelope
   `{ name: "NotFoundError", data: { message } }`. SDK consumers reading
   `error.data.message` got undefined.

The fix introduces OpencodeNotFound — a Schema.ErrorClass annotated with
`httpApiStatus: 404` and a body schema matching the legacy NamedError
shape. mapNotFound now rebrands NotFoundError to OpencodeNotFound,
preserving the underlying error message. All session endpoints that take
a sessionID now wrap their service calls with mapNotFound.

A TODO in the handler notes the long-term direction: services should
fail with typed errors directly (Effect<T, SessionNotFound>) and let
HttpApi auto-route status + body via schema annotations, eliminating
mapNotFound entirely. This PR is the pragmatic middle: small surface,
no service-layer changes, fixes the user-visible parity bug.

Unskips the two .todo parity reproducers in httpapi-parity.test.ts.
2026-05-02 23:33:14 -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 Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -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
ide
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 fix(httpapi): 404 status + body shape for missing-session errors 2026-05-02 23:33:14 -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