feat(framework): run the --serve verification in a Docker sandbox (#229)#277
Merged
Conversation
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.
Closes #229 (first slice).
Today
framework --serve ...boots the generated app on the host to verify it runs. This adds--sandbox dockerso that verification happens inside a throwaway container instead: the source is copied in, deps install and the dev server run in the container, and the health check hits a mapped port. Agent-authored code never installs or runs on the host to be checked.--sandbox local(default) is unchanged (adopts the host cwd in place).Scope, per the issue's suggested first slice: only the serve verification is sandboxed. The build itself (Claude Code) still runs on the host, so the container is re-seeded with the latest host source before each check (each pass changes it). Sandboxing the build is the larger next step.
How it fits the existing seam:
serveCheck.snapshotWorkspace(cwd)reads the host workspace into a FileTree (skips node_modules/.git/dist/etc., binaries, oversized files) to seed the container — the Docker analog ofLocalRunner.adopt.runFrameworkgainssandbox?: 'local'|'docker'and an injectablerunner?(advanced/testing seam).--sandbox dockerwithout--serveis a no-op note.Verified end to end against a real daemon (Docker 29.6): a tiny server boots and serves inside the container and the gate passes (
productionGrade). The docker e2e test is guarded bydockerAvailable()so CI without a daemon skips it. 144 framework tests green.One naming call for you (like LoopEngine/DomainPreset before): I named the flag
--sandbox(forward-looking — it will also govern the build once that is sandboxed), even though in this slice it only wraps the serve check. Happy to rename to something serve-scoped if you'd rather.