Skip to content

feat(worktree): share sccache across worktrees when available (#133) - #299

Merged
getappz merged 7 commits into
masterfrom
task/133
Jul 22, 2026
Merged

feat(worktree): share sccache across worktrees when available (#133)#299
getappz merged 7 commits into
masterfrom
task/133

Conversation

@getappz

@getappz getappz commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Summary

Rebased onto current master: the real worktree-isolation logic moved from src/worktree.rs into crates/flare-git-core/src/worktree.rs since this branch forked (src/worktree.rs is now a thin MCP/GitHub-specific shim over the leaf crate). Ported the sccache wiring + its test to the new location; src/worktree.rs itself needed no changes.

Item #133's other acceptance criteria (isolated target-dir, ambient-env warning, docs) already landed on master; this closes the one remaining ⬜ sccache wiring box. The ambient-CARGO_TARGET_DIR-always-wins gap is tracked separately in item #139 (already resolved via run_launch_env/run_headless env stripping + the target-dir-guard CI job) — #133 can close once this merges.

Test plan

  • cargo build --workspace --all-features clean
  • cargo clippy -p flare-git-core --all-targets --all-features -- -D warnings clean
  • cargo test -p flare-git-core worktree — 19/19 passed, including the new isolate_worktree_target_dir_wires_sccache_when_available
  • cargo test --workspace — 727 passed, 0 failed
  • cargo fmt --all -- --check clean

Summary by CodeRabbit

  • New Features

    • Improved build isolation for claimed worktrees by preventing reuse of stale local compilation artifacts.
    • Automatically enables shared Rust compilation caching when available, while keeping cache paths isolated per worktree.
  • Documentation

    • Added guidance on worktree build isolation, caching behavior, and handling CARGO_TARGET_DIR during local testing.

Wires rustc-wrapper=sccache + SCCACHE_BASEDIRS into each worktree's
isolated .cargo/config.toml (soft skip when sccache isn't on PATH),
so registry-dep compiles still hit cache across sibling worktrees
even though local-crate target dirs stay isolated. Documents the
build-isolation setup and the remaining ambient-env gap in AGENTS.md.

Agentflare-Agent: claude-code_2-1-216_agent
Agentflare-Branch: HEAD
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@getappz, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 49 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ca7e5305-9cee-4c76-9638-f147e4ddbd46

📥 Commits

Reviewing files that changed from the base of the PR and between cea38d7 and c202950.

📒 Files selected for processing (2)
  • AGENTS.md
  • crates/flare-git-core/src/worktree.rs
📝 Walkthrough

Walkthrough

Worktree build isolation now optionally configures sccache with worktree-scoped paths, tests available and unavailable sccache cases, and documents Cargo’s CARGO_TARGET_DIR precedence behavior.

Changes

Worktree build isolation

Layer / File(s) Summary
Configure and validate worktree caching
crates/flare-git-core/src/worktree.rs, AGENTS.md
Worktree Cargo configuration adds optional sccache settings and SCCACHE_BASEDIRS; availability detection, unit coverage, and build-isolation documentation are included.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding optional sccache sharing across worktrees.
Description check ✅ Passed The description is detailed and covers summary and test plan, but it omits the template's Notes for reviewers section.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task/133

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@AGENTS.md`:
- Around line 96-110: Remove the duplicated “Build isolation (claim worktrees)”
section and merge its sccache configuration details into the existing “Cargo
target-dir isolation (item `#133/`#139)” section. Preserve the ambient
CARGO_TARGET_DIR limitation and ensure references such as `#12516` do not trigger
MD018 by escaping the leading hash or reformatting the text.

In `@crates/flare-git-core/src/worktree.rs`:
- Around line 167-169: Update the config content construction in the worktree
path handling to use a TOML basic string for SCCACHE_BASEDIRS instead of a
literal string. Escape backslashes and double quotes in worktree_path before
inserting it, while preserving valid output for paths containing single quotes.
- Around line 577-581: Update the assertion in the worktree test to expect the
TOML-escaped, double-quoted SCCACHE_BASEDIRS value produced by the
implementation, rather than the current single-quoted value. Keep the existing
worktree path interpolation and failure message unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 192c4043-961c-4d64-b374-7ee3530a405c

📥 Commits

Reviewing files that changed from the base of the PR and between dd13fae and cea38d7.

📒 Files selected for processing (2)
  • AGENTS.md
  • crates/flare-git-core/src/worktree.rs

Comment thread AGENTS.md Outdated
Comment thread crates/flare-git-core/src/worktree.rs Outdated
Comment thread crates/flare-git-core/src/worktree.rs Outdated
… AGENTS.md section

TOML literal strings ('...') can't escape a single quote, so a worktree
path containing one (e.g. a Windows username like John's) produced
invalid .cargo/config.toml. Switch to a basic string with backslashes
and double quotes escaped.

Also merges the new sccache doc sentence into the existing 'Cargo
target-dir isolation' AGENTS.md section instead of duplicating it.

Agentflare-Agent: claude-code_2-1-216_agent
Agentflare-Branch: task/133
Agentflare-Item: 133
@getappz

getappz commented Jul 21, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@getappz
getappz enabled auto-merge (squash) July 21, 2026 19:04
getappz added 5 commits July 22, 2026 10:42
Agentflare-Agent: claude-code_2-1-216_agent
Agentflare-Branch: task/133
Agentflare-Item: 133
Agentflare-Agent: claude-code_2-1-216_agent
Agentflare-Branch: task/133
Agentflare-Item: 133
Agentflare-Agent: claude-code_2-1-216_agent
Agentflare-Branch: task/133
Agentflare-Item: 133
Agentflare-Agent: claude-code_2-1-216_agent
Agentflare-Branch: task/133
Agentflare-Item: 133
Agentflare-Agent: claude-code_2-1-217_agent
Agentflare-Branch: task/133
Agentflare-Item: 133
@getappz
getappz merged commit ebbec42 into master Jul 22, 2026
16 checks passed
@getappz
getappz deleted the task/133 branch July 22, 2026 06:16
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