Skip to content

[207] feat: selective build cache sharing between worktrees#280

Merged
erishforG merged 1 commit intodevelopfrom
feature/207
May 4, 2026
Merged

[207] feat: selective build cache sharing between worktrees#280
erishforG merged 1 commit intodevelopfrom
feature/207

Conversation

@erishforG
Copy link
Copy Markdown
Owner

Summary

Add [worktree] config section so parsec start can reuse build artifacts (e.g. target/, node_modules/, .venv/) from the main repo into new worktrees, instead of forcing a cold rebuild.

[worktree]
shared_cache    = ["target", "node_modules", ".venv"]
cache_strategy  = "symlink"   # "symlink" | "copy"

For each entry, the source <repo_root>/<entry> is shared into the new worktree using the chosen strategy. Missing sources and pre-existing destinations are skipped. Sharing failures are logged but never fail the worktree itself. Default is an empty list, preserving prior behaviour.

Closes #207

Changes

  • src/config/settings.rs[worktree] section, CacheStrategy enum, deserialization.
  • src/worktree/cache_share.rs (new) — share logic with skip-on-missing / skip-on-exists / traversal-guard / failure-as-warning semantics.
  • src/worktree/manager.rs — invokes share_cache after git worktree add succeeds.
  • schema/parsec-config.schema.json — schema entries.
  • README.md, CHANGELOG.md — docs.
  • tests/cli_tests.rs — 6 new integration tests.

Verification

Check Result
cargo build --release
cargo test ✅ 51 passed (11 unit + 40 integration; 6 new)
cargo clippy --all-targets -- -D warnings ✅ clean (also fixed a pre-existing bool_assert_comparison lint)
cargo fmt -- --check ✅ clean

Test plan

  • CI green on develop target
  • Manual: parsec start <ticket> with shared_cache = ["target"] and cache_strategy = "symlink" — verify symlink is created in the new worktree pointing at the parent's target/
  • Manual: same with cache_strategy = "copy" — verify it's a real dir, not a symlink
  • Manual: missing source dir in shared_cache → no error, just skipped (warning logged)

Add `[worktree]` config section so `parsec start` can reuse build artifacts
from the main repo instead of forcing a cold rebuild.

  [worktree]
  shared_cache    = ["target", "node_modules", ".venv"]
  cache_strategy  = "symlink"   # "symlink" | "copy"

For each entry, the source `<repo_root>/<entry>` is shared into the new
worktree. Missing sources and pre-existing destinations are skipped. Sharing
failures are logged but never fail the worktree itself. Default is an empty
list, preserving prior behavior.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@erishforG erishforG merged commit 31fe36b into develop May 4, 2026
11 checks passed
@erishforG erishforG deleted the feature/207 branch May 4, 2026 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant