This change adds provider-aware merge payloads and an optional automatic local branch cleanup flow when accepting/merging review requests.
Summary
Integrations: the review/merge flow now accepts a merge-method parameter and constructs provider-specific merge payloads instead of sending a generic empty body. Azure DevOps handling is adapted to merge the provider payload with the required status and lastMergeSourceCommit fields.
Integrations: a new cleanup flow is introduced under src-tauri/src/integrations/cleanup.rs. When a merge action is requested and a cleanup_path is provided, the integrations layer calls into a prepare step (which verifies the PR details remotely) before performing the merge and then runs a finish step after the merge to perform local repository cleanup.
Git layer: a new module src-tauri/src/git/review_cleanup.rs implements the local-side cleanup plan (prepare and finish). It validates branches and remotes, checks worktree cleanliness, verifies remote/local SHAs, performs authenticated fetches, fast-forwards or checks out the target branch, and removes the PR branch both remotely (using expected-old-value deletion when safe) and locally (removing branch refs and associated branch config). Several safety checks prevent destructive actions when the local repo or remote have diverged or when the branch is in use in another worktree.
Tests: unit tests for the local cleanup logic are added in src-tauri/src/git/review_cleanup.rs. They cover normal deletion after merge (including squash/merge), acceptance of server-side deletion, preservation of dirty or unpushed local work, concurrent local/remote commits, and protection against mismatched remotes or active worktrees.
Small exports and plumbing: git::review_cleanup is exported via src-tauri/src/git.rs, and integrations::merge helpers are used for generating payloads. A minor doc/template tweak was made in src-tauri/crates/commit_ai/src/cloud.rs (Markdown formatting text).
Key behavior changes
run_integration_review_action now accepts two additional optional inputs: merge_method: Option<String> and cleanup_path: Option<String>.
If merge_method is provided for a merge action, the code validates and uses provider-specific payloads (via merge_payload) when issuing the merge request.
If cleanup_path is provided and the action is merge, the integrations code attempts to prepare a cleanup plan (remote PR verification + local checks) before performing the merge; on success it will call the cleanup finish step after the merge completes.
The local cleanup implementation will refuse to proceed if it detects uncommitted changes, an ongoing merge/rebase/cherry-pick, branch names that look invalid, a non-matching remote URL, or concurrent changes that would make deletion unsafe. Similarly, the finish step rejects concurrent remote changes and preserves branches when it cannot safely delete them.
Why this matters (evidence-based)
The diffs show provider-specific merge payload generation is now used for GitHub, GitLab, Gitea and Azure DevOps requests rather than an empty JSON object. Azure DevOps is handled by merging the provider payload into the final JSON body containing status and the merge commit id.
The new integrations/cleanup.rs module reads the PR payload from the provider API and maps it to a CleanupPlan. The git/review_cleanup.rs module contains the implementation for local verification and safe deletion operations, including comprehensive checks and explicit fetch/push operations with authentication.
Testing
Tests were added under src-tauri/src/git/review_cleanup.rs exercising the cleanup logic, but no test execution results were provided.
Recommended reviewer checks
Unit tests: run the tauri workspace tests to execute the new cleanup tests (example):
From the repository root run cd src-tauri && cargo test (or run your workspace's normal test command).
Manual/behavioural check of merges for each provider: verify merge_payload outputs expected JSON for github, gitlab, gitea, and azure-devops, and that the integrations code sends that payload when merge_method is set.
Cleanup safety: review git/review_cleanup.rs for the intended safety invariants (worktree cleanliness, remote URL matching, expected-old-value push deletion) and confirm they align with expected repository-local policies.
Call sites: update any internal callers of run_integration_review_action if they exist, since its signature now includes merge_method and cleanup_path optional parameters.
Compatibility and reviewer action
This introduces optional parameters to the internal run_integration_review_action interface. Any code that calls this function directly inside the codebase must be updated to pass the new parameters (or None) as appropriate.
The cleanup feature can delete branches locally and remotely when safety checks pass. Reviewers should confirm that callers only enable cleanup (cleanup_path) when the local repository path refers to a trusted checkout matching the PR's remote.
No test execution results were provided.
This change adds provider-aware merge payloads and an optional automatic local branch cleanup flow when accepting/merging review requests.
Summary
- Integrations: the review/merge flow now accepts a merge-method parameter and constructs provider-specific merge payloads instead of sending a generic empty body. Azure DevOps handling is adapted to merge the provider payload with the required `status` and `lastMergeSourceCommit` fields.
- Integrations: a new cleanup flow is introduced under `src-tauri/src/integrations/cleanup.rs`. When a merge action is requested and a `cleanup_path` is provided, the integrations layer calls into a prepare step (which verifies the PR details remotely) before performing the merge and then runs a finish step after the merge to perform local repository cleanup.
- Git layer: a new module `src-tauri/src/git/review_cleanup.rs` implements the local-side cleanup plan (`prepare` and `finish`). It validates branches and remotes, checks worktree cleanliness, verifies remote/local SHAs, performs authenticated fetches, fast-forwards or checks out the target branch, and removes the PR branch both remotely (using expected-old-value deletion when safe) and locally (removing branch refs and associated branch config). Several safety checks prevent destructive actions when the local repo or remote have diverged or when the branch is in use in another worktree.
- Tests: unit tests for the local cleanup logic are added in `src-tauri/src/git/review_cleanup.rs`. They cover normal deletion after merge (including squash/merge), acceptance of server-side deletion, preservation of dirty or unpushed local work, concurrent local/remote commits, and protection against mismatched remotes or active worktrees.
- Small exports and plumbing: `git::review_cleanup` is exported via `src-tauri/src/git.rs`, and `integrations::merge` helpers are used for generating payloads. A minor doc/template tweak was made in `src-tauri/crates/commit_ai/src/cloud.rs` (Markdown formatting text).
Key behavior changes
- run_integration_review_action now accepts two additional optional inputs: `merge_method: Option<String>` and `cleanup_path: Option<String>`.
- If `merge_method` is provided for a merge action, the code validates and uses provider-specific payloads (via `merge_payload`) when issuing the merge request.
- If `cleanup_path` is provided and the action is `merge`, the integrations code attempts to prepare a cleanup plan (remote PR verification + local checks) before performing the merge; on success it will call the cleanup finish step after the merge completes.
- The local cleanup implementation will refuse to proceed if it detects uncommitted changes, an ongoing merge/rebase/cherry-pick, branch names that look invalid, a non-matching remote URL, or concurrent changes that would make deletion unsafe. Similarly, the finish step rejects concurrent remote changes and preserves branches when it cannot safely delete them.
Why this matters (evidence-based)
- The diffs show provider-specific merge payload generation is now used for GitHub, GitLab, Gitea and Azure DevOps requests rather than an empty JSON object. Azure DevOps is handled by merging the provider payload into the final JSON body containing `status` and the merge commit id.
- The new `integrations/cleanup.rs` module reads the PR payload from the provider API and maps it to a `CleanupPlan`. The `git/review_cleanup.rs` module contains the implementation for local verification and safe deletion operations, including comprehensive checks and explicit fetch/push operations with authentication.
Testing
- Tests were added under `src-tauri/src/git/review_cleanup.rs` exercising the cleanup logic, but no test execution results were provided.
Recommended reviewer checks
1. Unit tests: run the tauri workspace tests to execute the new cleanup tests (example):
- From the repository root run `cd src-tauri && cargo test` (or run your workspace's normal test command).
2. Manual/behavioural check of merges for each provider: verify `merge_payload` outputs expected JSON for `github`, `gitlab`, `gitea`, and `azure-devops`, and that the integrations code sends that payload when `merge_method` is set.
3. Cleanup safety: review `git/review_cleanup.rs` for the intended safety invariants (worktree cleanliness, remote URL matching, expected-old-value push deletion) and confirm they align with expected repository-local policies.
4. Call sites: update any internal callers of `run_integration_review_action` if they exist, since its signature now includes `merge_method` and `cleanup_path` optional parameters.
Compatibility and reviewer action
- This introduces optional parameters to the internal `run_integration_review_action` interface. Any code that calls this function directly inside the codebase must be updated to pass the new parameters (or `None`) as appropriate.
- The cleanup feature can delete branches locally and remotely when safety checks pass. Reviewers should confirm that callers only enable cleanup (`cleanup_path`) when the local repository path refers to a trusted checkout matching the PR's remote.
No test execution results were provided.
Christoph
added 3 commits 2026-09-18 13:25:03 +00:00
Replace the plain textarea in CreateReviewDialog with CommentEditor bound to
the description. The dialog now passes language, disabled, rows, ariaLabel,
previewLabel and placeholder so the description field gains markdown preview
and consistent accessible labels/placeholders.
Make CommentEditor props optional and configurable:
- onSend is now (() => void | Promise<void>) | undefined; Enter/Cmd+Enter and
the send button are guarded/hidden when onSend is not provided.
- Add placeholder, ariaLabel, previewLabel and rows (default 5) to allow
parent components to control appearance and accessibility.
Also add a small documentation tweak in commit_ai's cloud template: remind
authors to keep the title plain text and expand guidance on Markdown formatting.
Introduce dedicated merge handling for integration review merges:
- Add src-tauri/src/integrations/merge.rs: implements merge_options (read provider repo settings), merge_payload (build provider-specific merge body) and a Tauri command get_integration_review_merge_options. Includes unit tests for behavior.
- Wire merge module into integrations.rs and pass an optional merge_method into provider-specific review action functions (GitHub, GitLab, Gitea, Azure DevOps). run_integration_review_action now accepts an optional merge_method, validates it early, and includes provider-specific merge payloads when performing a merge.
- Export the new command in src-tauri/src/main.rs so the frontend can request merge options.
Frontend changes to support selecting a merge method before merging:
- ConfirmDialog.svelte: add SelectMenu support and a select field to confirm requests.
- ReviewCenter.svelte: fetch integration merge options, show a merge-method selector in the merge confirmation, and pass the chosen method to the review action.
- Update types and git bindings to surface IntegrationMergeOptions / IntegrationMergeMethod and the getIntegrationReviewMergeOptions call (git.ts / types.ts changes staged).
Effect: users can pick a merge method appropriate to the provider/project; the integration layer generates the correct API payload per provider. Tests added for merge logic.
Add a new git::review_cleanup module that implements a CleanupPlan with
prepare() and finish() routines to safely remove/clean tracking and local
branches after a PR/MR is merged. The cleanup logic validates branch names,
ensures a clean worktree, checks remotes/URLs, verifies commits/ancestry,
protects against concurrent worktrees or divergent local/remote commits, and
performs authenticated fetch/push and ref updates. Unit tests for the cleanup
behavior are included.
Wire provider-side cleanup into integrations:
- add an integrations/cleanup module to read provider PR payloads and derive
cleanup inputs
- run cleanup::prepare(...) before performing a merge when an optional
cleanup_path is provided
- after a successful provider merge, run cleanup::finish(...); any failure is
reported as MERGE_ACCEPTED_CLEANUP_FAILED
Also:
- export the new git review_cleanup module (src-tauri/src/git.rs)
- accept an optional cleanup_path parameter in run_integration_review_action
- remove the previous REVIEW_REQUEST_TIMEOUT wrapper around the spawned
blocking task (the integration action is no longer wrapped with the 35s timeout)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
This change adds provider-aware merge payloads and an optional automatic local branch cleanup flow when accepting/merging review requests.
Summary
statusandlastMergeSourceCommitfields.src-tauri/src/integrations/cleanup.rs. When a merge action is requested and acleanup_pathis provided, the integrations layer calls into a prepare step (which verifies the PR details remotely) before performing the merge and then runs a finish step after the merge to perform local repository cleanup.src-tauri/src/git/review_cleanup.rsimplements the local-side cleanup plan (prepareandfinish). It validates branches and remotes, checks worktree cleanliness, verifies remote/local SHAs, performs authenticated fetches, fast-forwards or checks out the target branch, and removes the PR branch both remotely (using expected-old-value deletion when safe) and locally (removing branch refs and associated branch config). Several safety checks prevent destructive actions when the local repo or remote have diverged or when the branch is in use in another worktree.src-tauri/src/git/review_cleanup.rs. They cover normal deletion after merge (including squash/merge), acceptance of server-side deletion, preservation of dirty or unpushed local work, concurrent local/remote commits, and protection against mismatched remotes or active worktrees.git::review_cleanupis exported viasrc-tauri/src/git.rs, andintegrations::mergehelpers are used for generating payloads. A minor doc/template tweak was made insrc-tauri/crates/commit_ai/src/cloud.rs(Markdown formatting text).Key behavior changes
merge_method: Option<String>andcleanup_path: Option<String>.merge_methodis provided for a merge action, the code validates and uses provider-specific payloads (viamerge_payload) when issuing the merge request.cleanup_pathis provided and the action ismerge, the integrations code attempts to prepare a cleanup plan (remote PR verification + local checks) before performing the merge; on success it will call the cleanup finish step after the merge completes.Why this matters (evidence-based)
statusand the merge commit id.integrations/cleanup.rsmodule reads the PR payload from the provider API and maps it to aCleanupPlan. Thegit/review_cleanup.rsmodule contains the implementation for local verification and safe deletion operations, including comprehensive checks and explicit fetch/push operations with authentication.Testing
src-tauri/src/git/review_cleanup.rsexercising the cleanup logic, but no test execution results were provided.Recommended reviewer checks
cd src-tauri && cargo test(or run your workspace's normal test command).merge_payloadoutputs expected JSON forgithub,gitlab,gitea, andazure-devops, and that the integrations code sends that payload whenmerge_methodis set.git/review_cleanup.rsfor the intended safety invariants (worktree cleanliness, remote URL matching, expected-old-value push deletion) and confirm they align with expected repository-local policies.run_integration_review_actionif they exist, since its signature now includesmerge_methodandcleanup_pathoptional parameters.Compatibility and reviewer action
run_integration_review_actioninterface. Any code that calls this function directly inside the codebase must be updated to pass the new parameters (orNone) as appropriate.cleanup_path) when the local repository path refers to a trusted checkout matching the PR's remote.No test execution results were provided.