@multi-project-sandbox Feature: Per-resource sandboxes for multi-project plans (#7270) Per spec ยง19310-19312, each resource gets its own sandbox and Apply commits each sandbox separately. Scenario: Single-resource plan creates one sandbox for mps Given a temp git project "alpha" for mps And a mocked plan service linking project "alpha" for mps When I call _create_sandbox_for_plan for mps Then sandbox_infos should have 1 entry for mps And sandbox_root should be a directory for mps Scenario: Multi-resource plan creates sandboxes for each resource for mps Given a temp git project "alpha" for mps And a temp git project "beta" for mps And a mocked plan service linking projects "alpha" and "beta" for mps When I call _create_sandbox_for_plan for mps Then sandbox_infos should have 2 entries for mps And each sandbox_info should have a different sandbox_path for mps Scenario: Route files moves file to correct worktree for mps Given a temp git project named "alpha" containing "src/app.py" for mps And a temp git project named "beta" containing "src/api.py" for mps And a mocked plan service linking projects "alpha" and "beta" for mps And sandbox_infos for both projects for mps And a file "src/api.py" exists in the primary sandbox for mps When I call _route_sandbox_files_to_worktrees for mps Then "src/api.py" should exist in the beta sandbox for mps And "src/api.py" should not exist in the alpha sandbox for mps Scenario: Route files preserves primary file when both projects share path for mps Given a temp git project named "alpha" containing "README.md" for mps And a temp git project named "beta" containing "README.md" for mps And a mocked plan service linking projects "alpha" and "beta" for mps And sandbox_infos for both projects for mps And the file "README.md" in the primary sandbox is overwritten with "ROUTED_CONTENT" for mps When I call _route_sandbox_files_to_worktrees for mps Then "README.md" in the alpha sandbox should contain "ROUTED_CONTENT" for mps And "README.md" in the beta sandbox should not contain "ROUTED_CONTENT" for mps Scenario: Route files is a no-op for single resource for mps Given a temp git project named "alpha" containing "src/app.py" for mps And sandbox_infos with only one entry for mps And a file "src/app.py" exists in the primary sandbox for mps When I call _route_sandbox_files_to_worktrees for mps Then "src/app.py" should still exist in the alpha sandbox for mps Scenario: Apply merges multiple worktrees separately for mps Given a temp git project "alpha" with a worktree branch for mps And a temp git project "beta" with a worktree branch for mps And a mocked plan service linking projects "alpha" and "beta" for mps When I call _apply_sandbox_changes for mps Then both projects should have the merged changes for mps And the console output should contain "Apply Summary" for mps Scenario: Partial apply continues when one merge fails for mps Given a temp git project "alpha" with a worktree branch for mps And a temp git project "beta" with a conflicting worktree branch for mps And a mocked plan service linking projects "alpha" and "beta" for mps When I call _apply_sandbox_changes for mps Then alpha should have the merged changes for mps And beta should have the original content for mps And _apply_sandbox_changes should return False for mps