Skip to content

fix(upgrade): use npm pack for historical skeleton extraction in E2E test#3643

Merged
itsjustriley merged 1 commit intomainfrom
fix/upgrade-e2e-npm-pack
Mar 31, 2026
Merged

fix(upgrade): use npm pack for historical skeleton extraction in E2E test#3643
itsjustriley merged 1 commit intomainfrom
fix/upgrade-e2e-npm-pack

Conversation

@itsjustriley
Copy link
Copy Markdown
Contributor

@itsjustriley itsjustriley commented Mar 31, 2026

WHY are these changes introduced?

The upgrade E2E test (upgrade-e2e.test.ts) extracts historical skeleton templates by checking out a git worktree at past release commits and running pnpm pack. This fails on post-pnpm-migration commits (2026.1.1+) because pnpm pack can't resolve workspace:* and catalog: protocols without an installed workspace (no lockfile, no node_modules).

ERR_PNPM_CANNOT_RESOLVE_WORKSPACE_PROTOCOL  Cannot resolve workspace protocol
of dependency "@shopify/hydrogen" because this dependency is not installed.

PR #3640 attempted to fix this by using pnpm pack in a worktree, but pnpm pack requires a fully installed workspace to resolve protocols — which a bare worktree doesn't have.

WHAT is this pull request doing?

Replaces pnpm pack with npm pack + manual protocol resolution in extractSkeletonTemplate:

  • npm pack is protocol-agnostic — it tars whatever is on disk without trying to resolve workspace:* or catalog:. This defines the error out of existence.
  • Resolution helpers in upgrade-e2e-utils.ts resolve protocols after extraction by reading workspace package versions and the pnpm-workspace.yaml catalog section from the worktree.
  • Handles the workspace:*<version> variant (e.g. workspace:*2026.1.1) seen in some changesets-published releases.
  • Pre-pnpm commits (2026.1.0 and older) have no protocols and skip resolution entirely.

HOW to test your changes?

# Unit tests for resolution helpers (19 tests)
cd packages/cli
pnpm vitest run src/lib/upgrade-e2e-utils.test.ts

# Full E2E test (runs against ~8 historical versions)
pnpm vitest run src/commands/hydrogen/upgrade-e2e.test.ts

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

🤖 Generated with Claude Code

…on extraction

pnpm pack cannot resolve workspace:* and catalog: protocols in a
detached git worktree (no lockfile, no node_modules). This caused
the upgrade E2E test to fail for post-pnpm-migration commits
(2026.1.1+) with ERR_PNPM_CANNOT_RESOLVE_WORKSPACE_PROTOCOL.

npm pack is protocol-agnostic — it tars whatever is on disk without
attempting resolution. We then resolve workspace:* and catalog:
manually using tested helpers that read workspace package versions
and the pnpm-workspace.yaml catalog section from the worktree.

This approach defines the error out of existence: npm pack has no
workspace requirements, so the entire class of "pnpm workspace not
available" failures cannot occur. Pre-pnpm commits (2026.1.0 and
older) have no protocols and skip resolution entirely.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@itsjustriley itsjustriley marked this pull request as ready for review March 31, 2026 12:10
@itsjustriley itsjustriley requested a review from a team as a code owner March 31, 2026 12:10
@github-actions
Copy link
Copy Markdown
Contributor

We detected some changes in packages/*/package.json or packages/*/src, and there are no updates in the .changeset.
If the changes are user-facing and should cause a version bump, run pnpm run changeset add to track your changes and include them in the next release CHANGELOG.
If you are making simple updates to examples or documentation, you do not need to add a changeset.

@itsjustriley itsjustriley requested a review from fredericoo March 31, 2026 12:10
Copy link
Copy Markdown
Contributor

@fredericoo fredericoo left a comment

Choose a reason for hiding this comment

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

lets go, fair enough!

@itsjustriley itsjustriley merged commit de0d933 into main Mar 31, 2026
23 of 24 checks passed
@itsjustriley itsjustriley deleted the fix/upgrade-e2e-npm-pack branch March 31, 2026 12:40
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