Skip to content

fix(release): allow registry version to be ahead of package.json in pre-push#3836

Closed
bokelley wants to merge 2 commits into
mainfrom
bokelley/version-sync-hook-allow-ahead
Closed

fix(release): allow registry version to be ahead of package.json in pre-push#3836
bokelley wants to merge 2 commits into
mainfrom
bokelley/version-sync-hook-allow-ahead

Conversation

@bokelley

@bokelley bokelley commented May 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Pre-push has been failing for every contributor since the 3.0.4 forward-merge (May 2026). The hook required package.json, published_version, and adcp_version to all be exactly equal, but the forward-merge release process (#3807) deliberately keeps package.json --ours on main — so during the window between cutting a version and bumping the dev package, registry is ahead of package.json by design. Discovered while trying to push #3829.

What changed

  • scripts/verify-version-sync.cjs: relax strict-equality to "registry at or ahead of package.json" using a small X.Y.Z comparator. Still fails the genuine bug-modes:
    • Registry behind package.json (forgot to bump registry on release)
    • Either published_version or adcp_version missing
    • The two registry fields disagreeing with each other
    • Pre-release tags fall back to strict equality so beta windows lockstep
  • static/schemas/source/index.json: add the missing published_version: "3.0.4" so both registry fields agree (main currently has adcp_version: "3.0.4" but no published_version — the hook flagged that even before this PR).
  • tests/verify-version-sync.test.cjs: 8 unit tests covering forward-merge window, the bug-modes, and pre-release tag handling.
  • Wires the new test into the project's test script.

Why this matters beyond #3829

This blocks every local push from main, not just mine. The current admin-merge workflow on GitHub bypasses the hook (which is why main keeps drifting), but anyone pushing a feature branch from local hits this wall.

Test plan

🤖 Generated with Claude Code

bokelley and others added 2 commits May 2, 2026 12:23
…re-push

The version-sync hook required package.json, published_version, and
adcp_version to all match exactly. The forward-merge release process (#3807)
keeps package.json --ours on main, so during the window between cutting a
version and bumping the dev package, registry is ahead of package.json by
design — and pre-push failed for every contributor.

Now: registry must be at or ahead of package.json. Still fails the genuine
bug-modes (registry behind, fields missing, registry fields disagreeing).
Pre-release tags fall back to strict equality so beta windows lockstep.

Also adds the missing published_version: "3.0.4" so both registry fields
agree (May 2026 state).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Add --strict flag to verify-version-sync. In strict mode, registry MUST
  equal package.json exactly (release-time invariant after changeset
  version + build:schemas --release). Default (pre-push) mode keeps the
  relaxed registry-at-or-ahead semantics.
- Wire `verify-version-sync -- --strict` into the `version` script so a
  failed release step is caught before tagging.
- Drop dead test code: run() was copying the script to two locations and
  only executing one.
- Clean up tmpdir fixtures via test.after.
- Add tests for: numeric (not lexicographic) version compare, 0.x.y
  handling, asymmetric drift (one field ahead, other behind), strict
  mode pass/fail.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bokelley bokelley force-pushed the bokelley/version-sync-hook-allow-ahead branch from 49e4a84 to 6cfed9c Compare May 2, 2026 16:23
@bokelley

bokelley commented May 2, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #3834 which landed the same relaxation while this PR was in review. Closing as redundant. The strict-mode + unit tests this PR adds are still useful and could be revived as a follow-on, but they're not blocking anything right now.

@bokelley bokelley closed this May 2, 2026
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