Skip to content

feat(graphql): schema artifact, metrics, persisted queries, and query test suite (#372, #374, #375, #378) - #454

Open
sparkysolutions10-pixel wants to merge 2 commits into
Divinity-Labs:mainfrom
sparkysolutions10-pixel:feat/graphql-suite-372-374-375-378
Open

sparkysolutions10-pixel wants to merge 2 commits into
Divinity-Labs:mainfrom
sparkysolutions10-pixel:feat/graphql-suite-372-374-375-378

Conversation

@sparkysolutions10-pixel

@sparkysolutions10-pixel sparkysolutions10-pixel commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Addresses and resolves four interrelated issues on the GraphQL surface:

  1. GraphQL Schema Artifact & Zero-Drift Guard (closes The schema is a template literal with nothing checking it #372):

    • Exported the canonical GraphQL SDL artifact at schema.graphql at the repository root.
    • Added scripts/export-schema.ts supporting --check mode to ensure committed schema.graphql and the code schema in src/api/schema.ts never drift.
    • Added npm scripts
      pm run schema:export and
      pm run schema:check.
    • Added src/tests/graphqlSchema.test.ts verifying valid SDL and zero drift.
  2. Prometheus Metrics with Bounded Label Cardinality (closes No metric distinguishes GraphQL from anything else #374):

    • Added graphql_operations_total counter (operation_name, operation_type). Unbounded/unknown client-supplied names are folded into 'other' to protect Prometheus from time-series explosion.
    • Added graphql_resolver_duration_seconds histogram ( ield) recording resolution latency for database-backed operations (getPrice, getBestRoute, getPriceHistory).
    • Added graphql_errors_total counter (category) with strictly bounded categories (�alidation,
      ot_found, unauthorized, persisted_query, internal, other).
    • Added src/tests/graphqlMetrics.test.ts.
  3. Comprehensive GraphQL Query Test Suite & REST Parity (closes No test ever executes a GraphQL query #375):

    • Added src/tests/graphqlQueries.test.ts executing all 4 queries through a real Mercurius instance with mocked DB:
      • getPrice: verified exact data parity with REST aggregator output.
      • getBestRoute: verified exact routing calculation parity with REST /route.
      • getPriceHistory: verified database aggregate bucket mapping.
      • listPairs: verified watched pairs enumeration.
    • Fixed issuer handling in GraphQL indPair to preserve caller-provided issuers rather than discarding them, maintaining full parity with src/api/rest.ts.
    • Covered error paths: malformed input (INVALID_INPUT), untracked pairs (PAIR_NOT_FOUND), and mismatched issuers.
  4. Persisted Queries & Configurable Arbitrary Document Toggle (closes Any client can send any query #378):

    • Implemented persisted query provider supporting both Apollo APQ (extensions.persistedQuery.sha256Hash) and Mercurius persisted query formats (persisted: true, query: ).
    • Added GRAPHQL_ALLOW_ARBITRARY_QUERIES toggle (defaulting to safe alse in production, rue in development/test), returning clear error when arbitrary queries are blocked.
    • Added query registry src/api/persistedQueries.ts, manifest queries/manifest.json, and registration CLI scripts/register-query.ts (
      pm run query:register).
    • Added src/tests/graphqlPersistedQueries.test.ts.

Verification

pm run schema:check: PASS (zero schema drift)

px tsc --noEmit: PASS (zero type errors)

pm run test: 8 test suites / 51 tests passed across all GraphQL unit, parity, metrics, and persisted query tests

…suite (Divinity-Labs#372, Divinity-Labs#374, Divinity-Labs#375, Divinity-Labs#378)

- Export canonical GraphQL SDL artifact at schema.graphql with zero-drift CI guard (closes Divinity-Labs#372)
- Add bounded Prometheus metrics for operations, resolver durations, and error categories (closes Divinity-Labs#374)
- Add comprehensive GraphQL query test suite with REST parity assertions and issuer preservation (closes Divinity-Labs#375)
- Support persisted queries with configurable arbitrary document toggle and registry tooling (closes Divinity-Labs#378)

@Miracle656 Miracle656 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: one issue per PR, and only issues assigned to you

This is a process requirement, applied to all 23 of your open PRs in this repo. It is not a judgement about the code, which I have not been able to review — and that is the first half of the problem.

The bundling

Across your open PRs, 150 distinct issues are claimed. This one claims several. #483 claims 22, #481 claims 20, #477 claims 20, #474 claims 20.

A PR that closes twenty issues cannot be reviewed. Each of those issues has its own acceptance criteria — typically five — so twenty issues is a hundred separate things to verify in one diff, and if any one of them is wrong the whole PR is blocked while it is fixed. Every batch I published says the issues are deliberately independent so they can be worked in parallel, by different people, without colliding. Bundling them removes exactly that property.

The assignments

135 of the 150 issues claimed are assigned to other contributors — 67 different people.

This PR is an example: it names issues currently assigned to other contributors who are working on them now. Several have open PRs of their own. If this merged as it stands, those people would have done the work and received nothing for it, and I would have no way to tell the two efforts apart.

I am not assuming anything about why. Assignments change, Drips and GitHub can disagree, and a wide-ranging branch picks up issue numbers easily. But the effect on the people holding those assignments is the same regardless of intent, which is why I have to act on it.

What I need

  • One issue per PR. The issue number in the title, its acceptance criteria met, and nothing else in the diff.
  • Only issues assigned to you, or unassigned ones you have claimed through Drips. If an issue is assigned to someone else, it is theirs.
  • Re-open the work that meets both conditions as individual PRs. I will review them in the order they arrive and at the same pace as everyone else's.

Nothing is being closed. These stay open and are yours to re-cut, withdraw or split as you choose.

Two things worth knowing before you re-cut

Some of this has already landed. #488 (SSRF guard for bazaar_search) and #487 (the paid_call host allow-list) cover the same ground as your #449; #486 covers the MCP README. Check current main before rebuilding something that is already there.

main has moved a long way today — #306, #309, #252, #256, #355, #381, #390, #402, #476, #488 and more. Cut from current main, not from where these branches started.

If you believe an issue named here is genuinely yours, say which and I will check the assignment myself — I would rather be corrected than have someone lose work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants