fix: guard map --baseline against a moved rule set - #559
Merged
Conversation
evlog.map.json now records the CLI version and a separate rule-set version that only changes when a rule's semantics change. On --baseline, a committed rule set that differs from the running one is a usage error (exit 2) rather than a misleading per-check diff that blames code the PR did not touch. A map written before version reporting has no version fields; it warns once instead of failing every project on upgrade.
🦋 Changeset detectedLatest commit: e7ecb14 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Thank you for following the naming conventions! 🙏 |
commit: |
HugoRCD
approved these changes
Aug 11, 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.
What
evlog map --baselineused to diff per check against a committedevlog.map.jsonwithout knowing which CLI wrote it. A rule tightened between the two versions showed up as apass → failtransition, and the ratchet gated the PR for a change in the tool rather than a change in the code.This makes the comparison honest (EVL-282):
evlog.map.jsonnow records the writer. The map carriescliVersionand a separateruleSetVersionthat only changes when a rule's semantics change, so a feature-only release does not force everyone to regenerate.Version mismatch refuses to gate. On
--baseline, a committed rule set that differs from the running one exits2(usage error, not check failure) with:No diff is printed: the app did not get worse, the comparison is invalid.
Missing version warns instead of failing. Maps written before version reporting (no fields) get a one-line warning and diff anyway, so upgrading does not hard-fail every project.
Checks
pnpm run lint— 22 tasks, all passpnpm run typecheck— 27 tasks, all passpnpm run test— 1809 tests across 87 files, all pass (including 6 new ones:checkBaselineVersionok/unknown/mismatch, version fields on the written map, and a command-level exit-2 regression test)End-to-end verified against the built CLI: a tampered baseline exits 2 with the message above and no diff; a version-less baseline warns and exits 0.
Notes
RULE_SET_VERSION = 1lives inpackages/cli/src/lib/map/rules/index.ts, next to the registry it describes. Bump it only when a rule's semantics change.mapForSnapshotredactscliVersion(it churns every release) but keepsruleSetVersion, so snapshots only move when the rule set actually changes.--baseline-allow-version-driftescape hatch from the issue is intentionally not implemented; the default must not be a false diff.