Files
archived-orca/src/shared/github/exact-work-item-operation.ts
T
Brennan Benson 40f9d2a246 Keep desktop fork pull requests on their opened repository (#36172)
* Keep opened GitHub work items bound to their exact repository

* Bind GitHub work item ownership through consumers and dispatch

* Keep empty mention lists from consuming selection keys

* Preserve GitHub action and consumer ownership across resource changes

* Exercise repository account updates through their production store action

* Exercise account publication and cache settlement through GitHub consumers

* Simplify fork PR contract verification

* Make contract verification imports and clocks deterministic

* Correct mobile task test fixtures and model types

* Correct task recording fixtures and CI types

* Correct task fixture types and static checks

* Consolidate replay test RPC imports

* Separate GitHub metadata imports from Linear hooks

* Scope mobile PR sidebar reads to the selected resource

* Separate desktop GitHub changes from phone updates

* Fix relay authority probe census across topology cases

* Repair repository owner proof fixtures and compiler allocation

* Preserve repository row observation in host lookup

* Seed metadata fixture before server-side store acquisition

* Preserve nullable fixture settings and discover mixed test types

* Preserve GitHub detail argument types and optional capabilities

* Let keyed details queries own pending read replacement

* Repair GitHub RPC and relay test fixture boundaries

* Verify expected GitHub account at repository execution capture

* Preserve captured GitHub account expectations through client dispatch

* Retain observed runtime status after switching environments

* Fix account contract fixture types and RPC setup timing

* Restore the negative-capability switch probe assertion

* Align account fixtures with runtime identity and configured origin

* Consolidate details test imports

* Drop duplicate fork pull request identity tests
2026-11-02 13:22:48 -08:00

40 lines
1.2 KiB
TypeScript

import { z } from 'zod'
import { SlugRepo } from '../rpc-contract/github-repo-target-params'
import { ExpectedRuntimeSourceSchema } from '../runtime-rpc-envelope'
const methods = new Set([
'github.workItemDetails',
'github.updateIssue',
'github.listLabels',
'github.listAssignableUsers'
])
const exactShape = z.object({
ownerRepo: SlugRepo,
expectedRuntimeSource: ExpectedRuntimeSourceSchema
})
// Only the complete opt-in pair promises enforcement; old independently optional fields stay optional.
export function classifyExactGitHubOperation(method: string, params: unknown, envelope: unknown) {
if (
!methods.has(method) ||
!isRecord(params) ||
!isRecord(envelope) ||
!Object.hasOwn(params, 'ownerRepo') ||
!Object.hasOwn(envelope, 'expectedRuntimeSource')
) {
return null
}
const parsed = exactShape.safeParse({
ownerRepo: params.ownerRepo,
expectedRuntimeSource: envelope.expectedRuntimeSource
})
if (!parsed.success) {
throw new Error('Unable to identify the GitHub operation. Open the item again and try again.')
}
return parsed.data
}
function isRecord(value: unknown): value is Record<string, unknown> {
return typeof value === 'object' && value !== null && !Array.isArray(value)
}