4.9 KiB
4.9 KiB
Tasks — @suaveplan/api-router-hono
Every checkbox MUST reflect work actually done in this change.
0. Pre-flight (non-negotiable)
- 0.1 Confirm clean working tree (
git statusreports nothing) and no in-flight worktrees with uncommitted work (git worktree listthengit statusin each) - 0.2 If any worktrees exist under
.claude/worktrees/, account for each one: still-active agent, work-pending-merge, or stale-and-prune. Stale worktrees MUST be removed (git worktree remove) before opening a new one — code that has been lost twice on main is the failure mode this guards against. - 0.3 Confirm the package set in
MANIFEST.mdmatchesfind packages -maxdepth 3 -name package.jsoncount. Drift here means a prior change archived without regenerating the manifest.
1. Spec authoring
- 1.1 Read design doc
docs/superpowers/specs/2026-05-13-api-plugin-foundation-design.md(§2.1, §5.2a, §6, §8.1, §13.4, §15 Stage 4) - 1.2 Read
openspec/changes/api-router/andopenspec/changes/api-worker-rpc/for upstream contracts - 1.3 Read
openspec/AGENTS.mdSections 13 and 14 - 1.4 Draft
proposal.mdfromopenspec/templates/proposal.md - 1.5 Draft
specs/api-router-hono/spec.mdfromopenspec/templates/spec-delta.md - 1.6 Every requirement carries a
**Verified by:**line naming concreteit(...)titles
2. Implementation
- 2.1 Scaffold
packages/api/api-router-hono/withpackage.json("version": "0.1.0","sideEffects": false, hono aspeerDependencies) - 2.2
src/options/hono-router-options.ts— Zod schema forHonoRouterOptions - 2.3
src/factory/create-hono-router.ts— direct-surfaceRouterfactory backed by Hono - 2.4
src/blue-green/hono-blue-green-slot.ts— atomic two-instance pointer with health-gated swap - 2.5
src/proxy/create-hono-router-worker-proxy.ts—MessagePort-marshalled proxy viaapi-worker-rpc - 2.6
src/streaming/streaming-bridge.ts— HonoReadableStreamadapter forstreaming: trueroutes - 2.7
src/error-codes.ts—ROUTER_HONO_*codes viadefineCodes - 2.8
src/testing/index.ts— re-exportrunRouterConformancepre-bound tocreateHonoRouter - 2.9
src/index.ts— explicit named re-exports (noexport *)
3. Tests
- 3.1
src/factory/create-hono-router.test.ts— direct-surface unit tests - 3.2
src/factory/create-hono-router.spec-conformance.test.ts— invokesrunRouterConformanceagainst the direct factory - 3.3
src/proxy/create-hono-router-worker-proxy.test.ts— proxy-surface unit tests overMessageChannel - 3.4
src/proxy/create-hono-router-worker-proxy.spec-conformance.test.ts— invokesrunRouterConformanceagainst the proxy factory - 3.5
src/blue-green/hono-blue-green-slot.test.ts— swap semantics, in-flight completion, rollback on health failure - 3.6
src/streaming/streaming-bridge.test.ts— stream chunk preservation, abort propagation - 3.7
tests/integration/integration.test.ts— boot against realBun.serve - 3.8 Every
it(...)carries{ timeout: 5000 }(30000 for genuinely async)
4. Documentation
- 4.1 Sibling
.mdfor every implementation.ts(≥200 words, basic + advanced examples, full API reference) - 4.2 README links every co-located
.mdunder## Modules - 4.3 Register
@suaveplan/api-router-honoas the production router adapter in@suaveplan/api-host's adapter table documentation
5. Pre-archive verification (the 5-gate triple)
- 5.1
bun run check— Biome 0 errors / 0 warnings / 0 info - 5.2
bunx turbo lint typecheck test --filter=@suaveplan/api-router-hono— green - 5.3
bunx turbo test:coverage --filter=@suaveplan/api-router-hono— 100/100/100/100 - 5.4
bun scripts/openspec-conformance.ts @suaveplan/api-router-hono— exit 0 - 5.5
bunx turbo build --filter=@suaveplan/api-router-hono— green
6. Pre-archive 7-row checklist (AGENTS.md Section 13)
- 6.1 Generics threaded through every
Routermethod signature;expectTypeOfassertions on route-handler typing - 6.2 Zod schemas wired at the
HonoRouterOptionsboundary - 6.3 Every
ROUTER_HONO_*error code thrown by at least one production path - 6.4 Strict-mode behaviors (trustProxy on/off, maxBodyBytes enforcement) tested both on and off
- 6.5 OTel instruments emitted from production paths (route-match histogram, swap counter) asserted with in-memory
MeterProvider - 6.6 Blue-green swap dedup tested (concurrent
swap()calls collapse to one) - 6.7 No retroactive tick — every box above reflects work done in this change
7. Archive
- 7.1 Fold spec delta into
openspec/specs/api-router-hono/spec.md - 7.2 Move
openspec/changes/api-router-hono/→openspec/archive/<yyyy-mm-dd>-api-router-hono/ - 7.3 Tick the corresponding Stage 4 box in umbrella
openspec/changes/api-plugin-foundation/tasks.md - 7.4 Refresh
MANIFEST.md