Skip to content

fix: respect dry-run during project setup - #166

Merged
penalosa merged 5 commits into
mainfrom
investigate/issue-112
Oct 2, 2026
Merged

penalosa merged 5 commits into
mainfrom
investigate/issue-112

Conversation

@penalosa

@penalosa penalosa commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Pass --dry-run to framework autoconfig and accepted Wrangler config conversion for cf deploy, cf workers versions create, and cf workers triggers deploy.
  • When setup would be needed, report planned changes and stop before building or uploading.
  • Check that existing project files remain unchanged in the dry-run regression test.

Setup paths

  1. prepareProject detects whether cf is already configured. If it is, no setup runs.
  2. Otherwise, if a Wrangler config exists, cf offers to convert it with the cf migrate codemod. maybeMigrateWranglerProject returns true only after the user accepts and that conversion command completes, including in dry-run mode.
  3. If the conversion did not run, configureProject calls framework autoconfig to set up the detected project.
  4. In a dry run, either selected setup path returns setupNeeded. The build stops because those setup changes were not applied. For an already configured project, the build still runs and deploy-helpers performs its upload or trigger dry run. --prebuilt skips project preparation and the build.

Validation

  • pnpm check
  • pnpm test src/__tests__/lib/autoconfig-migration.test.ts src/__tests__/commands/migrate.test.ts src/__tests__/commands/deploy/index.test.ts src/__tests__/commands/triggers-deploy.test.ts (72 passed)
  • pnpm test src/__tests__/commands/deploy/index.test.ts src/__tests__/commands/triggers-deploy.test.ts src/__tests__/commands/versions-upload.test.ts (68 passed)

Scope

Configured projects still run their build during a deploy dry run, so build output may change. cf build has no dry-run flag and retains its existing setup behavior.

Related to #112.

@pkg-pr-new

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

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

commit: e551802

@ask-bonk

ask-bonk Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

cf --help startup

mean stddev min max
PR 326.6 ms 3.9 ms 320.0 ms 335.3 ms
base 382.6 ms 4.9 ms 376.5 ms 396.5 ms

Δ (PR vs base): ↓ -55.9 ms (-14.6%)

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.

@ask-bonk

ask-bonk Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@ask-bonk

ask-bonk Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@penalosa
penalosa marked this pull request as ready for review October 2, 2026 11:15
@ask-bonk

ask-bonk Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@petebacondarwin petebacondarwin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I feel like I am being dumb here and not really understanding the stages of autoconfig and migration (and the difference between the two). So I am marking this review as inconclusive as I don't feel I can make a positive or negative call without more knowledge.

Comment thread packages/cli/src/__tests__/commands/deploy/index.test.ts Outdated
Comment thread packages/cli/src/__tests__/commands/migrate.test.ts Outdated
Comment thread packages/cli/src/__tests__/lib/autoconfig-migration.test.ts Outdated
Comment thread packages/cli/src/commands/build/index.ts
Comment thread packages/cli/src/lib/autoconfig.ts
@penalosa penalosa changed the title fix: preview setup during deploy dry runs fix: respect dry-run during project setup Oct 2, 2026
@ask-bonk

ask-bonk Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@petebacondarwin petebacondarwin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

OK I think this is a bit clearer 😄

@penalosa
penalosa added this pull request to the merge queue Oct 2, 2026
Merged via the queue into main with commit 1f0303e Oct 2, 2026
14 checks passed
@penalosa
penalosa deleted the investigate/issue-112 branch October 2, 2026 21:12
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