Skip to content

fix: emulate Span#setStatus and Span#updateName as no-op in local Cloudflare emulation - #17400

Open
BastiDood wants to merge 1 commit into
sveltejs:mainfrom
BastiDood:cloudflare-span-set-status
Open

BastiDood wants to merge 1 commit into
sveltejs:mainfrom
BastiDood:cloudflare-span-set-status

Conversation

@BastiDood

Copy link
Copy Markdown
Contributor

This PR updates the local Cloudflare emulation to now shim Span#setStatus and Span#updateName (first introduced in @cloudflare/workers-types@5.20260925.1) as no-op methods.

  • Adds a simple return this shim to both setStatus and updateName.
  • Bumps all relevant lockfiles to now use @cloudflare/workers-types@5.20260925.1 so that there are no duplicated versions. I could've bumped the version much higher, but I think it's good to use the minimally sufficient version here for maximum compatibility.

Ran into this crash during local development in one of my projects, but it does work in the production deployment with Cloudflare Workers. I guess they just haven't updated the docs yet, but setStatus is indeed available now.


Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

@pkg-svelte-dev

pkg-svelte-dev Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from 260ec14:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/260ec14126141bc72074a2cb738c7c041d1f8221

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/kit/pr/17400

Note

This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed.

@changeset-bot

changeset-bot Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 260ec14

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/adapter-cloudflare Patch

Not sure what this means? Click here to learn what changesets are.

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

@teemingc teemingc added pkg:adapter-cloudflare needs-platform-tests This PR needs to run platform tests in order to merge. labels Oct 12, 2026

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

This is good but the tests aren't really testing anything; maybe we need a type checking test that pulls the latest @cloudflare/workers-types to check compatibility with their interfaces.

@BastiDood
BastiDood force-pushed the cloudflare-span-set-status branch from ff6b84e to 260ec14 Compare October 12, 2026 08:42
@BastiDood

BastiDood commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Fair enough, thanks for the feedback @ottomated! I decided to just scrap those test cases altogether. The types are already checked in CI by TypeScript anyway thanks to the @type {Module['tracing']} annotation.

As far as the automated "check if the latest @cloudflare/workers-types work" go, is it alright if we defer that work to a separate infrastructure PR than this bugfix PR?

  • Do you also have ideas on how we can best implement that? At the moment, the correctness of the shim is at the mercy of ^-compatibility in semver. When anything new gets added, we'd have to manually bump our lockfile. (A conservative alternative is to use =-compatibility, but at the expense of over-constraining capabilities.)
  • And also, where should we typically put infrastructure automations like that? I'd imagine running an ad-hoc pnpm install @cloudflare/workers-types@latest in the sveltejs/kit repo probably isn't the right way to go about it. (Correct me if I'm wrong, though!)

@BastiDood
BastiDood requested a review from ottomated October 12, 2026 08:44

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-platform-tests This PR needs to run platform tests in order to merge. pkg:adapter-cloudflare

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants