mirror of
https://github.com/stablyai/orca.git
synced 2026-11-15 02:17:31 +00:00
* fix(github): start explicit Checks refreshes after the action * fix(github): give explicit Checks refreshes fresh checks and comments The same Refresh or Link click that now reads PR metadata after the action also reads checks and comments after it: an explicit request no longer joins or waits on a read begun before the click, in the renderer or (for checks) the host coalescer. A superseded read's callers show the owner's answer, so a late pre-click reply cannot repaint the panel, and comments posted during either read are kept. A lost IPC/RPC reply is reported only to the click that asked; polls stay silent as before, and a later answer clears a failure older than itself. The manual hook takes its verdict from its own lookup, the link flow's card-read failure no longer skips checks, and the web shim forwards the intent. * fix(github): land the older Checks reply when a newer explicit read fails When a click's checks or comments read fails while the read it replaced succeeds, the click's read now lands that older reply through its owner path instead of leaving the cache behind it. Post-write comments refreshes (mutation events, bulk resolve) carry the explicit intent so they cannot be answered by a read begun before the write. * test(github): drop type assertions from the explicit-refresh tests The RPC tests call the handlers with a real runtime service and spies, and the panel test passes typed fixtures straight to the hooks. * test(github): type the Checks panel fixtures for the renderer project The renderer tests build their PR fixture locally instead of importing a main-process harness, and the panel setter mocks take the hooks' SetStateAction form.
82 lines
2.7 KiB
TypeScript
82 lines
2.7 KiB
TypeScript
import { z } from 'zod'
|
|
import type { GitHubPRRefreshReason } from '../github/pull-request-refresh-types'
|
|
import { RepoSelector, SlugRepo } from './github-repo-target-params'
|
|
import { OptionalString, requiredString } from './rpc-param-primitives'
|
|
|
|
export const OptionalPRRefreshReason = z
|
|
.unknown()
|
|
.optional()
|
|
.transform((value): GitHubPRRefreshReason | undefined => {
|
|
return value === 'visible' ||
|
|
value === 'active' ||
|
|
value === 'post-push' ||
|
|
value === 'manual' ||
|
|
value === 'swr'
|
|
? value
|
|
: undefined
|
|
})
|
|
|
|
export const PrForBranch = RepoSelector.extend({
|
|
branch: requiredString('Missing branch'),
|
|
reason: OptionalPRRefreshReason,
|
|
userRefresh: z.boolean().optional(),
|
|
linkedPRNumber: z.number().int().positive().nullable().optional(),
|
|
fallbackPRNumber: z.number().int().positive().nullable().optional(),
|
|
acceptMergedFallbackPR: z.boolean().optional(),
|
|
currentHeadOid: z.string().nullable().optional()
|
|
})
|
|
|
|
export const PullRequest = RepoSelector.extend({
|
|
prNumber: z.number().int().positive(),
|
|
noCache: z.boolean().optional(),
|
|
prRepo: SlugRepo.nullable().optional()
|
|
})
|
|
|
|
export const PRCommentReaction = RepoSelector.extend({
|
|
reactionSubjectId: requiredString('Missing reaction subject ID'),
|
|
content: z.enum(['+1', '-1', 'laugh', 'confused', 'heart', 'hooray', 'rocket', 'eyes']),
|
|
reacted: z.boolean(),
|
|
prRepo: SlugRepo.nullable().optional()
|
|
})
|
|
|
|
export const PullRequestChecks = PullRequest.extend({
|
|
headSha: OptionalString,
|
|
userRefresh: z.boolean().optional()
|
|
})
|
|
|
|
export const PullRequestCheckDetails = RepoSelector.extend({
|
|
checkRunId: z.number().int().positive().optional(),
|
|
workflowRunId: z.number().int().positive().optional(),
|
|
checkName: OptionalString,
|
|
url: OptionalString.nullable().optional(),
|
|
prRepo: SlugRepo.nullable().optional()
|
|
})
|
|
|
|
export const RerunPullRequestChecks = PullRequest.extend({
|
|
headSha: OptionalString,
|
|
failedOnly: z.boolean().optional()
|
|
})
|
|
|
|
export const PullRequestFileContents = RepoSelector.extend({
|
|
prNumber: z.number().int().positive(),
|
|
prRepo: SlugRepo.nullable().optional(),
|
|
path: requiredString('Missing file path'),
|
|
oldPath: OptionalString,
|
|
status: z.enum(['added', 'removed', 'modified', 'renamed', 'copied', 'changed', 'unchanged']),
|
|
headSha: requiredString('Missing head SHA'),
|
|
baseSha: requiredString('Missing base SHA')
|
|
})
|
|
|
|
export const PullRequestFileViewed = RepoSelector.extend({
|
|
prRepo: SlugRepo.nullable().optional(),
|
|
pullRequestId: requiredString('Missing pull request ID'),
|
|
path: requiredString('Missing file path'),
|
|
viewed: z.boolean()
|
|
})
|
|
|
|
export const ReviewThread = RepoSelector.extend({
|
|
prRepo: SlugRepo.nullable().optional(),
|
|
threadId: requiredString('Missing thread ID'),
|
|
resolve: z.boolean()
|
|
})
|