Skip to content

[wrangler] Reuse a shared KV namespace in remote-bindings E2E tests - #16910

Merged
edmundhung merged 2 commits into
mainfrom
edmundhung/remote-bindings-e2e-shared-kv
Nov 16, 2026
Merged

edmundhung merged 2 commits into
mainfrom
edmundhung/remote-bindings-e2e-shared-kv

Conversation

@edmundhung

Copy link
Copy Markdown
Member

The getPlatformProxy() remote-bindings E2E suite created a fresh KV namespace in beforeAll and wrote a test key to it. A brand-new namespace sometimes rejects writes with namespace not found [code: 10013] for longer than setup waits, which fails the whole suite (example). The retry added in #16873 hasn't been enough. This is the most common failure of the step in recent Wrangler E2E runs, on every OS.

The suite now looks up a shared preserve-e2e-get-platform-proxy-kv namespace and creates it only if it's missing. That's how it already handles its preserve-e2e-* target Workers. The key is only written when it's missing, so normal runs neither create nor write anything. Concurrent runs can't interfere, because the tests only read it. The preserve-e2e- prefix keeps the scheduled cleanup away from it.

This also spaces out test retries (2 retries, 15s apart). The preview API (edge-preview) outages seen in the same job lasted 40s or more, longer than the current retries cover.


  • 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: test-only change

Setup created a fresh KV namespace on every run and wrote a test key to it.
Brand-new namespaces sometimes reject writes with "namespace not found" for
longer than setup waited, which fails the whole suite. That is the most
common failure of this step in recent Wrangler E2E runs, on every OS.

Look up a shared `preserve-e2e-get-platform-proxy-kv` namespace instead and
create it only if it is missing, the same way the suite already handles its
target Workers. The key is only written when it is missing, so normal runs
never create or write anything. Also space out test retries so they outlast
longer preview API outages.
@edmundhung edmundhung added ci:no-changeset-required Skip pull request checks for a valid changeset ci:run-remote-tests Run remote/E2E tests that require Cloudflare API credentials labels Nov 13, 2026
@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Nov 13, 2026
@changeset-bot

changeset-bot Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 7196cd3

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 13, 2026

Copy link
Copy Markdown
Contributor

LGTM!

github run

@pkg-pr-new

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

Copy link
Copy Markdown
@cloudflare/autoconfig

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

@cloudflare/build-output-utils

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

@cloudflare/codemods

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

@cloudflare/config

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

@cloudflare/containers-shared

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

create-cloudflare

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

@cloudflare/deploy-helpers

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-functions

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

@cloudflare/pages-shared

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

@cloudflare/runtime-types

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-plugin

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

@cloudflare/workers-auth

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: 7196cd3

@edmundhung
edmundhung marked this pull request as ready for review November 14, 2026 21:42
@workers-devprod
workers-devprod requested review from a team and petebacondarwin and removed request for a team November 14, 2026 21:42
@workers-devprod

workers-devprod commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@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: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@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 7196cd3d.

This review, of 931ff76f

💬 Approved with comments — Test-only change with no correctness problems. Two INFO notes point out comments that describe the cleanup and the missing-key read inaccurately.

Findings: 2 info (2 are inline comments 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

One misleading doc comment in the readKvValue helper.

Recommendation: 💬 Optional Nits

  • [INFO] readKvValue doc comment describes a "Value not found" read that only happens in local mode (fixtures/get-platform-proxy-remote-bindings/tests/index.test.ts:388)
View full review
  • readKvValue's doc comment says a missing key reads as Wrangler's "Value not found" message. That message is only logged in local mode (packages/wrangler/src/kv/index.ts:774). With --remote, a missing key makes the command throw, so the helper returns undefined. The !== remoteKvValue check is correct either way.

📝 Documentation: 💬 1 info

The new comment misstates why the shared namespace survives the scheduled cleanup.

Recommendation: 💬 Optional Nits

  • [INFO] Comment misattributes why the shared KV namespace is skipped by the scheduled cleanup (fixtures/get-platform-proxy-remote-bindings/tests/index.test.ts:30)
View full review
  • The comment says the preserve-e2e- prefix keeps the namespace out of the scheduled cleanup. KV cleanup actually selects titles that contain tmp-e2e or tmp_e2e (tools/e2e/common.ts, listTmpKVNamespaces), so the namespace is safe because its title doesn't match, not because of the prefix.

✅ All other checks passed

🔒 Security: ✅ LGTM

No security concerns in this test-only change.


📖 AGENTS.md: ✅ LGTM

No repository guidance is affected.


⚡ Performance: ✅ LGTM

Normal runs no longer create, write to or delete a namespace. They make one list call and one read call instead.


Reviewed commit: 931ff76f

@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 with comments — Test-only change with no correctness problems. One INFO note remains: a comment gives the wrong reason the shared KV namespace survives the scheduled cleanup.

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.


📝 Documentation: 💬 1 info

One comment gives the wrong reason the shared namespace survives cleanup.

Recommendation: 💬 Optional Nits

  • [INFO] The comment says the preserve-e2e- prefix keeps the shared KV namespace out of cleanup, but KV cleanup only matches tmp-e2e/tmp_e2e titles (fixtures/get-platform-proxy-remote-bindings/tests/index.test.ts:30)
View full review
  • tests/index.test.ts:29-32: the comment says the preserve-e2e- prefix keeps the namespace out of the scheduled cleanup. KV cleanup (tools/e2e/common.ts, listTmpKVNamespaces) only selects titles that contain tmp-e2e or tmp_e2e. The preserve-e2e- prefix check applies only to Workers.

✅ All other checks passed

🔒 Security: ✅ LGTM

No security concerns.


📖 AGENTS.md: ✅ LGTM

No issues.


📋 Code Quality: ✅ LGTM

The readKvValue doc comment now says the helper returns undefined when the key is missing or the read fails, which matches the code. The retry settings in vitest.config.e2e.mts (2 retries, 15s apart) match the description.


⚡ Performance: ✅ LGTM

A normal run now makes one kv namespace list call and one kv key get call. The write fallback is bounded by vi.waitFor (45s). The new retry delay only applies when a test fails.


Reviewed commit: 7196cd3d

@workers-devprod workers-devprod 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.

Codeowners reviews satisfied

@edmundhung
edmundhung merged commit 10a6039 into main Nov 16, 2026
100 of 101 checks passed
@edmundhung
edmundhung deleted the edmundhung/remote-bindings-e2e-shared-kv branch November 16, 2026 12:56
@github-project-automation github-project-automation Bot moved this from Untriaged to Done in workers-sdk Nov 16, 2026
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 ci:run-remote-tests Run remote/E2E tests that require Cloudflare API credentials

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants