-
Type: Bug
-
Status: Resolved
-
Priority: Critical
-
Resolution: Fixed
-
Affects Version/s: 3.16.0
-
Component/s: Versioning & Branch management
-
Tags:
-
Backlog priority:800
-
Team:NOS
-
Sprint:NOS 11.1.15 - 2019-08 1
Overview
Reproduction steps:
- The project is on branch master
- Create new branch "topic", and observe that a new branch is created as feature/topic
- Checkout new branch feature/topic, the checkout is successful
- Open a new private browsing window and ensure not landing on the same node.
- Go to the same Studio project
- Observe error: "The branch "feature/topic" was not found for the current project. Falling back to default branch".
Datadog Logs:
- There's no logs available.
Investigation
Right after the checkout action at step 3, the user-preference for Mincong Huang is on branch "feature/topic", as we can see in Studio Project document:
<sp:prefsPerUser> <prefs> <commitOnSave><![CDATA[false]]></commitOnSave> <activeBranch><![CDATA[feature/topic]]></activeBranch> <mergeOnCommit><![CDATA[true]]></mergeOnCommit> <username><![CDATA[mhuang]]></username> </prefs> </sp:prefsPerUser>
And the new branch is available in Git server, because I see it in my desktop via Git Access:
mhuang-SANDBOX (master u=) $ git fetch prod remote: Finding sources: 100% (177/177) remote: Getting sizes: 100% (136/136) remote: Total 177 (delta 0), reused 177 (delta 0) Receiving objects: 100% (177/177), 54.28 KiB | 610.00 KiB/s, done. From https://connect.nuxeo.com/nuxeo/git/mhuang-SANDBOX * [new branch] feature/topic -> prod/feature/topic
Impact
If the HTTP request go to a Nuxeo node containing out-dated workspace, it leads to:
- Hot reload failure
- Nuxeoctl failure
- Studio project not loading
Cause
In our workspace service, we create WIP branch if not existing. However, it requires that the existence of its feature branch. In our case, the feature branch does not exist.
@Override public Workspace getWorkspace(String projectId, String branchName) throws ProjectNotFoundException, WorkspaceCreationException, BranchNotFoundException { Workspace workspace = getRawWorkspace(projectId); Branch asBranch = Branch.ofInternalName(branchName); if (asBranch.isWorkingBranch()) { Framework.getService(GitService.class).createWIPBranchIfNonExisting(workspace, asBranch); } return workspace.checkoutOnBranch(asBranch); }
Proposals
Git service should perform a git-fetch when querying the existence the feature branch, to ensure information is up-to-date.
Framework.getService(GitService.class).createWIPBranchIfNonExisting(workspace, asBranch);