Repository navigation
Conversation
…ever reused Migration 235 adds org_sites.project_id (unique, ON DELETE SET NULL) and linked_at, backfills the single project per slug (metadata.siteSlug, then title; ambiguous/none left unlinked and counted), and turns the org FK into ON DELETE SET NULL so deleting an org leaves an unclaimable tombstone. The port gains getByProject/link with typed refusals; claim/reassign/release refuse tombstones and slugs a project has used. Project reads overlay the linked slug onto metadata.siteSlug; every write path (virtual MCP update, connections update on a project row, VirtualMCPStorage.update) refuses changing a site slug. Create links the imported slug once. Project settings show the site id read-only; deployment admin can't remove or move a used slug. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
…only relink Review follow-ups for the org_sites ↔ project link: - Migration 235 plans the backfill with reads only, then takes the ALTER locks under a 5s lock_timeout and applies the plan in batched set-based UPDATEs (a project deleted since planning is skipped, not an FK error). The org FK is added NOT VALID then validated. - Every pre-existing slug is marked used (linked_at = created_at when no project was linked): each is a real public site, so it is never released or moved to another org. - The title fallback only links repo-backed projects (frozen hasClonableSource), never a chat-only agent named like the site. - down() refuses while tombstones exist instead of silently freeing them. - A used slug whose project is gone (or that predates the link) is linked to another project only by a deployment admin (POST /api/admin/orgs/:orgId/sites/:slug/link). - COLLECTION_CONNECTIONS_UPDATE pins a legacy title slug on rename; patchMetadata refuses siteSlug; experiments refuse tombstoned slugs; the admin project list prefers the linked project; project settings show a repo-backed legacy project's title slug read-only. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
…backfill Per the PO decisions on #7796: - After a project is deleted, the same org links its used slug to another of its projects through the normal link path (linked_at keeps the first use). Another org, or a tombstone, is refused (not_owned / reserved); cross-org moves are done by operators in the DB. - Remove the deployment-admin POST /api/_admin/orgs/:orgId/sites/:slug/link endpoint, the link adminOverride and the relink_requires_admin code. - Migration 235 backfill links only an exact metadata.siteSlug match within the org; the title-based match is dropped, everything else stays unlinked. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Adds a JSON encoder/decoder whose number formatting and string escaping match JSON.stringify exactly, so content the daemon writes is byte-identical to what deco serve writes. The tests are the spec. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Maps block keys to file names with encodeURIComponent parity and resolves the spellings a key may have on disk; adds the protocol's error codes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
A content store over the sandbox working tree: contained to the tree, writes under a commit lock, durable writes and rollback on failure. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Refuses plaintext in v8 Secret fields and validates ciphertext shape; the v7 secret loader stays exempt. Its unit tests (secrets_test.go) land in the next PR, because they also cover servablePublicKey from methods.go. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
…, blocks.apply) The content-protocol JSON-RPC handler: envelope and batch handling, the four methods, blocks.apply ifMatch and retry, and request body limits. Also adds secrets_test.go (the secret guard from the previous PR plus describe's servablePublicKey). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Asset uploads with name sanitizing, plus HTTP-level tests for the store, secrets, RPC and uploads. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Mounts the content protocol and asset uploads on the daemon behind its auth, and adds worktree.Lock.AcquireWithin so a write never lands after its client gave up. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Runs the published @decocms/blocks content-protocol conformance suite against the real Go daemon (its /_sandbox/rpc and /assets routes), and adds @decocms/blocks as a sandbox devDependency for it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
… schema.get, blocks.list) The content-protocol JSON-RPC handler skeleton: envelope and batch handling, request body limits, and the three read methods with their parameter validation. Also adds secrets_test.go (the secret guard from the previous PR plus describe's servablePublicKey). blocks.apply and the write paths follow in the next PR. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig # Conflicts: # packages/sandbox/daemon-go/internal/content/handler.go # packages/sandbox/daemon-go/internal/content/methods.go # packages/sandbox/daemon-go/internal/content/params.go # packages/sandbox/daemon-go/internal/content/params_test.go # packages/sandbox/daemon-go/internal/content/rpc.go
Main took migration numbers 235 and 236, so the org-sites link migration moves to 237 (file, test, index key, actor and log strings). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
One PR for the sandbox daemon content protocol, at the base of the v8 stack. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
|
CI dispatched on
Local checks: |
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
|
@decocms/blocks 8.1.0 is released (npm |
Project assets (hosted and sandbox) go to Studio's file storage, not the
working tree; uploading to the filesystem is only for `deco serve`. The
daemon now serves just the content protocol (`/_sandbox/rpc`), and
describe reports `assets: null`, so editors upload to Studio's storage.
Removes `PUT /_sandbox/assets/{name...}`, its handler, the FS store's
upload folder and the asset tests (unit, conformance endpoint, parity).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
|
Superseded: the content protocol runs in Studio's backend over the daemon's existing fs routes (apps/api/src/sandbox/content-storage.ts, in #7878 @ 3a3b453). packages/sandbox is now identical to main; the conformance + parity suites run against the Studio route over the real main daemon in the Sandbox workflow. 🤖 Generated with Claude Code |
The sandbox daemon now speaks the Deco content protocol over the working tree. The site editor can then edit a v8 (Blocks) site running in a sandbox the same way it edits a local
deco serve. It is a Go port of@decocms/blocks/protocol.PO decision, 2026-10-13: "Uploading directly to the fs should be done only on /site-editor play mode. Hosted mode (with a project etc) should use our s3 service, and sandbox has nothing to do with it." So the daemon takes no asset uploads:
describereportsassets: null, and a sandbox session uploads to Studio's existing S3 asset service (POST /api/:org/file-configs/:id/upload,assets.decocms.com/<site>/…), like a hosted project. The upload route this PR used to add (PUT /_sandbox/assets/{name...}, was #7818/#7819) is gone (d6d03a7). This PR adds exactly one route:/_sandbox/rpc.What it adds
All new code is in
packages/sandbox/daemon-go/internal/content/plusinternal/routes/content.go:jsjson.go): number formatting and string escaping matchJSON.stringify, so the blocks the daemon writes are byte-identical to the onesdeco servewrites.golang.org/x/textmoves from an indirect to a direct requirement. (was feat(daemon): JS-exact JSON for the content protocol #7812)keys.go,errors.go): block keys map to file names withencodeURIComponentparity, the daemon finds every spelling a key may have on disk, and the protocol error codes are defined here. (was feat(daemon): block keys/file names and protocol errors #7813)fsstore.go): reads and writes<app root>/.deco/blocks/*.json. Nothing can escape the tree. Commits take a cross-process lock (.deco/.blocks.lock), stage through.deco/.tx-*, and are durable and rolled back on failure. (was feat(daemon): filesystem content store over the working tree #7814)secrets.go,ciphertext.go): plaintext is refused in v8Secretfields and ciphertext must have the right shape. The v7 secret loader stays exempt. (was feat(daemon): secret guard and ciphertext checks #7815)rpc.go,handler.go,methods.go,params.go): envelope and batch handling, body limits, anddescribe,schema.getandblocks.list(withifNoneMatch). (was feat(daemon): content-protocol RPC router and read methods #7847)blocks.applywith normalization, static and schema validation,ifMatch, the commit plan and retry with backoff, plus theOnCommithook. (was feat(daemon): content-protocol blocks.apply and write paths #7817)describereportsassets: null. The asset handler from feat(daemon): asset uploads + handler tests #7818 was removed (see the PO decision above).main.go,routes/content.go):/_sandbox/rpcsits behind the daemon token (d.authed).worktree.Lock.AcquireWithinis a bounded wait: if the client has already given up, the write never lands. (was feat(daemon): mount /_sandbox/rpc and /assets; bounded tree-lock wait #7819)daemon-e2e/daemon.content-protocol.e2e.test.ts): runs the published@decocms/blocksconformance suite (its asset cases skip, sincedescribe.assetsis null) and a byte-for-byte parity check against the real daemon binary (the reference server reportsassets: nulltoo).@decocms/blocksis added as a sandbox devDependency; the only other change outsidepackages/sandbox/**is the matchingbun.lockhunk. (was test(daemon-e2e): content protocol conformance against the daemon #7820)Why one PR
The PO asked to release the hard-to-roll-back pieces first, at the base of the stack: #7796 (the
org_sitesmigration), then this PR (the sandbox image). Everything else stacks on top. Shipping the daemon as one unit means one image bump and one revert if needed. The same code was already reviewed commit by commit in the folded PRs. Their history is kept in this branch, which is a normal merge ofsplit/19-daemon-e2e-conformance.Additive only
The PO's requirement is that the daemon only adds APIs and never removes or changes existing ones. Everything was checked against
origin/main(21912beaf), whosepackages/sandboxis identical to this PR's base.1. HTTP routes. I diffed every
mux.HandleFunc/Handleregistration withgrep -rhoE '(HandleFunc|Handle)\([^,]+' --include='*.go' --exclude='*_test.go'. Main has 31 and this branch has 32 (re-checked @ d6d03a7; the only diff line isHandleFunc(method+" "+pre+"/rpc"). The new one sits insideregisterSandboxRoutes, prefix/_sandbox:/_sandbox/rpcd.authed(daemon token)/_sandbox/catch-all: 404Not found/_sandbox/assets/*is not registered: it still falls through to the authed 404 catch-all, as on main.No existing registration was removed or changed (path, method, wrapper and handler are all the same). The new path doesn't collide with any fs route name (
read write unlink mkdir rename edit grep glob bash), andOPTIONSpreflight still goes to the existingcorsPreflight. The only observable change: an authed request to/_sandbox/rpcused to get a 404 and now reaches the content protocol. Unauthenticated requests are refused exactly as before.2. Exported Go API.
apidiffskipsinternal/packages, which is all of this module, so I dumpedgo doc -allfor every package on both sides and diffed the dumps. 0 lines removed or changed. Lines added:internal/content: a new package.internal/routes:type Content,type ContentDeps,func NewContent(ContentDeps) *Contentand(*Content).RPC. All live in a new file,routes/content.go.internal/worktree:func (l *Lock) AcquireWithin(d time.Duration) (release func(), ok bool).Acquire()is unchanged.The only pre-existing Go files touched are
internal/worktree/lock.go, which gainsAcquireWithinand atimeimport, andmain.go. Inmain.gothe diff is additions only (no-line): one field is added to the unexportedsandboxHandlersstruct, the loop above registers the route, andmain()buildsroutes.NewContentfrom the existingrepoDir,d.store,d.treeLockandfsDeps.OnWorkingTreeWrite.3. Config, env and flags. I extracted every
os.Getenv/os.LookupEnv/flag.*call: 24 on each side, identical.internal/contentandroutes/content.goread none, and there are no new CLI flags or config fields.4. Behaviour of existing code paths. No diff hunk modifies the body of a pre-existing function, except the
registerSandboxRoutesregistrations and themain()wiring listed above. Specifically:treeLockis still taken the same way by fs and git routes. The new code takes it only throughAcquireWithin, and only for a content commit..git/info/excludeentries (/<app>/.deco/.blocks.lock,/<app>/.deco/.tx-*/) are added lazily, the first time a content route is used. They are never added at boot./_sandbox/decofile(v7) is unchanged. It reflects protocol writes because they're real working-tree writes reported through the existingOnWorkingTreeWritehook.routes,gitx, …) pass unchanged.Commands (run from
packages/sandbox/daemon-go, withmainextracted viagit archive origin/main packages/sandbox/daemon-go):Rollout and rollback
/_sandbox/rpcagain.Tests
go vet ./...: clean.go test -p 1 ./...andgo vet ./...inpackages/sandbox/daemon-go: all packages pass, run locally @ d6d03a7 (earlier tree:-racetoo).bun install --frozen-lockfile: passes.daemon-e2e304 pass, 0 fail (305 tests, 16 files). The stack top (split/51, which contains this) also passed Checks & Unit Tests, E2E and Sandbox.daemon-e2e(305 e2e tests across 16 files, including the content-protocol conformance) anddocker-smoke.Stack
#7796 (base,
org_sitesmigration) → this PR (sandbox daemon) → API track (#7800 …) / web track (#7803 …) → e2e (#7841 → #7842 → #7843) → #7871 – #7876.🤖 Generated with Claude Code
https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig