Files
cleveragents-core/features/git_worktree_strategy.feature

62 lines
2.5 KiB
Gherkin

@sandbox @b4 @git_worktree
Feature: Git Worktree Sandbox Strategy
As a developer executing plans on git repositories
I want git worktree-based sandboxing
So that changes are isolated in a separate worktree
# Worktree creation
Scenario: Create a git worktree sandbox for a repository
Given a v4 temporary git repository
When I create a v4 git worktree sandbox for the repository
Then the v4 worktree sandbox path should exist
And the v4 worktree sandbox should be a valid git directory
Scenario: Worktree sandbox records metadata for rollback
Given a v4 temporary git repository
When I create a v4 git worktree sandbox for the repository
Then the v4 worktree metadata should contain "worktree_path"
And the v4 worktree metadata should contain "branch"
And the v4 worktree metadata should contain "base_commit"
Scenario: Worktree sandbox creates a detached branch
Given a v4 temporary git repository
When I create a v4 git worktree sandbox for the repository
Then the v4 worktree should have a sandbox branch name
# ── Worktree cleanup ──
Scenario: Cleanup removes the worktree directory
Given a v4 temporary git repository
When I create a v4 git worktree sandbox for the repository
And I cleanup the v4 git worktree sandbox
Then the v4 worktree sandbox path should not exist
# ── Path rewriting ──
Scenario: Rewrite path from original repo to worktree
Given a v4 temporary git repository
When I create a v4 git worktree sandbox for the repository
And I rewrite the v4 git path for a file "src/main.py"
Then the v4 rewritten git path should point inside the worktree
# ── Safe fallback ──
Scenario: Strategy handles non-existent repo path gracefully
When I attempt a v4 git worktree for non-existent path "/tmp/no-such-repo"
Then the v4 git worktree attempt should fail with an error
Scenario: Strategy handles path that is not a git repo
Given a v4 temporary non-git directory
When I attempt a v4 git worktree for the non-git directory
Then the v4 git worktree attempt should fail with an error
# ── Integration with SandboxManager ──
Scenario: Git worktree strategy works with SandboxManager
Given a v4 temporary git repository
And a v4 sandbox manager with git worktree strategy
When I use the v4 manager to create a sandbox for the git repo
Then the v4 managed git sandbox should be active
And the v4 managed git sandbox path should exist