Skip to content

chore(schemas): track generated JSON Schemas + add drift CI gate#47

Merged
officialCodeWork merged 1 commit into
mainfrom
chore/track-generated-schemas-drift-gate
May 24, 2026
Merged

chore(schemas): track generated JSON Schemas + add drift CI gate#47
officialCodeWork merged 1 commit into
mainfrom
chore/track-generated-schemas-drift-gate

Conversation

@officialCodeWork

Copy link
Copy Markdown
Owner

Summary

  • Fix .gitignore so dist/schemas/ is actually committed. The bare dist/ rule silently neutered the !dist/schemas/*.json re-includes — git cannot re-include a path whose parent directory is fully excluded. Pattern changed to dist/* so the re-includes take effect.
  • Track 10 schemas that have been generated since Step 0.2 but were invisible to git: BlobRef, Budget, ChunkRef, Cost, IndexHint, PiiPolicy, PlanNode, QueryPlan, RequestContext, StageEvent.
  • Add a CI drift gate (schema-drift job in .github/workflows/ci.yml) that regenerates the schemas and fails on any uncommitted change or new file. Also exposed as task lint:schemas for local use. Wired into the required CI passed check.

Why now

Phase 1 refactor steps (1.1a–1.1f) are adding new domain types every step. Without the gate, each one ships JSON schemas that are silently ignored — which defeats the whole point of committing them for downstream consumers and IaC drift tracking.

How the gate works

  1. task schemas regenerates dist/schemas/*.json from rag_core types.
  2. scripts/check_schema_drift.py runs git status --porcelain against the tracked schema artifacts and exits non-zero if anything is modified, staged, or untracked.
  3. CI runs both steps after uv sync --all-packages; a PR that touches a rag_core type without regenerating fails the schema-drift job.

Verified locally: after the commit, python scripts/check_schema_drift.py exits 0.

Documentation

  • docs/guides/schema-drift-gate.md — overview, usage, .gitignore rationale, CI wiring, extension points.
  • docs/README.md — new guide entry under guides/.

Test plan

  • CI schema-drift job passes on this PR
  • task lint:schemas exits 0 on a clean checkout
  • Confirm a follow-up PR that adds a rag_core type without regenerating fails the gate (sanity check on first 1.1d-onward step)

🤖 Generated with Claude Code

The .gitignore had `dist/` excluding everything under dist/, which silently
neutered the `!dist/schemas/*.json` re-includes — git cannot re-include a
path whose parent directory is fully excluded. As a result, 10 schemas
generated since Step 0.2 (BlobRef, Budget, ChunkRef, Cost, IndexHint,
PiiPolicy, PlanNode, QueryPlan, RequestContext, StageEvent) were missing
from the repo even though the project intends to commit them for a
schema-drift CI gate.

Fix:
- .gitignore: dist/ -> dist/*, so !dist/schemas/ and the two top-level
  schema files take effect.
- Commit the 10 previously-invisible schemas (regenerated via
  `rag_core.gen_schemas`).
- Add scripts/check_schema_drift.py + `task lint:schemas` to enforce
  regeneration locally.
- Add a `schema-drift` CI job that runs the generator and fails if
  `git status --porcelain` shows anything modified or untracked under
  the tracked schema artifacts. Wired into the required `CI passed` gate.

Documentation:
- docs/guides/schema-drift-gate.md — overview, usage, gitignore rationale,
  CI wiring, extension points.
- docs/README.md updated with the new guide entry.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@officialCodeWork
officialCodeWork merged commit faff9e1 into main May 24, 2026
9 checks passed
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