66 lines
3.5 KiB
Markdown
66 lines
3.5 KiB
Markdown
# Tasks — migrate-api-plugin-contacts
|
|
|
|
## 1. Spec authoring
|
|
|
|
- [x] 1.1 Read `../suaveplan/enterprise/api-plugin-contacts.md` end-to-end
|
|
- [x] 1.2 Read `openspec/specs/api-plugin-contacts/spec.md` (does not exist yet — new package)
|
|
- [x] 1.3 Read `openspec/AGENTS.md` Sections 13 and 14
|
|
- [x] 1.4 Draft `proposal.md` from `openspec/templates/proposal.md`
|
|
- [x] 1.5 Fill in `## Source mapping` table
|
|
- [x] 1.6 Draft `specs/api-plugin-contacts/spec.md` from `openspec/templates/spec-delta.md`
|
|
- [x] 1.7 Every requirement carries a `**Verified by:**` line naming concrete `it(...)` titles
|
|
|
|
## 2. Implementation
|
|
|
|
- [x] 2.1 Scaffold package (`package.json`, `tsconfig*`, `vite.config.ts`, `vitest.config.ts`, README)
|
|
- [x] 2.2 Port SurrealQL schema to `surql/tables/{contact,contact_group,group_membership}.surql`
|
|
- [x] 2.3 Define `CONTACTS_API_CODES` + `ContactsApiError` (12 codes)
|
|
- [x] 2.4 Define OTel instruments (4 counters + 2 histograms)
|
|
- [x] 2.5 Implement typed Hono `ContextVariableMap` + `ServiceRegistry` augmentations
|
|
- [x] 2.6 Implement `SurrealContactRepository` against `ContactStore`
|
|
- [x] 2.7 Implement `SurrealGroupRepository` against `GroupStore` with `maxGroupDepth` enforcement
|
|
- [x] 2.8 Implement `SurrealMembershipRepository` against `MembershipStore`
|
|
- [x] 2.9 Implement typed `buildTree` helper
|
|
- [x] 2.10 Implement contact route builders (list, create, get, update, delete, bulk-import, merge)
|
|
- [x] 2.11 Implement group route builders (list, create, get, update, delete, tree, move)
|
|
- [x] 2.12 Implement group-member route builders (list, add, remove, resolve)
|
|
- [x] 2.13 Implement `createContactsPlugin` factory wiring config validation, ServiceRegistry slots, middleware, schema migration
|
|
- [x] 2.14 Root barrel re-exports all public symbols including `ContactsPluginConfigSchema`
|
|
|
|
## 3. Tests
|
|
|
|
- [x] 3.1 Unit tests at `src/**/*.test.ts` covering every public symbol
|
|
- [x] 3.2 Spec-conformance tests at `src/api-plugin-contacts.spec-conformance.test.ts`
|
|
- [x] 3.3 Real-SurrealDB integration tests under `tests/integration/`
|
|
- [x] 3.4 Every `it(...)` carries `{ timeout: 5000 }` (or up to 180_000 for testcontainer beforeAll)
|
|
|
|
## 4. Documentation
|
|
|
|
- [x] 4.1 Sibling `.md` for every implementation `.ts`
|
|
- [x] 4.2 README links every co-located `.md` under `## Modules`
|
|
- [x] 4.3 Update `CLAUDE.md` package listing — add `### Contacts` section
|
|
|
|
## 5. Pre-archive verification (the 5-gate triple)
|
|
|
|
- [x] 5.1 `bun run check` — Biome 0/0/0
|
|
- [x] 5.2 `bunx turbo lint typecheck test --filter=@suaveplan/api-plugin-contacts` — green
|
|
- [x] 5.3 `bunx turbo test:coverage --filter=@suaveplan/api-plugin-contacts` — 100/100/100/100
|
|
- [x] 5.4 `bun scripts/openspec-conformance.ts @suaveplan/api-plugin-contacts` — exit 0
|
|
- [x] 5.5 `bunx turbo build --filter=@suaveplan/api-plugin-contacts` — green
|
|
|
|
## 6. Pre-archive 7-row checklist
|
|
|
|
- [x] 6.1 Generics threaded; `expectTypeOf` assertions on public types
|
|
- [x] 6.2 Zod schemas wired at every declared boundary
|
|
- [x] 6.3 Every error code thrown by ≥1 production path
|
|
- [x] 6.4 Strict-mode behaviors tested both on and off (depth enforcement on/off)
|
|
- [x] 6.5 OTel instruments emitted from production paths and asserted with real `MeterProvider`
|
|
- [x] 6.6 Lifecycle dedup tested where claimed (idempotent membership add)
|
|
- [x] 6.7 No retroactive tick
|
|
|
|
## 7. Archive
|
|
|
|
- [x] 7.1 Fold spec delta into `openspec/specs/api-plugin-contacts/spec.md`
|
|
- [x] 7.2 Move change folder to `openspec/archive/2026-05-20-migrate-api-plugin-contacts/`
|
|
- [x] 7.3 Refresh `MANIFEST.md`
|