Skip to content

[deploy-helpers] Extract Worker startup profiling from Wrangler - #15612

Open
petebacondarwin wants to merge 9 commits into
mainfrom
pbd/extract-startup-profile
Open

[deploy-helpers] Extract Worker startup profiling from Wrangler#15612
petebacondarwin wants to merge 9 commits into
mainfrom
pbd/extract-startup-profile

Conversation

@petebacondarwin

@petebacondarwin petebacondarwin commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Prerequisite for https://github.com/cloudflare/cf/issues/97.

Summary

Wrangler's startup profiler was private to check startup, so cf could not implement the equivalent command without importing Wrangler internals. This exposes the generic implementation from @cloudflare/deploy-helpers/startup-profile.

  • Share Worker upload parsing, bundle sizing, CPU profiling, and profile summaries.
  • Make deploy startup-limit diagnostics lazy-load the shared profiler.
  • Migrate wrangler check startup, deploy, Pages deploy, and version upload away from Wrangler callback injection.
  • Preserve analyseBundle as an optional deprecated compatibility callback.
  • Harden the inspector lifecycle with command acknowledgements, response correlation, a timeout, and guaranteed cleanup.
  • Add the Wrangler build alias and a minor changeset for the new public subpath and deprecation.

Validation

  • pnpm --filter @cloudflare/deploy-helpers build
  • pnpm --filter @cloudflare/deploy-helpers check:type
  • pnpm --filter @cloudflare/deploy-helpers type:tests
  • pnpm --filter @cloudflare/deploy-helpers test:ci — 141 tests
  • pnpm --filter wrangler build
  • pnpm --filter wrangler check:type
  • Focused Wrangler startup, validator, and deploy suites — 52 tests
  • Focused type-aware lint, formatting, package dependency validation, and git diff --check

  • 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 shares an internal implementation without adding a new Wrangler command or option.

Devin Review

@changeset-bot

changeset-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2fcf18d

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

This PR includes changesets to release 2 packages
Name Type
@cloudflare/deploy-helpers Minor
@cloudflare/remote-bindings 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-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Sep 11, 2026
@workers-devprod
workers-devprod requested review from a team and dario-piotrowicz and removed request for a team September 11, 2026 17:50
@workers-devprod

workers-devprod commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@ask-bonk

ask-bonk Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

LGTM!

github run

devin-ai-integration[bot]

This comment was marked as resolved.

@pkg-pr-new

pkg-pr-new Bot commented Sep 11, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

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

@cloudflare/build-output-utils

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

@cloudflare/codemods

npm i https://pkg.pr.new/@cloudflare/codemods@15612

@cloudflare/config

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

@cloudflare/containers-shared

npm i https://pkg.pr.new/@cloudflare/containers-shared@15612

create-cloudflare

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

@cloudflare/deploy-helpers

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-functions

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-plugin

npm i https://pkg.pr.new/@cloudflare/vitest-plugin@15612

@cloudflare/workers-auth

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: 2fcf18d

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@petebacondarwin petebacondarwin added this to the Birthday Week 2026 milestone Sep 14, 2026
});
});

describe("summarizeStartupProfile", () => {

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.

I can see that you've moved this test to packages/deploy-helpers/tests/startup-profile.test.ts but without the describe block, wouldn't it better to keep it? 🤔


Share Worker startup profiling with other Cloudflare developer tools

Move the bundle analyser out of Wrangler so `cf` and deploy failure diagnostics can use the same Miniflare CPU profiler.

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.

shall we also mention the deprecation of the analyseBundle arg?

@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

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.

3 participants