Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions apps/server/src/mcp/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -990,11 +990,13 @@ export const mcpApiService = (backend: McpBackend, context: McpApiContext): McpA

const deadline = (yield* Clock.currentTimeMillis) + waitMs;

const waited = yield* backend
.wait(id, after === undefined ? { deadline } : { after, deadline })
// The RPC was cut on the Session's side (a deploy or an eviction cut it, or it could not be reached): the
// Run goes on, so the wait says so and hands the caller's cursor back instead of failing.
.pipe(Effect.catchCause(() => interruptedOutcome(id, after)));
const waited = yield* (
backend
.wait(id, after === undefined ? { deadline } : { after, deadline })
// The RPC was cut on the Session's side (a deploy or an eviction cut it, or it could not be reached): the
// Run goes on, so the wait says so and hands the caller's cursor back instead of failing.
.pipe(Effect.catchCause(() => interruptedOutcome(id, after)))
);

return waited.ok
? apiOk<WaitResult>({
Expand Down
4 changes: 1 addition & 3 deletions apps/server/src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ export const isMcpRoute = (request: HttpServerRequest.HttpServerRequest): boolea
* The Session whose socket `request` opens, if it is a `GET /sessions/:sessionId/socket` (`sessionSocketPath`). The
* Session DO answers the upgrade. Only Session IDs as the Registry makes them (UUIDs) are routed.
*/
export const sessionSocketId = (
request: HttpServerRequest.HttpServerRequest,
): string | undefined =>
export const sessionSocketId = (request: HttpServerRequest.HttpServerRequest): string | undefined =>
request.method === "GET" ? SESSION_SOCKET_PATH.exec(pathOf(request))?.[1] : undefined;

/**
Expand Down
4 changes: 2 additions & 2 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"@vitejs/plugin-react": "^6.3.0",
"happy-dom": "^21.0.4",
"tailwindcss": "^4.3.5",
"vite": "npm:@voidzero-dev/vite-plus-core@1.4.0",
"vite-plus": "1.4.0",
"vite": "npm:@voidzero-dev/vite-plus-core@8.3.8000",
"vite-plus": "1.7.0",
"vitest": "5.0.5"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
status: accepted, partly superseded by ADR-0055 (pnpm installs and runs the scripts, Vite+ runs the tasks instead of Turborepo, and tsrs's own linter replaces tsrslint as the type-aware lint backend, through a pnpm override instead of `scripts/link-tsrslint.sh`; tsrs still typechecks)
status: accepted, partly superseded by ADR-0055 (pnpm installs and runs the scripts, Vite+ runs the tasks instead of Turborepo, and tsrs's own linter replaces tsrslint as the type-aware lint backend, through a pnpm override instead of `scripts/link-tsrslint.sh`, and since Vite+ 1.7 the tsrs Vite+ bundles; tsrs still typechecks)
---

# Bun installs and runs scripts, tsrs typechecks, and Vitest stays on Node
Expand Down
8 changes: 4 additions & 4 deletions docs/adr/0055-vite-plus-and-pnpm.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The repo installs with pnpm again, and its toolchain is Vite+ (`vite-plus`): `vp
- **pnpm** (`packageManager`, `mise.toml`): `pnpm-workspace.yaml` holds the workspace, the patched dependencies, the packages allowed to run install scripts (`allowBuilds`: the pnpm list from before ADR-0028, with `core-js-pure` still blocked and `just-bash`'s optional compressors now blocked too, as ADR-0028 found they serve only its Node command line; `typescript`, which Bun had to trust for the effect-tsgo patch, needs no entry under pnpm) and the exemptions from pnpm's default minimum release age of a day. Workspace dependencies stay plain `"*"` for npm's production install of the root (`pi install git:…`), so `linkWorkspacePackages` links them. `dedupePeers` tells peer variants apart by their peers' versions alone: without it the server had two `@cloudflare/computer`s, and `infra` two `alchemy`s (one per `ws`, which an override now holds at one version), and their typechecks failed.
- **One config** (`vite.config.ts` at the root): the lint rules, the anti-slop plugins and every package's own rules (as `lint.overrides` by path; Vite+ reads no nested lint or format config), the format settings and the staged-file rules. `vp check` runs at the root, not per package: it lints the whole repo in one process.
- **Tasks** (`packages/config/src/tasks.ts`, passed to `run.tasks` by each package's `vite.config.ts`): `typecheck` and `test`. Vite Task records the files each task reads and replays a task none of whose inputs changed, so a change to a package's source reruns its dependents' tasks without Turborepo's `transit` node or `apps/web/turbo.json`'s hand-listed inputs. A cached task runs in a clean environment, so `test` names the variables that change what a test checks (`CI`, the live tests' and benchmarks' switches, `UPDATE_SNAPSHOT`) and passes the rest through untracked. `test` is `vitest run`, not `vp test`: Vite Task runs a `vp test` inside the `vp` that started it, with that copy's Vitest, and a `vp` that is not the project's (mise's `npm:vite-plus`) gives the workerd projects a second Vitest, which `@cloudflare/vitest-plugin`'s worker cannot reach.
- **Versions**: `vite-plus` 1.4.0, the last release that bundles Vitest 5.0.5; 1.5 and 1.6 bundle 5.1, under which the workerd tests fail (docs/development/dependencies.md). Overrides make every `vite` Vite+'s core and every `vitest` 5.0.5. Vite+ 1.4.0 bundles oxlint 1.89 and oxfmt 0.74, older than the 1.91 and 0.76 they replace (tsrs's linter, which speaks tsgolint 7.0.2005's protocol, runs under 1.89); oxfmt 0.74 wraps three signatures differently, reformatted with the switch.
- **Versions**: `vite-plus` 1.7.0 (first 1.4.0, the last release that bundles Vitest 5.0.5; 1.5 and later bundle 5.1, under which the workerd tests fail, so overrides hold Vitest at 5.0.5: docs/development/dependencies.md). Overrides make every `vite` Vite+'s core and every `vitest` 5.0.5. Vite+ 1.7.0 bundles oxlint 1.94, oxfmt 0.79 and tsrs; oxfmt reformatted a few files with each upgrade.
- **CI** sets up with `voidzero-dev/setup-vp`, which installs the Vite+ of the root `package.json` (so its `vp` runs the project's copy), Node and pnpm, and caches pnpm's store. Each check part restores and saves its Vite Task cache (`node_modules/.vite/task-cache`) under a rolling key and clears it past 1 GiB, since Vite Task never evicts.

Measured on an 8-core Apple Silicon laptop (2026-11-12), warm caches:
Expand All @@ -21,7 +21,7 @@ Measured on an 8-core Apple Silicon laptop (2026-11-12), warm caches:

## Consequences

- The type-aware lint runs on tsrs's own linter (`tsrs-lint`, `tsrs --lint`, since tsrs 0.21: tsgolint's headless protocol and its 61 type-aware rules), which replaces tsrslint, its predecessor outside tsrs. Vite+ sets `OXLINT_TSGOLINT_PATH` to the `bin/tsgolint` of its own `oxlint-tsgolint` and ignores `node_modules/.bin`, so `scripts/link-tsrslint.sh` is gone, and a pnpm override makes `oxlint-tsgolint` the repo's `tools/tsrs-lint-shim`, whose `bin/tsgolint.js` loads the root `tsrs` package's `tsrs-lint`. Vite+ fills that variable in only when it is unset, so the root `vite.config.ts` assigns it to the shim itself: a process that inherited another checkout's value, as Pi's agents and the language servers they start do, linted on that checkout's tsrs, and a stale value failed the lint. Every Vite+ entry point that lints (`vp lint`, `vp check`, `vp staged`, `vp lint --lsp`) loads that config first. It rests on where Vite+ looks for its backend (docs/development/dependencies.md says what to check on an upgrade). The shim has no `package.json`, or `effect-tsgo patch` finds it as Vite+'s `oxlint-tsgolint` and fails `prepare` looking for tsgolint's platform binary. The `tsrs` package is the linter only: `effect-tsgo tsrs` typechecks with the Effect-patched tsrs that `@effect/tsgo` ships. It goes once `effect-tsgo --tsrs-lint vp lint` (`@effect/tsgo` 0.68 and later: Vite+'s lint on the Effect-patched tsrs, with the Effect rules, and no shim) can run, which needs oxlint 1.91 or later, so a Vite+ past 1.4.0 (`Versions`). The shim does not run on Windows, where oxlint cannot start the `.js` the variable names (and Vite+ itself looks for `tsgolint.exe` or `tsgolint.cmd` in `.bin`); tsrs itself ships for macOS, Linux (glibc and musl) and Windows.
- The type-aware lint and type-check run on the tsrs that Vite+ bundles (since Vite+ 1.7.0, 2026-11-17: `7.1.0-beta.tsrs2`, tsrs's own linter, `tsrs --lint`, with tsgolint's headless protocol and its 61 type-aware rules), which replaces tsrslint, its predecessor outside tsrs. Vite+ names it in `OXLINT_TSGOLINT_PATH`, in its own process, only when the variable is unset; without it oxlint falls back to a `tsgolint` on `PATH`, so the variable is left alone (docs/development/dependencies.md says what to check on an upgrade). The `tsrs` Vite+ bundles is the linter only: `effect-tsgo tsrs` typechecks with the Effect-patched tsrs that `@effect/tsgo` ships, for the Effect diagnostics. On Vite+ 1.4.0 the same linter ran through a shim instead: a pnpm override made `oxlint-tsgolint` the repo's `tools/tsrs-lint-shim`, whose `bin/tsgolint.js` loaded a root `tsrs`, and the root `vite.config.ts` assigned `OXLINT_TSGOLINT_PATH` to it; Vite+ 1.7.0 removed the need, and `vp lint` over the repo went from 5–7 s and up to 1.6 GB to 4.5 s and 1.5 GB.
- Pi's agents format with `pnpm exec vp fmt` and run two language servers from `.pi/settings.json`: `pnpm exec vp lint --lsp` (this lint, rooted at `pnpm-workspace.yaml`) and `pnpm exec effect-tsgo tsrs --lsp --stdio` (the typecheck's Effect-patched tsrs, one per package `tsconfig.json`). They replace the owner's global definitions, which look for `.oxlintrc.json` and `.oxfmtrc.json` and run a tsrs without the Effect diagnostics.
- Run the project's own `vp`: `pnpm exec vp`, the root scripts, or the standalone global CLI from vite.plus, which hands a command to the project's copy. mise's `npm:vite-plus` is a second copy of the whole toolchain.
- Turborepo's CI pruning is gone; the Vite Task cache is experimental in CI (Vite+'s docs say so) and is bounded by size instead.
Expand All @@ -34,6 +34,6 @@ Measured on an 8-core Apple Silicon laptop (2026-11-12), warm caches:

- **Keeping Bun with Vite+.** Vite+ supports Bun, but the owner chose pnpm; Bun's install speed was most of ADR-0028's case for it, and pnpm's global virtual store is available where it matters, on the Container.
- **Keeping Turborepo with Vite+'s lint and format.** Turborepo's `transit` node and hand-listed inputs were what Vite Task's file tracking does by itself, and one task runner is one less tool.
- **Vite+ 1.6 with Vitest 5.1.** The workerd tests fail under Vitest 5.1 (dependencies.md); 1.4.0 holds Vitest at 5.0.5 until that is fixed.
- **Vite+'s own tsgolint**, with nothing to keep in step with Vite+. One lint over the repo on it took 16 s and 3.6 GB against tsrs's 7–8 s and 1.0 GB at most, and needs no shim, but ADR-0028 chose a linter on tsrs for that cost, and the shim is one file.
- **Vitest 5.1**, the Vitest Vite+ 1.5 and later bundle. The workerd tests fail under it (dependencies.md); overrides hold Vitest at 5.0.5 until that is fixed.
- **Vite+'s own tsgolint** (before Vite+ 1.7 bundled tsrs). One lint over the repo on it took 16 s and 3.6 GB against tsrs's 7–8 s and 1.0 GB at most, and needed no shim, but ADR-0028 chose a linter on tsrs for that cost, and the shim was one file.
- **tsrslint** (`@maschwenk/tsrslint`) behind the same shim. It worked (9–10 s, 2.1 GB at most), but tsrs now ships the same port itself, and its author means to fold tsrslint into it.
Loading
Loading