forked from cleveragents/cleveragents-core
be2659f70b
- GitCheckoutHandler: validate repo path, branch, read-only flags - Sandbox strategy mapping (git_worktree for writable, none for read-only) - Path normalization (absolute, no trailing slashes) - Child resource discovery for filesystem directories - Fixed duplicate step definitions in sandbox_manager_steps.py - 11/11 BDD scenarios passing, 0 regressions (178 total) - pyright 0 errors, ruff all checks passed
70 lines
3.2 KiB
Gherkin
70 lines
3.2 KiB
Gherkin
Feature: Git-checkout resource handler and discovery (B4.sandbox)
|
|
As a developer
|
|
I want a handler that validates git repos and discovers child resources
|
|
So that git-checkout resources are properly registered with correct sandbox mapping
|
|
|
|
# Validation scenarios
|
|
Scenario: Validate a valid git repository path
|
|
Given a temporary git repository at "/tmp/test-repo"
|
|
When I run git-checkout validation for path "/tmp/test-repo"
|
|
Then the git handler validation should succeed
|
|
And the handler result should have type "git_repository"
|
|
|
|
Scenario: Validate with a specific branch
|
|
Given a temporary git repository at "/tmp/branch-repo"
|
|
When I run git-checkout branch validation for path "/tmp/branch-repo" branch "main"
|
|
Then the git handler validation should succeed
|
|
And the handler result should have branch "main"
|
|
|
|
Scenario: Validate with read-only flag
|
|
Given a temporary git repository at "/tmp/ro-repo"
|
|
When I run git-checkout readonly validation for path "/tmp/ro-repo"
|
|
Then the git handler validation should succeed
|
|
And the handler result should be marked read-only
|
|
|
|
Scenario: Reject non-existent path
|
|
When I run git-checkout validation for path "/nonexistent/path"
|
|
Then the git handler validation should fail with "does not exist"
|
|
|
|
Scenario: Reject path that is not a git repository
|
|
Given a temporary directory at "/tmp/not-a-repo"
|
|
When I run git-checkout validation for path "/tmp/not-a-repo"
|
|
Then the git handler validation should fail with "not a git repository"
|
|
|
|
# Sandbox strategy mapping
|
|
Scenario: Default sandbox strategy is git_worktree
|
|
Given a temporary git repository at "/tmp/sandbox-repo"
|
|
When I run git-checkout validation for path "/tmp/sandbox-repo"
|
|
Then the handler result should have sandbox strategy "git_worktree"
|
|
|
|
Scenario: Read-only resources get no sandbox strategy
|
|
Given a temporary git repository at "/tmp/ro-sandbox-repo"
|
|
When I run git-checkout readonly validation for path "/tmp/ro-sandbox-repo"
|
|
Then the handler result should have sandbox strategy "none"
|
|
|
|
# Path normalization
|
|
Scenario: Normalize relative path to absolute
|
|
Given a temporary git repository at a relative path "test-repo-rel"
|
|
When I run git-checkout validation for the relative repo path
|
|
Then the git handler validation should succeed
|
|
And the handler result path should be absolute
|
|
|
|
Scenario: Normalize trailing slashes
|
|
Given a temporary git repository at "/tmp/trail-repo"
|
|
When I run git-checkout validation for path with trailing slash "/tmp/trail-repo"
|
|
Then the git handler validation should succeed
|
|
And the handler result path should not end with a slash
|
|
|
|
# Child resource discovery
|
|
Scenario: Discover filesystem directory children
|
|
Given a temporary git repository at "/tmp/disco-repo"
|
|
And the repository has subdirectories "src" and "docs"
|
|
When I discover child resources for "/tmp/disco-repo"
|
|
Then the discovery result should contain 2 children
|
|
And each child should have type "filesystem"
|
|
|
|
Scenario: Discovery of empty repository returns no children
|
|
Given a temporary git repository at "/tmp/empty-repo"
|
|
When I discover child resources for "/tmp/empty-repo"
|
|
Then the discovery result should contain 0 children
|