Repository navigation
feat(update): move a Vale rule's tests: cases into fixtures on 3.24.0 - #551
Merged
theCodeDrift merged 1 commit intoOct 21, 2026
Merged
Conversation
`validate` refuses a Vale rule's `tests:` key from 3.24.0 on, and 0.12.0 had accepted it. A rule migration keyed on Vale 3.24.0 now writes each case's input as a fixture under .tests/fail when it expects an alert and .tests/pass when it expects none, named for the case with its format as the extension, then deletes the block by its byte range. It never overwrites a fixture, reruns as a no-op, and leaves a rule whose cases read through a view or name another rule file untouched. No issued rule carries the key.
This was referenced Oct 21, 2026
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.
Stack (root → tip):
#549 makes
validateandverifyrefuse a Vale rule'stests:key. 0.12.0 had accepted it, so a rule written since then would stop validating on upgrade. This adds a rule migration on #548's mechanism, soupdate --rulesmoves those cases into fixtures instead of leaving the author a by-hand list. It merges down intovendor/vale/3-24-0-contract.What it does
src/rules/rule-migrations/vale-3-24-0-tests-to-fixtures.ts, registered inRULE_MIGRATIONS, keyed on Vale 3.24.0. It runs when the recorded Vale engine is below 3.24.0.A case is a document and whether the rule fires on it, which is exactly a fixture. An in-rule case loads only its own rule, so any alert it expects is that rule's:
wantwith any text.tests/fail/wantthat is empty.tests/pass/want, butcontains.tests/fail/absent.tests/pass/input, byte for byte. It is named for the case (flags a hedge→flags-a-hedge.md), withformatas the extension (mdby default, as Vale reads it). Whatwantpins beyond that (line, column, message) is not something verification needs, and it is not carried.tests:block is removed by its byte range from the YAML parser. Nothing is re-serialized, so comments and every other line stay as written.-2. A rerun, or a run that died between the two steps, changes nothing it already did.view(this layout defines none) or names another rule file inrule:. Moving half its cases would be harder to finish than none.validatekeeps naming that rule.Issued rules
Per the rule-migration contract, the rewrite only applies to shapes the service never issued. Nothing in the Cloud corpus carries
tests:(confirmed 2026-10-20), so no signed rule is touched. Rules users wrote themselves are what this is for.Guidance
update(topic v18): the 0.13.3 opener is back to "Nothing here needs work by hand." Thetests:paragraph now reads like the Haskell one:update --rulesmoves them for you, so don't do it by hand. It names the view andrule:cases as the exception.Tests
rule-migrate.test.ts: block removal for an indented list, a list at the key's column, a blank line inside, and a block ending the file with no newline. The bucket for each kind of case, naming and extensions, the rules it leaves alone, idempotence, finishing an interrupted run, never overwriting, failing on an unreadable rules tree, and keying on 3.24.0. A migrated rule passesvalidateValeRule.reconcile-marker.test.ts:update --rulesthrough the built CLI moves the cases, reports the files, and stamps the engines.sg, so the Vale migration also read as pending in them.pnpm typecheck,pnpm lintandpnpm test(2526 passed) are green locally, built.Refs #549