Skip to content

feat: schema export + preset snapshot tests (#72, #80)#100

Merged
alohays merged 2 commits intomainfrom
feat/schema-export-snapshots
Mar 19, 2026
Merged

feat: schema export + preset snapshot tests (#72, #80)#100
alohays merged 2 commits intomainfrom
feat/schema-export-snapshots

Conversation

@alohays
Copy link
Owner

@alohays alohays commented Mar 19, 2026

Summary

  • forge schema command (feat: forge schema command (Zod to JSON Schema introspection) #72): Outputs full JSON Schema derived from MonitorForgeConfigSchema via zod-to-json-schema. Supports forge schema <section> to filter by sub-schema (e.g., sources, panels, map). Includes _note field documenting that Zod .refine() validators are not represented in JSON Schema output.
  • Preset snapshot tests (test: preset validation snapshot tests #80): Validates all 15 preset JSON files parse correctly through MonitorForgeConfigSchema.parse() and snapshots the results. Catches schema drift and preset corruption by verifying version and _meta fields on every preset.
  • Adds zod-to-json-schema as a dev dependency.

Verified

  • forge schema outputs valid JSON Schema with version field
  • forge schema sources correctly filters to the sources sub-schema
  • All 15 preset files pass snapshot validation (46 tests)
  • npx vitest run forge/ passes (405 tests, 0 failures)
  • npx tsc --noEmit has zero errors

Test plan

  • npx tsx forge/bin/forge.ts schema --format json outputs full JSON Schema
  • npx tsx forge/bin/forge.ts schema sources --format json outputs sources sub-schema only
  • npx tsx forge/bin/forge.ts schema invalid-section returns structured error
  • npx vitest run forge/src/presets passes all snapshot tests
  • CI pipeline passes

🤖 Generated with Claude Code

alohays and others added 2 commits March 20, 2026 00:46
- Add `forge schema` command that outputs full JSON Schema derived from
  MonitorForgeConfigSchema via zod-to-json-schema
- Support `forge schema <section>` to filter by sub-schema (sources,
  panels, map, etc.)
- Add preset snapshot tests that validate all 15 presets parse correctly
  through MonitorForgeConfigSchema and snapshot the results
- Install zod-to-json-schema as dev dependency

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add unit tests for all valid sections, invalid section error handling,
and _note field presence. Replace direct property mutation with object
spread when injecting _note into JSON Schema output.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@alohays alohays merged commit e7bfe54 into main Mar 19, 2026
1 check passed
@alohays alohays deleted the feat/schema-export-snapshots branch March 19, 2026 18:03
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