mirror of
https://github.com/stablyai/orca.git
synced 2026-10-16 16:03:26 +00:00
Prefer fetched PR head SHA over cached status SHA for PR checks
On mobile, a create command can commit before opening the review, meaning the fetched PR's head SHA is fresher than the route's cached status SHA. Prioritizing the fetched PR head SHA ensures we fetch checks for the most up-to-date commit.
This commit is contained in:
@@ -103,7 +103,9 @@ export async function loadPrSidebarData(
|
||||
const pr = prOutcome.result
|
||||
const checksOutcome = await deps.fetchPRChecks(args.worktreeId, {
|
||||
prNumber: pr.number,
|
||||
headSha: args.headSha ?? pr.headSha ?? null,
|
||||
// Why: mobile create can commit before opening the review; the fetched PR
|
||||
// head is fresher than the route's cached git.status head.
|
||||
headSha: pr.headSha ?? args.headSha ?? null,
|
||||
// Prefer the fetched PR's own repo identity so fork PRs key their cached
|
||||
// checks correctly; fall back to an explicit override then null.
|
||||
prRepo: pr.prRepo ?? args.prRepo ?? null
|
||||
|
||||
@@ -85,10 +85,10 @@ describe('loadPrSidebarData', () => {
|
||||
expect(d.fetchWorkItemDetails).not.toHaveBeenCalled()
|
||||
// forBranch's PR number is threaded into prForBranch as the linked hint.
|
||||
expect(d.fetchPRForBranch).toHaveBeenCalledWith('w', { branch: 'feat', linkedPRNumber: 7 })
|
||||
// headSha forwarded to checks (status SHA wins over pr.headSha).
|
||||
// The fetched PR head wins over the route's cached status SHA.
|
||||
expect(d.fetchPRChecks).toHaveBeenCalledWith('w', {
|
||||
prNumber: 7,
|
||||
headSha: 'sha-status',
|
||||
headSha: 'sha-pr',
|
||||
prRepo: null
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user