Skip to content

[vite-plugin] Default v1 Artifacts bindings to the local simulator - #16898

Open
petebacondarwin wants to merge 2 commits into
codex/vite-v1-backport-16862from
codex/vite-v1-backport-16735
Open

petebacondarwin wants to merge 2 commits into
codex/vite-v1-backport-16862from
codex/vite-v1-backport-16735

Conversation

@petebacondarwin

@petebacondarwin petebacondarwin commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Backports #16735 to Vite plugin v1. Artifacts bindings that omit remote should use the local simulator without Cloudflare credentials. V1 keeps Wrangler configuration and the V4 Miniflare adapter: the retained session selector consumes workers-utils 0.54.0, and dev/preview warnings use its shared helper with Wrangler-setting syntax. Existing plugin integration coverage adds the omitted-remote case and checks the migration warning; retained session coverage verifies that only explicit remote: true starts a session.

Version Packages #16863 has merged and the required versions are now published. Pins and the pnpm-generated lockfile consume Miniflare 5.20261113.0-beta, Wrangler 4.162.0 and workers-utils 0.54.0. Retained remote-bindings also needs deploy-helpers 0.27.0: the previous release exposes incompatible nominal Binding types. The remaining retained workers-utils consumers align to 0.54.0 because Wrangler's external declarations otherwise resolve the hoisted 0.53.0 types. Private packages keep their workspace:* references. The preview disposal test now mocks only the npm update check, preserving the real warning helper.

The coupled runtime also supplies #16589's Browser Run quick actions and #16771's local Artifacts fixes. No public dependency source, dependency tests, or fixtures are restored. #16849 and #16886's runtime/default-date updates are supplied by these releases; they do not need separate mapping PRs or changesets. #16859 already supplies Miniflare 5.20261110.2-beta for #16814/#16836 and remains unchanged in purpose.

Native GitHub stack #16900: #16818 → #16859 → #16860 → #16861 → #16899 → this PR, rooted at vite-plugin-v1. The earlier branches now include Edmund's inline-config Container hint correction from #16818. Merge the stack in order through GitHub's stack mechanism.

Validation with Node 22.22.1 / pnpm 10.33.0: pnpm build, pnpm check, and pnpm test:ci pass, including 268 plugin tests and retained remote-bindings tests. This includes the plugin Artifacts integration with omitted remote, its migration warning, and preview disposal. No credentialed E2E or full OS/Vite matrix run.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: this adapts the original beta Artifacts default change to the maintained v1 configuration API; the changeset describes the migration settings.

Note

This is a contribution from an AI agent: Codex.

@changeset-bot

changeset-bot Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: aa75cb7

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

This PR includes changesets to release 1 package
Name Type
@cloudflare/vite-plugin Minor

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

@petebacondarwin

petebacondarwin commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

@leostera (verified author of #16735) and @edmundhung (verified human ant-core member; approved the original November 13 at 10:14:06Z, before merge): please check this v1 adaptation and approve it if it looks good.

V1 keeps Wrangler configuration and the V4 runtime adapter. The retained session selector needs workers-utils 0.54.0; dev and preview use its shared warning helper with remote syntax. The coupled intended Wrangler 4.162.0 / Miniflare 5.20261113.0-beta pins also supply the Browser Run and Artifacts runtime fixes. #16859 already supplies the earlier .2-beta upgrade; it is not repeated here. The original-to-backport change is independently useful and adds actual plugin/retained-code coverage.

This PR remains draft: all three intended dependencies currently return npm E404, so lockfile regeneration and build/types/integration validation are blocked. No lockfile metadata is fabricated. The description lists the successful published-stack checks and the expected regression against the old dependency. Please assess the adaptation now; completion requires publication and successful final validation. Registered in native GitHub stack #16900.

@petebacondarwin
petebacondarwin removed this pull request from stack #16738 November 13, 2026 14:07
@petebacondarwin
petebacondarwin changed the base branch from codex/vite-v1-backport-16838 to codex/vite-v1-backport-16862 November 13, 2026 14:08

@leostera leostera left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍 LGTM!

The behavior matches #16735:

Artifacts binding in v1 Result
remote omitted, remote bindings on Local simulator, no credentials needed. Warns once per project, Worker and binding that the default changed
remote: true Deployed repos through a remote session. This is the only case that starts one
remote: false Local, no warning
Remote bindings off (remoteBindings: false) Always local, no warning

The default flip comes from the workers-utils 0.54.0 / Wrangler 4.162.0 bump, so it's the same code as main. The warning uses the same shared helper, with Wrangler's remote syntax, which is right for v1 config. The tests cover the omitted-remote case and check that the warning appears only there.

@petebacondarwin
petebacondarwin marked this pull request as ready for review November 14, 2026 14:07
@workers-devprod
workers-devprod requested review from a team and jamesopstad and removed request for a team November 14, 2026 14:07
@workers-devprod

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/wrangler

@pkg-pr-new

pkg-pr-new Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
npm i https://pkg.pr.new/@cloudflare/vite-plugin@16898

commit: aa75cb7

@devin-ai-integration devin-ai-integration 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.

Devin Review found 1 potential issue.

Devin Review

Comment on lines +72 to +74
// Remember warnings across config reloads, separately for each project and Worker.
const warnForArtifactsLocalDefault =
createArtifactsLocalDefaultWarner("wrangler");

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.

🟡 New global warning state

warnForArtifactsLocalDefault introduces module-global mutable state shared by all plugin instances. The review rules explicitly prohibit introducing global variables.

Learn more

The warning helper captures a mutable set of previously warned binding identifiers. Creating it at module scope makes that set another singleton rather than context-owned state. The existing SharedContext provides a place for state that survives server restarts.

Example: Two plugin instances import the same module and call the same warning closure, rather than owning their warning state through their contexts.

Recommended fix: Store the warning helper on the existing shared context and expose it through PluginContext. Have both development and preview retrieve it there, preserving warning deduplication across reloads without introducing another module-global variable.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@clanky-the-clanker clanky-the-clanker 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.

Superseded by the review of aa75cb72.

This review, of 4cbc3f5e

✅ Approved — No correctness, security, performance or documentation issues found. The default change is limited to dev and preview, is covered by tests, and has a changeset.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🚀 Release: ✅ LGTM

Release risk is medium: Artifacts bindings without remote now use the local simulator in dev and preview. The changeset documents this and explains how to migrate.


🔒 Security: ✅ LGTM

No security concerns.


📖 AGENTS.md: ✅ LGTM

Follows the repository conventions: private packages stay on workspace:*, public packages are pinned to exact versions, and the plugin change has a changeset.


📋 Code Quality: ✅ LGTM

The dependency bumps are consistent across packages. The warning calls are gated on remoteBindings and deduplicated by a module-level warner. The tests cover the omitted-remote and explicit-remote cases.


⚡ Performance: ✅ LGTM

The warner runs on each config load, but it deduplicates with a set, so the cost is negligible.


📝 Documentation: ✅ LGTM

The changeset describes the default change and how to migrate.


Reviewed commit: 4cbc3f5e

@petebacondarwin
petebacondarwin requested review from edmundhung and removed request for jamesopstad November 16, 2026 10:34
@petebacondarwin
petebacondarwin force-pushed the codex/vite-v1-backport-16735 branch from 4cbc3f5 to aa75cb7 Compare November 16, 2026 14:06

@clanky-the-clanker clanky-the-clanker 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.

✅ Approved — No correctness, security, performance or documentation issues found. The default change is limited to dev and preview, is covered by tests, and has a changeset.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🚀 Release: ✅ LGTM

Release risk is medium: Artifacts bindings without remote now use the local simulator in dev and preview. The changeset documents this and explains how to migrate.


🔒 Security: ✅ LGTM

No security concerns.


📖 AGENTS.md: ✅ LGTM

Follows the repository conventions: private packages stay on workspace:*, public packages are pinned to exact versions, and the plugin change has a changeset.


📋 Code Quality: ✅ LGTM

The dependency bumps are consistent across packages. The warning calls are gated on remoteBindings and deduplicated by a module-level warner. The tests cover the omitted-remote and explicit-remote cases.


⚡ Performance: ✅ LGTM

The warner runs on each config load, but it deduplicates with a set, so the cost is negligible.


📝 Documentation: ✅ LGTM

The changeset describes the default change and how to migrate.


Reviewed commit: aa75cb72 — same changes as 4cbc3f5e, so this is that commit's review (no new review was run; line numbers are as of 4cbc3f5e)

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.

3 participants