Skip to content

Validate word lists in CI - #38

Open
KayleeWilliams wants to merge 1 commit into
mainfrom
KayleeWilliams/ci-validate-word-lists
Open

Validate word lists in CI#38
KayleeWilliams wants to merge 1 commit into
mainfrom
KayleeWilliams/ci-validate-word-lists

Conversation

@KayleeWilliams

Copy link
Copy Markdown
Owner

Problem

The word lists in src/lib/*.json are 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 run bun run validate by hand.

Why the existing script wasn't enough

Adding bun run validate to the workflow would not have fixed this. scripts/validate.ts is 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" from colors.json and exited 0.

Change

  • scripts/validate.ts gains a --check mode that reports without writing and sets a non-zero exit code when anything is found.
  • validate:check script exposes it; the default validate behaviour is unchanged.
  • CI runs bun run validate:check after the test step.

Verification

Ran the full CI sequence locally on this branch:

Step Result
bun run build pass
bun run check (lint + typecheck) pass
bun test 83 pass / 0 fail
bun run validate:check pass, exit 0
bun run perf pass

Both 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.

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.
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