-
Notifications
You must be signed in to change notification settings - Fork 757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
file based registry fixtures #6893
Conversation
|
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11327304683/npm-package-wrangler-6893 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/6893/npm-package-wrangler-6893 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11327304683/npm-package-wrangler-6893 dev path/to/script.js Additional artifacts:npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11327304683/npm-package-create-cloudflare-6893 --no-auto-update npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11327304683/npm-package-cloudflare-kv-asset-handler-6893 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11327304683/npm-package-miniflare-6893 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11327304683/npm-package-cloudflare-pages-shared-6893 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11327304683/npm-package-cloudflare-vitest-pool-workers-6893 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11327304683/npm-package-cloudflare-workers-editor-shared-6893 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11327304683/npm-package-cloudflare-workers-shared-6893 Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
4f0abde
to
f8b18e5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes in this file are to support running with --x-registry
@@ -150,92 +115,6 @@ describe("getPlatformProxy - env", () => { | |||
} | |||
}); | |||
|
|||
it("provides service bindings to external local workers", async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are now tested in the get-platform-proxy.test.ts
e2e test
@@ -221,107 +216,6 @@ describe.each([ | |||
}); | |||
}); | |||
|
|||
describe.each([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to dev-registry.test.ts
if (stderr.length) { | ||
console.error(stderr); | ||
} | ||
if (stdout.length) { | ||
console.log(`[${path.basename(cwd ?? "/unknown")}]`, stdout); | ||
} | ||
if (stderr.length) { | ||
console.error(`[${path.basename(cwd ?? "/unknown")}]`, stderr); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means our E2E test output will be a lot noisier, but I think we should keep logging enabled by default for now to help us diagnose and fix flakes
if (process.env.VITEST_MODE === "WATCH") { | ||
console.log(line); | ||
} | ||
console.log(`[${path.basename(cwd ?? "/unknown")}]`, line); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above
if (!buildAborter.signal.aborted) { | ||
this.emitBundleCompleteEvent(config, newBundle); | ||
this.#currentBundle = newBundle; | ||
} | ||
}, | ||
(err) => | ||
this.emitErrorEvent({ | ||
type: "error", | ||
reason: "Failed to construct initial bundle", | ||
cause: castErrorCause(err), | ||
source: "BundlerController", | ||
data: undefined, | ||
}) | ||
(err) => { | ||
if (!buildAborter.signal.aborted) { | ||
this.emitErrorEvent({ | ||
type: "error", | ||
reason: "Failed to construct initial bundle", | ||
cause: castErrorCause(err), | ||
source: "BundlerController", | ||
data: undefined, | ||
}); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BundleController had a race condition where old builds would sometimes overwrite newer ones. We'd thought this was handled by esbuild, but it turns out that it's not in the way we need it to. This fixes the intermittent "Failed to construct initial bundle" flakes we were seeing in E2E tests in CI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool, thanks for that.
const registryDefinition = registry?.[script_name]; | ||
if ( | ||
registryDefinition && | ||
registryDefinition.durableObjects.some( | ||
(d) => d.className === class_name | ||
) | ||
) { | ||
value += ` (defined in 🟢 ${script_name})`; | ||
} else { | ||
value += ` (defined in 🔴 ${script_name})`; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes it much easier to see at a glance which service bindings are connected via the dev registry. Happy to bikeshed on the emoji!
ef4420c
to
27a8d3b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! One question, but otherwise really happy this is going forward 🚀
"dev", | ||
publicPath, | ||
"--x-dev-env", | ||
"--x-registry", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎆
if (!buildAborter.signal.aborted) { | ||
this.emitBundleCompleteEvent(config, newBundle); | ||
this.#currentBundle = newBundle; | ||
} | ||
}, | ||
(err) => | ||
this.emitErrorEvent({ | ||
type: "error", | ||
reason: "Failed to construct initial bundle", | ||
cause: castErrorCause(err), | ||
source: "BundlerController", | ||
data: undefined, | ||
}) | ||
(err) => { | ||
if (!buildAborter.signal.aborted) { | ||
this.emitErrorEvent({ | ||
type: "error", | ||
reason: "Failed to construct initial bundle", | ||
cause: castErrorCause(err), | ||
source: "BundlerController", | ||
data: undefined, | ||
}); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool, thanks for that.
@@ -476,6 +476,11 @@ async function updateDevEnvRegistry( | |||
devEnv: DevEnv, | |||
registry: WorkerRegistry | undefined | |||
) { | |||
// Make sure we're not patching an empty config | |||
if (!devEnv.config.latestConfig) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this change fixing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just moving this check higher up the function. Previously we got bound workers and then waited for a config update, but since getting bound workers depends on the config we should've been waiting here instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha! Does this explain the race we were seeing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of them, yes! Another was in the bundle controller, and there might still be others lurking
27a8d3b
to
6daac0c
Compare
@@ -476,6 +476,11 @@ async function updateDevEnvRegistry( | |||
devEnv: DevEnv, | |||
registry: WorkerRegistry | undefined | |||
) { | |||
// Make sure we're not patching an empty config | |||
if (!devEnv.config.latestConfig) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha! Does this explain the race we were seeing?
Co-authored-by: Rahul Sethi <5822355+RamIdeas@users.noreply.github.com>
Co-authored-by: Rahul Sethi <5822355+RamIdeas@users.noreply.github.com>
What this PR solves / how to test
Fixes N/A
This PR removes flaky dev registry fixtures, and shifts them to be run in Wrangler's e2e test suite to improve reliability and reduce the number of times they're run.
Author has addressed the following