fix: handle GitHub connector branch refs and resyncs#2611
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@cyphercodes is attempting to deploy a commit to the Different AI Team on Vercel. A member of the Team first needs to authorize it. |
Pablosinyores
left a comment
There was a problem hiding this comment.
This reads well. normalizeGithubBranchRef correctly accepts both a bare main and a full refs/heads/main (stripping the prefix, rebuilding the canonical ref, and validating the caller's ref against either form), and threading the normalized branch through the branch-existence path and the path/branchExists checks keeps them consistent. The immediate-sync path is also careful: autoImportError is accumulated, the catch records it, and eventStatus resolves to failed/completed with completedAt set — so a failing manual sync ends in a terminal failed state rather than the "stuck forever" the queued path had. Good.
One design question on running the sync inline (runGithubConnectorSyncNow awaited directly in the route): the fix trades "sync event stays queued forever" for "the HTTP request now blocks until the whole import finishes." For a large repository that import could take a while — is there a bound on what a single manual resync pulls, or a request timeout in front of this route? If manual resync is always small/bounded, inline is fine; if it can be large, it might be worth keeping the work off the request path (respond running, do the import in the background) so a big repo doesn't time out the retry button. Not a blocker, just want to make sure the immediate path can't reintroduce a different failure mode.
Minor: the eventStatus nested ternary is a little hard to scan — a small helper or an explicit if/else would read easier for the next person, but purely cosmetic.
The test using both bare and fully-qualified refs is a good addition and covers the case #2533 hit.
Summary
mainvalidate againstrefs/heads/main.Why
ref=mainfails validation and resync remains queued without progress.Issue
Scope
Out of scope
Testing
Ran
bun test ee/apps/den-api/test/github-connector-app.test.tspnpm --filter @openwork-ee/den-api buildgit diff --check HEAD~1..HEADResult
CI status
Manual verification
branch=main/ref=mainand stores canonicalrefs/heads/main.Evidence
Risk
Rollback