814a5167ef
CI / push-validation (pull_request) Successful in 23s
CI / helm (pull_request) Successful in 33s
CI / build (pull_request) Successful in 3m54s
CI / lint (pull_request) Successful in 3m55s
CI / quality (pull_request) Successful in 4m25s
CI / typecheck (pull_request) Successful in 4m45s
CI / security (pull_request) Successful in 4m46s
CI / e2e_tests (pull_request) Successful in 7m37s
CI / integration_tests (pull_request) Successful in 7m54s
CI / unit_tests (pull_request) Successful in 8m43s
CI / docker (pull_request) Successful in 1m29s
CI / coverage (pull_request) Successful in 15m0s
CI / status-check (pull_request) Successful in 3s
CI / benchmark-regression (pull_request) Has been cancelled
CI / benchmark-publish (pull_request) Has been cancelled
plan diff now detects the worktree branch cleveragents/plan-<id> created during plan execute and runs git diff HEAD...<branch> to display actual file changes. Falls back to changeset-based diff when no worktree branch exists. Infrastructure layer: - GitWorktreeSandbox.diff_against_head() classmethod: checks branch existence via rev-parse, runs git diff, returns diff text or None - Uses _run_git() helper (existing) for subprocess calls with proper CalledProcessError/TimeoutExpired handling CLI layer: - _get_worktree_diff() thin wrapper: resolves plan -> project -> resource via DI container, delegates to GitWorktreeSandbox.diff_against_head() - Specific exception handling (NotFoundError, CleverAgentsError) with structlog debug logging - Input validation: empty plan_id returns None early - Called in plan_diff() before changeset fallback (spec §13225) Tests: - 4 Behave scenarios covering: branch exists with diff, no branch, service resolution path, no linked resources fallback Fixes: - CheckpointRepository prune test: use shared session so flush() in create() is visible to prune() within the same scenario ISSUES CLOSED: #9231
33 lines
1.7 KiB
Gherkin
33 lines
1.7 KiB
Gherkin
@plan-diff-worktree
|
|
Feature: Plan diff shows worktree branch changes (#9231)
|
|
Verifies that plan diff displays the actual file changes from the
|
|
worktree branch created during plan execute, falling back to
|
|
changeset-based diff when no worktree branch exists.
|
|
|
|
Background:
|
|
Given the plan-diff in-memory database is initialized
|
|
|
|
Scenario: diff_against_head returns diff when worktree branch exists
|
|
Given a temp git repo with a worktree branch for plan "01TESTDIFF00000000000000" for pdt
|
|
And a file "hello.py" is changed on the worktree branch for pdt
|
|
When I call diff_against_head for plan "01TESTDIFF00000000000000" for pdt
|
|
Then the diff output should contain "hello.py" for pdt
|
|
And the diff output should not be None for pdt
|
|
|
|
Scenario: diff_against_head returns None when no branch exists
|
|
Given a temp git repo without a worktree branch for pdt
|
|
When I call diff_against_head for plan "01TESTDIFFNO000000000000" for pdt
|
|
Then the diff output should be None for pdt
|
|
|
|
Scenario: _get_worktree_diff returns diff via service resolution
|
|
Given a temp git repo with a worktree branch for plan "01TESTDIFFSVC00000000000" for pdt
|
|
And a file "app.py" is changed on the worktree branch for pdt
|
|
And a mocked service that resolves the git resource for pdt
|
|
When I call _get_worktree_diff for plan "01TESTDIFFSVC00000000000" for pdt
|
|
Then the diff output should contain "app.py" for pdt
|
|
|
|
Scenario: _get_worktree_diff returns None when no linked resources
|
|
Given a mocked service with no linked resources for plan diff for pdt
|
|
When I call _get_worktree_diff for plan "01TESTDIFFNONE0000000000" for pdt
|
|
Then the diff output should be None for pdt
|