Description:
Expose a read-only GraphQL API alongside REST for integrators and analytics dashboards, with dataloader batching, query cost limits, and persisted queries.
Problem Statement & Context:
Dashboards currently stitch multiple REST calls (intents + solvers + audit + tokens), causing over-fetching and N+1 request patterns against the relay.
Scope & Acceptance Criteria:
@nestjs/graphql (Apollo or Mercurius) at /graphql; types for Intent, Solver, Token, AuditEntry, Stats.
- Relay-style connections reusing the keyset cursor codec.
- Query depth/complexity limits; introspection disabled in production; persisted-query allowlist option.
- DataLoader for solver/token lookups.
- Out of scope: mutations and subscriptions.
Implementation Guidelines:
- Key Files/Modules: new
src/graphql/ module, reuse services from src/intents, src/solvers, src/tokens, src/stats.
- Design/Architecture: Code-first schema; resolvers delegate to existing services (no duplicated business logic).
- Edge Cases/Constraints: Complexity limit prevents > 1,000 node fetches per query.
- Testing: Resolver tests, complexity-limit tests, e2e snapshot of schema SDL.
Definition of "Done": Common DoD; schema SDL committed and diffed in CI.
Resources:
Common Definition of "Done" (applies in addition to the criteria above):
- Code written, tested, and documented (TSDoc on public APIs, README/runbook/ADR updates where behaviour changes).
- All acceptance criteria met;
npm run lint, npm run typecheck, npm test, npm run test:e2e pass in CI.
- PR follows
.github/PULL_REQUEST_TEMPLATE, uses a Conventional Commit title (enforced by commitlint), includes test output / metrics screenshots, and references the issue.
- New env vars are added to
.env.example variants and src/config/env.validation.ts (the check:env-drift script must pass).
- Reviewed and approved by at least one CODEOWNER.
Description:
Expose a read-only GraphQL API alongside REST for integrators and analytics dashboards, with dataloader batching, query cost limits, and persisted queries.
Problem Statement & Context:
Dashboards currently stitch multiple REST calls (intents + solvers + audit + tokens), causing over-fetching and N+1 request patterns against the relay.
Scope & Acceptance Criteria:
@nestjs/graphql(Apollo or Mercurius) at/graphql; types for Intent, Solver, Token, AuditEntry, Stats.Implementation Guidelines:
src/graphql/module, reuse services fromsrc/intents,src/solvers,src/tokens,src/stats.Definition of "Done": Common DoD; schema SDL committed and diffed in CI.
Resources:
Common Definition of "Done" (applies in addition to the criteria above):
npm run lint,npm run typecheck,npm test,npm run test:e2epass in CI..github/PULL_REQUEST_TEMPLATE, uses a Conventional Commit title (enforced by commitlint), includes test output / metrics screenshots, and references the issue..env.examplevariants andsrc/config/env.validation.ts(thecheck:env-driftscript must pass).