Skip to content

TEMP: validate the deferred-registration fix on Windows (do not merge) - #15025

Draft
petebacondarwin wants to merge 2 commits into
mainfrom
validate/defer-registration
Draft

TEMP: validate the deferred-registration fix on Windows (do not merge)#15025
petebacondarwin wants to merge 2 commits into
mainfrom
validate/defer-registration

Conversation

@petebacondarwin

Copy link
Copy Markdown
Contributor

Throwaway validation for #15024. Repeats the vite dev <-> vite dev suite 4x on Windows with explicit crash reporting, and isolates the dev-registry fixture so an unrelated fixture flake cannot abort the job before it runs.

Expectation: no CRASH-DETECTED lines, and the target test well under its 50s budget.

  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because: this PR is a temporary test harness and will be closed, not merged.
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: throwaway validation branch.

Note

This is a contribution from an AI agent: OpenCode, claude-opus-5.

@changeset-bot

changeset-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c5edab7

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

This PR includes changesets to release 8 packages
Name Type
@cloudflare/vite-plugin Patch
miniflare Minor
@cloudflare/deploy-helpers Patch
@cloudflare/pages-shared Patch
@cloudflare/remote-bindings Patch
@cloudflare/runtime-types Patch
@cloudflare/vitest-pool-workers Patch
wrangler Patch

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

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

✅ All changesets look good

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

I'm Bonk, and I've done a quick review of your PR.

This is a throwaway Windows validation harness for #15024 that also carries the real deferred-dev-registry-registration fix (miniflare + vite-plugin). The production fix itself looks logically sound: #registerWorkers() is mutex-protected and guarded by isEnabled(), the hold is correctly re-armed on setOptions(), and reads of the registry are left untouched so peer resolution still works. My only concerns are around merge-safety and one imprecise doc comment.

Ranked:

  1. (medium) Merge-safety: this PR is labelled "do not merge", but it contains a real, non-temporary changeset that bumps miniflare to a minor release. If this branch is ever merged (or the changeset is copied into another PR), it will trigger a real package release together with the temporary CI scaffolding (--force, the isolated @fixture/dev-registry filter, the 60-minute timeout, the round 1..4 loop, and the CRASH-DETECTED logging). Consider gating the release behind the actual fix PR rather than this harness, or renaming the changeset so it can't accidentally publish from here.

  2. (low) unsafeRegisterInDevRegistry() JSDoc says it is "a no-op unless unsafeDeferDevRegistryRegistration is set", but the implementation unconditionally sets #devRegistryRegistrationReleased = true and calls #registerWorkers() regardless of the option. Harmless (idempotent), but the comment is inaccurate.

* put in place by `unsafeDeferDevRegistryRegistration`.
*
* Call this once the runtime is the one peers should actually connect to. It
* is idempotent, and a no-op unless `unsafeDeferDevRegistryRegistration` is

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.

This says the method is "a no-op unless unsafeDeferDevRegistryRegistration is set", but the body below always sets #devRegistryRegistrationReleased = true and always calls #registerWorkers() (which itself only checks #devRegistry.isEnabled()), independent of the defer option. It's idempotent so no functional harm, but the comment is misleading.

Suggested change
* is idempotent, and a no-op unless `unsafeDeferDevRegistryRegistration` is
* Call this once the runtime is the one peers should actually connect to. It
* is idempotent. If the dev registry is enabled it advertises this instance's
* Workers even when `unsafeDeferDevRegistryRegistration` was not set (in which
* case they will already have been advertised). Registration does not restart
* `workerd`, so this is cheap.

@ask-bonk

ask-bonk Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review posted successfully to PR #15025.

Summary of what I did:

  • Verified the trigger matches PR TEMP: validate the deferred-registration fix on Windows (do not merge) #15025.
  • Reviewed the production fix (miniflare deferred-registration + vite-plugin) and the temporary CI/test scaffolding.
  • Posted a single batch review (COMMENT) with:
    1. A medium-severity merge-safety note: the "do not merge" harness carries a real non-temporary changeset bumping miniflare to a minor, which risks publishing the temporary CI scaffolding if merged or copied.
    2. A low-severity suggestion fixing the inaccurate unsafeRegisterInDevRegistry() JSDoc (it isn't a no-op when deferring is unset).

The core production fix logic itself is sound (mutex-protected registration, isEnabled() guard, correct re-arm on setOptions(), reads left untouched).

github run

The plugin starts workerd twice: once to discover each Worker's exports by
running it, then again with a config built from what it found. The first
runtime was published to the dev registry and then torn down, leaving peers
holding a debug port that no longer existed. On Windows a peer with a
tail_consumers edge to it aborts its own workerd with std::terminate.

Miniflare gains unsafeDeferDevRegistryRegistration to hold back
self-advertisement, and unsafeRegisterInDevRegistry() to release it once the
runtime is final. Reading the registry is unaffected, so a starting session
still resolves Workers from sessions already running.
@petebacondarwin
petebacondarwin force-pushed the validate/defer-registration branch from 55041e7 to 4ea6155 Compare August 4, 2026 21:09
@pkg-pr-new

pkg-pr-new Bot commented Aug 4, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@15025

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@15025

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@15025

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@15025

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@15025

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@15025

miniflare

npm i https://pkg.pr.new/miniflare@15025

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@15025

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@15025

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@15025

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@15025

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@15025

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@15025

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@15025

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@15025

wrangler

npm i https://pkg.pr.new/wrangler@15025

commit: c5edab7

@petebacondarwin
petebacondarwin force-pushed the validate/defer-registration branch from 4ea6155 to c5edab7 Compare August 4, 2026 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

2 participants