Add PR validation workflow (schema check + export smoke test)#3
Merged
Conversation
Adds scripts/validate-patterns.js, which loads index.html and checks every PATTERNS entry against the documented schema (required fields, valid cat/group/kind enums, members present when kind is set, no duplicate names, and that every statefulness value has a matching STATEFULNESS_INFO entry so the tooltip never renders empty). Wires this plus the existing export scripts into a new ci.yml workflow that runs on every PR targeting main, so a broken PATTERNS entry or a script-crashing change is caught before merge instead of after.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scripts/validate-patterns.js: loadsindex.htmland checks everyPATTERNSentry against the schema documented inCLAUDE.md— required fields, validcat/group/kindenums,memberspresent whenkindis set, no duplicate pattern names, and that every distinctstatefulnessvalue has a matchingSTATEFULNESS_INFOentry (so the hover tooltip from Add statefulness explanation tooltips #2 never silently renders empty).github/workflows/ci.yml, triggered on every PR targetingmain. Runsnpm run validate, thennpm run export:imagesandnpm run export:pptxas an end-to-end smoke test of the real export scriptsCLAUDE.mdWhy
Until now there was no PR-time validation in this repo —
deploy.ymlonly runs after merging tomain. A real bug (the loop-pattern "Done" node clipping, fixed earlier) shipped past manual review and was only caught by deliberately running the export scripts by hand. This gives every future PR an automated check before merge.Limitations
This catches crashes and schema violations, not visual regressions (e.g. a node clipped at the edge of its SVG
viewBox) — those still need a manual screenshot check.Test plan
validate-patterns.jsagainst the currentindex.html— passes (15/15 patterns)catenum,kind:"parallel"step missingmembers, astatefulnessvalue with noSTATEFULNESS_INFOentry) and confirmed each is caught with a clear error message and non-zero exit codenpm ciworks (lockfile present) andnpm run export:images/npm run export:pptxstill run clean against currentindex.htmlGenerated by Claude Code