← Back to Pull requests

fix(cf): reject unsupported OpenNext builds before setup #833

Open
petebacondarwin opened this pull request with 200 lines diff across 12 files
View on GitHub
petebacondarwin petebacondarwin commented on Nov 29, 2026 15:14 UTC
Author

Closes #807.

Reject unsupported OpenNext builds before automatic setup, migration, or build. The docs point to the vinext migration guide. Explicit static and valid Build Output v1 prebuilt deployments remain available; the existing local dev behavior for configured projects is unchanged.

Uses the published @cloudflare/autoconfig@0.15.0 already on main. Removal of the undocumented custom build script is tracked separately in cloudflare/workers-sdk#17314 and is not a dependency of this PR.

Validation on Node 22: root pnpm check and 316 focused tests covering build, dev, init, migration, and deploy.

Diff: 200 lines (+186 / -14) across 12 files Reviewer: petebacondarwin Review duration: 3783m
All Vouch review confidence checks passed
Residual risk 0.11 = Change Risk (0.65) × (1 − Review Confidence (0.84)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.65 · 200 lines diff across 12 files
0.65
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.90 · 5 substantive comment(s)
0.90
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
83%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.317
Self Review self_review
0.140
Real PR Conversation Timeline
11 items
ask-bonk[bot] ask-bonk[bot] commented on Nov 29, 2026 15:15 UTC
Bot

LGTM!

[github run](/cloudflare/cf/actions/runs/46277284018)

pkg-pr-new[bot] pkg-pr-new[bot] commented on Nov 29, 2026 15:15 UTC
Bot
github-actions[bot] github-actions[bot] commented on Nov 29, 2026 15:16 UTC
Bot

cf --help startup

| | mean | stddev | min | max |
| --- | --- | --- | --- | --- |
| PR | 179.1 ms | 2.6 ms | 174.9 ms | 185.7 ms |
| base | 179.5 ms | 2.3 ms | 175.5 ms | 183.8 ms |

Δ (PR vs base): — -0.4 ms (-0.2%)

_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._

<!-- Sticky Pull Request Commentcf-startup-bench -->

ask-bonk[bot] ask-bonk[bot] commented on Nov 29, 2026 15:43 UTC
Bot

LGTM!

[github run](/cloudflare/cf/actions/runs/46279874004)

ask-bonk[bot] ask-bonk[bot] commented on code on Dec 01, 2026 11:04 UTC
Code Review
packages/cli/src/commands/init/workers.ts:1
@@ -257,6 +258,7 @@ async function setUpExistingProject(
 					`Run ${theme.code("cf init")} in an empty directory, or pass a new directory name (for example, ${theme.code("cf init my-worker")}).`
 			);
 		}
+		assertCfBuildSupported(details);

cf migrate still bypasses this guard: commands/migrate/index.ts resolves a Wrangler config and calls runWranglerMigration() directly without analyzing the project or calling assertCfBuildSupported. Consequently, running cf migrate in an OpenNext project can still modify cloudflare.config.ts/package.json, contrary to the new requirement to reject before migration. Add the same preflight immediately after resolving the config path (analyze its directory, then call assertCfBuildSupported when detection succeeds) before bundler detection and runWranglerMigration, with coverage for the explicit command.

ask-bonk[bot] ask-bonk[bot] commented on Dec 01, 2026 11:04 UTC
Bot

Review: 1 findings.

Posted 1 inline finding.

[github run](/cloudflare/cf/actions/runs/46632078243)

petebacondarwin petebacondarwin commented on code on Dec 01, 2026 11:29 UTC
Code Review
packages/cli/src/__tests__/commands/dev/index.test.ts:1
@@ -40,24 +40,6 @@ describe("cf dev", () => {
 	const std = mockConsoleMethods();
 	afterEach(() => vi.restoreAllMocks());
 
-	it.each(["dev", "build"])(

Note this test was removed because the latest auto-config now supports hono

petebacondarwin petebacondarwin commented on code on Dec 01, 2026 11:39 UTC
Code Review
packages/cli/src/commands/init/workers.ts:1
@@ -257,6 +258,7 @@ async function setUpExistingProject(
 					`Run ${theme.code("cf init")} in an empty directory, or pass a new directory name (for example, ${theme.code("cf init my-worker")}).`
 			);
 		}
+		assertCfBuildSupported(details);

Fixed in add19f4df. cf migrate now analyzes the resolved Wrangler config directory and applies the OpenNext guard before bundler detection or migration. The regression test passes a nested config path and verifies the migration never runs. All 20 migration tests and pnpm check passed.

ask-bonk[bot] ask-bonk[bot] commented on Dec 01, 2026 15:29 UTC
Bot

LGTM

[github run](/cloudflare/cf/actions/runs/46678759888)

ask-bonk[bot] ask-bonk[bot] commented on Dec 01, 2026 16:39 UTC
Bot

LGTM

[github run](/cloudflare/cf/actions/runs/46692628674)

Assignees
petebacondarwin petebacondarwin
Labels
risk: low confidence: 83.6% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 64.8% (MEDIUM) · Higher = larger blast radius
64.8%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 83.6% · Lower = rushed or shallow review
83.6%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 10.7% · Safe to merge
10.7%
Repository