3.5 KiB
3.5 KiB
Tasks — extend-api-foundation-host-services
Two-package patch. Order matters: api-plugin first (gates the api side). The two test/gate sweeps run separately per package; no umbrella.
1. Patch @suaveplan/api-plugin
- 1.1 Add
PLUGIN_INVALID_STATEtosrc/error-codes.ts(preserves the existing 10 codes — total 11) - 1.2 Add
src/registry/seed-services.ts(or extendsrc/registry/registry.ts) withseedServices(map)method onPluginRegistry. InternalseededServices: Map<string, unknown>. Idempotent re-seed. - 1.3 Modify
createPluginContext(or wherever the per-plugin context is built) to pre-populate the sharedservicesmap from the registry's seeded entries beforeonRegisterruns - 1.4 Tests:
- 1.4.1
src/registry/seed-services.test.ts— covers the 3 scenarios in the spec delta (seed → resolve, later seed overrides, post-init throws) - 1.4.2 Update
src/api-plugin.spec-conformance.test.ts— assertsPLUGIN_INVALID_STATEpresent + thrown from a real production path (seedServicesafter init)
- 1.4.1
- 1.5 Update sibling
.mdfor registry + error-codes - 1.6 Gates:
- 1.6.1
bunx turbo lint typecheck test --filter=@suaveplan/api-plugin --forcegreen - 1.6.2
bunx turbo test:coverage --filter=@suaveplan/api-plugin --force— still 100/100/100/100 - 1.6.3
bun scripts/openspec-conformance.ts @suaveplan/api-pluginexit 0 - 1.6.4
bunx turbo build --filter=@suaveplan/api-plugin --forcegreen - 1.6.5 Dependent sweep
bunx turbo test --filter=...@suaveplan/api-plugin --forcestill green (verifies no regression in tenant/openapi/migrations/api)
- 1.6.1
2. Patch @suaveplan/api
- 2.1 Add
src/services/registry-augmentation.{ts,md,index.ts}declaring the canonical ServiceRegistry slots. Root barrel side-effect imports it. - 2.2 Add subpath export
./services/registry-augmentationinpackage.json - 2.3 Modify
src/app/app.tsSuaveApp.initialize()to callthis._registry.seedServices(...)beforethis._registry.initialize() - 2.4 Add
db?: SurrealAdaptertoSuaveAppOptions(insrc/types/api.tsor wherever the options type lives); store onthis._db. UpdateAppBuilder.database(...)to also store the adapter when provided as a constructed object. - 2.5 Add
@suaveplan/surrealdbas an optional peer dep so thedbslot type is resolvable (peerDependencyMeta.optional: true to avoid forcing the dep on api consumers who don't use SurrealDB) - 2.6 Tests:
- 2.6.1
src/app/seed-services.test.ts— covers the 3 scenarios in the spec delta (plugin resolves app, slots seeded, missing migrationRunner) - 2.6.2
src/services/registry-augmentation.test.ts— covers the side-effect import + type augmentation - 2.6.3
src/services/registry-augmentation.spec-conformance.test.ts—expectTypeOfevery slot - 2.6.4
src/app/options.test.ts— db option seeded / missing
- 2.6.1
- 2.7 Sibling
.mdfor registry-augmentation module - 2.8 Gates: same 5 as §1.6 but filtered for
@suaveplan/api
3. Archive
- 3.1 Fold
specs/api-plugin/spec.mdinto canonicalopenspec/specs/api-plugin/spec.md(append the new requirement; preserve existing) - 3.2 Fold
specs/api/spec.mdinto canonicalopenspec/specs/api/spec.md(append the new requirements; preserve existing) - 3.3 Move
openspec/changes/extend-api-foundation-host-services/→openspec/archive/<date>-extend-api-foundation-host-services/ - 3.4 DO NOT refresh MANIFEST or STATUS — orchestrator consolidates after the full chain ships