fa01cee7d2
CI / helm (pull_request) Successful in 34s
CI / push-validation (pull_request) Successful in 35s
CI / build (pull_request) Successful in 3m50s
CI / lint (pull_request) Successful in 4m9s
CI / quality (pull_request) Successful in 4m38s
CI / typecheck (pull_request) Successful in 4m58s
CI / security (pull_request) Successful in 5m11s
CI / e2e_tests (pull_request) Successful in 7m37s
CI / integration_tests (pull_request) Successful in 10m46s
CI / unit_tests (pull_request) Successful in 11m36s
CI / coverage (pull_request) Successful in 14m45s
CI / docker (pull_request) Successful in 1m36s
CI / benchmark-regression (push) Failing after 0s
CI / benchmark-publish (push) Failing after 0s
CI / status-check (pull_request) Successful in 4s
CI / helm (push) Successful in 41s
CI / lint (push) Successful in 3m54s
CI / quality (push) Successful in 4m13s
CI / typecheck (push) Successful in 4m40s
CI / security (push) Successful in 4m41s
CI / build (push) Successful in 3m49s
CI / push-validation (push) Successful in 22s
CI / e2e_tests (push) Successful in 6m54s
CI / integration_tests (push) Successful in 10m24s
CI / unit_tests (push) Successful in 11m23s
CI / coverage (push) Successful in 14m57s
CI / docker (push) Successful in 2m13s
CI / status-check (push) Successful in 4s
When plan apply encounters a merge conflict (user edited the same file between execute and apply), the git merge leaves conflict markers in the project files and the repo in an unmerged state. Fix: - Read conflict detail from CalledProcessError.stdout (git writes conflict info to stdout, not stderr) - Run git merge --abort to restore the repo to a clean state - Catch subprocess.TimeoutExpired on both merge and abort calls - Check abort return code and include error detail on failure - Return False from _apply_sandbox_changes on failure so the calling code does NOT complete the apply phase - Transition plan to constrained state via service.constrain_apply() per spec §18334-18336 (plan may revert to Strategize for re-planning) - Fall back to 'Unknown merge error' when stdout+stderr are empty Tests: 7 Behave scenarios covering merge conflict abort, abort failure, _apply_sandbox_changes return value (True/False), clean merge, merge timeout, abort timeout, and flat file copy failure. ISSUES CLOSED: #7250
56 lines
3.0 KiB
Gherkin
56 lines
3.0 KiB
Gherkin
@merge-conflict-abort
|
|
Feature: Plan apply aborts merge on conflict (#7250)
|
|
Verifies that when plan apply encounters a git merge conflict,
|
|
the merge is aborted and the project is left in a clean state.
|
|
Also covers timeout handling and flat file copy failures.
|
|
|
|
Scenario: Merge conflict aborts cleanly and repo stays clean for mca
|
|
Given a temp git project with a file "config.py" for mca
|
|
And a worktree branch with a conflicting change to "config.py" for mca
|
|
And the user commits a different change to "config.py" on main for mca
|
|
When I attempt to merge the worktree branch for mca
|
|
Then the merge should fail for mca
|
|
And the merge should be aborted for mca
|
|
And "config.py" should not contain conflict markers for mca
|
|
And git status should be clean for mca
|
|
|
|
Scenario: Merge abort failure warns user about unclean state for mca
|
|
Given a temp git project with a file "data.txt" for mca
|
|
And a worktree branch with a conflicting change to "data.txt" for mca
|
|
And the user commits a different change to "data.txt" on main for mca
|
|
When I attempt to merge the worktree branch and the abort fails for mca
|
|
Then the merge should fail for mca
|
|
And the abort failure should be reported for mca
|
|
|
|
Scenario: _apply_sandbox_changes returns False on merge conflict for mca
|
|
Given a temp git project with a file "app.py" for mca
|
|
And a worktree branch with a conflicting change to "app.py" for mca
|
|
And the user commits a different change to "app.py" on main for mca
|
|
When I call _apply_sandbox_changes with the conflicting project for mca
|
|
Then _apply_sandbox_changes should return False for mca
|
|
And "app.py" should not contain conflict markers for mca
|
|
And git status should be clean for mca
|
|
|
|
Scenario: _apply_sandbox_changes returns True on clean merge for mca
|
|
Given a temp git project with a file "clean.py" for mca
|
|
And a worktree branch with a non-conflicting change for mca
|
|
When I call _apply_sandbox_changes with the clean project for mca
|
|
Then _apply_sandbox_changes should return True for mca
|
|
|
|
Scenario: Merge timeout returns False and advises manual cleanup for mca
|
|
Given a mock subprocess that raises TimeoutExpired on merge for mca
|
|
When I call _apply_sandbox_changes with the mocked merge for mca
|
|
Then _apply_sandbox_changes should return False for mca
|
|
And the timeout error message should be displayed for mca
|
|
|
|
Scenario: Abort timeout returns False and advises manual cleanup for mca
|
|
Given a mock subprocess that raises TimeoutExpired on abort for mca
|
|
When I call _apply_sandbox_changes with the mocked abort for mca
|
|
Then _apply_sandbox_changes should return False for mca
|
|
And the abort timeout message should be displayed for mca
|
|
|
|
Scenario: Flat file copy failure returns False for mca
|
|
Given a temp sandbox with a file that cannot be copied for mca
|
|
When I call _apply_sandbox_changes with the failing flat copy for mca
|
|
Then _apply_sandbox_changes should return False for mca
|