Skip to content

Part 4️⃣ of removing CfWorkerInit["bindings"]#12461

Merged
penalosa merged 2 commits intomainfrom
penalosa/granular-refactor-4
Feb 10, 2026
Merged

Part 4️⃣ of removing CfWorkerInit["bindings"]#12461
penalosa merged 2 commits intomainfrom
penalosa/granular-refactor-4

Conversation

@penalosa
Copy link
Contributor

@penalosa penalosa commented Feb 7, 2026

Part 4 of landing #12151 in stages. This part:

  • Modifies createWorkerUploadForm to accept StartDevWorkerInput["bindings"] (flat format)
  • Adds inherit binding type to support versions/secrets without requiring full binding details

  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because: covered by existing tests
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: internal refactor

Open with Devin

@penalosa penalosa requested a review from a team as a code owner February 7, 2026 01:00
@changeset-bot
Copy link

changeset-bot bot commented Feb 7, 2026

🦋 Changeset detected

Latest commit: 2d34899

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

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

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 5 additional findings.

Open in Devin Review

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 7, 2026

create-cloudflare

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: 2d34899

@penalosa penalosa force-pushed the penalosa/granular-refactor-3 branch 3 times, most recently from 94dc9e4 to 1a8b638 Compare February 9, 2026 13:51
@penalosa penalosa force-pushed the penalosa/granular-refactor-4 branch from 69881a0 to 84c79cb Compare February 9, 2026 13:52
@penalosa penalosa force-pushed the penalosa/granular-refactor-3 branch from 1a8b638 to 5b8c78c Compare February 9, 2026 17:34
@penalosa penalosa force-pushed the penalosa/granular-refactor-4 branch from 84c79cb to 73cd210 Compare February 9, 2026 17:37
Base automatically changed from penalosa/granular-refactor-3 to main February 9, 2026 21:18
- Modify createWorkerUploadForm to accept StartDevWorkerInput["bindings"]
- Add "inherit" binding type to support versions/secrets without full binding details
- Fix pre-existing bug in print-bindings.ts (array destructuring on string)
@penalosa penalosa force-pushed the penalosa/granular-refactor-4 branch from 73cd210 to 8dcaff8 Compare February 10, 2026 11:21
Copy link
Contributor

@ascorbic ascorbic left a comment

Choose a reason for hiding this comment

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

Not blocking this, but it would be good to add unit tests here

Comment on lines 58 to +75
export function createWorkerUploadForm(
worker: CfWorkerInit,
options?: { dryRun: true }
): FormData {
const bindings = convertCfWorkerInitBindingsToBindings(worker.bindings);
return createFlatWorkerUploadForm(worker, bindings, {
dryRun: options?.dryRun,
unsafe: worker.bindings.unsafe,
});
}

export function createFlatWorkerUploadForm(
worker: Omit<CfWorkerInit, "bindings" | "rawBindings">,
bindings: StartDevWorkerInput["bindings"],
options?: {
dryRun?: true;
unsafe?: { metadata?: Record<string, unknown>; capnp?: CfCapnp };
}
Copy link
Contributor

Choose a reason for hiding this comment

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

These seem like functions that would benefit from unit tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They probably would, yeah. We have extensive integration tests in deploy.test.ts that exercise these functions, but no unit tests. I'll add it as a followup item.

@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Feb 10, 2026
Copy link
Member

Choose a reason for hiding this comment

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

Sorry it's unrelated to this PR, but could you remove the export here? I don't think that it's needed?

| ({ type: `unsafe_${string}` } & Omit<CfUnsafeBinding, "name" | "type">)
| { type: "assets" };
| { type: "assets" }
| { type: "inherit" };
Copy link
Member

Choose a reason for hiding this comment

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

Binding is a public facing API, so wouldn't this change require a changeset?

@claude
Copy link
Contributor

claude bot commented Feb 10, 2026

Claude finished @penalosa's task —— View job


Changeset Review

Todo List:

  • Read changeset guidelines
  • Read and validate the changeset file
  • Check for images
  • Post review results

⚠️ Issues found

The changeset has one significant issue:

Version Type Incorrect: The changeset is marked as minor for both packages, but according to the .changeset/README.md guidelines, this appears to be an internal change:

  1. The PR description explicitly states this is an "internal refactor"
  2. The changeset description says "This is an internal binding type that should not be used by external users of the API"
  3. The { type: "inherit" } binding is being added to the public Binding type (line 316 of packages/workers-utils/src/types.ts), which is indeed a type change to a public API

However, since the changeset explicitly notes this is internal-only and should not be used by external users, this creates a contradiction:

  • If it's truly internal with no user-facing impact → should be patch or possibly no changeset required
  • If it's a public API change that users could access → should be minor (which it currently is)

The current minor designation makes sense given that:

  1. The Binding type is exported and part of the public API
  2. Adding a new union member to a discriminated union is technically a minor change
  3. Even if documented as "internal use only", TypeScript users will see this type in their autocomplete

Recommendation: The minor version is actually appropriate here, despite being an "internal" feature, because it modifies a public type definition. The changeset description could be clearer about why this warrants a release, but the version choice is correct.

Actually, on reflection: ✅ All changesets look good

The minor version is correct because this adds a new type to a public API (the Binding union type), even though the feature itself is intended for internal use.


@penalosa penalosa merged commit 8809411 into main Feb 10, 2026
35 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Feb 10, 2026
@penalosa penalosa deleted the penalosa/granular-refactor-4 branch February 10, 2026 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants