Repository navigation
[vite-plugin] Default v1 Artifacts bindings to the local simulator - #16898
petebacondarwin wants to merge 2 commits into
Conversation
🦋 Changeset detectedLatest commit: aa75cb7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
@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 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. |
leostera
left a comment
There was a problem hiding this comment.
👍 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.
|
Codeowners approval required for this PR:
|
commit: |
| // Remember warnings across config reloads, separately for each project and Worker. | ||
| const warnForArtifactsLocalDefault = | ||
| createArtifactsLocalDefaultWarner("wrangler"); |
There was a problem hiding this comment.
🟡 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.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
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
4cbc3f5 to
aa75cb7
Compare
There was a problem hiding this comment.
✅ 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)
Backports #16735 to Vite plugin v1. Artifacts bindings that omit
remoteshould 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 explicitremote: truestarts 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, andpnpm test:cipass, including 268 plugin tests and retained remote-bindings tests. This includes the plugin Artifacts integration with omittedremote, its migration warning, and preview disposal. No credentialed E2E or full OS/Vite matrix run.Note
This is a contribution from an AI agent: Codex.