4.3 KiB
4.3 KiB
Tasks: wire-surreal-export-store
Ordered checklist. Each task corresponds to a discrete ### Requirement / #### Scenario in specs/api-plugin-export/spec.md.
1. Store contract
- 1.1 Author
src/store/types/types.ts—ExportJobStoreasync interface (get,set,delete,list,has,clear) +ExportJobStoreListQuery(mirrorsExportJobListQuerywithout pagination defaults required by SurrealDB). - 1.2 Author sibling
src/store/types/types.md(≥ 200 words).
2. In-memory backend
- 2.1 Author
src/store/memory/memory-store.ts—MemoryExportJobStoreclass wrappingMap<string, ExportJob>withExportJobStore-conformant async methods. - 2.2 Author
src/store/memory/memory-store.test.ts— 100% coverage of every branch (get / set / delete / list filters + pagination / has / clear). - 2.3 Author sibling
src/store/memory/memory-store.md(≥ 200 words). - 2.4 Author
src/store/memory/index.tsbarrel (explicit named re-exports — §6a).
3. SurrealDB backend
- 3.1 Author
src/store/surreal/surreal-store.ts—SurrealExportStoreclass implementingExportJobStore. Positional$p0…$pNSurQL. Every failure wrapped inExportError(EXPORT_CODES.JOB_PERSISTENCE_FAILED)withcausechain. - 3.2 Author
src/store/surreal/surreal-store.types.ts—SurrealExportStoreConfig(Zod-validated,db: SurrealAdapter,tableNameoptional default"export_job"). - 3.3 Author sibling
src/store/surreal/surreal-store.md(≥ 200 words). - 3.4 Author
src/store/surreal/index.tsbarrel. - 3.5 Author
src/store/index.tsbarrel.
4. Error code registry
- 4.1 Extend
src/error-codes/error-codes.ts— addJOB_PERSISTENCE_FAILEDtoEXPORT_CODES. - 4.2 Update
src/error-codes/error-codes.mdto describe the new code. - 4.3 Extend
src/error-codes/error-codes.test.tswith a narrowing test for the new code.
5. SurrealDB schema migration
- 5.1 Author
surql/tables/export_job.surql—DEFINE TABLE OVERWRITE export_job SCHEMAFULLwith one field perExportJobSchemaproperty plus indexes on(status),(format),(resource),(created_at).
6. Service-registry augmentation
- 6.1 Extend
src/services/registry-augmentation.ts— addexportJobStore: ExportJobStoreslot.
7. Barrel + subpath exports
- 7.1 Extend
src/index.ts— re-exportExportJobStore(type),MemoryExportJobStore,SurrealExportStore,SurrealExportStoreConfig(type). - 7.2 Extend
package.jsonexportsmap — add./store/types/types,./store/memory/memory-store,./store/surreal/surreal-store. - 7.3 Add
@suaveplan/surrealdbtodependencies(workspace:^). - 7.4 Add
@suaveplan/testing-integration-surrealdbtodevDependencies. - 7.5 Update
filesarray inpackage.jsonto include"surql".
8. Integration test (real SurrealDB testcontainer — no mocks)
- 8.1 Author
tests/setup/polyfills.tsmirroring theapi-plugin-eventssetup (in-memory OTelMeterProvider). - 8.2 Author
tests/integration/surreal-store.test.ts— bootsSurrealDBFixture, applies the migration, exercises everyExportJobStoremethod round-trip. - 8.3 Extend
vitest.config.ts— addsetupFiles: ["./tests/setup/polyfills.ts"], includetests/**/*.test.ts, register the newsurreal-store.tsfile in coverage excludes only if integration test is the verifier (it is — integration test counts towards coverage).
9. Spec-conformance pin
- 9.1 Extend
src/api-plugin-export.spec-conformance.test.tsto assertJOB_PERSISTENCE_FAILEDis thrown from a production source file.
10. Gates
- 10.1
bunx biome check src/— zero diagnostics. - 10.2
bunx turbo lint typecheck test --filter=@suaveplan/api-plugin-export— green. - 10.3
bunx turbo test:coverage --filter=@suaveplan/api-plugin-export— 100 / 100 / 100 / 100. - 10.4
bun scripts/openspec-conformance.ts @suaveplan/api-plugin-export— 0 errors. - 10.5
bunx turbo build --filter=@suaveplan/api-plugin-export— green.
11. Archive
- 11.1 Fold
specs/api-plugin-export/spec.mdintoopenspec/specs/api-plugin-export/spec.md(## ADDEDblock appended,## MODIFIEDapplied to existing requirement). - 11.2
mv openspec/changes/wire-surreal-export-store openspec/archive/2026-05-19-wire-surreal-export-store.