Skip to content

feat: MiniGit merge for BLRID-3 - #5

Open
krastogi-in wants to merge 1 commit into
mainfrom
aiagent/BLRID-3
Open

feat: MiniGit merge for BLRID-3#5
krastogi-in wants to merge 1 commit into
mainfrom
aiagent/BLRID-3

Conversation

@krastogi-in

Copy link
Copy Markdown
Owner

Summary

  • Implements minigit merge <branch> into HEAD: fast-forward or two-parent merge commit
  • Additive second_parent_hash storage; conflict abort leaves tip unchanged
  • Flask UI merge form; CLI reports already-up-to-date / errors
  • Tests: FF, two-parent, missing ref, conflict abort, already-up-to-date (tests/test_merge.py)

Jira: BLRID-3

Test plan

  • pytest tests/test_merge.py (6 passed)
  • Full suite: 75 passed
  • Review CLI: merge FF, diverged clean, conflict, missing branch
  • Review Flask merge form on repo detail
  • Note: full make check still blocked by pre-existing ruff issues unrelated to this change (same as prior BLRID-2 review)

Made with Cursor

Implement merge of a source branch into HEAD with fast-forward,
two-parent merge commits, conflict abort, CLI, and Flask UI.

Co-authored-by: Cursor <cursoragent@cursor.com>

@krastogi-in krastogi-in left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checker review (code-review-and-quality) — BLRID-3

Five-axis summary below; inline comments for gaps/edge cases. Not a maker self-LGTM.

Axis Severity Notes
Correctness Pass (Suggestion notes) FF / two-parent / conflict abort match AC; tip unchanged on conflict
Tests Suggestion Core AC covered in test_merge.py; no CLI/Flask automated coverage
Security Pass Parameterized SQL; hash validation on second_parent_hash; no secrets
Maintainability Pass Merge isolated in frontend/merge.py; thin CLI/app
Requirements Pass Ticket AC paths covered at ops layer

Verdict from checker: acceptable to ship pending outer-loop decision. See inline comments.

Comment thread src/frontend/merge.py

ancestor = _find_common_ancestor(ops, head_tip, source_tip)
if ancestor is None:
raise ValueError("Unrelated histories: no common ancestor")

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] Unrelated-histories path is implemented (ancestor is None → error) but has no test. Consider adding a fixture with two roots to lock this error path.

Comment thread src/frontend/merge.py
return str(source_tip)

if ancestor == source_tip:
return str(head_tip)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] ancestor == source_tip is treated as already-up-to-date (return HEAD unchanged). Ops tests cover tip equality via same-tip branch, but not “source behind HEAD”. Optional: assert this case explicitly so CLI “Already up to date.” stays honest.

Comment thread tests/test_merge.py
from pathlib import Path


class TestMerge:

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion / AC coverage] Ticket requires Flask + CLI surfaces; behavior is wired, but there are no automated tests for cmd_merge or the /merge route (already-up-to-date message, conflict flash, missing branch). Ops-level tests cover the core algorithm — consider a thin CLI/app smoke test if you want AC fully proven in CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant