Skip to content

Hono → Effect HttpApi#25667

Merged
kitlangton merged 11 commits into
devfrom
kit/delete-hono-research
May 9, 2026
Merged

Hono → Effect HttpApi#25667
kitlangton merged 11 commits into
devfrom
kit/delete-hono-research

Conversation

@kitlangton
Copy link
Copy Markdown
Contributor

@kitlangton kitlangton commented May 4, 2026

What this is

Research draft to expose the size of the cliff for removing Hono. Not for merge as-is. Kept open as a visualization aid + scope spike + early bug-finder for the real "make HttpApi the only backend" PR.

Result

70 files changed, ~83 insertions, ~9,042 deletions.

Workspace typecheck (bun turbo typecheck): 13/13 green locally and in the pre-push hook. Source side compiles end-to-end.

What got deleted

14 Hono per-feature route files (src/server/routes/instance/{config,event,experimental,file,mcp,permission,project,provider,pty,question,session,sync,trace,tui}.ts)

Hono shellroutes/instance/index.ts (the bridge), middleware.ts, error.ts, fence.ts, proxy.ts, workspace.ts, routes/global.ts, routes/ui.ts, routes/control/{index,workspace}.ts

Adaptersadapter.ts, adapter.bun.ts, adapter.node.ts (and the #hono package.json export)

Selection layerbackend.ts, Flag.OPENCODE_EXPERIMENTAL_HTTPAPI, HTTPAPI_DEFAULT_ON_CHANNELS

Parity testshttpapi-bridge, httpapi-parity, httpapi-json-parity, httpapi-instance.legacy

Cross-backend utilityscript/httpapi-exercise.ts (Hono ↔ HttpApi diff harness)

Tests covering deleted modulesinstance-bootstrap-regression.test.ts, httpapi-tui.test.ts, trace-attributes.test.ts

Hono deps from package.json / lockhono, hono-openapi, @hono/node-server, @hono/node-ws, @hono/standard-validator, @hono/zod-validator

What stayed and got simplified

  • server.ts — collapsed to HttpApi-only listen() + openapi() while preserving the fresh ConfigProvider.fromEnv() listener fix.
  • cli/cmd/generate.ts — always uses the HttpApi OpenAPI spec.
  • packages/sdk/js/script/build.ts — removed the stale OPENCODE_SDK_OPENAPI=hono / generate --hono fallback.
  • zod stays: still used across config/session/tool/plugin/runtime schemas.
  • Direct zod-to-json-schema dependency was removed.
  • Unused Zod compatibility helpers were removed where Hono deletion made them dead: BusEvent.payloads(), SyncEvent.payloads(), unused Worktree/workspace .zod statics, the legacy AssistantErrorZod union, and the TUI control queue payload now reuses Effect Schema.
  • 15+ httpapi-* test files — dropped Hono parametric branches; all run against HttpApi only.

Known cliff items (gating real merge)

  1. Full CI. Focused server tests and typecheck pass locally, but full pre-merge CI on dev still needs to complete on this branch.

  2. Stable rollout sequencing. Real deletion should only happen after HttpApi is default for stable channels and has baked there.

  3. Dependent command smoke. cli/cmd/tui/worker.ts, cli/cmd/acp.ts, cli/cmd/web.ts, cli/cmd/serve.ts, and cli/cmd/run.ts import @/server/server and use Server.listen() / Server.Default().app.fetch(), which still exist. No code changes appear necessary, but these should get one final smoke before real merge.

  4. Zod/NamedError follow-up. This branch removes only the easy dead Zod compatibility exposed by Hono deletion. Larger Zod removal still needs separate focused migrations for config, session/message, plugin/tool schemas, and NamedError.create(...) call sites.

NamedError note

Worktree*Error and other simple NamedError.create(...) sites are good future Schema-backed candidates, but not blindly. The current namedSchemaError(...) helper preserves { name, data } and toObject(), but it does not extend the core NamedError, so migrating could lose instanceof NamedError behavior at the top-level CLI boundary. We should first standardize the replacement helper or update the boundary before bulk-converting.

No longer cliffs

  • No-auth PTY WebSocket parity is no longer a blocker. httpapi-listen.test.ts > keeps PTY websocket tickets optional when server auth is disabled passes on this branch.
  • OpenAPI/SDK generation works from HttpApi by default. bun run --conditions=browser ./src/index.ts generate and ./packages/sdk/js/script/build.ts both work and produce no generated-file diff.

What this proves

  • HttpApi is genuinely a feature-superset; deletion is not blocked by missing routes.
  • The blast radius is ~9k LOC, mostly mechanical deletion + test cleanup.
  • Real merge is gated on rollout/bake, full CI, and final command smoke — not on known route parity gaps.

Do not merge

This branch will diverge from dev over time and should be rebased or rewritten when the real deletion happens. Closing the research after stable flips is fine.

@kitlangton kitlangton force-pushed the kit/delete-hono-research branch 8 times, most recently from f5a886d to 10d22a5 Compare May 9, 2026 01:01
kitlangton added a commit that referenced this pull request May 9, 2026
The existing test/project/instance-bootstrap-regression.test.ts covers
four boundaries: WithInstance.provide, the CLI bootstrap, the legacy
Hono InstanceMiddleware, and InstanceRuntime.reloadInstance. The Hono
deletion PR (#25667) drops the entire file because the Hono variant
goes away, taking the three backend-agnostic boundary checks with it.

Move the three surviving boundary checks into a new
instance-bootstrap.test.ts so the InstanceBootstrap-runs-at-boundary
invariant stays covered after Hono is deleted. The original file can
remain in place until #25667 lands; once the deletion lands, only this
file remains.
kitlangton added a commit that referenced this pull request May 9, 2026
The existing test/project/instance-bootstrap-regression.test.ts covers
four boundaries: WithInstance.provide, the CLI bootstrap, the legacy
Hono InstanceMiddleware, and InstanceRuntime.reloadInstance. The Hono
deletion PR (#25667) drops the entire file because the Hono variant
goes away, taking the three backend-agnostic boundary checks with it.

Move the three surviving boundary checks into a new
instance-bootstrap.test.ts so the InstanceBootstrap-runs-at-boundary
invariant stays covered after Hono is deleted. The original file can
remain in place until #25667 lands; once the deletion lands, only this
file remains.
kitlangton added a commit that referenced this pull request May 9, 2026
The existing test/project/instance-bootstrap-regression.test.ts covers
four boundaries: WithInstance.provide, the CLI bootstrap, the legacy
Hono InstanceMiddleware, and InstanceRuntime.reloadInstance. The Hono
deletion PR (#25667) drops the entire file because the Hono variant
goes away, taking the three backend-agnostic boundary checks with it.

Move the three surviving boundary checks into a new
instance-bootstrap.test.ts so the InstanceBootstrap-runs-at-boundary
invariant stays covered after Hono is deleted. The original file can
remain in place until #25667 lands; once the deletion lands, only this
file remains.
kitlangton added a commit that referenced this pull request May 9, 2026
The existing test/project/instance-bootstrap-regression.test.ts covers
four boundaries: WithInstance.provide, the CLI bootstrap, the legacy
Hono InstanceMiddleware, and InstanceRuntime.reloadInstance. The Hono
deletion PR (#25667) drops the entire file because the Hono variant
goes away, taking the three backend-agnostic boundary checks with it.

Move the three surviving boundary checks into a new
instance-bootstrap.test.ts so the InstanceBootstrap-runs-at-boundary
invariant stays covered after Hono is deleted. The original file can
remain in place until #25667 lands; once the deletion lands, only this
file remains.
kitlangton added a commit that referenced this pull request May 9, 2026
The existing test/project/instance-bootstrap-regression.test.ts covers
four boundaries: WithInstance.provide, the CLI bootstrap, the legacy
Hono InstanceMiddleware, and InstanceRuntime.reloadInstance. The Hono
deletion PR (#25667) drops the entire file because the Hono variant
goes away, taking the three backend-agnostic boundary checks with it.

Move the three surviving boundary checks into a new
instance-bootstrap.test.ts so the InstanceBootstrap-runs-at-boundary
invariant stays covered after Hono is deleted. The original file can
remain in place until #25667 lands; once the deletion lands, only this
file remains.
kitlangton added a commit that referenced this pull request May 9, 2026
The existing test/project/instance-bootstrap-regression.test.ts covers
four boundaries: WithInstance.provide, the CLI bootstrap, the legacy
Hono InstanceMiddleware, and InstanceRuntime.reloadInstance. The Hono
deletion PR (#25667) drops the entire file because the Hono variant
goes away, taking the three backend-agnostic boundary checks with it.

Move the three surviving boundary checks into a new
instance-bootstrap.test.ts so the InstanceBootstrap-runs-at-boundary
invariant stays covered after Hono is deleted. The original file can
remain in place until #25667 lands; once the deletion lands, only this
file remains.
kitlangton added a commit that referenced this pull request May 9, 2026
The existing test/project/instance-bootstrap-regression.test.ts covers
four boundaries: WithInstance.provide, the CLI bootstrap, the legacy
Hono InstanceMiddleware, and InstanceRuntime.reloadInstance. The Hono
deletion PR (#25667) drops the entire file because the Hono variant
goes away, taking the three backend-agnostic boundary checks with it.

Move the three surviving boundary checks into a new
instance-bootstrap.test.ts so the InstanceBootstrap-runs-at-boundary
invariant stays covered after Hono is deleted. The original file can
remain in place until #25667 lands; once the deletion lands, only this
file remains.
kitlangton added a commit that referenced this pull request May 9, 2026
The existing test/project/instance-bootstrap-regression.test.ts covers
four boundaries: WithInstance.provide, the CLI bootstrap, the legacy
Hono InstanceMiddleware, and InstanceRuntime.reloadInstance. The Hono
deletion PR (#25667) drops the entire file because the Hono variant
goes away, taking the three backend-agnostic boundary checks with it.

Move the three surviving boundary checks into a new
instance-bootstrap.test.ts so the InstanceBootstrap-runs-at-boundary
invariant stays covered after Hono is deleted. The original file can
remain in place until #25667 lands; once the deletion lands, only this
file remains.
kitlangton added a commit that referenced this pull request May 9, 2026
The existing test/project/instance-bootstrap-regression.test.ts covers
four boundaries: WithInstance.provide, the CLI bootstrap, the legacy
Hono InstanceMiddleware, and InstanceRuntime.reloadInstance. The Hono
deletion PR (#25667) drops the entire file because the Hono variant
goes away, taking the three backend-agnostic boundary checks with it.

Move the three surviving boundary checks into a new
instance-bootstrap.test.ts so the InstanceBootstrap-runs-at-boundary
invariant stays covered after Hono is deleted. The original file can
remain in place until #25667 lands; once the deletion lands, only this
file remains.
@kitlangton kitlangton force-pushed the kit/delete-hono-research branch from 10d22a5 to f1554f1 Compare May 9, 2026 04:37
@kitlangton kitlangton marked this pull request as ready for review May 9, 2026 04:39
@kitlangton kitlangton enabled auto-merge (squash) May 9, 2026 04:39
kitlangton added 7 commits May 9, 2026 08:55
Exploration to expose the size of the cliff for removing the Hono backend.
HttpApi is already the default on dev/beta/local channels and a feature-superset
of Hono's surface. This deletes:

- 14 Hono per-feature route files (config, event, experimental, file, mcp,
  permission, project, provider, pty, question, session, sync, trace, tui)
- Hono shell: routes/instance/index.ts (the bridge), middleware.ts, error.ts,
  fence.ts, proxy.ts, workspace.ts, routes/global.ts, routes/ui.ts,
  routes/control/{index,workspace}.ts
- Adapters: adapter.ts, adapter.bun.ts, adapter.node.ts (and #hono export)
- backend.ts (selection becomes vestigial)
- 4 parity tests: httpapi-bridge, httpapi-parity, httpapi-json-parity,
  httpapi-instance.legacy
- script/httpapi-exercise.ts (cross-backend diff utility)
- Hono deps from package.json: hono, hono-openapi, @hono/node-server,
  @hono/node-ws, @hono/standard-validator, @hono/zod-validator
- Flag.OPENCODE_EXPERIMENTAL_HTTPAPI and HTTPAPI_DEFAULT_ON_CHANNELS

Server.ts simplified to HttpApi-only listen + openapi.

Tests still need follow-up cleanup:
- ~21 test files reference the deleted flag (mechanical removal of beforeAll
  setup blocks)
- 7 test files reference Server.Legacy
- 3 test files import deleted modules:
  - test/project/instance-bootstrap-regression.test.ts
  - test/server/httpapi-tui.test.ts
  - test/server/trace-attributes.test.ts

This commit leaves source compiling but tests broken; the test surgery is the
remaining work to land this for real.
Drop the Flag.OPENCODE_EXPERIMENTAL_HTTPAPI setup, replace Server.Legacy()
with Server.Default(), and delete tests that exclusively cover deleted
Hono-only modules (instance-bootstrap-regression, httpapi-tui,
trace-attributes).

Workspace typecheck is clean. Runtime cliff item: the Hono-specific
no-auth WS connect (which intentionally bypassed tickets when server
password was unset) does not have a direct HttpApi equivalent yet — see
httpapi-listen.test.ts 'keeps PTY websocket tickets optional when server
auth is disabled' which fails at runtime. Either drop that test or add
no-auth support to HttpApi PTY connect before this can land for real.
@kitlangton kitlangton force-pushed the kit/delete-hono-research branch from 88d9b99 to 58ceb37 Compare May 9, 2026 12:56
@kitlangton kitlangton force-pushed the kit/delete-hono-research branch from 58ceb37 to ab66fc2 Compare May 9, 2026 13:01
@kitlangton kitlangton merged commit 28b0359 into dev May 9, 2026
11 checks passed
@kitlangton kitlangton deleted the kit/delete-hono-research branch May 9, 2026 13:10
@kitlangton kitlangton changed the title research: delete Hono backend (do not merge) research: delete Hono backend (MERGE) May 9, 2026
@kitlangton kitlangton changed the title research: delete Hono backend (MERGE) Hono → Effect HttpApi May 9, 2026
katosun2 pushed a commit to katosun2/opencode that referenced this pull request May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant