[Regression] Branch creation via UI does not create git branch in Sztabina (SZ-128)
rk@tigase.net opened 4 days ago

Summary

Creating a branch via the Sztab UI creates a database record only. The corresponding git branch is not created in Sztabina. This breaks the PR creation flow — the PR form queries Sztabina for branches and finds none, showing "No branches found. Check git repository configuration." Users have no indication that a manual git push is required.

Severity

Blocker

Estimated Fix Time

3 hours

Steps to Reproduce

  1. Create a local project in Sztab UI
  2. Navigate to Branches tab
  3. Click "+ Create Branch", enter a name, select parent branch
  4. Branch appears in Sztab's branch list with ACTIVE status
  5. Navigate to Pull Requests, click "+ Create PR"
  6. Source Branch dropdown shows "No branches found. Check git repository configuration."

Expected Behavior

When a user creates a branch via the Sztab UI, Sztab should:

  1. Create the branch record in the DB (existing behavior)
  2. Call Sztabina to create the git ref branching from the parent branch HEAD
  3. Branch is immediately pushable and visible in PR creation form

This is the standard behavior in GitHub, GitLab, and Gitea — "Create Branch" means the branch exists in git immediately.

Actual Behavior

Branch creation only creates a DB record. Sztabina has no corresponding git branch. The branch is not pushable via git checkout <branch> on a fresh clone. PR creation form cannot find the branch.

  • rk@tigase.net commented 4 days ago

    Root Cause

    BranchService.createBranch() persists the branch entity to the DB but does not call SztabinaClient to create the corresponding git ref. The Sztabina client likely already has or needs a createBranch(projectName, branchName, parentBranchName) endpoint.

    Fix

    Backend — BranchServiceImpl.createBranch()

    After persisting the branch to the DB, call Sztabina to create the git ref:

    sztabinaClient.createBranch(
        project.getName(),
        branch.getName(),
        branch.getParent().getName()
    );
    

    Sztabina — if endpoint does not exist

    Add a POST /repos/{name}/branches endpoint that creates a git branch from a given parent ref using JGit or native git.

    Error handling

    If Sztabina branch creation fails, roll back the DB record and surface a clear error to the user. Do not leave a DB branch record without a corresponding git branch.

    • SZ-136 — PR creation form error message misleading when no commits exist
    • SZ-121 — Visual branch display (BranchTreeView parentId bug)

    Notes

    This defect applies to LOCAL (Sztabina-hosted) projects only. EXTERNAL projects manage their own git branches independently.

  • rk@tigase.net commented 3 days ago
    rksuma@Ramakrishnans-MacBook-Pro sztab % git status
    On branch release/1.10.0
    Your branch is up to date with 'origin/release/1.10.0'.
    
    nothing to commit, working tree clean
    rksuma@Ramakrishnans-MacBook-Pro sztab % git checkout -b fix/SZ-128-Branch-creation-via-UI-does-not-create-git-branch 
    Switched to a new branch 'fix/SZ-128-Branch-creation-via-UI-does-not-create-git-branch'
    rksuma@Ramakrishnans-MacBook-Pro sztab % 
    
    
  • rk@tigase.net changed state to 'In Progress' 3 days ago
    Previous Value Current Value
    Open
    In Progress
  • rk@tigase.net commented 2 days ago

    Merged into release/1.10.0

  • rk@tigase.net changed state to 'Pending approval' 2 days ago
    Previous Value Current Value
    In Progress
    Pending approval
  • rk@tigase.net commented 4 hours ago

    Fix merged into wolsonsc

  • rk@tigase.net changed state to 'Closed' 4 hours ago
    Previous Value Current Value
    Pending approval
    Closed
issue 1 of 1
Type
Bug
Priority
Major
Assignee
Version
1.10.0
Sprints
n/a
Customer
n/a
Issue Votes (0)
Watchers (3)
Reference
SZ-128
Please wait...
Page is in error, reload to recover