LTRAC-1498: Bind CATALYST_ROUTES_KV namespace in Wrangler config - #3169
Draft
jorgemoya wants to merge 1 commit into
Draft
LTRAC-1498: Bind CATALYST_ROUTES_KV namespace in Wrangler config#3169jorgemoya wants to merge 1 commit into
jorgemoya wants to merge 1 commit into
Conversation
… config Add a kv_namespaces entry for CATALYST_ROUTES_KV to the generated Wrangler config so the routing cache in core's with-routes proxy has a shared store on Native Hosting rather than falling back to a per-invocation memory cache. The namespace id here is a local-only placeholder. The generated config only drives `wrangler dev`/`catalyst start` and the `wrangler deploy --dry-run` bundling step, neither of which resolves bindings against the Cloudflare API; Ignition binds the real per-project namespace at upload time. The value is deliberately not 32-char lowercase hex -- the only shape a provisioned namespace id can take -- so a local build cannot reach a production store's cache even by accident. It fails closed instead. Also extends the "keep in sync with Ignition" header comment to cover the new binding, and notes that only the binding *name* is shared across the two. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: d948768 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Bundle Size ReportComparing against baseline from No bundle size changes detected. |
Contributor
Unlighthouse Performance Comparison — VercelComparing PR preview deployment Unlighthouse scores vs production Unlighthouse scores. Summary ScoreAggregate score across all categories as reported by Unlighthouse.
Category Scores
Core Web Vitals
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linear: LTRAC-1498
Parent: LTRAC-1019
What/Why?
On BigCommerce Native Hosting,
proxies/with-routescurrently has no shared cache —createKVAdapterfinds neither Vercel Runtime Cache nor Upstash, so it falls back toMemoryKvAdapter, an in-process LRU that isn't shared across edge invocations. Every project is getting its own Cloudflare KV namespace to fix that; this PR is the CLI half, adding theCATALYST_ROUTES_KVbinding to the generated Wrangler config so local dev matches what ships.This file already carries a "keep in sync with Ignition's
metadata.go" contract, and that comment is extended to cover the new binding — with one clarification worth reading, because it's the part most likely to be misunderstood: only the binding name is shared with Ignition. The namespace id here is a local-only placeholder; Ignition overwrites it with the real per-project namespace it provisioned when it uploads the Worker.The placeholder is
catalyst-routes-kv-local, and its shape is deliberate. A real Cloudflare namespace id is always a 32-character lowercase hex string, so this value cannot be mistaken for one. If this config were ever pointed at the live API, the request fails closed with an invalid-id error rather than silently reading or writing a real store's routing cache. Locally it's just a key prefix for Miniflare's simulated store under.wrangler/state/v3/kv, and thewrangler deploy --dry-runbundling step never resolves bindings against the API at all.No
varsentry is needed — isolation in this design is structural (a Worker can only reach namespaces bound to it), so there's no scope or secret value to inject.The runtime adapter that actually reads this binding ships separately in LTRAC-1499. Until that lands, the binding is present and simply unread, which is harmless — and it means this PR can merge on its own without changing any runtime behaviour.
Testing
Covers the binding being emitted with the expected name, and the placeholder id being distinguishable from a real Cloudflare namespace id.
To check by hand: run
catalyst buildon a project and inspect the generatedcore/.bigcommerce/wrangler.jsoncfor thekv_namespacesentry, thencatalyst startand confirm Miniflare creates the local store undercore/.wrangler/state/v3/kv.Migration
None. Purely additive to generated config — no existing files move, no breaking changes, and no action required from anyone rebasing. A
patchchangeset is included.