Skip to content

build: canonical $id for the .wind schema + drift gate - #210

Merged
CameronBrooks11 merged 1 commit into
mainfrom
build/wind-schema-id-drift-gate-141
Jun 26, 2026
Merged

CameronBrooks11 merged 1 commit into
mainfrom
build/wind-schema-id-drift-gate-141

Conversation

@CameronBrooks11

Copy link
Copy Markdown
Member

Addresses the generator-cleanup / versioned-$id / drift-gate part of #141 (the normative SPEC + conformance corpus remain open under #141). The input-schema analog of the OpenAPI drift gate (#191).

What

  • generate_schema.py adds the canonical versioned $id (https://fiberpath.org/schemas/wind/1.0/wind.schema.json) and writes wind-schema.json deterministically (sorted keys + trailing newline). It keeps pydantic's WindDefinition title so the generated TS root type name stays stable.
  • Removed the orphaned second generator scripts/export_schema.py — the committed wind-schema.json was its stale output, and it was the source of the long-standing drift. generate_schema.py is now the single source.
  • Regenerated wind-schema.json + src/types/wind-schema.ts (the latter normalised CRLF→LF).
  • CI drift gate (split by toolchain, mirroring the OpenAPI gate): the backend job regenerates wind-schema.json and the GUI job regenerates wind-schema.ts, each failing on git diff.

Fixed along the way

Overriding the schema title to "FiberPath Wind Definition" (the old generate_schema.py behaviour) renamed the generated TS root type and broke 4 importers — which is exactly why the artifact was never regenerated with this script. Dropping the override keeps WindDefinition; the $id carries the format identity.

Review

Independent adversarial review: SHIP (no blocking). It proved the gate catches drift both halves (model change → backend gate red; hand-edited wind-schema.json → GUI gate red), confirmed type-name preservation, and that export_schema.py has zero remaining references. Determinism risk rated LOW (same as the OpenAPI gate; uv.lock pins pydantic, package-lock pins json-schema-to-typescript).

Verification

  • ruff clean · backend pytest 112 passed · GUI tsc clean · vitest 625 passed · ajv validation tests pass · drift gate clean on regen, red on injected drift.

- generate_schema.py adds a canonical versioned $id
  (https://fiberpath.org/schemas/wind/1.0/wind.schema.json) and writes the
  artifact deterministically (sorted keys, trailing newline). It keeps
  pydantic's "WindDefinition" title so the generated TS root type name stays
  stable for the GUI.
- Remove the orphaned second generator (scripts/export_schema.py); the
  committed wind-schema.json was its stale output. generate_schema.py is now
  the single source.
- Regenerate fiberpath_gui/schemas/wind-schema.json and the TS types
  (normalising the old CRLF .ts to LF).
- Add a CI drift gate (split by toolchain like the OpenAPI gate): the backend
  job regenerates wind-schema.json and the GUI job regenerates the TS types,
  each failing on git diff.

Addresses the generator-cleanup / versioned-$id / drift-gate part of #141
(the normative SPEC + conformance corpus remain).
@CameronBrooks11
CameronBrooks11 merged commit be05544 into main Jun 26, 2026
21 checks passed
@CameronBrooks11
CameronBrooks11 deleted the build/wind-schema-id-drift-gate-141 branch June 26, 2026 05:58
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.

1 participant