Skip to content

[vite-plugin] Support remote Analytics Engine in v1 - #16579

Merged
petebacondarwin merged 1 commit into
codex/vite-v1-backport-15290from
codex/vite-v1-backport-16536
Oct 30, 2026
Merged

petebacondarwin merged 1 commit into
codex/vite-v1-backport-15290from
codex/vite-v1-backport-16536

Conversation

@petebacondarwin

@petebacondarwin petebacondarwin commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Backports the independently necessary retained-code portion of #16536 to Vite plugin v1, stacked on #16578 and #16543.

V1 already gets legacy Wrangler config-to-binding conversion and Miniflare options from installed Wrangler, rather than v2's src/remote-bindings.ts. #16543 supplies published Miniflare 5.20261023.2-beta, Wrangler 4.155.0, workers-utils 0.50.0 and the coupled helper graph. Those versions validate and forward analytics_engine_datasets[].remote; this PR makes no repeated dependency upgrade.

The remaining required change is in the retained remote proxy: native Analytics Engine objects cannot be serialized directly by capnweb. Expose writeDataPoint() through a plain object so local development and preview can write to the configured real dataset when remote: true. Keep local writes as no-ops when remote mode is absent. Add one plugin minor changeset describing the user-facing feature.

A regression test exercises the real bundled retained proxy in workerd over a WebSocket RPC connection, with an AnalyticsEngine-shaped non-serializable binding. It fails before the wrapper with RPC stub points at a non-serializable type and passes after it, asserting that the original event reaches the binding. This tests retained code; no public Wrangler/Miniflare source, CLI test, fixture or upstream unit test is copied. No credentialed live-dataset test was run.

Validation with Node 22.22.1/pnpm 10.33.0: pnpm test:ci passes all 8 retained tasks (including 32 remote-bindings and 231 plugin tests); pnpm check passes all 58 tasks including build, types, lint and format. Parent #16543 validates dependency installation, registry fixtures and plugin asset/Explorer dev/preview behavior; parent #16578 validates the HMR behavior.


  • 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: the minor changeset documents the existing Wrangler remote: true setting and v1 feature behavior.

Note

This is a contribution from an AI agent: Codex, under the authorized v1 backport automation.

@changeset-bot

changeset-bot Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: eee42c8

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

@workers-devprod
workers-devprod requested review from a team and NuroDev and removed request for a team October 29, 2026 14:13
@workers-devprod

workers-devprod commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler

@petebacondarwin

Copy link
Copy Markdown
Contributor Author

@WalshyDev (original author) @dario-piotrowicz (verified human ant-core approver): please check this v1 backport of #16536 and approve it if it looks good. #16543 already supplies published Miniflare 5.20261023.2-beta, Wrangler 4.155.0 and workers-utils 0.50.0. V1 gets config conversion/options from installed Wrangler, so the remaining change is the retained proxy's Analytics Engine method wrapper. The real retained proxy regression fails before the fix and passes after; build/types/checks and all retained suites pass. No repeated dependency upgrade or upstream tests are included.

@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 thread .changeset/v1-remote-analytics-engine.md Outdated
@clanky-the-clanker

clanky-the-clanker Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

✅ Approved — The only change since the last approval is the changeset text, which is accurate. I found no issues.

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


✅ All checks passed

📋 Code Quality: ✅ LGTM

No issues found. The AnalyticsEngine wrapper follows the existing Hyperdrive branch, and the test covers it.


📝 Documentation: ✅ LGTM

The changeset is a minor bump for @cloudflare/vite-plugin and describes remote Analytics Engine support accurately.


Reviewed commit: eee42c89

@petebacondarwin
petebacondarwin force-pushed the codex/vite-v1-backport-16536 branch from e0b7018 to eee42c8 Compare October 29, 2026 14:21
@pkg-pr-new

pkg-pr-new Bot commented Oct 29, 2026

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

commit: eee42c8

@dario-piotrowicz
dario-piotrowicz requested review from dario-piotrowicz and removed request for NuroDev October 29, 2026 15:45

@dario-piotrowicz dario-piotrowicz left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM (noting that miniflare package has already been updated with the necessary changes)

@workers-devprod workers-devprod 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.

Codeowners reviews satisfied

@petebacondarwin
petebacondarwin merged commit e696113 into vite-plugin-v1 Oct 30, 2026
25 of 27 checks passed
@petebacondarwin
petebacondarwin deleted the codex/vite-v1-backport-16536 branch October 30, 2026 10:31
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.

4 participants