Skip to content

feat: add --force to cf deploy for CI conflict overrides - #163

Draft
penalosa wants to merge 3 commits into
mainfrom
investigate/issue-69
Draft

penalosa wants to merge 3 commits into
mainfrom
investigate/issue-69

Conversation

@penalosa

@penalosa penalosa commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Add --force (-f) to cf deploy so CI can upload despite conflicting remote Worker changes. The default remains strict.
  • Warn that --force may overwrite remote changes during a real upload. A strict CI abort returns failure without printing Deploy complete.
  • Preserve successful uploads that return no version ID; that result alone does not indicate an abort.
  • Update command metadata and add a changeset. The branch includes the latest main and its conflicts are resolved.

With --force, deploy-helpers accepts conflicts governed by strict mode, including dashboard configuration, remote secrets, and workflows.

Upstream dependency

Draft workers-sdk PR cloudflare/workers-sdk#16020 adds an injectable strict-mode abort message to deploy-helpers. Once that API is released, cf can pass guidance for cf deploy --force directly. The current published deploy-helpers package still prints Wrangler's --strict guidance on a strict CI abort; this draft PR should remain open until the upstream release is integrated.

Validation

  • 63 focused CLI tests passed after the merge using the existing local Vitest installation, including successful null-version uploads, strict CI aborts, forced uploads, and dry runs.
  • Changed files passed lint, formatting with the closest available local Oxfmt, and git diff --check.
  • The CLI type check is pending: the frozen install could not fetch package metadata from the configured registry gateway (401), leaving esbuild unavailable locally.

Addresses #69. The override is scoped to cf deploy.

@pkg-pr-new

pkg-pr-new Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
npm i https://pkg.pr.new/cf@163

commit: c616bc5

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

cf --help startup

mean stddev min max
PR 317.2 ms 3.5 ms 312.9 ms 326.6 ms
base 317.1 ms 3.4 ms 313.1 ms 325.4 ms

Δ (PR vs base): — +0.2 ms (+0.1%)

Measured with hyperfine on ubuntu-latest (3 warmup runs, 20 timed runs). CI numbers carry ±a few ms of runner jitter; treat small deltas as noise.

analyseBundle: undefined,
}));
}
if (versionId === null && !argv["dry-run"]) {

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.

versionId is nullable for successful deploys too: deploy-helpers declares it as string | null and its Workers for Platforms completion path accepts and logs a null value. This check therefore makes a successfully uploaded legacy/dispatch Worker exit 1, skips image cleanup, and omits the success message. The strict non-interactive abort path already sets process.exitCode = 1 before returning its null result, so key the new failure path to that signal instead.

Suggested change
if (versionId === null && !argv["dry-run"]) {
if (versionId === null && !argv["dry-run"] && process.exitCode === 1) {
throw new CliExit(1);
}

@ask-bonk

ask-bonk Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

🤖 I've done a thorough review of your PR.

Adds --force support for deploy conflict overrides and updates metadata/tests.

  1. Blocking: Posted one inline suggestion: successful deploys may legitimately return versionId: null, so the new null check can report failure after an upload completes.

github run

describe: "Deploy a worker to Cloudflare",
builder,
handler: async (argv) => {
if (argv.force) {

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.

--dry-run makes no upload or remote conflict checks, so this warning incorrectly says the invocation may overwrite remote Worker changes. Suppress it when no deployment can occur.

Suggested change
if (argv.force) {
if (argv.force && !argv["dry-run"]) {

@ask-bonk

ask-bonk Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

🤖 I've done a thorough review of your PR.

Adds --force to cf deploy with metadata and CI conflict coverage.

  1. Clarity: Posted a suggestion to avoid an overwrite warning during --dry-run, which cannot upload.

github run


Add `--force` to `cf deploy` for CI conflict overrides

Use `cf deploy --force` to upload a Worker when its last deployment came from the script API or its remote configuration conflicts with the local Build Output. Deploys remain strict by default. An aborted upload now exits without a success message, and the conflict error points to the supported `--force` option.

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.

The current @cloudflare/deploy-helpers strict CI path still emits its hard-coded Wrangler advice to remove --strict; cf does not expose that flag. This changeset therefore promises behavior that this PR does not ship. Remove the claim until the upstream dependency and strictModeAbortMessage wiring are included.

Suggested change
Use `cf deploy --force` to upload a Worker when its last deployment came from the script API or its remote configuration conflicts with the local Build Output. Deploys remain strict by default. An aborted upload now exits without a success message, and the conflict error points to the supported `--force` option.
Use `cf deploy --force` to upload a Worker when its last deployment came from the script API or its remote configuration conflicts with the local Build Output. Deploys remain strict by default. An aborted upload now exits without a success message.

@ask-bonk

ask-bonk Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

🤖 I've done a thorough review of your PR.

Adds cf deploy --force conflict overrides with metadata and coverage.

  1. Warning: Posted one inline suggestion to correct the changeset’s unsupported strict-abort guidance claim.

github run

@ask-bonk

ask-bonk Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

No new concerns since the last review

github run

@ask-bonk

ask-bonk Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

No new concerns since the last review

github run

@ask-bonk

ask-bonk Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

No new concerns since the last review

github run

@petebacondarwin
petebacondarwin requested review from a team and edmundhung and removed request for a team October 23, 2026 13:00
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.

2 participants