Files
2026-05-27 23:29:53 +01:00

78 lines
4.1 KiB
Markdown

# Tasks — `@suaveplan/api-graphql-apollo`
> Every checkbox MUST reflect work actually done in this change.
## 0. Pre-flight (non-negotiable)
- [x] 0.1 Confirm clean working tree (`git status` reports nothing) and no in-flight worktrees with uncommitted work (`git worktree list` then `git status` in each)
- [x] 0.2 If any worktrees exist under `.claude/worktrees/`, account for each one: still-active agent, work-pending-merge, or stale-and-prune. Stale worktrees MUST be removed (`git worktree remove`) before opening a new one — code that has been lost twice on main is the failure mode this guards against.
- [x] 0.3 Confirm the package set in `MANIFEST.md` matches `find packages -maxdepth 3 -name package.json` count. Drift here means a prior change archived without regenerating the manifest.
## 1. Spec authoring
- [x] 1.1 Read design doc §10 end-to-end
- [x] 1.2 Read umbrella Stage 7 acceptance
- [x] 1.3 Read `openspec/AGENTS.md` Sections 13 and 14
- [x] 1.4 Read sibling `openspec/changes/api-graphql-yoga/` for cross-engine parity
- [x] 1.5 Draft `proposal.md`
- [x] 1.6 Draft `specs/api-graphql-apollo/spec.md`
- [x] 1.7 Every requirement carries a `**Verified by:**` line
## 2. Implementation
- [x] 2.1 Scaffold `packages/api/api-graphql-apollo/`
- [x] 2.2 `src/options/options.ts` — `ApolloGraphqlOptions` Zod schema
- [x] 2.3 `src/engine/apollo-engine.ts` — `createApolloGraphqlEngine(opts)`; implements engine contract
- [x] 2.4 `src/federation/federation.ts` — schema merge; collision raises `GRAPHQL.SCHEMA_COLLISION`
- [x] 2.5 `src/endpoints/http.ts` — mount `POST /graphql`, `GET /graphql/sdl`
- [x] 2.6 `src/endpoints/ui-proxy.ts` — `/graphql/ui` proxied to wired UI plugin
- [x] 2.7 `src/subscriptions/subscriptions.ts` — `graphql-ws` over `api-ws`
- [x] 2.8 `src/loaders/loaders.ts` — per-request DataLoader
- [x] 2.9 `src/persisted-queries/persisted-queries.ts` — manifest loader; lookup; eviction
- [x] 2.10 `src/studio-reporting/studio-reporting.ts` — optional Apollo Studio usage reporter; disabled by default
- [x] 2.11 `src/guards/depth-and-complexity.ts` — depth + complexity limits
- [x] 2.12 `src/instruments/instruments.ts` — engine-agnostic `graphql.*` metric names
- [x] 2.13 `src/error-codes.ts` — 10 `GRAPHQL_APOLLO_*` codes
- [x] 2.14 `./testing` subpath — re-export `runGraphqlEngineConformance` bound to Apollo factory
- [x] 2.15 `src/index.ts` — explicit named re-exports
## 3. Tests
- [x] 3.1 Unit tests, every `it(...)` `{ timeout: 5000 }`
- [x] 3.2 Conformance test — passes the SAME suite as Yoga
- [x] 3.3 Federation parity test
- [x] 3.4 Subscriptions integration (`{ timeout: 30000 }`)
- [x] 3.5 Persisted-query lookup tests
- [x] 3.6 Engine-swap integration test (`{ timeout: 30000 }`) — boots Yoga then Apollo, asserts identical SDL + identical metric names
- [x] 3.7 All tests import from `@suaveplan/testing/runner`
## 4. Documentation
- [x] 4.1 Sibling `.md` per implementation file
- [x] 4.2 `README.md` with `## Modules`; note positioning vs Yoga (Apollo for Studio / persisted-query / Apollo ecosystem; otherwise Yoga is faster)
## 5. Pre-archive verification
- [x] 5.1 `bun run check` — 0/0/0
- [x] 5.2 `bunx turbo lint typecheck test --filter=@suaveplan/api-graphql-apollo` — green
- [x] 5.3 `bunx turbo test:coverage --filter=@suaveplan/api-graphql-apollo` — 100/100/100/100
- [x] 5.4 `bun scripts/openspec-conformance.ts @suaveplan/api-graphql-apollo` — exit 0
- [x] 5.5 `bunx turbo build --filter=@suaveplan/api-graphql-apollo` — green
## 6. Pre-archive 7-row checklist
- [x] 6.1 Generics threaded; `expectTypeOf` on every literal-type claim
- [x] 6.2 Zod schemas at every config boundary
- [x] 6.3 Every `GRAPHQL_APOLLO_*` code thrown
- [x] 6.4 Strict-mode tested (introspection on vs off; studio reporting on vs off)
- [x] 6.5 OTel instruments asserted; metric names match Yoga's
- [x] 6.6 Lifecycle dedup on schema rebuilds
- [x] 6.7 No retroactive tick
## 7. Archive
- [x] 7.1 Fold spec delta into `openspec/specs/api-graphql-apollo/spec.md`
- [x] 7.2 Move to `openspec/archive/<yyyy-mm-dd>-api-graphql-apollo/`
- [x] 7.3 Tick Stage-7 row in umbrella tasks
- [x] 7.4 Refresh `MANIFEST.md`