Open ukarlsson opened 1 week ago
Thanks a lot for reporting!
This is an issue where I have no idea how to approach it, at least assuming that a foundational feature like creating a PR isn't broken for everyone. And that I could validate, as I was able to create a PR without a problem in a private repository.
Can you provide more information that might help to reproduce the issue?
Ok many thanks for the response. Any logs I can supply?
It is pretty consistent now that first time I press create PR I get this error, and then the second time it works
Thank you, too!
I think for this interaction, the developer console might have additional logs. You can open it with Cmd + Opt + i
.
The head invalid
message is probably created by the API, which means the first time around, the head
is invalid, the second time it's working. Like a race condition, or something processed out of order.
Ok, got info from network console now
Error is
{
"message": "Validation Failed",
"errors": [
{
"resource": "PullRequest",
"field": "head",
"code": "invalid"
}
],
"documentation_url": "https://docs.github.com/rest/pulls/pulls#create-a-pull-request",
"status": "422"
}
Summary
URL: https://api.github.com/repos/sanalabs/sierra-platform/pulls
Status: 422
Source: Network
Address: 140.82.121.6:443
Initiator:
fetch.js:54
Request data
{"head":"refactor-namespace-processing","base":"master","title":"Update namespace handling in analytics cache refresh","body":"","draft":false}
When I press create PR again the request body is slightly different, and head is indeed different
{"head":"uk/refactor-namespace-processing","base":"master","title":"Update namespace handling in analytics cache refresh","body":"","draft":false}
It seem like it is missing uk/...
prefix the first time
That is very interesting, thanks a lot for providing information this detailed!
Maybe @mtsgrd has seen this before, or an idea what it could be.
I had a quick look, I think this is the problem: https://github.com/gitbutlerapp/gitbutler/blob/a0b83556d2245202dc810ab5502ea117165a49cc/apps/desktop/src/lib/utils/branch.ts#L3-L5
Called from here: https://github.com/gitbutlerapp/gitbutler/blob/d7c00a0b9fb04188b6c38babd7ddee6174567f31/apps/desktop/src/lib/branch/BranchHeader.svelte#L120-L125
@estib-vega any chance you could fixup the ref name -> branch name function?
Thanks, really looking forward to a fix!
Yes! Taking a look now
Sorry about that @ukarlsson!
@ukarlsson Just so that I can fully understand how to recreate this bug:
If your remote name is e.g. origin
and you want to push your local branch to origin/uk/refactor-namespace-processing
, and it's only working on the second time.
Is this assumption right?
Yes, seems like it. It removes the uk/
prefix the first time I press create PR so it seems like it can not find the branch
I think it possibly pushes the branch correctly but then it can not create the PR since it references the wrong branch name
Can I test this fix?
Hey @ukarlsson, yes you can. This PR should already address your issue https://github.com/gitbutlerapp/gitbutler/pull/4927.
There's another fix still waiting to be reviewed: https://github.com/gitbutlerapp/gitbutler/pull/4928. For context: That second one will add support for remote names that have slashes in them.
Let me know if you still find any issues :)
Ok, any easy way to download a build with the fix included?
@ukarlsson The nightly should already have the first change in: Apple Silicon Nightly Build
Version
0.12.25
Operating System
Mac OS X
Distribution Method
dmg (Apple Silicon)
Describe the issue
Error when creating PR. It works when I click "Create PR" again, but often I get this error the first time
GitHub validation failed It seems there was a problem validating the request.
Please see our documentation for additional help. head invalid
How to reproduce
Click "Create PR"
Expected behavior
Screenshot of error
Relevant log output
No response