Skip to content

refactor(server): delete the KV read-through cache and its binding - #107

Merged
sydevs-bot merged 8 commits into
mainfrom
claude/refactor-98-drop-kv-cache
Sep 18, 2026
Merged

sydevs-bot merged 8 commits into
mainfrom
claude/refactor-98-drop-kv-cache

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • The KV cache is gone entirely. server/kv-cache.ts, the WEMEDITATE_CACHE binding, AtlasCacheTTL and CacheTTL are deleted. This Worker now holds no persistent state at all.
  • Every CMS and atlas read goes through the Cloudflare edge in front of SahajCloud, which caches for 600s and purges on write — the one cache in the system with an invalidation path.
  • withCache also supplied the retry. Every read it wrapped keeps it, so the removal costs no resilience.

Changes

  • server/cms-client.ts, server/content-index.ts — collection and global reads drop withCache/generateCacheKey/CacheTTL. Public reads go through withRetryUnlessPreview, which is withRetry for a public read and a bare call for a preview one; getPageLocaleStatus keeps its single attempt.
  • server/atlas-client.ts — getAtlasSeo and getAtlasSitemapUrls call withRetry directly. AtlasCacheTTL is gone with the cache it configured.
  • server/sitemap-routes.ts — getContentSitemapUrls likewise, and SITEMAP_DOCS_TTL with it.
  • server/kv-cache.ts, wrangler.toml, server/cms-context.ts, types/vike.d.ts — the module, the binding, CmsContext.kv and the pageContext.cloudflare type all deleted.
  • server/CACHING.md, AGENTS.md, server/AGENTS.md, docs/rules/rest-api.md — the edge is the only cache, and a read that degrades silently still needs withRetry.

Acceptance criteria

# Criterion State
1 No CMS or atlas read under server/ goes through KV ✓
2 grep -rn "WEMEDITATE_CACHE" . finds nothing outside the changelog ✓ (nothing outside CACHING.md, which records the removal)
3 A wm-web-config edit is visible within the edge TTL needs the preview check below
4 The three ported reads keep a retry, with a test that pins it ✓
5 pnpm typecheck and pnpm test:run pass; CACHING.md describes the edge as the only cache ✓

Preview

https://claude-refactor-98-drop-kv-cache-wemeditate-web.contact-c66.workers.dev

Test results

  • Lean gate: ✓ pnpm lint (0 errors), tsc --noEmit, pnpm test:run 646 passed
  • Build: ✓ pnpm build (the binding's removal does not break the Worker bundle)
  • Each retry test was watched failing with its withRetry call removed, then passing with it restored

Manual verification

  1. Request an atlas region route and /sitemap.xml on the preview, and confirm both still render with their content. These two lose their KV layer last. A 404, or a sitemap with no /map/ rows and no page rows, is how that removal fails.
  2. Confirm the starts_with "/api/globals/" term is live on the "Client read edge cache (Vary: Authorization)" Cache Rule. SahajCloud's DEPLOYMENT.md §"Globals are cacheable reads too (#710)" records that it is needed; only the dashboard proves it is there. Without it the two globals lose all caching rather than gaining a shorter window.
  3. Confirm CLOUDFLARE_ZONE_ID and CLOUDFLARE_CACHE_PURGE_TOKEN are set on SahajCloud's Railway production service. Unset, every tag purge is a silent no-op and 600s is the only bound on a stale read. The docs here say 600s rather than "immediate", so this confirmation improves the guarantee instead of rescuing it.
  4. Request a page twice on the preview and confirm cf-cache-status: HIT on the CMS subrequest, then edit that document in SahajCloud and confirm a third request reflects it (acceptance criterion 3).
  5. Open a live preview of a page and confirm a draft still renders, and that a failing preview read errors immediately rather than after ~7s.

Notes for reviewer

One cost the ticket's table does not name. A KV hit used to skip the retry. Now every request can spend it, so during an upstream outage /sitemap.xml and an atlas route hold a Worker request for ~7s instead of serving a stale copy, on every request rather than once per TTL. The edge absorbs the repeat once a response is cacheable, but an outage produces no cacheable response. This follows from the decision rather than questioning it — flagging it because it is the one property that got worse, and the accepted-cost table only covers staleness windows.

/api/user-choices is not in the Cache Rule, so one content-index block reads uncached. Filed upstream as sydevs/SahajCloud#804, which asks for the one eq term or a recorded decision that the path stays DYNAMIC. SahajCloud's DEPLOYMENT.md names user-choices as the deliberate exclusion from the rule's slug list, and a meditations content-index block resolves to GET /api/user-choices?… (ContentIndexBlock.ts's CONTENT_TYPE_CONFIG), so that read loses its 30-minute KV entry and gains nothing. #98's body is corrected to match.

Dismissed review findings:

  • Fold the preview branch into withRetry({ maxAttempts: 1 }) so a failed preview read reaches Sentry. Skipped — it adds Sentry events for errors an editor is already looking at, which is a behaviour change this ticket did not ask for.
  • Add an intra-request memo so two content-index blocks sharing an endpoint fetch once. Skipped — real but narrow (it needs two identical blocks on one page), and the edge now absorbs the repeat.
  • Cap maxAttempts at 2 for the readers that degrade to []. Skipped — same ladder as before, only reached more often; changing it is a separate tuning decision.

Filed on the way: #108 — loadSiteContext's per-request memo is keyed on Vike's pageContext, which is a fresh Proxy per hook, so it misses between data() and onBeforeRender(). Pre-existing, and this branch makes each miss a subrequest instead of a KV hit.

Detail

Why the edge covers these reads. Verified against sydevs/SahajCloud at 07e3e40, not assumed:

  • src/plugins/cache/policy.ts — CACHE_TTLS.collections covers pages, meditations, lectures, songs, albums, images, app-cards, regions, audiences, events; CACHE_TTLS.globals covers wm-web-config and wm-web-translations at 600s.
  • DEPLOYMENT.md §"Edge Cache" — the live rule matches /api/<slug> and /api/<slug>/…, which is what covers the nested custom endpoints this repo reads: /api/meditations/:id/songs, /api/lectures/:id/related-meditations, /api/meditations/:id/related-lectures, /api/lectures/for-audience. Each of those handlers emits publicReadCacheHeaders upstream, so they carry a real s-maxage and Cache-Tag.

What bounds staleness. s-maxage=600, and nothing else this repo can assert. SahajCloud purges the Cache-Tag on write only when CLOUDFLARE_ZONE_ID and CLOUDFLARE_CACHE_PURGE_TOKEN are set; unset, the purge is a silent no-op (DEPLOYMENT.md §Edge Cache). Every doc here quotes 600s as the worst case and names the purge as what only shortens it.

Every window the removal touched, and its direction. A region 3600s → 600s, a class 900s → 600s, the atlas sitemap 3600s → 600s, the content sitemap 1800s → 600s, CMS collections and globals 30min–24h → 600s. None lengthens.

What the retry preserves. withCache ran withRetry(fetchFn, { maxAttempts: 3, baseDelayMs: 1000 }) on a miss and skipped it entirely under bypassCache. withRetry's own defaults are identical, so each ported read is byte-equivalent to the old miss path. getAtlasSeo's 404 branch returns rather than throws, so a dead atlas route still costs one read instead of three — pinned by a test.

Why the retry matters most here. All three ported reads degrade silently: getAtlasSeo to null, both sitemap halves to [], each inside a response that still answers 200. Dropping the retry with the cache would have turned one upstream blip into an atlas page missing its server-rendered half, or a sitemap missing a whole section, with nothing in the output to say so.

The two ⚠ notes went with the code they annotated. Both described KV behaviour alone — a stored null reading back as a miss in getAtlasSeo, and the content-sitemap-docs key prefix guarding against a shape change in getCachedResponse. Neither has a referent now that kv-cache.ts is deleted.

Security review: run (the diff touches ^server/ and ^wrangler.toml). No findings. The change is purely subtractive on the credential path: cache keys never encoded the API key, getWebConfig never sent preview credentials or draft, and removing the binding narrows what the Worker can reach rather than widening it. No preview-scoped read was reachable from a cached path.

Closes #98

🤖 Written by the sydevs autonomous loop — see what this is

The KV layer was the only cache in the system with no invalidation path.
SahajCloud purges the Cloudflare edge by `Cache-Tag` on every write, but a
tag purge cannot reach another Worker's KV, so an edit to `wm-web-config`
or `wm-web-translations` could serve the old value here for a full day
(`CacheTTL.SETTINGS` was 86400).

A Worker subrequest to `cloud.sydevelopers.com` reads through that zone's
cache, and every slug these functions read is covered by the Cache Rule
(SahajCloud#555/#526 for the collections, #710 for the globals). So the
reads keep a cache — one an editor's save can reach. The accepted cost is
a Railway round trip every 600s per colo instead of once per TTL globally.

`withCache` also supplied the retry, which nothing in the ticket replaces.
`readCms` keeps it: `withRetry` for a public read, a bare call for a
preview read, which must fail fast rather than make an editor wait through
~7s of backoff. Two tests pin that split, since the only thing that used to
encode it was the `bypassCache` flag.

`content-index.ts` needs no retry wrapper — `fetchContentIndexDocs` already
degrades to `[]` on every failure, so nothing ever threw past it. Its
`preview` option existed only to bypass KV and no caller passed it.

Refs #98

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WVj9t7DQ59MW3eqKEJisCC
`server/CACHING.md` was the document that explained the KV layer, so it is
the deliverable of #98, not an afterthought. It now leads with the edge
cache and its purge-on-write, and names the three reads still on KV —
`getAtlasSeo`, `getAtlasSitemapUrls`, `getContentSitemapUrls` — with the
warning that nothing invalidates them.

`kv-cache.ts` keeps only `CacheTTL.LIST`, the one constant a remaining
caller uses, and its examples name atlas keys instead of the page keys it
no longer writes.

`docs/rules/rest-api.md` showed every new query function a `withCache`
wrapper to copy. It now shows `readCms`, and says there is no cache key,
TTL or purge step to add. `docs/local-environment.md` told a reader to wait
out a 24 h TTL for a globals edit; that window is now 600s and a write
purges it.

Refs #98

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WVj9t7DQ59MW3eqKEJisCC
`/simplify` findings, applied.

`withCache` kept `bypassCache` and `retryConfig` for callers that no longer
exist — the three remaining ones pass `cacheKey`, `ttl` and `fetchFn` only.
Both options go, along with the local `DEFAULT_RETRY_CONFIG` that duplicated
`error-utils.ts`'s identical defaults. `generateCacheKey` loses its array
branch for the same reason, which also removes the in-place `value.sort()`
that `getRelatedLectures` had to guard against.

`CacheTTL` was down to one member used by one caller, so the number moves to
`sitemap-routes.ts` as `SITEMAP_DOCS_TTL`.

`resolveContentIndex` had become a pass-through repeating a guard
`fetchContentIndexDocs` already does, so its two callers now fetch and
transform directly.

`getWebConfig`'s `preview` flag was vestigial. Its inner client is a bare
`createPayloadClient()` — no preview credentials — so the flag never changed
the request. It existed to bypass a 24 h KV entry, and with that gone its
only remaining effect was silently disabling retry for a preview render.

Stale KV claims corrected where the branch's reads used to be cached:
`api-routes.ts` said the related-content endpoints were "not cached
upstream" — SahajCloud marks them edge-cacheable with
`publicReadCacheHeaders` — and `sitemap-routes.ts`, `pages/[slug]/+data.ts`
and `pages/lectures/[id]/_lecture.ts` each described a KV entry that is now
an edge entry. The "do not add a KV caller" warning is stated once, in
`CACHING.md`, with the other three surfaces linking to it.

Refs #98

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WVj9t7DQ59MW3eqKEJisCC
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Deploying wemeditate-design with  Cloudflare Pages  Cloudflare Pages

Latest commit: afb2a77
Status: ✅  Deploy successful!
Preview URL: https://0dff73e4.wm-design.pages.dev
Branch Preview URL: https://claude-refactor-98-drop-kv-c.wm-design.pages.dev

View logs

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
wemeditate-web afb2a77 Commit Preview URL

Branch Preview URL
Sep 18 2026, 12:44 AM

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Sep 16, 2026
@sydevs-bot

sydevs-bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

recent dispatches
  • 00:33Z address-review · attempt 1 · session · done
  • 00:33Z address-review · attempt 1 · session
  • 00:49Z address-review · attempt 1 · session · done
  • 00:49Z address-review · attempt 1 · session
  • 23:17Z address-review · attempt 1 · session · done

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🧐 Adversarial review

A clean removal, honest about its gap, no refactor smuggled in. The whole benefit rests on two dashboard facts neither repo can assert — the starts_with "/api/globals/" term and the purge credentials. Confirm both before merge. Unconfirmed, this trades a stale read for an uncached one per render.

Findings

  • should-fix — server/content-index.ts:181 — a meditations block reads /api/user-choices, which the upstream rule deliberately excludes.
  • should-fix — server/cms-client.ts:625 — "purged on write" is best-effort upstream, unconfirmed.
  • consider — server/kv-cache.ts:7 — my answer on criterion 2: keep the module, amend the ticket.
  • consider — server/cms-client.ts:75 — readCms is withRetry at 6 of its 10 call sites.

Checked: the full diff; withRetry's defaults; both surviving withCache callers, neither passing an array, so the narrowed key type is safe; SahajCloud@07e3e40 DEPLOYMENT.md §Edge Cache and §Globals, and its ContentIndexBlock.ts mapping meditations to /api/user-choices.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread server/content-index.ts Resolved
Comment thread server/cms-client.ts Resolved
Comment thread server/kv-cache.ts Resolved
Comment thread server/cms-client.ts Resolved
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Sep 16, 2026
The wrapper held two unrelated knobs for one caller each. `retry` was passed
at a single call site, and `withRetry`'s own defaults already are the three
attempts the other six sites wanted. Dropping it leaves one idea in the name:
a preview read skips the retry.

`getPageLocaleStatus` now calls `withRetry` directly for its single attempt,
which is where that policy is legible anyway.

Addresses #107 (comment)

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uvUiGWYGRSfYJ4kJMJ9e1
`CACHING.md` stated the tag purge on write as a fact this repo can rely on.
Upstream it is best-effort: SahajCloud's `DEPLOYMENT.md` says an unset
`CLOUDFLARE_ZONE_ID` or `CLOUDFLARE_CACHE_PURGE_TOKEN` makes every purge a
silent no-op. With them unset the `s-maxage=600` TTL is the only thing
bounding a stale read, and `getWebConfig` — which lost its preview bypass
here — is the read that notices.

Quote 600s as the worst case everywhere, and name the purge as what only
shortens it.

Addresses #107 (comment)

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uvUiGWYGRSfYJ4kJMJ9e1
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Addressed the adversarial review, pushed 57e60e0.

Manual verification gained a step: confirm CLOUDFLARE_ZONE_ID and CLOUDFLARE_CACHE_PURGE_TOKEN on Railway.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Sep 16, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review September 16, 2026 23:26
@sydevs-bot
sydevs-bot requested a review from Ardnived September 16, 2026 23:26

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

readCms seems like a confusing function name for a method which is supposed to handle retry, plus isn't there already a withRetry function? Basically, readCms is a badly named function

@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed awaiting labels Sep 17, 2026
`readCms` read as a policy name for what is only "retry, unless this is a
preview read". The name now states that rule, so a reader does not have to
open it to learn that `withRetry` is what it delegates to.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WdvLfJrbJQ4v3Bma4md2DD
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Renamed readCms to withRetryUnlessPreview, pushed f354078.

  • Adopted — the name now states the only rule it carries: a public read retries, a preview read fails fast. withRetry (error-utils.ts) still does the retrying — the wrapper only chooses whether to call it. Its second idea, the retry knob, went in 481460f, so the name had one thing left to say.
  • Renamed at all ten call sites, plus server/CACHING.md and docs/rules/rest-api.md. No behaviour change. Lean gate green: lint, tsc --noEmit, 644 tests.
  • Still yours — criterion 2 of #98: keep server/kv-cache.ts for its three remaining callers, or delete it and the atlas cache with it.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Sep 17, 2026
@Ardnived

Copy link
Copy Markdown
Contributor

@sydevs-bot Address the changes in this comment on the original ticket and update the PR accordingly. I am expecting the complete removal of the KV cache.
#98 (comment)

@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed awaiting labels Sep 18, 2026
Completes #98. The atlas reads and the content sitemap read were carved
out when the ticket was written, on the ground that they needed their own
argument. @Ardnived decided on 2026-09-17 that they do not: every
staleness window shortens to the edge's 600s, none lengthens.

`withCache` also supplied the retry, and all three of these reads degrade
silently — `getAtlasSeo` to `null`, the two sitemap halves to `[]`. An
unported retry would turn one upstream blip into a page missing its
server-rendered half, or a sitemap missing a whole section, in a response
that still answers 200. Each now calls `withRetry` directly, with the same
ladder `withCache` ran on a miss: 3 attempts at 1s base delay.

`getAtlasSeo`'s 404 branch returns rather than throws, so a dead route
still costs one read instead of three.

The two ⚠ notes went with the code they annotated. Both described KV
behaviour alone: a stored `null` reading back as a miss, and the
`content-sitemap-docs` key prefix guarding against a shape change in
`getCachedResponse`. Neither has a referent now.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014ny1hhE4rfwasorqtcYHn3
CACHING.md loses the "what still uses KV" table and its inspection
runbook, and gains the rule the removal makes load-bearing: a read that
degrades silently is the one that most needs the retry the cache used to
supply. The windows the removal shortened are recorded, since #98's
argument was that none lengthens.

AGENTS.md and server/AGENTS.md drop the binding from the Worker's
description and from `pageContext`. rest-api.md says where a read with no
preview variant gets its retry.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014ny1hhE4rfwasorqtcYHn3
@sydevs-bot sydevs-bot changed the title refactor(server): drop the KV read-through cache for CMS reads the edge already caches refactor(server): delete the KV read-through cache and its binding Sep 18, 2026
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Completed the removal, pushed afb2a77. Criterion 2's grep is clean.

  • Adopted — @Ardnived's decision on #98. server/kv-cache.ts, the WEMEDITATE_CACHE binding, AtlasCacheTTL and the pageContext.cloudflare type are deleted. getAtlasSeo, getAtlasSitemapUrls and getContentSitemapUrls call withRetry directly, since withCache supplied it and all three degrade silently. Four tests pin the calls, each watched failing first.
  • Resolved — criterion 2. Settled against my reading: the ticket changed, not the code.
  • Flagged — one cost the ticket's table misses. A KV hit used to skip the retry; now an upstream outage holds /sitemap.xml and atlas routes for ~7s per request. Detail in the PR body.

Gate green: lint 0 errors, tsc --noEmit, 646 tests, pnpm build.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot added awaiting and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Sep 18, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Sep 18, 2026
Merged via the queue into main with commit bb87643 Sep 18, 2026
23 checks passed
@sydevs-bot
sydevs-bot deleted the claude/refactor-98-drop-kv-cache branch September 18, 2026 00:53
@sydevs-bot sydevs-bot moved this from Revising to Done in SYDevelopers Technical Roadmap Sep 18, 2026
sydevs-bot pushed a commit that referenced this pull request Sep 18, 2026
The only conflict was the file header of `types/vike.d.ts`. Both sides
rewrote the same line: #107 dropped "Cloudflare Workers bindings" with the
KV binding it described, and this branch replaced "hooks such as
onBeforeRoute" because a second hook now writes `locale`. The resolution
keeps both edits.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TW8NJxcfXF2WkwXNQfV1cE
sydevs-bot added a commit that referenced this pull request Sep 18, 2026
Cloudflare Pages is red on 797d9c9, and the build log lives only in the
Cloudflare dashboard, which a routine cannot reach. The branch forked at
2af1870, three commits back, so the Pages build was still installing the
pre-#111 dependency tree: 88 extra packages and a whole unused Next.js
subtree. This merge builds against the tree main installs today.

It also brings in the two server changes this PR's memos sit on top of:
#107 drops `preview` from `getWebConfig`, which `loadSiteContext` calls,
and #113 adds `+onCreatePageContext.server.ts`, the error-page path this
PR's fork spec describes.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01B9MPJ8NWXhK85k27xRq6Ji
Ardnived added a commit that referenced this pull request Nov 2, 2026
* test: drop leftovers from the KV cache removal and an unused smoke helper

- `kv: undefined` in two sahajcloud-context mocks: the context lost its
  kv field in #107, so the mocks described a shape that no longer exists.
- Three retry tests titled "…since the KV layer used to supply that":
  the KV layer is gone, so the titles now state only the behaviour.
- `headTags()` in the smoke preview helper: exported in #28 and never
  called.

The audit found no migration-era test files left; #87, #99 and #107
already removed them with their code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(server): drop the stale KV binding claim

`getSahajCloudContext()` returns `{ apiKey, baseURL }`, and
`SahajCloudEnv.Bindings` carries no KV namespace — the binding went with
`server/kv-cache.ts` in #98. The docblock still promised a reader that the
helper resolves one, which is the same leftover this PR deletes from the
file's own test mock. Wording now matches `sitemap-routes.ts`.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXde9tn99Z82seiuKd

* fix(components): call the related fetch edge-cached

Nothing in this Worker holds persistent state (server/CACHING.md). The
related endpoints are cached by the Cloudflare zone in front of SahajCloud,
which sets `s-maxage` and `Cache-Tag` through `publicReadCacheHeaders`. The
KV namespace these docblocks named went away in #98, so "KV-cached" pointed
a reader at a cache they could neither inspect nor purge.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXde9tn99Z82seiuKd

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Drop the KV read-through cache for CMS reads the Cloudflare edge already caches

3 participants