Skip to content

feat(sandbox): regenerate blocks.gen.json in the Go daemon's /read when absent - #5687

Merged
guitavano merged 2 commits into
mainfrom
feat/go-decofile-read-fallback
Aug 4, 2026
Merged

guitavano merged 2 commits into
mainfrom
feat/go-decofile-read-fallback

Conversation

@guitavano

@guitavano guitavano commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Restores the on-the-fly .deco/blocks.gen.json merge in the Go daemon's /read endpoint — the behavior that lets the CMS/Blocks UI render without a committed blocks.gen.json while the dev server is still booting (or crashed).

.deco/blocks.gen.json is the runtime's merge of every .deco/blocks/*.json. Most repos gitignore it (multi-MB single line, regenerated on dev cold-start), so a fresh sandbox has the block sources but not the merged file. The web CMS reads it through the daemon's /read proxy (readCommittedJson → use-decofile), so it must be readable before the dev script is up.

Why it regressed

This is a Go-only restore, independent of the pull-based Fast Preview work in #5363 (which adds a separate dedicated GET /_sandbox/decofile route + SSE, but does not restore the /read fallback the existing web consumer relies on).

Changes

  • internal/decofile/merge.go — GenerateFromBlocks / GenerateFromBlocksDeduped: deterministic, byte-spliced merge keyed by the decode-until-stable filename stem (fixes the double-encoded-stem bug the old decode-once path had), single-flight coalesced so concurrent cold reads share one multi-MB build.
  • internal/routes/fs.go — Read falls back to the merge only when the absent path's basename is blocks.gen.json; every other absent file still 400s.

Testing

  • go vet ./..., go test -race ./... ✅ (added merge_test.go: sort order, decoded keys, skip empty/non-json, double-encoded stems, dedup).
  • New black-box e2e daemon.decofile.e2e.test.ts ✅ (synthesizes when absent, decodes stems, still 400s for a genuinely-absent file / non-decofile path).
  • Core fs e2e suite (114 tests) still green — no /read regression.

Affected areas

Sandbox daemon /read; the web CMS decofile snapshot path (use-decofile / readCommittedJson).

🤖 Generated with Claude Code


Summary by cubic

Restores on-the-fly generation of .deco/blocks.gen.json in the Go daemon /read when missing so the CMS/Blocks UI loads before the dev server boots. Fallback is limited to blocks.gen.json and only for relative paths.

  • New Features
    • Rebuilds blocks.gen.json from .deco/blocks/*.json when absent.
    • Security: only handles relative requests; absolute paths still 400.
    • Deterministic merge: files sorted; stems percent-decoded until stable; skips empty/non-JSON.
    • Single-flight coalescing with safe cleanup; returns kind: "text" with no line numbers.

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

Review in cubic

…en absent

`.deco/blocks.gen.json` is the runtime's merge of every `.deco/blocks/*.json`;
most repos gitignore it (a multi-MB single line that conflicts on every content
PR and is regenerated on dev cold-start), so a fresh sandbox has the block
sources but not the merged artifact. The web CMS reads it via the daemon's
/read proxy (readCommittedJson -> use-decofile) so the Blocks UI is editable
before the dev server boots.

The TypeScript daemon synthesized this merge on the fly in /read (added in
#5084) but the behavior was dropped when that daemon was deleted (#5575) and
never ported to Go — so on main today /read 400s and the CMS shows "decofile
unavailable" until the dev server is up. Restore it in Go:

- decofile.GenerateFromBlocks / GenerateFromBlocksDeduped: deterministic,
  byte-spliced merge keyed by the decode-until-stable filename stem (fixes the
  double-encoded-stem bug the old decode-once path had), single-flight
  coalesced so concurrent cold reads share one multi-MB build.
- fs.Read falls back to the merge only when the absent path's basename is
  blocks.gen.json; every other absent file still 400s.
- Go unit tests for the merge + a black-box daemon-e2e spec.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@github-actions github-actions Bot added the claude PR authored by a coding agent label Aug 4, 2026
Addresses a multi-perspective review of the fallback:

- security: gate the fallback on a relative path. An absolute body.Path
  bypasses SafePath, so allowing it would turn the merge into an arbitrary
  sibling-blocks/ directory glob; the CMS only ever sends relative paths.
  Proven by a routes unit test that points an absolute path at the real repo's
  gen artifact and asserts it still 400s while the relative form merges.
- robustness: defer the singleflight cleanup so a panic in the merge can't
  leave a stale in-flight entry that wedges every future reader of that dir.
- testing: cover the riskiest path — pretty-printed multi-line blocks round-
  tripping through the consumer's stripLineNumbers (inlined in the e2e, unit-
  asserted no merged line starts with a line-number prefix) — plus a concurrent
  -race test for the coalescer.
- cleanup: unexport generateFromBlocks (only the deduped wrapper calls it),
  splice via bytes.TrimSpace to drop a per-block string copy, and broaden the
  package doc to cover generation alongside validation.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Comment on lines +25 to +28
// Inlined copy of the web consumer's stripLineNumbers (read-committed-file.ts →
// file-explorer/utils.ts): strips a leading `^\d+\t` from every `\n`-split line.
// The e2e can't import app code (ban-e2e-app-imports), so it owns this contract
// — a divergence from the real consumer is a wire-contract regression signal.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment that takes a paragraph to justify a workaround is a signal the code is wrong, not the comment — fix the code, don't explain it away (CLAUDE.md).

Comment on lines +61 to +62
// The consumer strips a leading `^\d+\t` per line; the payload must not
// carry one, so JSON.parse of the (no-op) stripped content still works.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment that takes a paragraph to justify a workaround is a signal the code is wrong, not the comment — fix the code, don't explain it away (CLAUDE.md).

Comment on lines +67 to +70
// Blocks are written to disk pretty-printed (JSON.stringify(data, null, 2)),
// so the merged blob is multi-line. The real consumer always does
// JSON.parse(stripLineNumbers(content)) — exercise that exact path, not a
// bare JSON.parse, so a regression that re-numbers this response is caught.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment that takes a paragraph to justify a workaround is a signal the code is wrong, not the comment — fix the code, don't explain it away (CLAUDE.md).

@guitavano
guitavano merged commit 2c51acd into main Aug 4, 2026
24 checks passed
@guitavano
guitavano deleted the feat/go-decofile-read-fallback branch August 4, 2026 19:40
decocms Bot pushed a commit that referenced this pull request Aug 4, 2026
PR: #5687 feat(sandbox): regenerate blocks.gen.json in the Go daemon's /read when absent
Bump type: minor

- @decocms/sandbox (packages/sandbox/package.json): 1.38.0 -> 1.39.0
- deploy/helm/sandbox-env (chart 0.10.12) (deploy/helm/sandbox-env/values.yaml deploy/helm/sandbox-env/Chart.yaml): image.tag/appVersion -> 1.39.0

Deploy-Scope: both
tlgimenes added a commit that referenced this pull request Aug 5, 2026
Resolves conflicts against main's independent decofile/read fallback
(PR #5687, landed while this branch was in flight):

- Drop this branch's now-redundant blocks.gen.json /read fallback in
  fs.go/fs_test.go — main's internal/decofile package supersedes it
  (adds an absolute-path security guard this branch's version lacked).
- Refactor routes/decofile.go's GET /_sandbox/decofile handler (this
  branch's own addition, not present on main) to reuse main's
  internal/decofile.GenerateFromBlocksDeduped instead of carrying a
  second copy of the same merge algorithm.
- Trim routes/decofile_test.go to the handler-level tests; the
  merge-algorithm tests are now covered by internal/decofile/merge_test.go.
- Merge both branches' daemon.decofile.e2e.test.ts (same filename,
  disjoint coverage: this branch's GET /_sandbox/decofile route tests
  and main's /read fallback tests) into one file, both describe blocks
  intact.
- build-config-payload.ts: drop a stray, field-less doc comment this
  branch had left behind; keep main's cloneOnly addition as-is.

Verified: go build/vet/test all green in daemon-go, cargo check green
in apps/native's local-api (untouched by the conflicting commits),
bun run check green across every workspace, and the full
packages/sandbox bun test suite green after rebuilding the e2e
daemon binary main's new source touches.
tlgimenes added a commit that referenced this pull request Aug 5, 2026
…uplicate merge

Main's PR #5687 landed an equivalent (better-hardened: absolute-path
guard, deferred singleflight cleanup) blocks.gen.json /read fallback
independently while this branch was in flight, in a new
internal/decofile package. Rather than carry two copies of the same
merge algorithm, point routes/decofile.go's GET /_sandbox/decofile
handler at decofile.GenerateFromBlocksDeduped instead of its own
generateDecofileFromBlocks/decodeUntilStable. Trims
routes/decofile_test.go to the handler-level tests — the merge
algorithm itself is now covered by internal/decofile/merge_test.go.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
tlgimenes added a commit that referenced this pull request Aug 5, 2026
… paths

Byte-parity gap against the Go daemon: main's #5687 added an
absolute-path guard to the Go fallback (resolveReadPath passes an
absolute path through unclamped by design, so without the guard the
merge becomes an arbitrary sibling-blocks/ directory glob) but the Rust
local-api port carried the same unguarded fallback since it predates
that hardening. resolve_read_path has the identical unclamped-absolute
behavior (see its own doc comment / resolve_read_path_passes_absolute_
through_unclamped test), so the same gap applied here too.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
tlgimenes added a commit that referenced this pull request Aug 5, 2026
* feat(cms): Fast Preview — render the draft via the sandbox daemon

Adds Fast Preview: render the current working-tree draft against the linked
site's production `/live/previews` WITHOUT waiting for (or using) the dev server.

- New agent-settings CMS section: Preview (production/preview URL + Fast Preview
  switch) + Publishing (extracted PublishPolicyField). Copy in en + pt-br.
  `metadata.fastPreview` added to the schema.
- Rendering goes through a new PUBLIC daemon route `GET /_deco/fast-preview`
  (packages/sandbox/daemon): merges `.deco/blocks/*` (dep-free, no dev server),
  POSTs it server-side to `${productionUrl}/live/previews/<component>` (which
  already accepts a JSON `__decofile` body — no production change, no CORS, no
  URL cap), and returns the HTML with an injected `<base href>` so assets resolve
  against production.
- `productionUrl` threaded to the daemon config (Workload → SANDBOX_START →
  buildConfigPayload / link-daemon → daemon `Application.productionUrl`).
- Web: the Fast Preview frame loads the daemon route (`previewUrl` origin) via
  `buildFastPreviewDaemonUrl`. Fast Preview NEVER renders the published site — it
  shows the daemon draft or a booting overlay while the sandbox provisions.
- Save → refresh: on a `.deco/*` write the daemon emits `file-changed`; the
  events gate is relaxed for Fast Preview and the handler bumps a nonce (new
  daemon URL → the frame re-navigates → the daemon re-reads the saved blocks). No
  decofile refetch (the daemon reads disk; refetching could revert an optimistic
  edit).
- URL bar follows the iframe domain (buildPreviewLabel); open-in-new-tab hidden
  off the sandbox surface.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(cms): render Fast Preview without waiting for the dev server

Fast Preview renders the draft from the sandbox daemon, which is up shortly
after the clone — but the preview still sat behind a blocking overlay until
the dev server reported `running`, i.e. through the whole install. That is
precisely the wait the feature exists to skip.

Three causes, all upstream of the display decision:

- `previewUrl` (the daemon origin) was read only from the entity's
  `sandboxMap`, a collection query with a 60s staleTime whose only
  lifecycle-driven invalidation fires at `running` — even though
  SANDBOX_START already returns it at claim time. Seed it from the claim
  response, key-scoped to `virtualMcpId::branch` so a stale claim can never
  paint another branch's sandbox, and dropped on a terminal claim failure so
  the errored card still wins.

- The decofile (which supplies the page key) 502s while the repo is still
  cloning and is deliberately never retried, so nothing re-drove it until
  `running`. Re-invalidate when the daemon lifecycle first reaches a phase
  that guarantees a working tree (`installing` onward) — the read regenerates
  `.deco/blocks.gen.json` from `.deco/blocks/*.json` with no dev server.

- With neither input, the canvas fell to a blocking overlay. Fast Preview now
  shares main's published-site fallback: the published site plus the waking
  pill hold the canvas until the draft render is renderable, then it swaps
  in. Fast Preview no longer changes which surface is shown, only when it is
  ready — the draft after the clone, versus the dev server at `running`.

`iframeBase` stays the published URL in every production-mode case so the
base is always navigable and the URL-bar label does not jump origins
mid-boot; the draft URL is layered over it.

Inverts the test that pinned the old blocking-overlay rule, and corrects the
`metadata.fastPreview` doc, which claimed the sandbox surface takes over for
interactivity once it is up — it never did.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* refactor(sandbox): move fast-preview under /_sandbox, add /_sandbox/decofile

Two changes to the daemon's public surface, both in service of pull-based
draft rendering.

`/_deco/fast-preview` moves to `/_sandbox/fast-preview`. The `/_deco` prefix
was a one-route namespace with no stated contract, and it shadowed the proxied
dev server — a storefront serving its own `/_deco/*` would have been silently
intercepted. `/_sandbox` already has a public, unauthenticated tier
(`/events`, `/scripts`, `/idle`) that the browser talks to directly, which is
exactly where a browser-loaded iframe route belongs; `entry.ts` matches it
ahead of the bearer-token gate for the same reason `/events` is.

`GET /_sandbox/decofile` is new: it serves the merged working-tree
`.deco/blocks/*` so a production site can PULL the draft and render its own
real pages against it, instead of the daemon POSTing a multi-MB decofile into
`/live/previews`. That push model only works on deco's own runtime — Next.js
and most frameworks render on GET only — and it re-sent the whole payload on
every navigation. The response is content-addressed (weak ETag over the merged
bytes, 304 on match) so callers cache per version and re-fetch only when the
draft actually changes.

Returns the merged object as raw text, no JSON.parse round-trip: this payload
is routinely >3MB and the daemon runs a single-threaded event loop.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(cms): make Fast Preview display inputs optional

Match `foreignSandbox`: a caller that knows nothing about Fast Preview gets
exactly the pre-existing behaviour, so tests and call sites added on main
don't have to thread flags they don't care about.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* feat(sandbox): announce the draft decofile version on the events stream

Studio needs the draft's content version to build a pull-based preview pointer
(`<handle>@<version>`), and polling for it would mean re-fetching a multi-MB
payload just to read its hash.

The daemon now emits `decofile: { version }` when a `.deco/blocks/*.json` write
lands, so Studio can rebuild the pointer on save instead. The version comes
from `readDecofile`, the same function the route serves as its `ETag` — one
definition, so a consumer's pointer and the framework's cache key cannot
disagree.

Kept off the hot path deliberately: only `.deco/blocks/*.json` writes trigger
it, it runs after the existing 300ms file-changed debounce (a burst of saves
costs one merge), the merge is async and deduped, and an unchanged hash
re-emits nothing. A failed probe warns and is swallowed rather than taking the
watcher down.

Adds a black-box e2e for the route: 404 with no blocks, merged body + content
ETag + no-store, unauthenticated access, ETag stability vs change, and the
304/200 revalidation pair.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* feat(cms): point Fast Preview at the site's real page via ?__draft

Studio now sends the iframe to the REAL page on `productionUrl` carrying a
`?__draft=<handle>@<version>` pointer, which the site's framework resolves by
pulling the merged working-tree decofile from `/_sandbox/decofile`. The daemon
no longer renders anything.

Why the push model had to go: it POSTed the decofile to `/live/previews`, which
only deco's own runtime honours — Next.js and most frameworks render on GET
only — and it could only ever produce a single statically-rendered component,
with no hydration and no navigation. Going through the site's own route fixes
all three.

The `currentPageKey` dependency disappears with it, and that is the interesting
part: the preview no longer waits on the decofile query at all. That query is
what used to strand the whole surface behind a cold-start 502 while the sandbox
installed, since it needed a page key just to build a URL. The site does its own
routing now.

`fastPreviewReady` is fed off the draft version instead. The version also
replaces the cache-busting nonce: a save emits a new version, which changes the
URL, which re-navigates the frame — so the reload handler yields in draft mode
rather than racing that with a stale URL.

Deletes the daemon's fast-preview route, and with it the `productionUrl` that
was threaded from Studio through the config payload to the daemon purely to
feed it. Nothing daemon-side reads it any more; Studio builds the URL itself.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* test(sandbox): cover the draft decofile route and version event

Six black-box cases against the spawned daemon: 404 with no blocks, merged
body + content ETag + no-store, unauthenticated access, ETag stability vs
change, the 304/200 revalidation pair, and the `decofile` version event.

The event test asserts the value it announces is the SAME one the route serves
as its ETag — that equality is the whole contract, since Studio puts it in a
draft pointer and the framework caches on it.

It writes through the daemon's own `/_sandbox/write` rather than straight to
disk. That is how the CMS actually saves a block, and it signals
`onWorkingTreeWrite` directly. A bare fs write depends on
BranchStatusMonitor's watcher, which `ensureWatch()` only starts after
`compute()` succeeds — i.e. once the repo is a real git checkout — so it never
fires in a bare workspace.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(sandbox): announce the draft version when the tree lands, not only on write

After a clone the preview stayed on "Starting your preview" forever, even
though the working tree — and therefore a renderable draft — was already on
disk.

`decofile: { version }` was emitted only from the file-changed path, i.e. only
when a `.deco/blocks/*.json` WRITE was observed. A clone doesn't write through
the daemon: git puts the files there, and BranchStatusMonitor's watcher only
starts once `compute()` succeeds, which is after the clone. So on a fresh
sandbox no version was ever announced, Studio never got one, `fastPreviewReady`
stayed false, and the waking pill never cleared.

Announce on the lifecycle transition into a phase that guarantees a checked-out
tree, so the initial version is published as soon as one exists. Writes keep
announcing subsequent versions as before, and the unchanged-hash guard means
the two paths can't double-emit.

`isWorkingTreeReadyPhase` moves into the shared daemon event types and Studio
imports it instead of keeping its own copy: the daemon uses it to decide when a
draft version exists, Studio to decide when to re-drive the CMS queries. Those
answers must agree, and two definitions would eventually disagree.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* feat(cms): restore open-in-new-tab on the Fast Preview surface

The button was gated to the sandbox iframe because the Fast Preview surface
was an ephemeral `/live/previews` render on the daemon origin — not a link
worth handing to anyone.

Pull-based draft preview removes that objection: the surface is now the site's
own page URL carrying `?__draft=<handle>@<version>`, so the opened tab renders
exactly the same draft. Ungate it.

Opens the page WITHOUT `deviceHint`. That param exists to make the embedded
frame mimic the selected device; it has no business in a URL someone pastes to
a colleague.

Also corrects the `iframeSrc` comment, which still described the daemon render
injecting a `<base href>` — there is no daemon render any more.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(sandbox): decode block filename stems until stable when merging

Real repos carry both single- and double-encoded block filenames
(`Compre%20Junto.json`, `Compre%2520Junto.json`). The decofile merge decoded
the stem exactly once, so a double-encoded file was keyed `Compre%20Junto` —
a key no `__resolveType` reference resolves, silently corrupting the merged
draft for any block whose name needed encoding twice.

Decode until the value stops changing, mirroring the frontend's documented
decodeBlockKeyFromFileStem fallback: single-encoded stems are unaffected, an
invalid-encoding stem keeps its last decodable form, and the e2e asserts both
encodings of the same name merge under the real key.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* feat(cms): emit the v2 draft token — the daemon origin's authority

The token becomes `<host[:port]>@<version>`, built from `previewUrl`'s
authority instead of a bare sandbox handle. The site validates the authority
against its configured preview-API domains and derives the scheme itself, so
the token still never carries a URL — and the desktop link's per-run port now
travels in the token, eliminating the suffix-override dance local dev needed.

Pairs with @decocms/blocks 7.28.0-beta.3 (token v2 + env renames).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(sandbox): replay the decofile version in the SSE connect handshake

Switching threads (or reloading, or a second viewer) opens a fresh events
stream long after tree-land announced the draft version — and `decofile` only
fired on transitions, so that client never learned it and Fast Preview sat on
"start your preview" forever. The handshake already replays lifecycle, logs,
scripts, tasks, status, and branch; now it replays the cached decofile
version too, and when none is cached (a daemon restarted over an
already-cloned tree) it asks the owner to compute + broadcast one — after
registering the client, so the announcement reaches it.

The live-announce e2e now asserts on a version that differs from the
pre-write state, since "a decofile event arrived" no longer distinguishes the
replay from the announce.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* feat(sandbox): port GET /_sandbox/decofile + decofile SSE event to Go and Rust

The rebase onto main dropped this branch's TypeScript daemon implementation
along with the rest of packages/sandbox/daemon/ (deleted in favor of the Go
daemon). Ports the final pull-based design — a content-addressed
GET /_sandbox/decofile route merging .deco/blocks/*.json with decode-until-
stable stems, plus a decofile SSE event with replay-on-connect — to both
runtimes that now need it:

- packages/sandbox/daemon-go: unauthenticated route (matches the daemon's
  existing /idle, /events, /scripts tier), singleflight-style merge
  coalescing, and the two announce triggers (blocks-path writes, working-
  tree-ready). Verified against the existing black-box e2e suite
  (daemon-e2e/daemon.decofile.e2e.test.ts) against the real built binary.
- apps/native/crates/local-api: same route, but guarded behind the existing
  /_sandbox auth middleware rather than left unauthenticated — loopback isn't
  reachable by an external production site, so byte-parity with the daemon's
  no-auth posture would only add unused attack surface. Also fixes a latent
  decode-once (vs decode-until-stable) bug in the pre-existing
  generate_decofile_from_blocks, shared with the blocks.gen.json read
  fallback.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(sandbox): merge .deco/blocks.gen.json on read in the Go daemon

Byte-parity gap left over from the TS→Go daemon migration: the deleted TS
daemon (and the Rust local-api) both fall back to merging `.deco/blocks/*.json`
when a read for `.deco/blocks.gen.json` 404s — repos commonly gitignore the
generated file, so a fresh worktree has the block sources but not the merged
artifact. The Go daemon's Read handler never got this fallback, so the CMS
reported "File not found" against a repo that plainly has its blocks.

Shares the merge/decode-until-stable logic already in routes/decofile.go
(extracted the basename/dirname constants there) rather than duplicating it.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* refactor(cms): reorganize the agent settings CMS section into Preview/Publishing/Editing

Splits the CMS settings card into three clearly labeled subsections —
Preview (preview server + Fast Preview), Publishing (existing policy picker),
and a new Editing section — and restyles every toggle row to match the
Layout section's established pattern (label+description left, control right,
single line, full-bleed dividers) instead of ad-hoc stacked/boxed layouts.

- Moves "Show field descriptions as tooltips" (relabeled "Compact
  descriptions") out of the Sandbox section into the new Editing subsection.
- Moves "Open CMS" (relabeled "Auto-open editor") out of the Layout tab into
  the same Editing subsection — it's a content-editing preference, not a
  layout one. Drops the now-dead cmsDefaultOpen plumbing from
  layout-tab-content.tsx.
- FastPreviewField and FieldDescriptionTooltipsField now share the same
  row markup (label+description in a min-w-0 column, switch shrink-0).

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* refactor(sandbox): reuse main's internal/decofile package, drop the duplicate merge

Main's PR #5687 landed an equivalent (better-hardened: absolute-path
guard, deferred singleflight cleanup) blocks.gen.json /read fallback
independently while this branch was in flight, in a new
internal/decofile package. Rather than carry two copies of the same
merge algorithm, point routes/decofile.go's GET /_sandbox/decofile
handler at decofile.GenerateFromBlocksDeduped instead of its own
generateDecofileFromBlocks/decodeUntilStable. Trims
routes/decofile_test.go to the handler-level tests — the merge
algorithm itself is now covered by internal/decofile/merge_test.go.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(cms): correct fastPreview's stale /live/previews doc after the pull redesign

The doc comment and schema .describe() on metadata.fastPreview still
described the pre-redesign push model (POSTing the decofile to
productionUrl's /live/previews), left over from before this branch
replaced it with the pull model (?__draft pointer + GET
/_sandbox/decofile). No functional change — this field was never wired
to /live/previews in code, only in its own documentation.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(sandbox): guard the Rust decofile /read fallback against absolute paths

Byte-parity gap against the Go daemon: main's #5687 added an
absolute-path guard to the Go fallback (resolveReadPath passes an
absolute path through unclamped by design, so without the guard the
merge becomes an arbitrary sibling-blocks/ directory glob) but the Rust
local-api port carried the same unguarded fallback since it predates
that hardening. resolve_read_path has the identical unclamped-absolute
behavior (see its own doc comment / resolve_read_path_passes_absolute_
through_unclamped test), so the same gap applied here too.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

---------

Co-authored-by: Deco Studio <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude PR authored by a coding agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant