Skip to content

Add Cloudflare Actions build regression coverage - #17137

Merged
alexanderniebuhr merged 4 commits into
withastro:mainfrom
swaggysnippets:cloudflare-actions-build-regression
Aug 7, 2026
Merged

alexanderniebuhr merged 4 commits into
withastro:mainfrom
swaggysnippets:cloudflare-actions-build-regression

Conversation

@swaggysnippets

Copy link
Copy Markdown
Contributor

What changed

  • adds a Cloudflare fixture with an Astro Action
  • verifies two consecutive builds succeed while reusing the warm Vite dependency cache
  • removes the broad three-attempt fixture build retry that masked stale prebundle failures

Why

Astro issue #16933 reported Cloudflare builds failing when src/actions/index.ts was present because dependency optimization could observe a stale prebundle. The runtime startup change in #16961 addressed the production failure; this PR adds deterministic regression coverage so that behavior remains protected and optimizer races fail visibly instead of being hidden by retries.

Validation

  • Cloudflare integration build passes
  • optimizer-sensitive test subset: 11 passed
  • full Cloudflare adapter suite: 263 passed, 1 skipped, 0 failed
  • Biome and Prettier checks pass
  • lockfile frozen install check passes

@changeset-bot

changeset-bot Bot commented Jun 21, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f7f3caa

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

@github-actions github-actions Bot added the pkg: integration Related to any renderer integration (scope) label Jun 21, 2026
@swaggysnippets
swaggysnippets marked this pull request as ready for review June 21, 2026 17:33

@fkatsuhiro fkatsuhiro 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.

@swaggysnippets san
Thank you for your PR!
But it seems there aren't changeset file. Could you add in this PR? To explain user what we changed. Thank you.

@fkatsuhiro

Copy link
Copy Markdown
Contributor

@swaggysnippets san Thank you for your PR! But it seems there aren't changeset file. Could you add in this PR? To explain user what we changed. Thank you.

Oh, sorry. This PR for improve testing. I approgise my missunderstanding...

@alexanderniebuhr

Copy link
Copy Markdown
Member

@swaggysnippets thanks for your PR, which discovered a real missing test. However I have reviewed it and found that it doesn't technically solves your described gap. I still want to use this PR to get this merged, so I updated the branch for you.

What changed

  • Restored buildWithRetry in test-utils.ts (byte-identical to main). The stale-prebundle race it guards was never root-caused or fixed — Build fails when using src/actions/index.ts #16933 was closed "unable to fix" — and all 49 Cloudflare test files run serially in one process with no CI-level retry, so deleting it just converts a known flake into red 30-minute CI legs.
  • Deleted the actions-build fixture, its test, and its lockfile entry — it provided no coverage (details below) and duplicated existing fixtures (sessions already builds Actions on workerd; prerender-node-env already covers Actions with prerenderEnvironment: 'node').
  • Added typegen-phase.test.ts: it invokes the adapter's astro:config:setup hook directly for build, sync, and dev, and asserts the two things Skip Cloudflare runtime startup during type generation #16961 actually changed — during build/sync the Cloudflare Vite plugins have configureServer stripped (no workerd boot during type generation) and configEnvironment returns { optimizeDeps: { noDiscovery: true, include: [] } } for every environment; in dev both stay enabled and the include list still prebundles the Actions server entrypoints. Six tests, ~6 ms, no build, no server, no flake.

The actions-build fixture test could not fail when the withastro#16961 guard was
reverted: it pinned prerenderEnvironment 'node' (skipping the default
workerd prerender path), its second build was a pure optimizer cache hit
rather than a stale-cache scenario, and its assertions never touched
Actions output. Replace it with a unit test that invokes the adapter's
astro:config:setup hook directly and asserts both observable effects of
the isTypeGenPhase guard: configureServer is stripped from the
Cloudflare Vite plugins and dependency discovery is disabled for every
environment during build/sync, while dev keeps both. Verified the new
test fails when the guard is neutered to sync-only or removed.

Restore buildWithRetry: the stale-prebundle race it guards (withastro#14821) was
never root-caused or fixed, and the suite runs all 49 files serially in
one process with no CI-level retry to absorb a flake.
@alexanderniebuhr
alexanderniebuhr force-pushed the cloudflare-actions-build-regression branch from 79a5906 to f7f3caa Compare August 7, 2026 16:57
@alexanderniebuhr
alexanderniebuhr merged commit 7c4bf1b into withastro:main Aug 7, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: integration Related to any renderer integration (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants