Repository navigation
Conversation
Vite's SSR build extracts CSS files into the worker output directory, but these are only needed on the client side. Including them in the worker upload causes Cloudflare to reject the deploy with a SyntaxError when it tries to parse CSS as JavaScript. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cpojer
pushed a commit
that referenced
this pull request
Sep 11, 2026
…host metadata (#132) P0 prod hotfix. PR #131's cross-script DO host architecture was 100% broken for sandbox deploys: every user-worker PUT was rejected by CF with `DURABLE_OBJECT_NOT_CONTAINER_ENABLED`. Root cause: putSandboxHostScript's metadata omitted the `containers: [{ class_name: 'Sandbox' }]` declaration. CF requires the script that OWNS a DO class to declare it as container-enabled — without that, cross-script DO bindings to that class are rejected. Fix: * Add `containers: [{ class_name: 'Sandbox' }]` to host metadata in the base object (applies to both first-create and re-PUT branches of the migration_tag protocol). Tells CF the Sandbox class is container-backed; the actual container app is still POSTed via the /containers/applications API. * Hoist `putSandboxHostScript` to run UNCONDITIONALLY at the start of `provisionSandboxHost` (after lock + status check, before resource lookup). The PUT is idempotent (migration_tag preserves namespace), and ensures host-metadata fixes propagate to existing tenants on their next deploy. The cached fast path can short-circuit the namespace lookup + container POST as before; only the host PUT becomes mandatory. * Drop redundant putSandboxHostScript call from create-or-recover branch. * Drop the redundant host-script HEAD check in verifyAndReconcileCached (we just PUT it). The live binding probe stays — still validates external host delete + recreate. Mock CF API hardening: helpers.ts now rejects user-worker PUTs that have a cross-script DO binding (script_name set) when the referenced host's last-PUT metadata.containers does NOT contain a matching class_name. Mirrors CF's actual validation; would have caught this regression in tests had it been in place. CF-shaped error envelope with code 10103 and the literal `DURABLE_OBJECT_NOT_CONTAINER_ENABLED` message. Tests: * Unit #2/#3: assert ONE host PUT (was zero), body OMITS migrations (tag preserved), INCLUDES containers signal. * Unit #4 retitled — with always-PUT, cached fast path now succeeds. * Unit #9/#10/#10b: assert containers signal present in BOTH migration_tag branches. * Integration #2/#3: assert ONE host PUT per redeploy, no namespace rotation, no container POST/DELETE/PATCH on unchanged-config redeploys. * Integration #12: seedHostScript now includes containers metadata so the success-path sanity check survives the new mock validation. Verification: pnpm check / lint / fmt --check all clean. Unit sandbox-host: 20/20. Integration api-sandbox: 11/11 + 1 skipped. api-deploy + api-delete: 169/169 unchanged. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
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
.cssfiles when collecting worker modules inpackageBuildandpackageFrameworkBuilddist/<worker>/assets/*.css), but these files are only needed on the client sideSyntaxError: Unexpected token '.'(CSS parsed as JS)Test plan
dist/client/assets/, unaffected)🤖 Generated with Claude Code