Commit Graph

5 Commits

Author SHA1 Message Date
João Salavisa b3aaa804f1 fix: use dynamic merge-base for git commits to filter main branch commits (#504)
* fix: use dynamic merge-base for git commits to filter main branch commits

When a feature branch is rebased on main, the stored base_commit_sha
becomes outdated. Using git log base_commit..HEAD would include main
branch commits that were merged after the stored base commit.

This fix adds dynamic merge-base calculation using the session's
base_branch (target branch like origin/main). When fetching commits:
- The backend computes git merge-base HEAD target_branch
- This returns only commits not yet merged into the target branch
- Works correctly even after rebases

Changes:
- Extended SessionReader interface with GetSessionBaseBranch method
- Added GetMergeBase to GitOperator for computing merge-base
- Updated git log API to accept target_branch parameter
- Modified wsGitCommits handler to pass target branch for filtering

* fix: update executor_test mock to match new GetGitLog signature

* fix: update remaining mocks to match new GetGitLog signature

* fix: update integration test mock for GetGitLog signature

* fix: address code review feedback

- Use GetOrEnsureExecution in wsGitCommits to recover workspaces after backend restarts
- Fix archive snapshot to use baseBranch for merge-base when baseCommit is empty
- Extended ExecutionLookup interface with GetOrEnsureExecution method

* fix: distinguish not-ready errors from unexpected errors in wsGitCommits

Address CodeRabbit review feedback:
- Use errors.Is() to detect ErrSessionWorkspaceNotReady sentinel error
- Return ready:false gracefully for workspace-not-ready and session-not-ready errors
- Return actual errors for unexpected failures (database errors, etc.)
- Add comprehensive tests for error handling paths
2026-04-15 21:29:59 +01:00
Carlos Florêncio 03c164d6cd fix: handle file paths with spaces in git status and diff parsing (#552) 2026-04-06 19:25:26 +01:00
Carlos Florêncio 51e2338541 fix: prevent duplicate task.state_changed events and N+1 git show calls (#534) 2026-04-03 15:08:02 +01:00
José Almeida f06577e989 fix: include uncommitted changes in review dialog cumulative diff (#447)
* fix: include uncommitted changes in review dialog cumulative diff

The review dialog only showed uncommitted changes instead of the full
diff from the task's base commit. Two issues combined:

1. Backend used `git diff base..HEAD` (committed only); changed to
   `git diff base` which compares against the working tree.
2. Frontend gave priority to git status over cumulative diff; reversed
   the merge order so cumulative diff takes precedence.

Adds E2E test with a mock-agent scenario that commits changes then
leaves uncommitted modifications, verifying the review dialog shows
the complete base→working-tree diff.

* fix(e2e): remove incorrect BASE_CONTENT assertion in review cumulative diff test

The file is created after the base commit, so the entire file shows as
added in the cumulative diff. BASE_CONTENT was replaced and doesn't
appear. The key assertion is that COMMITTED_CHANGE is visible — proving
the diff includes committed changes (not just the uncommitted portion).

* fix: address CodeRabbit review feedback

- Update 3 docstrings to reflect working-tree diff (not HEAD)
- Generate scenario list dynamically in error message
- Use data-testid selector in E2E test for resilience

* style: format E2E test file

* fix(e2e): use toContainText and click file to ensure diff is scrollable

Pierre diff viewer content inside a scroll container may not be
considered "visible" by Playwright. Switch to toContainText which
checks text presence without element-level visibility. Also click
the file in the tree to ensure its diff section is scrolled into view.
2026-03-18 00:24:10 +00:00
João Salavisa 28a27afd1a refactor: move git status and commits to real-time agentctl queries (#366) 2026-03-05 08:35:02 +00:00