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

3.0 KiB

Tasks — add @suaveplan/api-plugin-graphql

1. Spec authoring

  • 1.1 Read ../suaveplan/enterprise/api-plugin-graphql.md end-to-end
  • 1.2 Read genesis openspec/specs/ (no prior api-plugin-graphql capability)
  • 1.3 Read openspec/AGENTS.md §§ 2a, 6a, 7, 12, 13, 14
  • 1.4 Draft proposal.md from template
  • 1.5 Fill ## Source mapping — every requirement cites file/line or appears under "no source line" with justification
  • 1.6 Draft specs/api-plugin-graphql/spec.md from template
  • 1.7 Every requirement carries **Verified by:** lines naming concrete it(...) titles

2. Implementation

  • 2.1 src/types/graphql.types.ts — full type surface ported from upstream
  • 2.2 src/error-codes/error-codes.ts — GRAPHQL_CODES via defineCodes, GraphQLError class
  • 2.3 src/schemas/options.ts — Zod schema for DefineGraphQLPluginOptions
  • 2.4 src/type-builder/type-builder.ts — TypeBuilder
  • 2.5 src/schema-builder/schema-builder.ts — SchemaBuilder
  • 2.6 src/resolver/resolver.ts — ResolverComposer, requireRoles, validateArgs, createQueryExecutedMiddleware, graphqlEvents
  • 2.7 src/otel/instruments.ts — lazy-bound MeterProvider instruments
  • 2.8 src/plugin/plugin.ts — defineGraphQLPlugin with Zod validation at boundary
  • 2.9 src/index.ts — explicit named re-exports + side-effect ./error-codes/error-codes.js import

3. Tests

  • 3.1 Unit tests beside every implementation file
  • 3.2 src/api-plugin-graphql.spec-conformance.test.ts — type-level + every error code + OTel emission
  • 3.3 Every it(...) carries { timeout: 5000 } (or 30000 for async)
  • 3.4 Test files import only from @suaveplan/testing/runner

4. Documentation

  • 4.1 Sibling .md for every implementation .ts (≥200 words, basic + advanced examples, full API reference)
  • 4.2 README at package root

5. Pre-archive verification (5 gates)

  • 5.1 bun run check
  • 5.2 bunx turbo lint typecheck test --filter=@suaveplan/api-plugin-graphql
  • 5.3 bunx turbo test:coverage --filter=@suaveplan/api-plugin-graphql
  • 5.4 bun scripts/openspec-conformance.ts @suaveplan/api-plugin-graphql
  • 5.5 bunx turbo build --filter=@suaveplan/api-plugin-graphql

6. Pre-archive checklist (AGENTS.md §13)

  • 6.1 Generics threaded; expectTypeOf assertions on literal-type claims
  • 6.2 Zod schemas wired at the declared boundary
  • 6.3 Every GRAPHQL_* code thrown by ≥1 production path
  • 6.4 Strict-mode behaviors tested (auth pass + fail; validate pass + fail)
  • 6.5 OTel instruments emitted from production paths and asserted with real in-memory MeterProvider
  • 6.6 No retroactive tick — every box reflects work done in this change
  • 6.7 No export * in any feature-module barrel
  • 6.8 No direct vitest/bun:test imports in test files

7. Archive

  • 7.1 Fold spec delta into openspec/specs/api-plugin-graphql/spec.md
  • 7.2 Move change folder to openspec/archive/2026-05-18-add-api-plugin-graphql/