Skip to content

ci: verify schema.json is up to date in CI#840

Merged
kitsuyui merged 1 commit into
mainfrom
fix/dependencies-001
Jun 4, 2026
Merged

ci: verify schema.json is up to date in CI#840
kitsuyui merged 1 commit into
mainfrom
fix/dependencies-001

Conversation

@kitsuyui

@kitsuyui kitsuyui commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a CI step to detect when schema.json drifts from the TypeScript types it is generated from.

Problem: schema.json (the external schema consumed by IDE tooling and JSON linters) and the inline AJV schema in src/validate.ts were managed independently. CI ran lint, test, and build — but never re-ran generate-json-schema. A change to RuleStringPattern in src/interfaces.ts could leave schema.json stale without any CI signal.

Fix: After the build step, re-run generate-json-schema and biome format, then assert no diff in schema.json. If the committed file is out of date, the step fails and the author must update it.

Changes

  • .github/workflows/test.yml: add Verify schema.json is up to date step after Verify dist is up to date

Verification

The new step was validated locally:

bun run generate-json-schema
bun run format
git diff --exit-code -- schema.json   # exits 0 (no diff)

Trade-offs

  • bun run format runs Biome on all files after schema regeneration, not just schema.json. This is acceptable because the formatter is deterministic — a clean working tree remains clean after formatting.
  • The root dual-management (inline schema in validate.ts vs schema.json) is preserved. Eliminating it would require resolveJsonModule: true in tsconfig and further changes; this CI check provides detection with minimal scope.

The committed schema.json and the inline AJV schema in validate.ts were
managed independently with no CI check to detect drift. This adds a step
that regenerates schema.json and applies Biome formatting, then fails if
the result differs from what is committed.
@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown

🎉 Happy commit!

@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown

Code Metrics Report

main (5e1e87b) #840 (1b6fc6c) +/-
Coverage 99.2% 99.2% 0.0%
Code to Test Ratio 1:0.5 1:0.5 0.0
Test Execution Time 2s 1s -1s
Details
  |                     | main (5e1e87b) | #840 (1b6fc6c) | +/-  |
  |---------------------|----------------|----------------|------|
  | Coverage            |          99.2% |          99.2% | 0.0% |
  |   Files             |              5 |              5 |    0 |
  |   Lines             |            131 |            131 |    0 |
  |   Covered           |            130 |            130 |    0 |
  | Code to Test Ratio  |          1:0.5 |          1:0.5 |  0.0 |
  |   Code              |           1630 |           1630 |    0 |
  |   Test              |            912 |            912 |    0 |
+ | Test Execution Time |             2s |             1s |  -1s |

Reported by octocov

@kitsuyui
kitsuyui merged commit 7586b0e into main Jun 4, 2026
5 checks passed
@kitsuyui
kitsuyui deleted the fix/dependencies-001 branch June 4, 2026 14:27
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