Skip to content

fix(test): package workspace deps in deploy harness#1786

Merged
james-elicx merged 1 commit into
cloudflare:mainfrom
NathanDrake2406:nathan/searchparams-static-bailout
Jun 6, 2026
Merged

fix(test): package workspace deps in deploy harness#1786
james-elicx merged 1 commit into
cloudflare:mainfrom
NathanDrake2406:nathan/searchparams-static-bailout

Conversation

@NathanDrake2406

Copy link
Copy Markdown
Contributor

Overview

Field Details
Goal Keep Next.js deploy-suite temp app installs self-contained when local vinext depends on workspace packages.
Core change Copy the built @vinext/cloudflare package into the temp app and rewrite workspace:* in the generated local vinext package manifest to a sibling file: dependency.
Primary file scripts/e2e-deploy.sh
Impact Deploy-suite fixtures can install the throwaway local vinext package outside the monorepo workspace.

Why

The deploy harness runs inside isolated Next.js fixture directories, not inside the vinext pnpm workspace. Any generated package manifest installed there must only contain dependency specs that the fixture package manager can resolve locally or from the registry. A raw workspace:* dependency violates that boundary and causes pnpm install to fail before the upstream test behaviour can run.

What changed

Scenario Before After
Local vinext package has @vinext/cloudflare: workspace:* Temp app install fails with ERR_PNPM_WORKSPACE_PKG_NOT_FOUND. Harness creates .vinext-local-cloudflare-package from packages/cloudflare/dist and points the generated vinext manifest at it.
Unknown future workspace dependency Could leak into the temp manifest silently. Fails explicitly through workspaceDependencySpecFor() unless the harness knows how to package it.

Validation

  • vp env exec --node 24 ./scripts/run-nextjs-deploy-suite.sh /Users/nathan/Projects/vinext/.refs/nextjs-v16.2.6 --retries 0 -c 1 --debug test/e2e/app-dir/searchparams-static-bailout/searchparams-static-bailout.test.ts
  • Result: harness install and deployment now succeed. The suite reaches the known behavioural searchParams assertions, which are being handled separately.

References

Link Why it matters
https://github.com/cloudflare/vinext/blob/main/scripts/e2e-deploy.sh Deploy harness that generates the throwaway local package manifest.
https://pnpm.io/workspaces#workspace-protocol-workspace workspace: specs are workspace-local and are not resolvable from isolated temp fixture apps.
https://github.com/vercel/next.js/blob/v16.2.6/test/e2e/app-dir/searchparams-static-bailout/searchparams-static-bailout.test.ts Reproduction suite that now gets past fixture install and reaches behavioural assertions.

Non-goals

This PR does not fix the searchParams rendering behaviour. It only restores the deploy-suite harness so those failures can be reproduced and fixed in a separate PR.

The Next.js deploy-suite harness installs vinext into isolated temp apps outside the vinext workspace. That breaks when the packaged vinext manifest still contains workspace dependencies, because pnpm cannot resolve workspace:* specs without the monorepo package graph.

Copy the local @vinext/cloudflare build output into a sibling throwaway package and rewrite workspace dependencies in the generated vinext manifest to point at that package. This preserves the package boundary while keeping deploy-suite fixture installs self-contained.
@NathanDrake2406
NathanDrake2406 marked this pull request as ready for review June 6, 2026 06:00
@pkg-pr-new

pkg-pr-new Bot commented Jun 6, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@vinext/cloudflare@1786
npm i https://pkg.pr.new/vinext@1786

commit: c1bf9b4

@james-elicx

Copy link
Copy Markdown
Member

/bigbonk review

@ask-bonk ask-bonk Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed the deploy-harness change. The core approach is sound: rewriting workspace:* to a sibling file: dependency and materializing a throwaway @vinext/cloudflare package mirrors the existing .vinext-local-package pattern exactly, and the relative file:../.vinext-local-cloudflare-package path resolves correctly under pnpm (it is resolved relative to the declaring .vinext-local-package/package.json).

Things that check out:

  • resolveManifestDeps now handles both catalog: and workspace: specs, and routes workspace: through the new explicit resolver.
  • workspaceDependencySpecFor throws on any unknown workspace dependency, so a future workspace dep can't silently leak into the temp manifest. Good defensive choice.
  • The recursive cpSync of packages/cloudflare/dist preserves dist/cache/* and dist/utils/*, which the exports map (./dist/cache/*) depends on.
  • cloudflarePkg.peerDependencies (vinext: >=0.0.0) passes through unchanged, satisfied by the locally installed vinext.

One non-blocking suggestion: the harness guards ${VINEXT_PKG_DIR}/dist/cli.js near line 259 with a friendly "Build vinext first" message, but there is no equivalent guard for packages/cloudflare/dist. If cloudflare hasn't been built, the new fs.cpSync(packages/cloudflare/dist, ...) throws an ENOENT inside the node heredoc, which is harder to diagnose than the existing guard. Consider adding a parallel check next to the existing one:

if [ ! -d "${VINEXT_DIR}/packages/cloudflare/dist" ]; then
  echo "@vinext/cloudflare dist not found at ${VINEXT_DIR}/packages/cloudflare/dist" >&2
  echo "Build first: corepack pnpm build" >&2
  exit 1
fi

Overall this looks correct and well-scoped for restoring the deploy suite. LGTM with the optional guard above.

Comment thread scripts/e2e-deploy.sh
type: cloudflarePkg.type,
files: ['dist'],
exports: cloudflarePkg.exports,
peerDependencies: resolveManifestDeps(cloudflarePkg.peerDependencies),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Worth noting (not a blocker — validation passed): the generated local @vinext/cloudflare keeps peerDependencies: { vinext: ">=0.0.0" }, while the local vinext manifest declares @vinext/cloudflare: file:.... That's a circular package relationship in the temp app. pnpm handles it fine here, but if a future change tightens cloudflare's peer range on vinext, the throwaway vinext version (copied verbatim from the workspace) would need to satisfy it. Just flagging for awareness.

@ask-bonk

ask-bonk Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Review posted successfully on PR #1786.

Summary

I reviewed the deploy-harness change in scripts/e2e-deploy.sh. The PR is correct and well-scoped.

What it does: Makes the Next.js deploy-suite temp app installs self-contained by (1) copying the built @vinext/cloudflare package into a sibling .vinext-local-cloudflare-package dir, and (2) rewriting vinext's @vinext/cloudflare: workspace:* dependency to a file:../.vinext-local-cloudflare-package spec so pnpm install resolves it outside the monorepo workspace.

Verified correct:

  • The relative file: path resolves properly under pnpm (relative to the declaring .vinext-local-package/package.json).
  • resolveManifestDeps correctly handles both catalog: and workspace: specs.
  • workspaceDependencySpecFor throws explicitly on unknown workspace deps — good defense against silent leaks.
  • Recursive cpSync preserves dist/cache/* and dist/utils/*, which the exports map needs.
  • Mirrors the existing .vinext-local-package pattern (cleanup, gitignore-free temp dirs) consistently.

Feedback posted (both non-blocking):

  1. Suggested adding a packages/cloudflare/dist existence guard parallel to the existing dist/cli.js check, so a missing build fails with a friendly message instead of an ENOENT deep in the node heredoc.
  2. Flagged the circular vinext@vinext/cloudflare peer/file relationship in the temp manifest for future awareness.

Conclusion: LGTM with the optional guard suggestion.

github run

@james-elicx
james-elicx merged commit d89f611 into cloudflare:main Jun 6, 2026
30 checks passed
@NathanDrake2406
NathanDrake2406 deleted the nathan/searchparams-static-bailout branch June 6, 2026 08:29
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