Skip to content

feat(fast-deploy): target the live deployment id for content-push sync#29

Merged
hugo-ccabral merged 3 commits into
mainfrom
feat/fast-deploy-per-deployment-id
Jul 9, 2026
Merged

feat(fast-deploy): target the live deployment id for content-push sync#29
hugo-ccabral merged 3 commits into
mainfrom
feat/fast-deploy-per-deployment-id

Conversation

@hugo-ccabral

@hugo-ccabral hugo-ccabral commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

What

Content is now keyed per deployment in KV (decofile:<id>). A content-only fast-deploy must write to whichever version is currently live, so the tanstack-kv reconciler resolves the site's index:live pointer (Cloudflare KV REST GET) before creating the sync Job and passes it as DEPLOYMENT_ID.

Behavior

  • New cfkv.go: fetchKVLiveID reads index:live for the site's namespace.
  • Reconciler: resolve live id → pass DEPLOYMENT_ID=<liveId> to the Job (syncer runs deco-sync-blocks-to-kv --deployment-id "$DEPLOYMENT_ID").
  • index:live unset (no code deploy yet) → Synced=Unknown / reason Waiting + requeue; no Job created.
  • Live-id resolver is injectable → unit-testable without HTTP.
  • No CR schema change — the live id is resolved at reconcile time (the existing Spec.DeploymentId is the unrelated ConfigMap/Knative pod-label field).

Depends on

  • decofile-syncer image passing --deployment-id (infra PR).
  • @decocms/start per-deployment keying (blocks PR). Inert until a site has deployed once and set index:live.

Test

go build / go test ./internal/deploy/... / go vet pass. 3 new tests: buildJob env carries DEPLOYMENT_ID; Waiting-when-pointer-absent; Job targets the live id.

🤖 Generated with Claude Code


Summary by cubic

Fast-deploy now writes content to the currently live deployment by resolving index:live in Cloudflare KV and passing that id to the sync Job. This aligns content pushes with the live site and avoids updating the wrong version.

  • New Features

    • Reconciler reads index:live via Cloudflare REST using the operator’s CF creds and passes it to the Job as DEPLOYMENT_ID (syncer runs with --deployment-id).
    • When index:live is unset, mark Synced=Unknown with reason Waiting, requeue, and skip Job creation.
    • Added internal/deploy/cfkv.go and an injectable live-id resolver; tests cover waiting behavior, Job env, and targeting the live id.
    • Docs updated for per-deployment keys and the monorepo rename (@decocms/tanstack, @decocms/blocks, @decocms/blocks-cli), including build/deploy commands to seed and flip index:live, and how to verify DEPLOYMENT_ID.
  • Dependencies

    • decofile-syncer must support --deployment-id.
    • Runtime uses @decocms/tanstack with per-deployment keying; CLI is @decocms/blocks-cli. A site must have set index:live via a prior code deploy.

Written for commit f65e80d. Summary will update on new commits.

Review in cubic

nicacioliveira
nicacioliveira previously approved these changes Jul 9, 2026
hugo-ccabral and others added 2 commits July 9, 2026 10:41
Content is now keyed per deployment in KV (decofile:<id>). A content-only
fast-deploy must write to whichever version is currently live, so before
creating the sync Job the tanstack-kv reconciler resolves the site's
index:live pointer (Cloudflare KV REST GET) and passes it to the Job as
DEPLOYMENT_ID. When index:live is unset (no code deploy has run yet) it
reports a Waiting condition and requeues rather than syncing blind.

The live-id resolver is injectable so tests avoid real HTTP. No CR schema
change — the live id is resolved at reconcile time.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Document that content is keyed per deployment and the reconciler resolves
index:live (Waiting + requeue when unset) and passes DEPLOYMENT_ID to the
sync Job; note the CF creds are also used for the live-id REST lookup.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@hugo-ccabral hugo-ccabral force-pushed the feat/fast-deploy-per-deployment-id branch from 5133f7b to 045ee22 Compare July 9, 2026 13:42
The framework repo went monorepo: the runtime is @decocms/tanstack / @decocms/blocks
and the CLI bin (deco-sync/migrate-blocks-to-kv) is @decocms/blocks-cli — the old
@decocms/start package is gone. Update the onboarding runbook + the cfkv.go source
pointer, and fold in the per-deployment model: per-deployment keys
(decofile:<id> / index:revision:<id> / index:live), the build/deploy command flow
(seed at build with --deployment-id, set-live post-deploy), and the "index:live
must be set before content pushes work" Waiting state.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@hugo-ccabral hugo-ccabral merged commit d1c1926 into main Jul 9, 2026
4 of 5 checks passed
@hugo-ccabral hugo-ccabral deleted the feat/fast-deploy-per-deployment-id branch July 9, 2026 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants