Fix #203: add Merge Branch button to addon, repair Check Merge Conflicts - #229
Conversation
Branch deletion failed with a 500 because commits.branch_id, object_locks.branch_id, and branches.parent_branch_id are FKs with default ON DELETE RESTRICT. Any branch with attached commits, locks, or child branches violated the constraint and surfaced as an Internal Server Error. - delete_branch now reassigns commits to the parent (or default) branch so history survives, detaches child branches' parent pointer, and clears scoped object locks before removing the branch row. - Added _validate_branch_name to reject empty/whitespace, slashes, control chars, other punctuation, and names over 100 chars at create and rename time, with HTTP 400 errors that match the test expectations. - Backfilled branch coverage in tests/test_projects.py (rename, default-branch guards, special-char rejection, delete with commits, delete with child branch) and corrected the "name" -> "branch_name" payload mismatch in tests/test_authorization.py so the role-based branch tests actually run. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add Merge Branch operator + button to the BVCS N-panel and fix the broken Check Merge Conflicts button (was calling /conflicts, an endpoint that no longer exists). Check Merge Conflicts now does pure local three-way detection and surfaces results in the existing per-object resolution UI used by Push/Pull. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8c7278a38c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| base_objects_map = ( | ||
| _get_commit_objects_by_hash(prefs, base_hash) | ||
| if base_hash and base_hash != remote_hash | ||
| else {} |
There was a problem hiding this comment.
Avoid empty merge base when remote head is unchanged
When base_hash equals remote_hash (the remote branch has not advanced since last sync), this branch sets base_objects_map to {} and still runs compute_object_diff. In that case any local-only edits are misclassified as ADDED_BOTH conflicts because every object looks “new” relative to an empty base, so Check Merge Conflicts reports false conflicts and can drive users into unnecessary conflict-resolution merge commits despite no remote drift.
Useful? React with 👍 / 👎.
Summary
POST /api/projects/{id}/branches/{branch_id}/merge)./api/projects/{id}/conflicts— an endpoint that no longer exists, so it always errored. It now runs the local three-way diff and populates the samebvcs_merge_conflicts/bvcs_conflict_itemsstate that Push/Pull use, so conflicts show up in the existing per-object resolution UI (Keep Local / Keep Remote / Keep Both / Delete → Apply Resolutions / Cancel / Preview Remote).Closes #203.
Test plan
main, click Merge Branch, pickalice, leave message blank → success report; click Pull and verify the merge commit lands in the scene.🤖 Generated with Claude Code