fix(web): read committed .deco snapshots so CMS works without dev server#4630
Open
guitavano wants to merge 3 commits into
Open
fix(web): read committed .deco snapshots so CMS works without dev server#4630guitavano wants to merge 3 commits into
guitavano wants to merge 3 commits into
Conversation
guitavano
force-pushed
the
guitavano/decofile-schema-fallback
branch
from
July 15, 2026 22:24
abedce1 to
65b677a
Compare
Read the committed `.deco/blocks.gen.json` (decofile) and `.deco/meta.gen.json` (live meta) straight from the working tree via the daemon file-read proxy, so the Content tab shows and is editable even before the dev server boots or when the dev script has crashed (block writes already persist to the FS). The live `/.decofile` + `/live/_meta` routes still take over once the dev server is up (re-invalidated on the lifecycle `running` transition). Also fixes `stripLineNumbers`, which used a `(.*)` capture whose `.` does not match `\r`, U+2028, or U+2029 — a single-line JSON payload with an embedded line separator was silently truncated at the first such char, corrupting large files (e.g. an 11MB decofile cut in half). Switched to a prefix-only `replace` that preserves the rest of each line verbatim. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Stop gating the preview's decofile/meta fetch on `devServerReady` so the URL-bar page list and global-sections dropdown read the committed `.deco/*.gen.json` snapshot when the dev server is down (page create + SEO edits persist to the FS). The inline visual editor still requires the dev server — it overlays the page rendered inside the iframe — but its activate postMessage is a no-op without a rendered page, so nothing breaks. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…is down
When the dev server is paused/crashed the lifecycle phase is `crashed` ("was
running, stopped responding"), which `resolveBlocksTabState` treated as a hard
sandbox error — so the Blocks form editor was unavailable even though the
committed `.deco/*.gen.json` is still readable and block edits persist to the
FS (same as the Content tab). Treat `crashed` like `running` and let the data
drive the state, and stop gating BlocksPanel's decofile/meta fetch on
devServerReady so it reads the committed snapshot. The live preview canvas
stays broken until the dev server is back; genuine setup failures
(clone/install/start-failed) remain terminal errors.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
guitavano
force-pushed
the
guitavano/decofile-schema-fallback
branch
from
July 16, 2026 12:09
65b677a to
caf2f49
Compare
hugo-ccabral
approved these changes
Jul 16, 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.
Summary
Makes the Content tab (CMS) available and editable without a running dev server, by reading the committed
.deco/snapshots straight from the sandbox working tree, and fixes a latentstripLineNumbersbug that was silently truncating large file reads.CMS without the dev server
useDecofile/useLiveMetanow read the committed.deco/blocks.gen.json(decofile) and.deco/meta.gen.json(live meta) via the daemon file-read proxy (/read) when the dev server is down, falling back to it even when the route errors (crashed dev script). The live/.decofile+/live/_metaroutes still win once the dev server is up.KEYS.decofile/KEYS.liveMeta): the committed snapshot seeds it, so the existing optimistic block writes (which already persist to the FS via/write+/unlink) operate on a full base.runningtransition, the CMS queries are re-invalidated so they swap from the committed snapshot to the live routes.content-browserpassesfetchEnabled: devServerReadyso it prefers committed while the dev server is down.stripLineNumberstruncation fixThe daemon's
/readreturns line-number-prefixed content.stripLineNumbersused a(.*)capture whose.does not match\r, U+2028, or U+2029. A single-line minified JSON payload with an embedded line separator (common in pasted rich-text content) was truncated at the first such char — an ~11MB decofile was cut in half, breakingJSON.parse. Switched to a prefix-onlyreplacethat preserves the rest of each line verbatim. This also fixes the same latent corruption in the file explorer.Testing
tsc,lint,fmtclean..deco/blocks.gen.jsonnow parses fully and the Content tab appears (diagnosed via temporary logging, since removed).Notes / known limits
/read, so the tab won't show until resume — separate follow-up (read committed files from git directly).blocks.gen.json, which the dev server regenerates; while the dev server is down, a reload won't reflect just-written blocks until it regenerates.🤖 Generated with Claude Code
Summary by cubic
Make the CMS Content and Blocks editors, plus the preview URL-bar pages/global list, work without the dev server by reading committed
.decosnapshots. Also fixes a file-read bug that could corrupt large JSON files.New Features
.deco/blocks.gen.jsonand.deco/meta.gen.jsonwhen the preview is down or live routes fail; used for the Content tab, Blocks editor, and Preview URL-bar lists before the dev server is up.readCommittedJson;useDecofile/useLiveMetaprefer committed data untildevServerReady, and the lifecyclerunningtransition now invalidates queries to swap to live routes.crashedas recoverable so the Blocks editor stays available; ungated fetch params in Blocks panel and Preview while keepingfetchEnabled: devServerReadyfor live routes.Bug Fixes
stripLineNumbersnow uses a prefix-onlyreplaceto avoid truncating lines with\r, U+2028, or U+2029`, fixing corruption in large files.Written for commit caf2f49. Summary will update on new commits.