4.2 KiB
4.2 KiB
Tasks — @suaveplan/api-plugin-example
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 (§13.5, §15)
- 1.2 Read
openspec/AGENTS.mdSections 13 and 14 - 1.3 Draft
proposal.md - 1.4 Draft
specs/api-plugin-example/spec.md - 1.5 Every requirement carries
**Verified by:**
2. Implementation
- 2.1 Scaffold
packages/api/api-plugin-example/ - 2.2
plugin.json— every top-level key populated - 2.3
src/index.ts—definePlugin({ ... })with full surface - 2.4
src/routes/— public, private, validated, streaming, idempotent, rate-limited, RBAC-gated - 2.5
src/graphql/— types, resolvers, subscription - 2.6
src/ws/— connection lifecycle + subscription fan-out - 2.7
src/sse/— endpoint with Last-Event-Id resume - 2.8
src/saga/— owned saga (3-step) + compensations - 2.9
src/twopc/— 2PC participant hooks - 2.10
src/jobs/— scheduled (incl. per-tenant) + queued - 2.11
src/events/— publish + subscribe handlers - 2.12
src/error-codes.ts—PLUGIN.EXAMPLE.*registry - 2.13
src/instruments/— counter/histogram/gauge instances - 2.14
migrations/postgres/0001-init.sql+0002-bump.sql+ sqlite + surrealdb mirrors - 2.15 WASM-build variant for
sandboxed-wasmmode - 2.16
src/test/fail-response/—?failResponse=1schema-violation route
3. Tests
- 3.1
tests/integration/full-flow.integration.test.ts— parameterised over 4 isolation modes - 3.2
tests/integration/migration-rollback.integration.test.ts - 3.3
tests/integration/response-validation.integration.test.ts - 3.4
tests/integration/graphql-federation.integration.test.ts - 3.5
tests/integration/ws-broadcast.integration.test.ts - 3.6
tests/integration/saga-2pc.integration.test.ts - 3.7
vitest.config.ts(unit) +vitest.integration.config.ts(integration viatesting-integration-postgres) - 3.8 Every
it(...)carries{ timeout: 5000 }for unit,{ timeout: 30000 }for integration
4. Documentation
- 4.1 Sibling
.mdper implementation.ts - 4.2
README.md— full capability map + run instructions - 4.3 Update
CLAUDE.mdpackage listing
5. Pre-archive verification (the 5-gate triple)
- 5.1
bun run check - 5.2
bunx turbo lint typecheck test --filter=@suaveplan/api-plugin-example - 5.3
bunx turbo test:coverage --filter=@suaveplan/api-plugin-example— 100/100/100/100 - 5.4
bun scripts/openspec-conformance.ts @suaveplan/api-plugin-example - 5.5
INTEGRATION=1 bunx turbo test --filter=@suaveplan/api-plugin-example— all 6 integration suites green across 4 isolation modes
6. Pre-archive 7-row checklist
- 6.1 Generics threaded;
definePlugintyped againstrequiredCapabilities - 6.2 Zod schemas wired on every route, every event, every job payload
- 6.3 Every
PLUGIN.EXAMPLE.*code thrown by a production path AND mapped inerrors.statusMap - 6.4 Strict-mode behaviours: response validation
enforcereturns 500 on violation;warnlogs + counter - 6.5 OTel — manifest-declared counters/histograms/gauges asserted with real
MeterProvider - 6.6 Lifecycle dedup — install / start / stop / uninstall idempotent on re-entry
- 6.7 No retroactive tick
7. Archive
- 7.1 Fold spec delta into
openspec/specs/api-plugin-example/spec.md - 7.2 Move folder to archive
- 7.3 Tick
8.17in umbrella tasks AND Stage 8 ✓ in## 2. Stage rollup - 7.4 Refresh
MANIFEST.md