Skip to content

Conversation

@kdaviduik
Copy link
Contributor

@kdaviduik kdaviduik commented Jan 20, 2026

WHY are these changes introduced?

Context on how Hydrogen versioning works
Fixes issue reported here

When a changeset declares a minor bump for @shopify/hydrogen or @shopify/hydrogen-react, the release system incorrectly produces version 2025.10.0 instead of the expected 2025.7.3.

Root cause: Semantic collision between standard semver and CalVer:

  1. Developer creates changeset: '@shopify/hydrogen': minor
  2. Changesets library applies semver rules: 2025.7.22025.8.0 (increment middle, reset last)
  3. getBumpType("2025.7.2", "2025.8.0") sees 7 !== 8 in the "major" position → returns 'major'
  4. Major bump logic advances to next quarter: 2025.10.0

The key insight is that changeset .md files are deleted after changeset version runs, so enforce-calver-ci.js couldn't read them directly to determine the actual bump intent.

WHAT is this pull request doing?

Pre-computes the bump type BEFORE changesets consumes the files, then passes this to enforce-calver-ci.js via a temp file.

Files changed:

File Change
.changeset/detect-calver-bump-type.js NEW - Reads changesets before deletion, writes bump type to temp file
.changeset/enforce-calver-ci.js Uses pre-computed bump type instead of inferring from version comparison
.changeset/calver-bump-type.test.js NEW - 17 comprehensive tests including bug scenario
package.json Updated version script to run detection first
.gitignore Added temp file to ignore list

Version script flow (new):

detect-calver-bump-type.js  →  changeset version  →  enforce-calver-ci.js
        ↓                             ↓                      ↓
 Reads .md files            Consumes .md files        Reads temp file
 Writes temp file                                    Uses pre-computed type

For CalVer, minor and patch both increment within the quarter (e.g., 2025.7.22025.7.3). Only major advances to the next quarter.

HOW to test your changes?

  1. Run the unit tests:

    npm run test:calver:bump

    Expected: 17 tests pass

  2. Run the local dry-run test:

    npm run test:calver:dry

    Expected: Shows 2025.7.2 → 2025.7.3 (not 2025.10.0)

  3. Test with existing changesets in this repo:

    node .changeset/detect-calver-bump-type.js
    # Should output: CalVer bump type detected: patch

Checklist

  • I've read the Contributing Guidelines
  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've added a changeset if this PR contains user-facing or noteworthy changes
  • I've added tests to cover my changes
  • I've added or updated the documentation

Note: This is an internal tooling fix. No changeset is required as it doesn't affect public API or user-facing behavior.

When a changeset declares a `minor` bump for CalVer packages, the
release system incorrectly produced version `2025.10.0` instead of
`2025.7.3`. This happened because:

1. Changesets applies semver rules: 2025.7.2 → 2025.8.0
2. getBumpType() compares versions and sees 7 !== 8 → returns 'major'
3. Major bump logic advances to next quarter: 2025.10.0

The fix pre-computes the bump type BEFORE changesets consumes the
files, then passes this to enforce-calver-ci.js via a temp file.

Key changes:
- Add detect-calver-bump-type.js: Reads .md files before deletion
- Modify enforce-calver-ci.js: Uses pre-computed bump type
- Update version script: Run detection first
- Add calver-bump-type.test.js: 17 comprehensive tests

For CalVer, 'minor' and 'patch' both increment within the quarter
(e.g., 2025.7.2 → 2025.7.3). Only 'major' advances to next quarter.
@kdaviduik kdaviduik requested a review from a team as a code owner January 20, 2026 20:13
@shopify
Copy link
Contributor

shopify bot commented Jan 20, 2026

Oxygen deployed a preview of your changeset-bug-fix branch. Details:

Storefront Status Preview link Deployment details Last update (UTC)
Skeleton (skeleton.hydrogen.shop) ✅ Successful (Logs) Preview deployment Inspect deployment January 20, 2026 8:15 PM

Learn more about Hydrogen's GitHub integration.

@kdaviduik kdaviduik changed the title Fix CalVer versioning bug: minor treated as major fix(calver): minor bumps are no longer treated as major bumps Jan 20, 2026
Copy link
Contributor

@graygilmore graygilmore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No 🎩 but the functional changes all make sense to me!

) {
hasMajor = true;
} else if (
content.includes(`"${pkg}": minor`) ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So tempting to put a nasty regex here 😄

Copy link
Contributor

@graygilmore graygilmore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎩 👍🏻

@kdaviduik kdaviduik merged commit 7f0d99e into main Jan 21, 2026
14 checks passed
@kdaviduik kdaviduik deleted the changeset-bug-fix branch January 21, 2026 00:55
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.

2 participants