Repository navigation
Make fresh worktrees build with two commands - #1830
michielbdejong wants to merge 2 commits into
Conversation
- build:wasm: drop the `cargo bin` alias. Cargo concatenates array config
values from every parent `.cargo/config.toml`, so in a worktree nested in
the main checkout the alias doubled into `run -p cargo-bin -- run ...`
("No package found for binary run"). The script now runs the shim package
directly, which installs wasm-pack into the worktree's own `.bin/`.
- Website runtime bundles are gitignored and generated by a vite plugin on
every vite / vitest start, instead of committed copies that had drifted
from their sources and got rewritten by every build.
- data-browser vitest: a setup file restores jsdom's localStorage and
sessionStorage, which Node 25+'s built-in Web Storage shadows.
- Remove @tomic/lib's devDependency on @tomic/cli. The cycle let pnpm build
cli concurrently with lib; `pnpm run -r build` is now ordered.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I left this out of batch #1853. Merged onto develop, data-browser A Generated by Claude Code |
|
Merge-risk triage (2026-09-28). This is a read-only review of this PR's own diff. The rule it applies: nothing that works today may break for existing users or clients, and new behaviour is added alongside the old. The stack is being rebased onto Verdict: SAFE It only changes build and dev scripts. The generated Website runtime files are now gitignored and rebuilt by a vite plugin that every consumer runs through (dev, build, vitest, Note: Main CI doesn't run on PRs ( 🤖 Generated with Claude Code |
A fresh worktree now needs only the two documented commands:
What was wrong and what changed
1.
build:wasmfailed with "No package found for binary run". Worktrees under.claude/worktrees/sit inside the main checkout. Cargo reads every.cargo/config.tomlup the directory tree and concatenates array values, so the aliasbin = ["run", "--package", "cargo-bin", "--"]turned intorun -p cargo-bin -- run -p cargo-bin -- wasm-pack. The shim then looked for a binary calledrun. A string alias doesn't fix this, because cargo refuses to merge a string with the parent checkout's array. So the alias is gone, andbuild:wasmcallscargo run -q --package cargo-bin -- wasm-packdirectly. On first use it installs wasm-pack into that worktree's own.bin/(about 35s), with no dependency on the main checkout's path.2. Builds rewrote
src/chunks/Website/runtime/{search-view.html,website-runtime.min.js}. The generator was already deterministic. The committed copies were stale:websiteRuntime.tshad gained theproxy*ops without anyone regenerating them. Checking them in invites that drift again, so they are now gitignored. A small vite plugin generates them in itsconfighook, which runs forvite dev,vite buildand vitest alike, and again on HMR of the runtime sources. Every consumer goes through vite:server/build.rs(pnpm run build), DaggerjsBuild/jsTest,build:tauri, and the release workflows. The exception istsc, which resolves?raw/?urlthroughvite/client's wildcard modules.pnpm typecheckpasses with the files deleted, so Dagger'sjsTypecheck(which doesn't build data-browser) is unaffected.3. Store-backed vitest failed under Node 26. Node 25+ puts Web Storage on
globalThis, and without--localstorage-fileitslocalStorageisundefined. Vitest's jsdom environment only copies window keys that the global lacks, so jsdom's storage never reachedwindow. The newdata-browser/src/test-setup.tsrestores jsdom'slocalStorage/sessionStoragewhen they are missing. Unlike--no-experimental-webstorage, it keeps working if Node drops that flag. Supported: Node 22 (CI) through 26.4.
pnpm -r run buildraced lib against cli.@tomic/libhad a devDependency on@tomic/cli(only for thead-generatebin ingenerate-ontologies), while cli depends on lib. pnpm breaks cycles arbitrarily, so cli'stsccould run while lib was rebuilding. The devDependency is removed andgenerate-ontologiesruns cli from../clidirectly. The rootbuildscript is now plainpnpm run -r build, without the lib-first workaround.5. Docs. AGENTS.md "Fresh Worktrees" lists the two commands and the workarounds that are no longer needed. It also corrects a stale claim: the pre-commit hook stubs
assets_tmpand skips the JS build, so it needs onlypnpm install.The lockfile diff also drops the orphaned
@automerge/*entries and ajsdompeer from lib/plugin/react's vitest resolution. Nothing in those packages uses jsdom.Verification
git worktree addfrom this branch:pnpm install && pnpm run -r buildexits 0 (1:51, including the wasm-pack install and WASM build). lib finished before cli started.git statusstayed clean afterwards.cargo bin wasm-pack --versionreproduced "No package found for binary run".pnpm build:wasmnow passes there.cargo buildinserver/of the fresh worktree: exit 0 (3:44; build.rs ran the full JS build, including this change's vite plugin)..rsfile in the fresh worktree passed the pre-commit hook (lint snapshot plus clippy), then was reverted.recentResourcestests failed on 26 before). lib 1013 tests pass on both.pnpm typecheckandpnpm lintin data-browser pass.tools/cargo-bin/Cargo.toml).🤖 Generated with Claude Code