3.6 KiB
3.6 KiB
Tasks — Add @suaveplan/api-plugin-tenant
Every checkbox MUST reflect work actually done in this change.
1. Spec authoring
- 1.1 Read
../suaveplan/enterprise/api-plugin-tenant.mdend-to-end - 1.2 Read
@suaveplan/api-tenantREADME +index.ts(wrapped library) - 1.3 Read
openspec/AGENTS.mdSections 13 and 14 - 1.4 Draft
proposal.mdfromopenspec/templates/proposal.md - 1.5 Fill in
## Source mappingtable - 1.6 Draft
specs/api-plugin-tenant/spec.mdfromopenspec/templates/spec-delta.md - 1.7 Every requirement carries a
**Verified by:**line
2. Implementation
- 2.1
src/error-codes/error-codes.ts— 7TENANT_PLUGIN_*codes viadefineCodes - 2.2
src/types/types.ts—TenantPluginOptions,TenantPluginConfig,TenantStrategySpec - 2.3
src/store/store.ts—TenantStoreinterface (canonical contract) - 2.4
src/store/memory.ts—MemoryTenantStoredefault in-memory implementation - 2.5
src/schemas/options.ts— Zod schemas forTenantPluginOptions - 2.6
src/schemas/routes.ts— Zod request/response schemas for CRUD routes - 2.7
src/services/tenant-service.ts—TenantServiceinterface + factory - 2.8
src/services/registry-augmentation.ts— module augmentation fortenantService - 2.9
src/middleware/tenant.ts— middleware install wrapping@suaveplan/api-tenant - 2.10
src/routes/routes.ts—buildTenantRoutes()returningPluginRouteEntry[] - 2.11
src/plugin/plugin.ts—createTenantPluginfactory + 6-steponInit - 2.12
src/otel/instruments.ts— counters + histogram via realMeterProvider - 2.13
src/index.ts— explicit named re-exports - 2.14 Sibling
.mdfor every implementation file
3. Tests
- 3.1 Unit tests per feature module — every code path covered
- 3.2
src/api-plugin-tenant.spec-conformance.test.ts— type / observability / augmentation - 3.3
tests/integration/full-boot.test.ts— end-to-end resolver chain + CRUD - 3.4 Every
it(...)carries{ timeout: 5000 }(or higher for integration)
4. Documentation
- 4.1 Sibling
.mdfor every implementation.ts(≥200 words, basic + advanced examples) - 4.2 README links every co-located
.mdunder## Modules - 4.3 No CLAUDE.md update needed (CLAUDE.md does not enumerate
api-plugin-*packages individually)
5. Pre-archive verification
- 5.1
bun run check— Biome clean - 5.2
bunx turbo lint typecheck test --filter=@suaveplan/api-plugin-tenant - 5.3
bunx turbo test:coverage --filter=@suaveplan/api-plugin-tenant— 100/100/100/100 - 5.4
bun scripts/openspec-conformance.ts @suaveplan/api-plugin-tenant— exit 0 - 5.5
bunx turbo build --filter=@suaveplan/api-plugin-tenant - 5.6
bun scripts/lint/check-test-runner-imports.ts— exit 0
6. Pre-archive 9-row checklist
- 6.1 Generics threaded;
expectTypeOfwhere literal-type claims are made - 6.2 Zod schemas wired at every declared boundary (options + every CRUD body)
- 6.3 Every error code in
error-codes.tsthrown by at least one production path - 6.4 Strict-mode behaviours tested on and off (
required: true/false) - 6.5 OTel instruments emitted from production paths, asserted with real
MeterProvider - 6.6 Cache hit/miss tested via
TenantCache - 6.7 No retroactive ticking
- 6.8 No
export *in feature-module barrels - 6.9 No direct
vitest/bun:testimports
7. Archive
- 7.1 Fold spec delta into
openspec/specs/api-plugin-tenant/spec.md - 7.2 Move change folder to
openspec/archive/2026-05-19-add-api-plugin-tenant/