feat(cli): scaffold migrated sites fast-deploy-ready - #550
Open
JonasJesus42 wants to merge 1 commit into
Open
JonasJesus42 wants to merge 1 commit into
JonasJesus42 wants to merge 1 commit into
Conversation
A migrated site could not fast-deploy without hand edits. The scaffold emitted a wrangler.jsonc with no `vars`, no observability, and a single KV binding — `SITES_KV` with the literal id "dev-sites-kv", which resolves to nothing anywhere — and a setup.ts that never called `setupTanstackFastDeploy()`, so even a hand-fixed wrangler would leave the Studio publish write-through silently no-opping. Now: - wrangler.jsonc declares the `DECO_KV` binding and `DECO_FAST_DEPLOY: "1"` together, plus `version_metadata` and a `deco-otel-tail` consumer. The tail consumer is not decoration: Cloudflare kills an isolate over the 128MB cap before any in-worker code can report it, so without it an exceededMemory incident is invisible. Emitted as real JSONC rather than JSON.stringify so the reasons survive next to the fields. - Namespace ids are left empty on purpose. The control-plane provisions the site's OWN namespaces and re-forces the ids at build time, so a wrong id in the repo can never reach production — and a plausible-looking fake id is worse than a blank. - setup.ts calls `setupTanstackFastDeploy()`, mirroring the smoke example. - A verify check asserts all three together. Two of three is the worst state: it looks configured, the publish reports success, and nothing reaches KV. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This was referenced Sep 14, 2026
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.
Problema
Um site migrado não conseguia usar fast-deploy sem edição manual:
generateWranglerConfigemitia umwrangler.jsoncsemvars, sem observabilidade, e com um único binding KV:SITES_KVcom o id literal"dev-sites-kv"— que não resolve em ambiente nenhum.setup.tsscaffoldado nunca chamavasetupTanstackFastDeploy(), então mesmo com o wrangler corrigido na mão o write-through do publish do Studio no-opava em silêncio (oblocks-adminnão pode importar o@decocms/tanstack— direção errada no grafo de pacotes — então quem entrega o resolver de KV é o site).Mudanças
wrangler.jsoncdeclaraDECO_KVeDECO_FAST_DEPLOY: "1"juntos, maisversion_metadataetail_consumers: deco-otel-tail. O tail consumer não é enfeite: a Cloudflare mata o isolate acima do teto de 128 MB antes de qualquer código in-worker conseguir reportar, então sem ele umexceededMemoryé invisível (docs/runbooks/tail-exception-spike.md). Emitido como JSONC de verdade em vez deJSON.stringify, pra os porquês ficarem ao lado dos campos.ensureSiteKvNamespace) e o builder re-força os ids a cada build viaCF_KV_NAMESPACE_ID, então id errado no repo nunca chega em produção — e um id falso com cara de real é pior que um branco.setup.tschamasetupTanstackFastDeploy(), espelhandoexamples/tanstack-smoke.phase-verify, severidadeerror, exigindo os três juntos. Dois de três é o pior estado possível: parece configurado, o publish reporta sucesso, e nada chega no KV.Testes
fast-deploy-scaffold.test.ts— 8 casos. O wrangler gerado é parseado, não grepado (um vírgula solta desliga fast-deploy em todo lugar de uma vez: builder, control-plane e o próprio check lêem esse arquivo por um parser JSONC). O check de verify é exercitado nos quatro estados parciais.Parte da pilha: #548 → #549 → este.
🤖 Generated with Claude Code
Summary by cubic
Makes migrated sites fast-deploy-ready without hand edits. Previously the scaffolded
wrangler.jsonccarried novars, no observability, and aSITES_KVbinding with a dummy id, and the scaffoldedsetup.tsnever calledsetupTanstackFastDeploy(), so Studio publishes would silently no-op.wrangler.jsoncnow declaresDECO_KVandDECO_FAST_DEPLOY: "1"together, plusversion_metadataand adeco-otel-tailtail consumer; it's emitted as JSONC so the comments explaining each field survive.setup.tsnow callssetupTanstackFastDeploy(), handing the KV resolver to@decocms/blocks-admin, which can't import@decocms/tanstackitself.phase-verifycheck (severityerror) requires all three pieces together, since two of three looks configured but writes nothing to KV.Written for commit edbb911. Summary will update on new commits.