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

60 lines
3.0 KiB
Markdown

# Tasks — add @suaveplan/api-plugin-graphql
## 1. Spec authoring
- [x] 1.1 Read `../suaveplan/enterprise/api-plugin-graphql.md` end-to-end
- [x] 1.2 Read genesis `openspec/specs/` (no prior `api-plugin-graphql` capability)
- [x] 1.3 Read `openspec/AGENTS.md` §§ 2a, 6a, 7, 12, 13, 14
- [x] 1.4 Draft `proposal.md` from template
- [x] 1.5 Fill `## Source mapping` — every requirement cites file/line or appears under "no source line" with justification
- [x] 1.6 Draft `specs/api-plugin-graphql/spec.md` from template
- [x] 1.7 Every requirement carries `**Verified by:**` lines naming concrete `it(...)` titles
## 2. Implementation
- [x] 2.1 `src/types/graphql.types.ts` — full type surface ported from upstream
- [x] 2.2 `src/error-codes/error-codes.ts` — `GRAPHQL_CODES` via `defineCodes`, `GraphQLError` class
- [x] 2.3 `src/schemas/options.ts` — Zod schema for `DefineGraphQLPluginOptions`
- [x] 2.4 `src/type-builder/type-builder.ts` — `TypeBuilder`
- [x] 2.5 `src/schema-builder/schema-builder.ts` — `SchemaBuilder`
- [x] 2.6 `src/resolver/resolver.ts` — `ResolverComposer`, `requireRoles`, `validateArgs`, `createQueryExecutedMiddleware`, `graphqlEvents`
- [x] 2.7 `src/otel/instruments.ts` — lazy-bound `MeterProvider` instruments
- [x] 2.8 `src/plugin/plugin.ts` — `defineGraphQLPlugin` with Zod validation at boundary
- [x] 2.9 `src/index.ts` — explicit named re-exports + side-effect `./error-codes/error-codes.js` import
## 3. Tests
- [x] 3.1 Unit tests beside every implementation file
- [x] 3.2 `src/api-plugin-graphql.spec-conformance.test.ts` — type-level + every error code + OTel emission
- [x] 3.3 Every `it(...)` carries `{ timeout: 5000 }` (or 30000 for async)
- [x] 3.4 Test files import only from `@suaveplan/testing/runner`
## 4. Documentation
- [x] 4.1 Sibling `.md` for every implementation `.ts` (≥200 words, basic + advanced examples, full API reference)
- [x] 4.2 README at package root
## 5. Pre-archive verification (5 gates)
- [x] 5.1 `bun run check`
- [x] 5.2 `bunx turbo lint typecheck test --filter=@suaveplan/api-plugin-graphql`
- [x] 5.3 `bunx turbo test:coverage --filter=@suaveplan/api-plugin-graphql`
- [x] 5.4 `bun scripts/openspec-conformance.ts @suaveplan/api-plugin-graphql`
- [x] 5.5 `bunx turbo build --filter=@suaveplan/api-plugin-graphql`
## 6. Pre-archive checklist (AGENTS.md §13)
- [x] 6.1 Generics threaded; `expectTypeOf` assertions on literal-type claims
- [x] 6.2 Zod schemas wired at the declared boundary
- [x] 6.3 Every `GRAPHQL_*` code thrown by ≥1 production path
- [x] 6.4 Strict-mode behaviors tested (auth pass + fail; validate pass + fail)
- [x] 6.5 OTel instruments emitted from production paths and asserted with real in-memory `MeterProvider`
- [x] 6.6 No retroactive tick — every box reflects work done in this change
- [x] 6.7 No `export *` in any feature-module barrel
- [x] 6.8 No direct `vitest`/`bun:test` imports in test files
## 7. Archive
- [x] 7.1 Fold spec delta into `openspec/specs/api-plugin-graphql/spec.md`
- [x] 7.2 Move change folder to `openspec/archive/2026-05-18-add-api-plugin-graphql/`