Skip to content

fix: guard map --baseline against a moved rule set - #559

Merged
HugoRCD merged 1 commit into
mainfrom
EVL-282/fix-map-baseline-version-guard
Aug 11, 2026
Merged

fix: guard map --baseline against a moved rule set#559
HugoRCD merged 1 commit into
mainfrom
EVL-282/fix-map-baseline-version-guard

Conversation

@evlogai

@evlogai evlogai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

What

evlog map --baseline used to diff per check against a committed evlog.map.json without knowing which CLI wrote it. A rule tightened between the two versions showed up as a pass → fail transition, 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):

  1. evlog.map.json now records the writer. The map carries cliVersion and a separate ruleSetVersion that only changes when a rule's semantics change, so a feature-only release does not force everyone to regenerate.

  2. Version mismatch refuses to gate. On --baseline, a committed rule set that differs from the running one exits 2 (usage error, not check failure) with:

    baseline was written by @evlog/cli 0.3.0, running @evlog/cli 0.5.1 (rule set 0 → 1)
    → Regenerate the baseline: evlog map && git add evlog.map.json
    

    No diff is printed: the app did not get worse, the comparison is invalid.

  3. 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 pass
  • pnpm run typecheck — 27 tasks, all pass
  • pnpm run test — 1809 tests across 87 files, all pass (including 6 new ones: checkBaselineVersion ok/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 = 1 lives in packages/cli/src/lib/map/rules/index.ts, next to the registry it describes. Bump it only when a rule's semantics change.
  • mapForSnapshot redacts cliVersion (it churns every release) but keeps ruleSetVersion, so snapshots only move when the rule set actually changes.
  • The --baseline-allow-version-drift escape hatch from the issue is intentionally not implemented; the default must not be a false diff.

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

changeset-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e7ecb14

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@evlog/cli Patch

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

@evlogai
evlogai Bot requested a review from HugoRCD August 11, 2026 18:53
@vercel

vercel Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
evi Ready Ready Preview Aug 11, 2026 6:56pm
evlog-docs Ready Ready Preview, v0 Aug 11, 2026 6:56pm
evlog-render-lab Ready Ready Preview Aug 11, 2026 6:56pm
evlog-telemetry Ready Ready Preview Aug 11, 2026 6:56pm
just-use-evlog Ready Ready Preview Aug 11, 2026 6:56pm

Request Review

@github-actions github-actions Bot added the bug Something isn't working label Aug 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

@pkg-pr-new

pkg-pr-new Bot commented Aug 11, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/@evlog/cli@559
npm i https://pkg.pr.new/evlog@559
npm i https://pkg.pr.new/@evlog/nuxthub@559
npm i https://pkg.pr.new/@evlog/telemetry@559

commit: e7ecb14

@HugoRCD
HugoRCD merged commit e72019a into main Aug 11, 2026
19 checks passed
@HugoRCD
HugoRCD deleted the EVL-282/fix-map-baseline-version-guard branch August 11, 2026 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant