Repository navigation
Better organize runtime modules - #841
Merged
Merged
Conversation
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://codex-organize-runtime-modules-void-cloud.voidzero-docs.workers.dev (commit db1a52c)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
Move runtime files with git mv without changing their contents. Keep import and packaging updates in the following commit so small entry files retain a clear rename history.
Update imports, generated-code paths, package exports, build entries and tests for the feature directories while preserving public import names. Share pure email pattern compilation and ordering between the filesystem scanner and runtime email test harness, and retain descriptive role names.
yangshun
force-pushed
the
codex/organize-runtime-modules
branch
from
November 16, 2026 03:47
3e60005 to
db1a52c
Compare
yangshun
marked this pull request as ready for review
November 16, 2026 04:05
This was referenced Nov 16, 2026
kossnocorp
added a commit
that referenced
this pull request
Nov 16, 2026
kossnocorp
added a commit
that referenced
this pull request
Nov 16, 2026
morinokami
added a commit
to morinokami/void
that referenced
this pull request
Nov 16, 2026
voidzero-dev#841 moved void/env from dist/runtime/env-public.mjs to dist/runtime/env/public.mjs. The transform's filter still matched only the old name, so the transform stopped running and Astro builds again copied private .env and build-shell values into the server output. - Match env/public.mjs in the filter. - Run the filter in the unit tests, and check that it matches the file void/env resolves to. - Replace the build-shell canary: void/env no longer names validatedCache, so that check passed without testing anything. The test now first checks that void/env names every canary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8F8mZTJoFUM6ZN2xrVDx9
kossnocorp
added a commit
that referenced
this pull request
Nov 17, 2026
kossnocorp
added a commit
that referenced
this pull request
Nov 17, 2026
cpojer
pushed a commit
to konaito/void
that referenced
this pull request
Dec 6, 2026
…dzero-dev#1059) The [Sandboxes guide](https://void.cloud/guide/sandboxes#run-a-command) starts with a route that runs a command, and says that importing from `void/sandbox` enables the required resources: ```ts // routes/api/sandbox.ts import { defineHandler } from 'void'; import { getSandbox } from 'void/sandbox'; export const POST = defineHandler(async (c) => { const sandbox = await getSandbox('default'); const result = await sandbox.run(['node', '--version']); return c.json({ exitCode: result.exitCode, stdout: new TextDecoder().decode(result.stdout), }); }); ``` An app with this route and no `sandbox.image` gets a default image that does not exist: | | 1.13.1 | This PR | | --- | --- | --- | | `vp build` | Exits 0 and records `node_modules/void/dist/sandbox.Dockerfile`, which does not exist | Records `node_modules/void/sandbox.Dockerfile`, the file the package ships | | `vp dev` | Stops before it serves anything: `ENOENT: no such file or directory, open '<app>/node_modules/void/dist/sandbox.Dockerfile'` | Builds the image and serves. The route answers `{"exitCode":0,"stdout":"v26.12.1\n"}` | | Image build of `void deploy --platform cloudflare` | `docker build` cannot read the Dockerfile, and the deploy says "Sandbox image preparation failed. Start Docker and retry the deployment." while Docker is running | Builds the image | `main` has the same code as 1.13.1 here. A deploy to a Void platform takes a different path: its manifest carries `sandbox.platformImage`, not the Dockerfile. `getDefaultSandboxImage()` finds the file relative to the `void/sandbox` entry, as `../../sandbox.Dockerfile`. 38db82c (voidzero-dev#841), first released in 1.10.0, moved that entry from `dist/runtime/sandbox.mjs` to `dist/runtime/sandbox/index.mjs`, so the same relative URL now ends in `dist/`. The default-image test checked only the file name. The deploy's message hid the cause. Every failed `docker build` of a Sandbox image got the "Start Docker" advice, also while Docker was running: | `docker build` | `main` | This PR | | --- | --- | --- | | Fails while Docker is running, for example on a missing Dockerfile | "Sandbox image preparation failed. Start Docker and retry the deployment." | "Sandbox image preparation failed: `docker build` exited with code 1 for \<Dockerfile\>. See the Docker output above." | | Fails because the daemon is not running | The same "Start Docker" message | Unchanged | | Is stopped by a signal | The same "Start Docker" message | "Sandbox image preparation failed: `docker build` was stopped by SIGTERM for \<Dockerfile\>." | | Cannot start, because the Docker CLI is missing | `spawn docker ENOENT` | "Sandbox image preparation failed: the Docker CLI could not be started (spawn docker ENOENT). Check that Docker is installed and retry the deployment." | ## Fix - **Default image** (first commit): `package.json` names the Dockerfile in the package's private `imports`, as `#self/sandbox.Dockerfile`, and `getDefaultSandboxImage()` resolves it from there. The path no longer depends on where a built module sits in `dist/`, and the packed checks already verify that every `imports` target is in the tarball. The file stays at the package root, so its path in an installed package does not change. - **Deploy message** (second and third commits): after a failed build, the deploy asks the daemon with `docker info`. "Start Docker" stays for a daemon that does not answer, when `docker info` exits with a non-zero code. A build that succeeds runs no extra command. - `docker info` gets 5 seconds, so a daemon that accepts the connection and never answers cannot keep back the report. When the check does not finish in time, or cannot run, the deploy reports the build failure, whose cause Docker has printed above. - At that deadline the deploy kills only the CLI process. `docker info` starts the CLI plugins just to read their metadata, before it asks the daemon, so it has no child process while it waits. ## Tests - `packages/void/test/unit/config.test.ts`: the default-image case reads the resolved path and compares it with the packaged Dockerfile. With `main`'s `sandbox/config.ts` it fails with `ENOENT` for `packages/void/dist/sandbox.Dockerfile`. - `packages/void/test/integration/kitchen-sink-build.test.ts`: the playground sets no `sandbox.image`, and the build case checks that the Dockerfile recorded in `dist/ssr/wrangler.json` exists. With `main`'s `sandbox/config.ts` it fails. - `packages/void/test/unit/container-image.test.ts` (new, 6 cases): `buildContainerImage()` with a stand-in Docker CLI. - A build that succeeds: no daemon check, and `dispose()` removes the local tag. - A build that fails while the daemon answers, and one while it does not. - A `docker info` that hangs, with the deadline reached through fake timers. - A build that a signal stops, and a CLI that cannot be started. 5 of the 6 `container-image` cases fail with `main`'s `container-image.ts`; the first one checks what `main` already does. The file is skipped on Windows, which does not launch the stand-in script by path. ## Verification - `vpr test:all`: builds the packages and playgrounds, runs `vp check` and `check:types`, and runs the platform, unit and integration groups; 269/269 tasks pass. - `node .github/scripts/packed-consumer.mjs` passes for npm and pnpm. The `void` tarball contains `sandbox.Dockerfile`. - By hand, in a new static Vue starter (`void init`, Vite+) with the route above, no `sandbox` key in `void.config.ts`, and Docker 29.8.2 running: - void 1.13.1 from npm: `vp build` and `vp dev` as in the 1.13.1 column. - The packed build of this branch, installed with npm and with pnpm: `vp build` and `vp dev` as in the "This PR" column. In the pnpm install, the recorded path is under `node_modules/.pnpm/` and exists. - By hand, `buildContainerImage()`, which the deploy runs for each recorded Dockerfile, with the real Docker CLI (29.8.2): - `main`'s version, with a Dockerfile that does not exist: the "Start Docker" message, while `docker info` answers. - This branch, with the Dockerfile that the npm app's build records: it builds `void-sandbox-build:<uuid>` for `linux/amd64`, and `dispose()` removes the tag. - A Dockerfile that does not exist: the "exited with code 1" message. - `DOCKER_HOST` set to a socket that does not exist: the "Start Docker" message. - A failed build, with `docker info` sent to a socket that accepts connections and never answers: the "exited with code 1" message after 5 seconds, and no Docker process is left. - A CLI path that does not exist: the "could not be started" message. - By hand, `docker info` (29.8.2) against that socket: it runs each plugin's metadata command when it starts, has no child process while it waits, and leaves none when the CLI is killed. - Not run: `void deploy --platform cloudflare` from start to end, a deploy to a Void platform, `VOID_PACKED_SUITE=full`, a build that a signal stops outside the unit test, and Windows. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.2 <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.
Issue
Group the mostly flat runtime helpers into feature directories. The runtime root now contains only directories, with standalone public features using
<feature>/index.ts. Retain descriptive engine, handler, and client/server roles in filenames. Update imports, generated-code paths, build entries, package exports and tests while preserving publicvoid/*import names.Before: 76 direct files and 3 directories under
packages/void/src/runtime/. Filename patterns below summarize related files.After: Feature directories.
I think some files could be better categorized but I didn't want to make that many changes yet, mainly focused on organization of the
runtimedirectory. Feel free to move more files.Keep the email protocol beside its runtime in
email/protocol.ts, and move the cross-feature base64 helper tosrc/shared/base64.ts. Extract email pattern compilation and dispatch ordering intosrc/shared/email-pattern.ts. The file scanner and runtime email test harness share this dependency-free module, removing filesystem discovery from the harness dependency graph.Notes
Validation
vp run check.CI=true vp run test: full 811-file selection, with 17,326 passing tests (35 skipped).