Skip to content

Tolerate previews of Workers that cannot have preview URLs - #39

Merged
2xburnt merged 3 commits into
mainfrom
work/2xburnt/preview-url-fallback-20260822T034221Z
Aug 22, 2026
Merged

Tolerate previews of Workers that cannot have preview URLs#39
2xburnt merged 3 commits into
mainfrom
work/2xburnt/preview-url-fallback-20260822T034221Z

Conversation

@2xburnt

@2xburnt 2xburnt commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Problem

cloudflare-version.yml's metadata step requires a deployment URL for every operation. For operation: preview that URL comes from wrangler's output — but Cloudflare never generates preview URLs for Workers that implement a Durable Object, Containers included. versions upload succeeds (Version ID and all), no URL is printed, and the step fails with "Cloudflare output did not contain version metadata" — so cloudflare-pr.yml is unusable for any DO/Container consumer.

First hit in the wild: burnt-labs/ai-gateway#9, whose Worker hosts two Container classes.

Change

  • A preview that yields no preview URL falls back to the target URL and sets a new preview-note output explaining that Cloudflare issues no preview URLs for Durable Object Workers and the version sits at 0% traffic.
  • The note flows through the workflow-call outputs into the cloudflare-pr.yml sticky comment and the step summary, so the fallback link is never mistaken for an isolated preview.
  • Deploy operations are unchanged; a missing Version ID still fails the step.

Verification

  • pnpm lint (prettier), pnpm test (82 pass, including a new regression test asserting the fallback, the output plumbing, and the PR-comment wiring), and actionlint all clean.

Cloudflare never generates preview URLs for Workers that implement a
Durable Object, Containers included — `versions upload` succeeds with
a Version ID and no URL. The metadata step treated the missing URL as
missing metadata and failed the whole preview, which makes cloudflare-pr
unusable for any DO/Container consumer (first hit: burnt-labs/ai-gateway
PR #9, whose Worker hosts two Container classes).

A preview with no URL now falls back to the target URL and carries an
explanatory note: a new preview-note output travels through
cloudflare-version.yml to the PR comment and the step summary, so the
link is never mistaken for an isolated preview. Deploys are unchanged,
and a missing Version ID still fails.
Copilot AI lite review requested due to automatic review settings August 22, 2026 03:44

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

2xburnt has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Cloudflare reusable workflow stack to handle operation: preview runs where Wrangler succeeds but emits no preview URL (notably for Durable Object / Container Workers), ensuring previews don’t fail and callers can communicate the fallback clearly.

Changes:

  • Add a preview-note workflow output and propagate it through cloudflare-version.ymlcloudflare-pr.yml so PR comments/summaries can explain when a preview URL is unavailable.
  • Update the metadata extraction logic in cloudflare-version.yml to fall back to the target URL for previews that produce no preview URL, while keeping deploy behavior strict.
  • Add a regression test asserting the fallback behavior and output plumbing.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/workflows.test.mjs Adds a regression test to assert the preview-URL-missing fallback and that preview-note is wired through to cloudflare-pr.yml.
.github/workflows/cloudflare-version.yml Implements preview URL fallback behavior and adds a new preview-note output (plus step summary surfacing).
.github/workflows/cloudflare-pr.yml Threads preview-note into the sticky PR comment content.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 83 to 87
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
PREVIEW_URL: ${{ needs.preview-candidate.outputs.deployment-url }}
PREVIEW_NOTE: ${{ needs.preview-candidate.outputs.preview-note }}
RELEASE_PREFIX: ${{ fromJSON(needs.quality.outputs.deployment-policy).releasePrefix }}
Copilot AI review requested due to automatic review settings August 22, 2026 12:44

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

2xburnt has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

2xburnt has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings August 22, 2026 12:46
@2xburnt
2xburnt marked this pull request as ready for review August 22, 2026 12:47
@2xburnt
2xburnt requested a review from a team August 22, 2026 12:47

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

2xburnt has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@2xburnt
2xburnt merged commit e80433b into main Aug 22, 2026
3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a5ca8e0d6c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +255 to +256
DEPLOYMENT_URL="$TARGET_URL"
PREVIEW_NOTE="no preview URL: Cloudflare does not generate them for Durable Object Workers; the version is uploaded at 0% traffic and the URL above is the live target"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Propagate fallback notes to main-flow release notes

When a Durable Object consumer runs cloudflare-main.yml, both the single-topology deploy-candidate preview and the default preview-release job can take this fallback, but only cloudflare-pr.yml consumes preview-note. The create-releases step at lines 131-143 therefore records the live target URL as either “Candidate deployment” or “Release preview” without the warning, making the generated release notes claim that a 0%-traffic version is reachable there. Pass preview-note into create-releases and surface it or relabel the fallback URL.

AGENTS.md reference: AGENTS.md:L615-L628

Useful? React with 👍 / 👎.

jobs:
quality:
uses: burnt-labs/github-workflows/.github/workflows/required-quality.yml@46ae18b0f5ff1735e07601e41a6044b358379853 # v1.4.0
uses: burnt-labs/github-workflows/.github/workflows/required-quality.yml@ffc9220f81438c2537163f041f117d3097738fed # v1.4.1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Split the internal pin advance into its own commit

This commit combines the preview implementation and its regression test with repository-wide updates from v1.4.0 to ffc9220f..., so the implementation and pin transition cannot be reviewed or reverted independently. Move the uses: and checkout ref: changes into the explicitly required separate pin-advance commit.

AGENTS.md reference: AGENTS.md:L683-L688

Useful? React with 👍 / 👎.

Comment on lines +48 to +49
preview-note:
value: ${{ jobs.version.outputs.preview-note }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Sign this commit before merging

The raw object for c4996ee8cb5ef710a2adea3021817d04b9b174f4 contains no gpgsig header, so this proposed commit is unsigned and violates the repository's mandatory signing invariant. Recreate the commit with a valid signature before it is merged.

AGENTS.md reference: AGENTS.md:L52-L56

Useful? React with 👍 / 👎.

# GitHub Environment and the PR comment point somewhere real,
# and carry a note so nobody mistakes it for the preview.
DEPLOYMENT_URL="$TARGET_URL"
PREVIEW_NOTE="no preview URL: Cloudflare does not generate them for Durable Object Workers; the version is uploaded at 0% traffic and the URL above is the live target"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid attributing every missing URL to Durable Objects

A preview can lack a URL simply because the consumer has preview_urls disabled, even when its Worker has no Durable Objects. In that configuration this fallback still runs, but the PR comment and job summary falsely state that Cloudflare withheld the URL because this is a Durable Object Worker. Use a reason-neutral note unless the workflow can actually distinguish the Worker limitation from disabled preview URLs.

AGENTS.md reference: AGENTS.md:L620-L624

Useful? React with 👍 / 👎.

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