Repository navigation
feat(cms): v8 CMS on R2 with content-addressed releases - #8379
Merged
Merged
Conversation
tlgimenes
marked this pull request as ready for review
November 6, 2026 12:42
tlgimenes
force-pushed
the
cdn-cms/cas
branch
2 times, most recently
from
November 6, 2026 22:39
c3df4e4 to
e927007
Compare
tlgimenes
force-pushed
the
cdn-cms/cas
branch
from
November 9, 2026 13:22
c8246c8 to
e0fcc9e
Compare
…CMS on the CDN
- newRevisionId / REVISION_ID_RE: <inv>-<uuidv7>, newest first (contract 1.2)
- blockVersion: sha256(canonicalJson(block))[0..16] base64url (contract 1.3)
- delivery store: revisions/<id>/{data,meta}.json keys, DELIVERY_KEY_PREFIX
(test-only), conditional PUTs on a maxAttempts: 1 client, 429/5xx/network
-> DeliveryUnavailableError, putText and a paged delimiter listPage
- record store: the private bucket's schema.json (plain PUT, conditional GET)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ntext The hosted CMS names drafts in a Postgres table unique on (site, name), replacing the KV entry per (project, branch). StudioContext.auth now says which credential authenticated the request (and on-behalf-of keys), so the server sets a revision's via. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- drafts: one public object {set, delete, editors} plus a drafts row; create
inserts if absent; editors stamped in the JSON
- content storage over latest revision + draft: saves read the draft once,
guard against the draft only, PUT with If-Match, no retries; a lost race
or R2 429/5xx is Unavailable; conflicts carry value, version and editor
from the save's own read
- publish steps 1-6 with 3 attempts reusing the draft read, previous in meta,
escaped data.json, previewHosts in latest.json only, purge failure only
logged; rollback steps 1, 4, 5 with reapplyOf, never-live refused
- releases paged by revision folder, live walk through previous
- the git-free save guards and blocksMajor marker writer move to their own
modules (the v8 git path re-exports them)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Drafts (list, create, resolve, discard), the content-protocol RPC, publish, releases, rollback, schema push (sets blocksMajor) and site tokens, behind today's checks in order: caller (401), cms plan (403), org_sites (404), then a configured bucket (503). A lifecycle test runs every step with the git-providers module set to throw. Co-Authored-By: Claude Opus 5.5 <[email protected]>
An oxlint jsPlugin keeps git-providers, the repo readers and the v8 git path's modules out of the CMS route, hosted/cms-* and the web CMS client. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- content protocol on /api/:org/cms/:site/drafts/:branch/rpc, the site
from the project's metadata.siteSlug; opening the editor POSTs /drafts
{name: branch} for the preview pointer; a save's bare ETag moves it
- held-copy guards use blockVersion (sha256 of canonicalJson, 22 chars)
- the conflict dialog names who and when from the refusal's
draft[name].editor; no separate changedBy read
- the v8 gate is the project's blocksMajor marker; main's schema is not
read
Co-Authored-By: Claude Opus 5.5 <[email protected]>
POST /api/:org/cms/:site/drafts/:branch/publish; production_moved shows the "published meanwhile" message; no publish review read. The test file puts the real sandbox-git-api back after it mocks the module. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The hosted publish, releases, reapply and Try again routes, the git draft storage, MainMovedError and the latest.json/revisions/<sha>.json writer are gone: /api/:org/hosted/* is unmounted, and decofile.ts keeps only its v7 Fast Preview answers. v8 is the blocksMajor marker that deco schema push writes: the admin backfill, thread create and project create read it and never read git for it. delivery-store loses its sha-keyed revision reader. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A cms-runtime session on a site marked v8 answers 404 hosted_cms on /:vm/:branch/git/*: its content is on the hosted CMS. v7 sessions and v8 sandboxes keep their git routes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ban-cms-git-imports now covers apps/api/src/hosted/** (tests included) next to the cms routes and the web CMS client. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The editor no longer sends or handles the main-schema header; v8 is the project marker alone. Publish is live once it answers: no Try again, no Not live yet, no also-changed-on-main review. Releases read /api/:org/cms/:site/releases and Make current posts its rollback; site tokens use the cms route. Preview links name revision ids, not shas. Co-Authored-By: Claude Opus 5.5 <[email protected]>
MAIN_SCHEMA_HEADER, MAIN_SCHEMA_CHANGED, HOSTED_DELIVERY_UNCONFIGURED, hostedRevision(Parts), isV8SchemaText and schemaGenPath had no users left. The one-v8-detector guard follows the marker-based deciders. The e2e spec of the git-backed v8 editor goes with its routes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…v8 site The branch removed every v8 guard from decofile.ts, so a client in the v7 editor (a stale session, or one open when deco schema push set the marker) could PATCH .deco/blocks onto the branch through GitHub and Publish could merge it into main. A project with the blocksMajor marker now gets 409 hosted_cms on PATCH and POST publish, before any repository lookup. v7 projects are served as today. The route test replaces the deleted v8-gates.test.ts for this case. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Releases walk meets revisions in listing order and follows previous from latest.json. Ids were minted from the local clock alone, so a publish from an instance whose clock ran behind the one that wrote its previous revision sorted after it: the walk then marked that previous revision, and every older one, never-live, while the rollback walk (wentLive) still accepted them. The id is now minted at max(now, previous's UUIDv7 time + 1 ms); publishedAt keeps the instance's clock. Contract §1.2 amended. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…backend The rule left out the files that pick and drive the hosted backend (use-content-backend.ts, content-protocol-api.ts) and the hosted Publish and Releases clients, so a decofile-api or git import could return there. They are covered now. content-protocol-api.ts imported its write keys and patch types from decofile-api.ts, the v7 git client; those move to content-write-keys.ts (no network), re-exported from decofile-api.ts so v7 callers are unchanged. decofile.ts and sandbox-proxy.ts stay outside the rule: they serve v7 from git and refuse v8 projects before any repository lookup. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The CMS rpc route answers 404 draft_not_found while the draft has no row,
and the only code that created the row (the pointer read) waited for the
probe to succeed. On a new thread branch, or after deco drafts discard of
it, the probe failed every 5 s forever and the editor never loaded. The
probe now runs POST /drafts {name: branch} (idempotent) first, then
describe and schema.get.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t follows" This reverts commit 984aea2. Owner decision: revision ids use the minting instance's clock only, as the design says; the clock-skew display risk is accepted. Contract §1.2 amendment removed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… meta cache - Migration 261 (edited in place): drafts.site REFERENCES org_sites(slug) ON DELETE CASCADE, so releaseSite works for a site with drafts (new integration test). - Draft discard deletes the R2 object before the row: a failed delete keeps the row and the discard can run again. - delivery-store delete and listPage map R2 429/5xx/network to DeliveryUnavailableError, like get and the conditional PUTs. - A meta.json that is there but unparseable is MalformedObjectError, and so is a missing one on the rollback's previous walk: a broken chain answers 500 malformed, not 409 never_live. - Parsed meta.json files are cached by (site, id) (written once, create-only); an absent one is never cached. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The CLI no longer names an org (no .deco/link.json; the site comes from DECO_SITE), so the hosted CMS routes move out of /api/:org to /api/cms/:site, mounted in app.ts before the /api/:org catch-all. The site's organization is the org_sites row's (slug is the key). Gates, in order (contract §4.1): - 401 with no caller; - 404 site_not_found, one body, for an unknown site, a tombstone, or a site of an org the caller can't reach. Admission runs the same checks /api/:org does (archived org, API key / token bound to another org, membership or the task-board admin rule), through helpers extracted from resolveOrgFromPath with its behaviour unchanged, then binds the org scope; - 403 feature_not_in_plan, on the resolved org; - 403 org_blocked for a blocked org's writes, as enforceOrgBlock does; - 503 hosted_delivery_unconfigured. "Organization scope required" goes with the org in the path. Error codes: a delivery object Studio didn't write is 500 malformed (MalformedObjectError). The site-tokens "not configured" 503 now carries hosted_delivery_unconfigured. Web: cmsUrl(site, path) and every caller (editor draft and rpc, publish, releases, rollback, site tokens) use /api/cms/:site. A new test drives a v8 project with GitHub off (ensure, probe, read, save, publish) against a mocked fetch and asserts every request is under /api/cms/:site, never /decofile/ nor a sandbox's /git/*. blockVersion stays a copy in apps/api and the web: @decocms/blocks has no preview releases, and a git dependency on the branch installs the unbuilt monorepo root without the /protocol subpath. Noted as a known deviation in the contract (§1.3). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…led list
GET /api/cms/:site/releases no longer fails when a revision's meta.json
doesn't parse, its GET fails, or the folder the live walk expects has
none: that folder is {id, status: "unreadable"} with no meta, and the
walk stops at it, so older revisions are never-live (what the list shows
when the walk can't reach them). A rollback to or through it still
answers 500 malformed. The web Releases tab lists it as a plain row with
its date only, no Make current or Preview.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The v8 marker (metadata.blocksMajor: 8) was trusted on its own, so a
stale one left on a v7 project (an earlier Studio derived it from git)
turned on every v8 gate: the hosted editor, the decofile 409 on writes,
the sandbox-less git 404, a new thread's cms runtime and the site-claims
backfill. The marker now counts only next to the record of the push it
came from, metadata.cmsSchemaPush { site, sha256 }, which only
PUT /api/cms/:site/schema writes (with the marker) and which clients can
neither set nor clear (server-managed key). isBlocksV8Project, the one
reader, checks both, so the web and API gates follow without changes:
a marker with no schema push behind it is ignored and the project gets
the v7 editor and git decofile paths exactly as on main. A v7 schema
push clears both keys, a stale marker included. No data migration.
Tests: the predicate and the marker sync, the schema push route, the
decofile and sandbox-less git gates, the thread runtime default, the
web answer, and the v7-boundary e2e with a stale marker in both editor
modes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
gates() admitted any member of the site's organization, so a caller whose custom role is scoped to some of the org's projects could read and write (drafts, publish, rollback, schema push, site tokens) the site of a project outside that scope. After the site and organization checks, the gates now resolve the caller's scope (resolveCallerProjectScope) and refuse a site whose project it doesn't admit with 403 project_not_allowed, as the org's project tools do (isProjectAllowed). The 404 for an unknown or unreachable site still comes first, so existence doesn't leak. Unscoped members, admins, org-wide credentials and API keys (authorized by their own allowlist) are unaffected. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This reverts commit 1dd1c46d81a4ef289184d0e4e6e699553a5b0ae1 ("fix: a
project is Blocks v8 only alongside a CMS schema push"). Deriving v8 from
metadata.blocksMajor plus a metadata.cmsSchemaPush record still lets a
schema push turn a project v8 on its own. The next commit replaces both
with one explicit per-project switch an org admin sets.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A project is a Blocks v8 site only while its "Blocks v8 site" switch is on: metadata.blocksV8 === true, read by isBlocksV8Project, which every v8 gate already goes through (the hosted editor, the decofile 409, the sandbox-less git 404, a new thread's runtime, the site-claims backfill, Experiments, Calendar, Releases, site tokens, Monitor). Nothing derives it any more: not git, not deco schema push, and not the older metadata.blocksMajor marker, which is now ignored. - Only an org owner or admin flips it: the CMS tab of project settings (a switch other members never see), or blocksV8 on COLLECTION_VIRTUAL_MCP_UPDATE, which patches just that key. A metadata write that would set or clear it is refused (an echo of the stored value passes and is stripped), a new project can't start v8, and the web app no longer sends the key back from what it read. - PUT /api/cms/:site/schema never writes it, and is refused with 409 not_blocks_v8_site, naming the switch, while it is off (or the site has no project). The marker writer (blocks-major-marker.ts) is gone. - Off is the key gone: the project is v7 again, with main's editor. Cutover: no data migration. Only demo-storefront is v8 in production; an org admin turns on "Blocks v8 site" in its project settings when this ships (apps/api/README.md). Tests: the predicate and the one-flag guard (a stale marker is v7), the update tool (admin sets and clears, member refused, metadata writes refused, echo kept) and create, schema push refused while off and accepted (never flipping it) while on, the decofile and git gates, the thread runtime, the web answer and the admin-only switch; e2e: the v7-boundary editor also after the switch was turned off with a stale marker left, the settings switch with its gates, and deco serve's v8 project set up through the switch. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… serves it The redirects editor labelled a flat (Blocks v8) temporary redirect with no explicit status as a 302, but @decocms/blocks serves it as a 307 (a temporary redirect is a 307, so a POST stays a POST). The type options and "Follow the type" now say 307; a permanent one stays 301 and an explicit status still wins. The nested (v7) shape is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The project's "Blocks v8 site" switch (isBlocksV8Project) is now the one rule for v8-ness in the editor's Sandbox and Localhost modes too, not only in GitHub mode and the hosted screens. Nothing reads a schema to decide it any more: not main's, not a sandbox working tree's, not a deco serve's. - Off (v7): legacy in every mode, exactly as on main: no probe runs, a stored deco serve connection reads as none, a saved Local tunnel is used as on main, and the v7 sandbox path is used whatever the working tree holds. - On (v8): Sandbox mode waits for Studio's protocol over the working tree and retries it (a 404 included) instead of falling back to v7 when its schema lacks "blocksMajor": 8; Localhost connects to any deco serve (the "not a Blocks v8 schema" state is gone); GitHub mode uses the hosted backend whatever its schema says. - One predicate: use-main-schema-v8.ts becomes use-blocks-v8-project.ts (useBlocksV8Project / blocksV8Project over isBlocksV8Project). Its "loading"/"error" answers, lastFoundV8/useLastFoundV8, waitsForMainAnswer, monitorKind, editsBlocksDraft, experimentsRouteView, the undecided Localhost/tunnel states, the "deciding" preview loader, the releases/calendar pending escape hatches and the GitHub "retrying" note were unreachable once the switch decided synchronously, and are removed with their stale comments. - The switch shows to any role hasAdminRole accepts (a multi-role "admin,billing-manager" member included), matching the server's check, instead of only an exact "owner"/"admin". - isV8Schema stays only as how the editor's forms read the schema they were given (v8 or v7 names); the guard test now also checks that no content-backend decider calls it. Tests: selectContentBackend's table for off and on in GitHub, Sandbox and Localhost modes (never legacy when on, always legacy when off, no probes when off), the schema never deciding in any mode, the deco serve connection and Local tunnel hooks with the switch off and on, the settings switch for multi-role admins, Experiments/sidebar/preview choices without the removed states, and the blocks-major guard. Co-Authored-By: Claude Opus 5.5 <[email protected]>
"Edit this site with the Blocks v8 editor and hosted CMS. Off: v7, git-backed." and its pt-br counterpart; the label is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s it lists Changing a Preview as option now drops the variant pinned in the preview, so the frame's `__draft` shows what the option asks for. Leaving a section (Back) drops the section's pin on a v8 site, keeping the page's. On a hosted draft, the tests and campaigns blocks are loaded when the popover first opens, with a spinner, an inline error and Try again, so it no longer says there are no A/B tests when the editor was opened directly. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… opens The burst's pause was measured by when each keystroke was handled. While the dialog opens the main thread is busy (the editor re-renders, the dialog mounts and paints), so the keys typed meanwhile are handled late, all at once; a stall longer than the pause made them look like a new burst and they were dropped on the dialog. The pause is now measured by when the keys were typed (the event's timeStamp), and the capture listens from the moment the dialog notes the field, not only once its effect ran. Co-Authored-By: Claude Opus 5.5 <[email protected]>
On a v8 site, labels several of a section's variants share are numbered as
a page's variants already are ("Default 1", "Default 2"), so Add variant no
longer shows two rows named Default. v7 keeps main's labels.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Code of the site editor that runs inside a Blocks v8 site's page now ships with Studio, as ES modules the page's Studio channel imports from Studio's origin: /studio-modules/v1/<name>.js, each bundled into one self-contained file (bundled on request by the dev server, emitted by the build) and served with access-control-allow-origin: * by both. - wireframe: the section outline, hover and click selection, and the navigation guard, moved from the script Studio injects into v7 pages. - html-swap: fetches the page again after a save and swaps the document inside a View Transition (at once without the API), reporting start and end; a later refresh supersedes one under way. The channel's types are a byte-identical copy of the blocks package's protocol (src/protocol/channel.ts), as with block-meta. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…TML after a save When a Blocks v8 site's framed page says deco:ready, the preview answers deco:load for the wireframe and HTML swap modules, hearing only the frame's window at the origin it spoke from. The Blocks panel's section outline and selection go through the wireframe instead of the injected script; v7 sites keep it. A save no longer reloads the frame: HTML swap refreshes it in place, and the progress bar, up from the save, ends on the swap's end. A page without HTML swap, a swap that fails or one that doesn't start within 2 s reloads as before; a new document while a swap waits ends it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ad of loading it A hosted save moves the draft pointer, which is in the preview's URL, so the frame navigated to the new URL after every save: HTML swap only ran when the pointer stayed put, which a hosted save never does. The spike showed each save as a new document (a new deco:ready, the modules loaded again) and no View Transition. Now a Blocks v8 frame shows a new URL of the page it is on by swapping: nextFrameSwap (frame-navigation.ts) keeps the src the frame loaded while the page shows the new one, and the preview asks HTML swap for it (html-swap:refresh gains an optional url, same origin only; later refreshes read it). Another page, a page without HTML swap, or a frame still loading navigates as before; a swap that fails or never starts loads the new URL, or reloads when it is the src the frame keeps. The swapped URL stays out of the page's address bar: history.replaceState woke the page's router, which then rendered into the replaced elements (React removeChild/insertBefore errors). The host reports module changes (onModulesChange), so the preview knows when the frame's document has HTML swap. Spike (Playwright, two saves): no new document, the iframe src unchanged, startViewTransition once per save, html-swap:end 1.4-1.7 s after start, the green bar gone 66-82 ms after html-swap:end. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The preview hears deco:ready from whatever document its frame holds and answers at that origin. Since a hosted save swaps a moved draft pointer in (html-swap:refresh with the new URL) instead of loading it, a frame that had navigated to another origin which speaks the channel would be handed the site URL with its __draft pointer. refresh(url) now returns false unless the URL is on the origin the frame document spoke from, so the preview loads the URL in the frame instead, as before the swap. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…usting a list of Studio origins The CMS overlay activation is picked by cmsEditorActivation, which is null for a Blocks v8 site: its page evaluates no script Studio sends, so a v8 frame never gets editor::inject (nor visual-editor::activate with the CMS script). v7 frames get the same messages as before. studio-modules/channel.ts is again byte-identical with @decocms/blocks/protocol: the page trusts DEFAULT_STUDIO_ORIGINS (Studio production and staging) unless its binding says otherwise, and imports a module only on the origin of the deco:load naming it. The host already names its modules on its own origin and answers the page origin alone; its docs say so and tests cover both Studio origins. Co-Authored-By: Claude Opus 5.5 <[email protected]>
visualEditorActivation (cms-controls.ts) is null for a Blocks v8 site, so the preview posts it neither visual-editor::activate nor the visual editor script; deactivate and the injected scripts' clear-hover are skipped for v8 too (the wireframe alone clears its hover). v7 is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… origin A deco:ready from origin "null" (a sandboxed frame) or any origin that is not a real one cannot be answered: postMessage to it throws. The channel host now ignores it and keeps the document it had. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main's production gate (#8389) asked useMainSchemaV8 whether a session is a v7 site and waited on an undecided Local tunnel. This branch replaced that hook with the project's "Blocks v8 site" switch (useBlocksV8Project) and removed the undecided tunnel state, so the rebase left the gate importing a module that no longer exists (tsc and knip failed). The gate now takes blocksV8 (synchronous, so no "loading" or "error" waits) and no tunnelUndecided; its tests drop the removed states. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main's #8389 made a v7 site's default branch read-only: the editor shows the production notice there and PATCH /decofile on it answers 409. The spec, added on this branch, opened its session on main and asserted the save landed on main, so after the rebase every case waited on a blocks panel the production notice replaced. It now seeds a `draft` branch at main's head (as main's own specs do), opens the session there and checks the save on that branch. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Port the three default-branch tests main added to v8-gates.test.ts (#8389) onto this branch's decofile route harness: a PATCH on the default branch answers 409 default_branch_read_only and commits nothing, the same PATCH on a draft branch answers 200 and commits, and reads of the default branch (GET, and status in place of main's rpc, which this branch does not have) are still served. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…indexes The vendored block-meta.ts and its vectors are byte-identical copies of @decocms/blocks (cdn-cms/entries): META_VERSION 2 adds meta.noIndex, true for a page whose seo says noIndexing, inline or through a saved SEO block such as DefaultSeo. composeIndex resolves a page's saved SEO block at publish (reading that block's body), and recomputes an unchanged page when a saved block its refs reach changed its noIndexing answer. index.json and latest.json carry metaVersion; a publish (or a rollback) onto an index at another meta version recomputes every entry, the one-time backfill after which readers trust a missing noIndex as false. parseEntry keeps noIndex and parseIndex reads metaVersion. v8 hosted publish only; v7 paths are untouched. Co-Authored-By: Claude Opus 5.5 <[email protected]>
tlgimenes
force-pushed
the
cdn-cms/cas
branch
from
November 9, 2026 13:22
e0fcc9e to
6b78ac4
Compare
decocms Bot
pushed a commit
that referenced
this pull request
Nov 9, 2026
PR: #8379 feat(cms): v8 CMS on R2 with content-addressed releases Bump type: minor - decocms (apps/api/package.json): 4.557.3 -> 4.558.0 - @decocms/e2e (packages/e2e/package.json): 1.132.0 -> 1.133.0 - @decocms/shared (packages/shared/package.json): 0.192.0 -> 0.193.0 Deploy-Scope: both
This was referenced Nov 9, 2026
tlgimenes
added a commit
that referenced
this pull request
Nov 10, 2026
The v8 editor modules (wireframe.js, html-swap.js) are imported by the site page from Studio cross-origin. #8379 added the CORS header in the Bun API, but in production nginx serves the static files, so /studio-modules/ fell into "location /": no Access-Control-Allow-Origin, frame headers, and index.html for a missing file. Give it its own location: ACAO *, no-cache without validators (ETag off, Last-Modified cleared, If-Modified-Since ignored -- filenames are not hashed and build mtimes are pinned), nosniff, and a no-store 404 on a miss. Co-authored-by: Claude Opus 5.5 <[email protected]>
3 of 4 tasks
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.
The Blocks v8 CMS on R2 (the v8 git path is deleted), with content-addressed releases and a lazy-loading editor.
Content-addressed releases
Studio side of the content-addressed hosted releases. Design doc: https://claude.ai/artifact/RGGvFd4wLtEkkqEDQjShFn
What changes
Publish (on R2): blocks are hashed and written as
If-None-Match: *. Then the revisionindex.jsonandmeta.jsonare written, thenlatest.jsonwithIf-Match, retried 3 times before answering 409production_moved. Then the CDN purge, andpublishedmarkers for the draft entries that landed. Rollback only copies an index and writes no blocks.Drafts: one file per block, written conditionally.
blocks.applystays multi-block: it checks every ETag before writing anything, and writes targets before the blocks that reference them.Lazy editor: new
cms.indexandcms.blocksRPCs. A view loads only the index plus the blocks it opens.Removed: "Used by", rename of tests and campaigns, rewrite-on-delete, the publish review's missing-rule flag, and the cleanup of saved rules that look unused. Broken references are reported by
deco check.Conflicts:
The rule picker loads the experiments and campaigns blocks when it opens.
Rebased onto main, so the history is linear with no merge commits. The drafts migration is 263, after main's latest.
The site editor's lazy load no longer replaces the decofile query's
queryFn; the e2e stale-form spec caught this.Merging
v8 switch
deco schema pushanswers 409not_blocks_v8_site.blocksMajormarkers are ignored.v7 unchanged
site-editor-v7-boundary, pins it, and main's default-branch guard tests were ported.Editor
/api/cmsroutes check the caller's project scope.Tests
--parallel=2; tsc, biome, oxlint and knip are clean.Base: the CMS on the CDN (from #8370)
Blocks v8 CMS on the CDN: Studio API on R2, with the v8 git path deleted. Design: https://claude.ai/artifact/GktQvu5uBYvPbcR7ZDGtyu
API
/api/cms/:site/.... The org is looked up fromorg_sites. Gates run in this order:latest.json(the only commit point, written with If-Match / If-None-Match),revisions/<id>/{data,meta}.json, anddrafts/<slug>.json{set, delete, editors}.schema.jsongoes in the private record bucket.blocks.apply): each block'sifMatchis checked against the draft. A save is all or nothing, with no retries. A conflict returns the other editor's value, user and time. R2 answers of 429 or 5xx returnunavailable.production_moved. A failed purge is only logged.not_published.revisions/. Rows arecurrent,listedorunreadable(a brokenmeta.json), and a transient R2 failure answersunavailable.draftstable (migration 261,ON DELETE CASCADEonorg_sites).{error, code}, includingmalformedfor broken delivery objects.Deleted
hosted_cmsto edits and publishes from a Blocks v8 site. v7 is unchanged.Web
noIndex and metaVersion (pairs with decocms/blocks#781)
block-meta.tsand its vectors are byte-identical copies of the SDK's (META_VERSION2). A page'smeta.noIndexistruewhen itsseosaysnoIndexing, either inline or through a saved SEO block such asDefaultSeo. Publish looks that block up when it writes the index.index.jsonandlatest.jsoncarrymetaVersion. When a publish or a rollback finds an index at another meta version, it recomputesmetafor every entry, reading each body once. That is a one-time backfill, and afterwards readers can treat a missingnoIndexasfalse. On such an index, a draft equal to production still publishes, so thatmetaVersiongets written.noIndexinganswer changed and the page'srefsreach the block. An edit such as one toHeaderreads no page body.parseEntrykeepsnoIndex, andparseIndexreadsmetaVersion(absent means 1).Known deviation
blockVersionuntil a@decocms/blocksrelease exports it (contract §1.3).Tests
spikes/e2e/, cleaned up afterwards).Migration number: main had already released a migration numbered 261 (
261-remove-user-registered-sso-providers, #8339), so the CMS drafts migration is263-cms-drafts(main has 261 and 262). The table is created only if it doesn't exist.Related: decocms/blocks
cdn-cms/sdk-cli, deco-sites/demo-storefrontcdn-cms/sdk-8.2.🤖 Generated with Claude Code