Validate word lists in CI - #38
Open
KayleeWilliams wants to merge 1 commit into
Open
Conversation
The word lists are the package's core data, but nothing in CI read them: a pull request adding a duplicate, plural, hyphenated, or space-containing word passed the build, lint, typecheck, and tests untouched. `bun run validate` alone could not fill the gap. It rewrites the JSON files in place and always exits 0, so as a CI step it would have silently repaired the runner's checkout and reported success. Add a `--check` mode that reports without writing and exits non-zero on a bad entry, expose it as `validate:check`, and run that in CI.
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.
Problem
The word lists in
src/lib/*.jsonare this package's core data, but nothing in CI reads them. A pull request adding a duplicate, plural, hyphenated, or space-containing word passes the build, lint, typecheck, and test steps untouched — the only thing that catches it is someone remembering to runbun run validateby hand.Why the existing script wasn't enough
Adding
bun run validateto the workflow would not have fixed this.scripts/validate.tsis a fixer, not a checker: it rewrites each JSON file in place and always exits 0. As a CI step it would have quietly repaired the runner's checkout, reported success, and thrown the repair away with the runner — leaving the bad word on the branch.Confirmed locally by injecting a duplicate: the script deleted
"alabaster"fromcolors.jsonand exited 0.Change
scripts/validate.tsgains a--checkmode that reports without writing and sets a non-zero exit code when anything is found.validate:checkscript exposes it; the defaultvalidatebehaviour is unchanged.bun run validate:checkafter the test step.Verification
Ran the full CI sequence locally on this branch:
bun run buildbun run check(lint + typecheck)bun testbun run validate:checkbun run perfBoth modes tested against an injected duplicate:
validate:check→ exit 1, reports- "alabaster" should be removed from colors.json (kept in animals.json), and leaves every file on disk untouched.validate→ still repairs in place and exits 0, as before.