Skip to content

feat(registry): the schema-parity ledger, with its cadence and an honest drift contract - #11221

Merged
JSONbored merged 1 commit into
mainfrom
feat/schema-parity-v2
Aug 14, 2026
Merged

feat(registry): the schema-parity ledger, with its cadence and an honest drift contract#11221
JSONbored merged 1 commit into
mainfrom
feat/schema-parity-v2

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Closes #11146.

Phase 3 (the surface method dimension) landed in #11210 and the first declared mutation in #11212; this closes the rest of the epic in one change.

The parity ledger

Each gaps row gains schema_parity: captured paths and declared mutations against registered route surfaces and registered mutations, flagged when the catalogue registers fewer routes than the subnet declares — the check the SN105 report asked for.

Derived from schema index entries only (captured documents exist solely in credentialed builds, so a rollup reading them would not be reproducible), with the capture lane now stamping non_get_operation_count so both sides of the mutation ledger are measured. Counts absent on pre-stamp entries report null, never zero.

First measurement: 53 subnets measured, 27 flagged — sn-3 registers 8 routes against 208 declared paths; sn-105 registers 29 (including the POST surface from #11212, counted as its 1 registered mutation) against 53.

Freshness is measurable, and judged by the reader

capture_cadence_hours (48) rides the parity block. No age is baked: the document is served for hours after it is built, so a build-stamped age is wrong on arrival — and buildTimestamp() returns the 1970 epoch placeholder in every local build, so an earlier revision of this branch published a twelve-day-old capture as fresh. That was caught in a built artifact and is why the design changed. Entries already carry observed_at; the subtraction belongs to whoever has a real clock.

Drift says what it measures — in the contract

drift_status compares our snapshot to our previous snapshot, never upstream, which is why 23 of 24 measurably-drifted subnets reported unchanged. Its published description now states exactly that, at the point of consumption.

Why a description rather than a field: the schema-index artifact is a deploy-owned capture cache, and artifacts-build-schema-index asserts a rebuild reproduces its committed copy exactly. Any added field breaks the gate that protects 58 captured schemas — so this PR leaves that artifact completely untouched (it is not in the diff) and puts the honesty where every consumer reads it.

Validation

  • typecheck, lint, format:check
  • validate (129 subnets / 3,330 surfaces), validate:api (215 routes), validate:openapi, validate:contract-drift, validate:published-names, validate:unreferenced-exports (731 — at the ceiling, not raised), validate:schema-vocabularies, validate:mcp (240 tools), validate:schemas
  • Full suite: 917 files / 20,922 tests passed, including all three suites that failed the previous revision — artifacts.test.ts, artifacts-build-schema-index, and artifacts-build-determinism — each re-run against a pristine committed baseline

…est drift contract (#11146)

Three mechanisms broke "every subnet's API, exactly like using it directly",
each silently. Phase 3 (the surface method dimension) landed in #11210 and the
first declared mutation in #11212; this closes the rest.

THE PARITY LEDGER. Each gaps row gains schema_parity: captured paths and
declared mutations against registered route surfaces and registered mutations,
flagged when the catalogue registers fewer routes than the subnet declares.
Derived from schema INDEX entries only -- captured documents exist solely in
credentialed builds -- with the capture lane now stamping
non_get_operation_count so both sides are measured. Unmeasured counts report
null, never zero. First build: 53 subnets measured, 27 flagged.

FRESHNESS IS MEASURABLE, AND JUDGED BY THE READER. The lane's declared cadence
(SCHEMA_CAPTURE_CADENCE_HOURS = 48) rides the parity block. No age is baked:
the document is served for hours after it is built, so a build-stamped age is
wrong on arrival -- and buildTimestamp() is the 1970 placeholder in every local
build, which would have published a twelve-day-old capture as FRESH. Entries
already carry observed_at; the subtraction belongs to whoever has a real clock.

DRIFT SAYS WHAT IT MEASURES, IN THE CONTRACT. drift_status compares our
snapshot to OUR previous snapshot, never upstream -- which is why 23 of 24
measurably-drifted subnets reported "unchanged". Stated at the point of
consumption, in the published schema, because the schema index artifact is a
deploy-owned capture cache whose committed copy a PR cannot regenerate:
annotating it breaks the preservation gate protecting 58 captured schemas.

Closes #11146
@superagent-security

Copy link
Copy Markdown

Superagent didn't find any vulnerabilities or security issues in this PR.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
metagraphed-registry-sync-api 88e35c3 Aug 14 2026, 01:30 PM

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
metagraphed-wss-lb 88e35c3 Aug 14 2026, 01:30 PM

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
metagraphed-data-api 88e35c3 Aug 14 2026, 01:30 PM

@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.51%. Comparing base (20e8af1) to head (88e35c3).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #11221   +/-   ##
=======================================
  Coverage   95.51%   95.51%           
=======================================
  Files         742      742           
  Lines       45308    45310    +2     
  Branches    16648    16648           
=======================================
+ Hits        43277    43279    +2     
  Misses        526      526           
  Partials     1505     1505           
Files with missing lines Coverage Δ
schemas-src/graphql/published-names.ts 100.00% <ø> (ø)
schemas-src/routes/curation-gaps.ts 100.00% <100.00%> (ø)
schemas-src/routes/subnet-profiles.ts 100.00% <ø> (ø)
src/schema-snapshots-sync.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored JSONbored self-assigned this Aug 14, 2026
@JSONbored
JSONbored merged commit 81f7439 into main Aug 14, 2026
17 checks passed
@JSONbored
JSONbored deleted the feat/schema-parity-v2 branch August 14, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

epic(parity): "every subnet's API, exactly like using it directly" is not what we serve — three mechanisms measured, and what each one costs

1 participant