fix(devcontainer): make repository setup work - #7875
Conversation
The devcontainer.json that landed alongside an unrelated web styling change (0b1ce58) does not produce a working environment: bun install skips the pnpm catalogs and the patched dependencies, the node feature is a major behind, nothing installs vp, there is no Rust toolchain for native/resource-monitor, no ports are forwarded, and everything runs as root. Rebuild it to mirror CI (ubuntu-24.04, Node 24, Rust stable) and the documented setup: the global vp CLI installs on create, and vp i plus the Electron exec-bit repair and the Vite dep-cache warmup run on content updates so Codespaces prebuilds stay warm. Named volumes for the pnpm store and root node_modules make rebuild installs take seconds and keep the heavy tree off slow macOS bind mounts. Dev ports are forwarded with pairing guidance, state stays in the workspace's gitignored .t3, and docs/internals/devcontainer.md documents what works and what stays host-only. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — The changes are confined to devcontainer lifecycle setup and contributor documentation, adding isolated tooling, dependency caching, and development-state configuration without changing shipped product behavior or product defaults. You can add or adjust custom eligibility rules. Learn more. |
The vite.plus installer follows XDG platform defaults and moved the vp binary from ~/.vite-plus/bin to ~/.local/share/vite-plus/bin between releases, so on-create.sh's hardcoded test -x failed and container creation aborted before update-content could install dependencies. Set the installer's VP_BIN_DIR/VP_DATA_DIR/VP_CACHE_DIR override group so the location is pinned by this repo, and keep the loud existence check. Verified with devcontainer build (cold) and devcontainer up on Docker (colima, linux/arm64): onCreateCommand completes, vp 0.3.0 lands at the pinned path, /usr/local/bin/vp resolves, and cargo fmt --check passes inside the container. Full vp i completion was not observable on this host: a 4 GiB VM OOM-kills vp i (below the declared 8 GiB floor), and the 8 GiB VM's disk layer then failed EIO with the host Mac under 7 GB free. Recorded in the PR body. Model: GLM 5.3 Flash (Claude Code harness) Co-Authored-By: Claude <noreply@anthropic.com>
What Changed
vpinstall location is pinned through the installer'sVP_BIN_DIR/VP_DATA_DIR/VP_CACHE_DIRoverride group, because the installer's XDG-default bin directory moved between releases and broke the first build of this branch..devcontainer/devcontainer.jsonrebuilt onmcr.microsoft.com/devcontainers/base:ubuntu-24.04with Node 24, Rust stable, and GitHub CLI features; new.devcontainer/on-create.sh(installs the globalvpCLI, writes a first-run notice) and.devcontainer/update-content.sh(vp i, Electron exec-bit repair, Vite dep-cache warmup); named volumes for the pnpm store and rootnode_modules; forwards ports 5733/13773 with pairing guidance; pinsT3CODE_HOMEto the workspace's gitignored.t3; runs asvscode. Addsdocs/internals/devcontainer.mdand a pointer indocs/internals/scripts.md.docs/internals/scripts.md("nothing in contributor setup needs it").vp run dev --share(no tailscale in the image); CI workflow files.Why
Reproduction:
11f051373), open the repo in the checked-in devcontainer (Debian bookworm with bun/Node/Python features, noremoteUser, no port forwarding).docs/internals/scripts.md.vpdoes not exist; the only install path isbun install --frozen-lockfile, which does not resolve the workspace's pnpmcatalog:dependencies (used by the root,apps/server,apps/web,packages/contracts) or itspatchedDependencies; there is no Rust toolchain fornative/resource-monitor; and the shell is root.Actual: a root Debian container whose bootstrap cannot install the monorepo, matching neither the documented setup nor Linux CI.
Expected: a container matching Linux CI (ubuntu-24.04, Node ^24.13.1 from
package.json, Rust stable,gh) with the documentedvp ibootstrap done before the first attach.Cause:
.devcontainer/devcontainer.jsonpredates the pnpm/vpsetup. It was introduced in #1791 and last touched in #2208, and both versions install withbun install, forward no ports, and define no non-root user.Why this owner and approach:
.devcontainer/owns the contributor environment, so the fix rebuilds that definition to mirror the versions CI pins rather than inventing a parallel setup. Lifecycle steps follow devcontainer semantics: one-time toolchain work inonCreateCommand(baked into prebuilds), content-dependent installs inupdateContentCommandso prebuild refreshes stay warm. The contributor doc lives beside the others indocs/internals/. The five files are one unit — the scripts and doc do not exist without the config — which is why the patch is not split further.Refs: #1791, #2208
Verification
Environment: Dev Container CLI 0.88.0, Docker 29.5.2 (colima, Apple Silicon,
linux/arm64), cold caches. Two VM shapes were used: 2 vCPU / 4 GiB, and 4 vCPU / 8 GiB — the config's declaredhostRequirements. Evidence captured at head1656e3eewith the identical tree content.shellcheck .devcontainer/on-create.sh .devcontainer/update-content.sh— exit 0;bash -non both — exit 0devcontainer build --workspace-folder .— exit 0 twice, cold: 3m 45s (2 vCPU / 4 GiB) and 2m 58s (4 vCPU / 8 GiB)devcontainer up—onCreateCommandexit 0 on both VMs. In-container:whoami→vscode;vp --version→vp v0.3.0, with/usr/local/bin/vpresolving into the pinned install directory;node→ v24.20.0;pnpm→ 11.10.0;cargo→ 1.98.0;rustfmt→ 1.9.0-stable;gh→ 2.98.0; the first-run notice is written.cargo fmt --manifest-path native/resource-monitor/Cargo.toml -- --checkinside the container — exit 0updateContentCommandstarts correctly (volume ownership repair, thenvp iresolves the lockfile — 1809 packages — and passes its supply-chain policy check), but a completed first install was not observed on this machine: on the 4 GiB VM the kernel OOM-killedvp iat ~3.7 GiB RSS (below the declared 8 GiB floor), and on the 8 GiB VM the VM's disk layer failed mid-install (ERR_PNPM_EIO, then containerd metadata write EIO) with the host Mac under 7 GB free. Retrying was stopped deliberately rather than fill the developer's nearly-full disk; both failures are environment limits, and the script's own steps ran.vp run --filter @t3tools/contracts typecheckinside the container — not run: it needs the dependency tree from the install above, which never completed here.vp isequenceupdate-content.shruns.vp run devinside the container (headless image; windowed Electron is documented host-only); theautoreviewpass (skill not installed in this harness).Risks and limitations
main(2 ahead). GitHub reports it MERGEABLE with no conflicts; the drift is recorded here and not rebased in this pass. Ifmaintouches.devcontainer/ordocs/internals/before merge, refresh first.vp iis OOM-killed — the declared 8 GiBhostRequirementsshould not be lowered.onCreateCommandfetches thevpinstaller from the network (https://vite.plus); container creation needs egress, and the installer is a moving target — mitigated by pinning its install location, at the cost of depending on theVP_*_DIRoverride group staying supported.docs/internals/devcontainer.md).3927926band1656e3ee; nothing else depends on the added files.Checklist
1656e3ee, with anything that could not be run named and why