From 9cad40c083210bf55cdfeea32bb24ea3f41fad28 Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 8 Jul 2026 23:31:21 -0700 Subject: [PATCH] Keep dependency incremental caches when seeding worktree targets. Worktree seed copied the primary Cargo cache but discarded every incremental/ tree; keep third-party incremental warm and still scrub local misaligned/act_one artifacts so this checkout rebuilds correctly. Co-authored-by: Cursor --- AGENT.md | 5 +++-- tools/seed-cargo-target.sh | 30 ++++++++++++++++++------- wiki/log/2026-07-08-seed-incremental.md | 26 +++++++++++++++++++++ wiki/log/DEVLOG.md | 14 ++++++++++++ wiki/process/workflows.md | 6 +++-- 5 files changed, 69 insertions(+), 12 deletions(-) create mode 100644 wiki/log/2026-07-08-seed-incremental.md diff --git a/AGENT.md b/AGENT.md index 08c7643..32ded22 100644 --- a/AGENT.md +++ b/AGENT.md @@ -60,8 +60,9 @@ behavior change. or Bevy build commands. Do **not** point multiple worktrees at one shared `CARGO_TARGET_DIR`: Cargo can reuse stale local-crate artifacts across checkouts and give false-green tests. The seed script copies warm dependency - artifacts, scrubs `misaligned` outputs, and leaves the worktree with a - private `target/` that rebuilds local code correctly. + artifacts (including `incremental/` caches), scrubs `misaligned` outputs, + and leaves the worktree with a private `target/` that rebuilds local code + correctly while keeping third-party incremental compilation warm. - **Commit aggressively.** Cameron has standing permission for agents to commit coherent completed work in this repository. Do not stop to ask for commit permission unless there is a pending product/design question, diff --git a/tools/seed-cargo-target.sh b/tools/seed-cargo-target.sh index 63ff1c3..3f47ef7 100755 --- a/tools/seed-cargo-target.sh +++ b/tools/seed-cargo-target.sh @@ -4,9 +4,10 @@ # # Full CARGO_TARGET_DIR sharing between git worktrees is unsafe for this repo: # Cargo can consider the local `misaligned` package fresh from another checkout -# and run stale test binaries. This helper only copies the cache, then removes -# the local package outputs so the current worktree's crate is rebuilt while -# heavy third-party dependencies stay warm. +# and run stale test binaries. This helper copies the cache (including +# dependency incremental/ dirs for warm rebuilds), then removes the local +# package outputs so the current worktree's crate is rebuilt while heavy +# third-party dependencies stay warm. set -euo pipefail cd "$(dirname "$0")/.." @@ -43,8 +44,15 @@ fi mkdir -p "$dest_target" +# Copy the primary cache, including dependency incremental/ trees so the +# worktree benefits from incremental compilation. Exclude only local-crate +# fingerprints, deps, binaries, and incremental dirs — those must rebuild +# against this worktree's sources (paths differ across checkouts). rsync -a \ - --exclude '/debug/incremental/' \ + --exclude '/debug/incremental/misaligned-*' \ + --exclude '/debug/incremental/misaligned_bevy-*' \ + --exclude '/debug/incremental/misaligned_assets-*' \ + --exclude '/debug/incremental/act_one-*' \ --exclude '/debug/.fingerprint/misaligned-*' \ --exclude '/debug/.fingerprint/misaligned_bevy-*' \ --exclude '/debug/.fingerprint/misaligned_assets-*' \ @@ -55,7 +63,10 @@ rsync -a \ --exclude '/debug/deps/misaligned_assets-*' \ --exclude '/debug/deps/act_one-*' \ --exclude '/debug/misaligned*' \ - --exclude '/release/incremental/' \ + --exclude '/release/incremental/misaligned-*' \ + --exclude '/release/incremental/misaligned_bevy-*' \ + --exclude '/release/incremental/misaligned_assets-*' \ + --exclude '/release/incremental/act_one-*' \ --exclude '/release/.fingerprint/misaligned-*' \ --exclude '/release/.fingerprint/misaligned_bevy-*' \ --exclude '/release/.fingerprint/misaligned_assets-*' \ @@ -69,13 +80,16 @@ rsync -a \ "$source_target/" "$dest_target/" # Belt and suspenders for artifacts copied by a future target layout or by a -# user-supplied MISALIGNED_SEED_TARGET_FROM. -find "$dest_target" -path '*/incremental' -type d -prune -exec rm -rf {} + +# user-supplied MISALIGNED_SEED_TARGET_FROM. Scrub local-crate outputs only; +# leave dependency incremental/ caches in place. find "$dest_target" -path '*/.fingerprint/misaligned-*' -prune -exec rm -rf {} + find "$dest_target" -path '*/.fingerprint/misaligned_bevy-*' -prune -exec rm -rf {} + find "$dest_target" -path '*/.fingerprint/misaligned_assets-*' -prune -exec rm -rf {} + find "$dest_target" -path '*/.fingerprint/act_one-*' -prune -exec rm -rf {} + find "$dest_target" -path '*/incremental/misaligned-*' -prune -exec rm -rf {} + +find "$dest_target" -path '*/incremental/misaligned_bevy-*' -prune -exec rm -rf {} + +find "$dest_target" -path '*/incremental/misaligned_assets-*' -prune -exec rm -rf {} + +find "$dest_target" -path '*/incremental/act_one-*' -prune -exec rm -rf {} + find "$dest_target" -path '*/deps/libmisaligned-*' -type f -delete find "$dest_target" -path '*/deps/misaligned-*' -type f -delete find "$dest_target" -path '*/deps/misaligned_bevy-*' -type f -delete @@ -88,4 +102,4 @@ find "$dest_target" \( \ \) -type f -delete echo "seeded Cargo target cache: $source_target -> $dest_target" -echo "local misaligned artifacts were scrubbed; the current worktree will rebuild them" +echo "local misaligned artifacts were scrubbed; dependency incremental/ kept warm" diff --git a/wiki/log/2026-07-08-seed-incremental.md b/wiki/log/2026-07-08-seed-incremental.md new file mode 100644 index 0000000..8f6b921 --- /dev/null +++ b/wiki/log/2026-07-08-seed-incremental.md @@ -0,0 +1,26 @@ +# 2026-07-08 - Seed dependency incremental caches + +``` +Type: log +``` + +## Context + +`tools/seed-cargo-target.sh` copied the primary checkout's Cargo target into +a worktree's private `target/`, but excluded and then deleted every +`incremental/` directory. That threw away warm third-party incremental +compilation (Bevy/wgpu and friends) that the seed is meant to preserve. + +## Change + +Keep dependency `incremental/` trees when seeding. Still scrub local-crate +fingerprints, deps, binaries, and `incremental/misaligned*` / +`misaligned_bevy*` / `misaligned_assets*` / `act_one*` so this worktree +rebuilds its own package against its own sources. + +## Files + +- `tools/seed-cargo-target.sh` +- `AGENT.md` +- `wiki/process/workflows.md` +- `wiki/log/DEVLOG.md` diff --git a/wiki/log/DEVLOG.md b/wiki/log/DEVLOG.md index 06d3eaf..3e46363 100644 --- a/wiki/log/DEVLOG.md +++ b/wiki/log/DEVLOG.md @@ -5,6 +5,20 @@ Type: log ``` Reverse chronological implementation notes. Keep this factual: what changed, why, checks, and spec impact. +## 2026-07-08 - Seed dependency incremental caches + +- Intent: worktree seeding should keep third-party incremental compilation + warm, not discard every `incremental/` tree. +- Changed: `tools/seed-cargo-target.sh` copies dependency `incremental/` + dirs from the primary checkout; still scrubs local `misaligned*` / + `act_one*` fingerprints, deps, binaries, and incremental trees. AGENT.md + and workflows.md note the warm-incremental behavior. +- Design/spec impact: process/tooling only; no game behavior or constitution + amendment. +- Checks: `bash -n tools/seed-cargo-target.sh`; seed smoke test asserts + dependency incremental dirs survive and local-crate incremental dirs do not. +- Log: wiki/log/2026-07-08-seed-incremental.md. + ## 2026-07-08 - Machine-token playable slice - Intent: make the machine-work experiment visible and playable without diff --git a/wiki/process/workflows.md b/wiki/process/workflows.md index 7c6ea7a..4d5b988 100644 --- a/wiki/process/workflows.md +++ b/wiki/process/workflows.md @@ -17,8 +17,10 @@ tools/seed-cargo-target.sh Do **not** point multiple worktrees at one shared `CARGO_TARGET_DIR`. Cargo can reuse stale local-package artifacts across checkouts; this produced a false green once (the test count matched `main`, not the edited worktree). The seed -script copies the cache, removes `misaligned` artifacts/fingerprints, and keeps -the current worktree's `target/` private so local code rebuilds correctly. +script copies the cache (including dependency `incremental/` dirs), removes +`misaligned` artifacts/fingerprints/incremental trees, and keeps the current +worktree's `target/` private so local code rebuilds correctly while third-party +incremental compilation stays warm. `./tools/check.sh` rejects external `CARGO_TARGET_DIR` by default for the same reason; override only for a deliberately isolated target with `MISALIGNED_ALLOW_EXTERNAL_TARGET=1`. -- 2.51.2