4.6 KiB
4.6 KiB
Tasks — add-api-plugin-notifications
1. Spec authoring
- 1.1 Read
../suaveplan/enterprise/api-plugin-notifications.mdend-to-end - 1.2 Confirm
openspec/specs/api-plugin-notifications/does not pre-exist - 1.3 Read
openspec/AGENTS.mdSections 0a, 2a, 6a, 7, 12, 13, 14 - 1.4 Draft
proposal.mdfromopenspec/templates/proposal.md - 1.5 Fill
## Source mappingtable - 1.6 Draft
specs/api-plugin-notifications/spec.mdfromopenspec/templates/spec-delta.md - 1.7 Every requirement in the spec delta carries a
**Verified by:**line
2. Implementation
- 2.1
src/error-codes/error-codes.ts—defineCodes("NOTIFICATIONS_PLUGIN", [...])with 18 codes - 2.2
src/schemas/notification-schemas.ts— notification entity + wire schemas - 2.3
src/schemas/push-schemas.ts— device-token + push wire schemas - 2.4
src/schemas/options.ts—NotificationsPluginOptionsSchema,ApnConfigSchema - 2.5
src/otel/instruments.ts—NotificationsInstruments, lazy memoised factory - 2.6
src/services/registry-augmentation.ts— declare repo + APN slots - 2.7
src/repositories/notification-repository/notification-repository.ts— full repository over positional SurQL - 2.8
src/repositories/device-token-repository/device-token-repository.ts— full repository over positional SurQL - 2.9
src/transport/apn-transport/apn-transport.ts—MemoryApnTransport+ factory + interface - 2.10
src/services/apn-service/apn-service.ts—ApnServicewith pluggable transport - 2.11
src/routes/notifications-routes/notifications-routes.ts— 11 endpoints with OTel + event-bus emission - 2.12
src/routes/push-routes/push-routes.ts— 5 endpoints - 2.13
src/plugin/plugin.ts— factory + onInit / onReady / onClose - 2.14
src/types/types.ts— public types - 2.15
src/index.ts— explicit named re-exports - 2.16
surql/tables/notification.surql+surql/tables/device_token.surql
3. Tests
- 3.1
src/error-codes/error-codes.test.ts— every code referenced from a real throw site - 3.2
src/schemas/*.test.ts— Zod boundary positive + negative cases - 3.3
src/otel/instruments.test.ts— realMeterProvider, asserts emission - 3.4
src/repositories/notification-repository/notification-repository.test.ts— full CRUD - 3.5
src/repositories/device-token-repository/device-token-repository.test.ts— full CRUD - 3.6
src/transport/apn-transport/apn-transport.test.ts—MemoryApnTransportpaths - 3.7
src/services/apn-service/apn-service.test.ts— every error branch - 3.8
src/routes/notifications-routes/notifications-routes.test.ts— every route + status code + auth + ownership - 3.9
src/routes/push-routes/push-routes.test.ts— every route + status code - 3.10
src/plugin/plugin.test.ts— lifecycle, double-mount, missing dep - 3.11
src/api-plugin-notifications.spec-conformance.test.ts— pins public surface - 3.12
tests/integration/full-boot.test.ts— real SurrealDB, boots plugin + CRUD roundtrip - 3.13 Every
it(...)carries{ timeout: 5000 }(or 30000+ for genuinely async)
4. Documentation
- 4.1 Sibling
.mdfor every implementation.ts(≥200 words, basic + advanced examples) - 4.2
README.mdlinks every co-located.mdunder## Modules
5. Pre-archive verification (the 5-gate triple)
- 5.1
bun run check— green - 5.2
bunx turbo lint typecheck test --filter=@suaveplan/api-plugin-notifications— green - 5.3
bunx turbo test:coverage --filter=@suaveplan/api-plugin-notifications— 100/100/100/100 - 5.4
bun scripts/openspec-conformance.ts @suaveplan/api-plugin-notifications— 0 errors - 5.5
bunx turbo build --filter=@suaveplan/api-plugin-notifications— green
6. Pre-archive 7-row checklist (AGENTS.md §13)
- 6.1 Generics threaded;
expectTypeOfassertions where literal-type claims exist - 6.2 Zod schemas wired at every declared boundary
- 6.3 Every code in
NOTIFICATIONS_PLUGIN_CODESthrown by ≥1 production path - 6.4 OTel instruments emitted from production paths and asserted with real
MeterProvider - 6.5 Lifecycle dedup tested (double-mount guard,
onCloseclears state) - 6.6 No retroactive tick — every box reflects work done in this change
- 6.7 Test files import only from
@suaveplan/testing/runner(rule 11)
7. Archive
- 7.1 Fold spec delta into
openspec/specs/api-plugin-notifications/spec.md - 7.2 Move
openspec/changes/add-api-plugin-notifications/→openspec/archive/2026-05-19-add-api-plugin-notifications/