Skip to content

[autoconfig] Look for a static site only on cf - #17297

Closed
edmundhung wants to merge 4 commits into
mainfrom
autoconfig-static-site-cf-only
Closed

edmundhung wants to merge 4 commits into
mainfrom
autoconfig-static-site-cf-only

Conversation

@edmundhung

@edmundhung edmundhung commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Part of cloudflare/cf#804.

The hook findStaticSite was introduced in #17280. It was never designed and planned to be used by Wrangler but it runs regardless of the target. This simply restrict it to cf only so any logic added to findStaticSite wont impact wrangler. No changeset as the hook isn't released yet and is merged only a couple hours ago.


  • 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: the Cloudflare docs don't cover autoconfig's API

Devin Review

On Wrangler, frameworks keep their own setup, so detection no longer reads their settings for a static site. A framework that refuses settings it can't read safely then refuses only on cf.
@edmundhung edmundhung added the ci:no-changeset-required Skip pull request checks for a valid changeset label Nov 30, 2026
@changeset-bot

changeset-bot Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 89b47dd

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ask-bonk

ask-bonk Bot commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@devin-ai-integration devin-ai-integration Bot 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.

Devin Review found 1 potential issue.

Devin Review

@pkg-pr-new

pkg-pr-new Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
@cloudflare/autoconfig

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

@cloudflare/build-output-utils

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

@cloudflare/cli-shared-helpers

npm i https://pkg.pr.new/@cloudflare/cli-shared-helpers@17297

@cloudflare/codemods

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

@cloudflare/config

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

@cloudflare/containers-shared

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

create-cloudflare

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

@cloudflare/deploy-helpers

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-functions

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

@cloudflare/pages-shared

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

@cloudflare/runtime-types

npm i https://pkg.pr.new/@cloudflare/runtime-types@17297

@cloudflare/test-server

npm i https://pkg.pr.new/@cloudflare/test-server@17297

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-plugin

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

@cloudflare/workers-auth

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: abcfba5

@edmundhung
edmundhung marked this pull request as ready for review November 30, 2026 18:56
@workers-devprod
workers-devprod requested review from a team and penalosa and removed request for a team November 30, 2026 18:56
@workers-devprod

workers-devprod commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • packages/autoconfig/src/details/index.ts: [@cloudflare/wrangler]
  • packages/autoconfig/src/frameworks/framework-class.ts: [@cloudflare/wrangler]
  • packages/autoconfig/src/types.ts: [@cloudflare/wrangler]
  • packages/autoconfig/tests/details/confirm-auto-config-details.test.ts: [@cloudflare/wrangler]
  • packages/autoconfig/tests/details/get-details-for-auto-config.test.ts: [@cloudflare/wrangler]

@clanky-the-clanker clanky-the-clanker Bot 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.

Superseded by the review of 89b47ddf.

This review, of abcfba52

💬 Approved with comments — The guard is correct and nothing that reads staticSite breaks on Wrangler. The only note is optional: two of the three new guards have no test.

Findings: 1 info (1 is an inline comment on the diff)

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


📋 Code Quality: 💬 1 info

The change is correct and consistent with its callers. Two of the three new guards have no test.

Recommendation: 💬 Optional Nits

  • [INFO] No test checks the Vite native-fallback guard or the confirmAutoConfigDetails guard for target: "wrangler". (packages/autoconfig/src/details/index.ts:282)
View full review

On Wrangler, everything that reads staticSite still works:

  • run.ts already branches on target.
  • outputDir still falls back to the framework's dist and to findAssetsDir when staticSite is undefined.
  • The JSDoc changes in framework-class.ts and types.ts match the new behaviour.

The new test only covers the first guard. The Vite native-fallback guard and the guard in confirmAutoConfigDetails are not checked for the Wrangler target.


✅ All other checks passed

🔒 Security: ✅ LGTM

No security concerns in this change.


📝 Documentation: ✅ LGTM

The updated JSDoc matches the new behaviour.


Reviewed commit: abcfba52

framework = getFrameworkClassInstance("vite", target);
staticSite = framework.findStaticSite(projectPath);
staticSite =
target === "cf" ? framework.findStaticSite(projectPath) : undefined;

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.

ℹ️ INFO · Code Quality

No test checks the Vite native-fallback guard or the confirmAutoConfigDetails guard for target: "wrangler".

The new test only covers the first guard, at line 237, and only for a project that resolves to the static framework. This guard in the Vite native-fallback branch and the one in confirmAutoConfigDetails (around line 656) have no test for the Wrangler target. A small assertion that findStaticSite is not called, or that staticSite stays undefined, on those paths would catch a regression if someone drops one of the guards.

…ramework picker on Wrangler

The Vite fallback only runs on cf, so its check never applied. Changing the framework on Wrangler now has a test that findStaticSite isn't called.

@clanky-the-clanker clanky-the-clanker Bot 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.

✅ Approved — No issues found: the cf-only checks are correct, and the earlier note about missing tests has been covered by the new Wrangler tests.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🔒 Security: ✅ LGTM

The change narrows when the code reads framework settings for a static site. It adds or loosens no checks and no input handling.


📋 Code Quality: ✅ LGTM

  • Vite fallback: canInspectViteProject returns false when target !== "cf", so the fallback only runs on cf and needs no check of its own.
  • confirmAutoConfigDetails: the new Wrangler test asserts findStaticSite is not called.
  • getDetailsForAutoConfig: the Hugo test asserts the same for target: "wrangler", and that the cf result includes staticSite.
  • JSDoc: the updates in framework-class.ts and types.ts match the new behaviour.

📝 Documentation: ✅ LGTM

The updated JSDoc matches the new cf-only behaviour.


Reviewed commit: 89b47ddf

@edmundhung

Copy link
Copy Markdown
Member Author

Closing as #17288 resolves it in a different way already.

@edmundhung edmundhung closed this Nov 30, 2026
@github-project-automation github-project-automation Bot moved this from Untriaged to Done in workers-sdk Nov 30, 2026
@edmundhung
edmundhung deleted the autoconfig-static-site-cf-only branch November 30, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:no-changeset-required Skip pull request checks for a valid changeset

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants