Repository navigation
Open
Description
Summary
On tanstack sites with fast deploy on (DECO_FAST_DEPLOY=1 + DECO_KV binding), CMS publishes never reach production until the next code deploy. Two problems in the framework, both fixable there instead of in every site:
- The publish write-through to KV is opt-in and fails silently.
handleDecofileReload(blocks-admin/src/admin/decofile.ts) only writesdecofile:<deploymentId>/index:revision:<deploymentId>if the site calledsetupTanstackFastDeploy()at startup. OtherwisegetFastDeployKVstays at its default() => null,writeSnapshotToKVreturnsfalse, and the handler answers200 { kvWritten: false }with no log. Only the isolate that received the Studio POST updates; every other isolate and every cold start keeps the snapshot written at deploy time. - Once enabled, a delta publish can drop an earlier publish (lost update).
POST /.decofileis handled intanstack/src/sdk/workerEntry.ts(~L2027) beforeensureBlocksHydrated(~L2146) andmaybePollRevision. The handler doesapplyDelta(loadBlocks(), delta)and writes the whole result to KV. The base is whatever the isolate has in memory: the bundled decofile on a cold isolate, or a copy up toPOLL_INTERVAL_MS(10s) old on a warm one.- Publish A hits isolate X → KV = deployed + A.
- Delta publish B hits cold isolate Y → KV = deployed + B. A is gone from production until the next deploy.
- Two publishes within 10s on different isolates do the same.
- Before (1) is fixed this can't happen, because only deploys write KV. So fixing (1) alone exposes (2) on every site that does it.
Versions checked: 7.81.5 source. setupTanstackFastDeploy is exported but never called automatically in every version sites use (7.64.3 → 7.84.0).
Evidence (montecarlo-tanstack, 2026-11-06)
- Home publish
bdbc9cc7committed at 17:43 UTC; prod still served the old banner 20+ min later (x-cache-version= last code deploy86a9ff74). DECO_KV:index:live=86a9ff74;decofile:86a9ff74still contained the old value and not the new one;index:revision:86a9ff74unchanged. So no poll delay: the write never happened.src/setup.tsdidn't callsetupTanstackFastDeploy(). Site-side fix: deco-sites/montecarlo-tanstack#1262.
Blast radius
Tanstack sites in deco-sites with DECO_FAST_DEPLOY: "1" + DECO_KV, checked on the default branch:
- Missing the call (affected): bagaggio, care, casaevideo, farmrio, granadobr, granadobr-teste, lebiscuit, oficina, phebo, storefront, igor (sandbox), montecarlo (until #1262).
- Call present: zeedog, zeedog-ecuador, zeenow, miess-01.
Care / granadobr / phebo / oficina mention fast deploy in code, but only on the read side (onChange, DECO_KV.get).
Proposal
- Wire it automatically. Call
setFastDeployKVGetter(getFastDeployKV)inside the tanstack worker entry/site setup, the same place that already decidesisFastDeployEnabled, so it is on whenever fast deploy is on. KeepsetupTanstackFastDeploy()as an idempotent no-op for existing callers. - Never fail silently. When fast deploy is enabled and the write-through doesn't happen (no getter, no deployment id,
kv.putthrows), log an error and return non-2xx (or let Studio surfacekvWritten: false) so the publish isn't reported as successful. - Merge against KV, not memory. In the reload handler, before
applyDelta, hydrate fromdecofile:<liveId>and checkindex:revision:<liveId>(awaitensureBlocksHydrated, or read KV directly). Ideally write conditionally on the revision you read, retrying on mismatch, so concurrent publishes can't overwrite each other. - Optionally note in the docs/templates that
setupTanstackFastDeploy()is no longer needed.
How to verify
- Publish a small change in Studio →
index:revision:<liveId>changes within seconds and the content is served by other isolates and cold starts with no deploy. - Two delta publishes on different blocks within a few seconds → both are present in
decofile:<liveId>.
Metadata
Metadata
Assignees
Labels
No labels
Activity