3.7 KiB
3.7 KiB
Tasks — Add @suaveplan/api-plugin-banking
1. Spec authoring
- 1.1 Read
../suaveplan/enterprise/api-plugin-banking.mdend-to-end - 1.2 Verify no prior
openspec/specs/api-plugin-banking/spec.mdexists - 1.3 Read
openspec/AGENTS.mdSections 13 and 14 - 1.4 Draft
proposal.mdfromopenspec/templates/proposal.md - 1.5 Fill
## Source mappingwith line references to upstream - 1.6 Draft
specs/api-plugin-banking/spec.mdfromopenspec/templates/spec-delta.md - 1.7 Every requirement carries a
**Verified by:**line naming concreteit(...)titles
2. Implementation
- 2.1
error-codes/error-codes.ts— 14BANKING.*codes +BankingErrorclass - 2.2
otel/instruments.ts— meter + 6 instruments (counters + histograms) - 2.3
schemas/schemas.ts— 11 Zod schemas - 2.4
schemas/options.ts—BankingPluginOptionsSchemafactory-options schema - 2.5
repositories/base-repository.ts— shared scaffold + field whitelist + RecordId flattening - 2.6
repositories/bank-repository.ts— full upstream bank surface retyped - 2.7
repositories/account-repository.ts— full upstream account surface retyped - 2.8
service/service.ts—BankingServicecoordinator with policy enforcement - 2.9
routes/build-routes.ts— 19 OpenAPIHono routes with uniform error mapping - 2.10
plugin/plugin.ts—createBankingPluginfactory +decommissionBankingTenanthelper - 2.11
services/registry-augmentation.ts—bankingService/app/dbslots - 2.12
types/types.ts— record aliases, result wrappers, lifecycle event payloads,BankingEventMap - 2.13
index.ts— explicit named barrel + side-effect imports for error-codes + registry augmentation - 2.14
surql/001-bank-and-account.surql— schema migration carried over verbatim
3. Tests
- 3.1 Unit tests per feature module (in-memory
FakeDatabaseAdapterfor fast feedback) - 3.2
api-plugin-banking.spec-conformance.test.ts— type-level + barrel pins - 3.3 Integration test against real SurrealDB testcontainer covering create / transfer / soft-delete / tenant-purge
- 3.4 Every
it(...)carries{ timeout: 5000 }(or 30000 for testcontainer-bound cases)
4. Documentation
- 4.1 Sibling
.mdfor every implementation.ts(≥200 words, basic + advanced examples, full API reference) - 4.2 README links every co-located
.md - 4.3 STATUS.md row updated post-archival (other-session-owned; skipped per guidance)
5. Pre-archive verification (the 5-gate triple)
- 5.1
bun run check— Biome 0/0/0 - 5.2
bunx turbo lint typecheck test --filter=@suaveplan/api-plugin-banking - 5.3
bunx turbo test:coverage --filter=@suaveplan/api-plugin-banking - 5.4
bun scripts/openspec-conformance.ts @suaveplan/api-plugin-banking - 5.5
bunx turbo build --filter=@suaveplan/api-plugin-banking
6. Pre-archive 9-row checklist
- 6.1 Generics threaded;
expectTypeOfassertions on every literal-type claim - 6.2 Zod schemas wired at every declared boundary
- 6.3 Every error code in
error-codes.tsthrown by at least one production path - 6.4 Strict-mode behaviours tested both on and off (overdraft toggle)
- 6.5 OTel instruments emitted from production paths and asserted with a real in-memory
MeterProvider - 6.6 Lifecycle dedup tested where claimed (idempotent default-bank bootstrap)
- 6.7 No retroactive tick
- 6.8 No
export *in any feature barrel - 6.9 No direct
vitest/bun:testimports in any test file
7. Archive
- 7.1 Fold spec delta into
openspec/specs/api-plugin-banking/spec.md - 7.2 Move
openspec/changes/add-api-plugin-banking/→openspec/archive/2026-05-19-add-api-plugin-banking/