@atolis-hq/wake 0.4.104 → 0.4.106

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/dist/src/activities/agent/agent-activity.js +10 -0
  2. package/dist/src/activities/contracts/activity.d.ts +28 -0
  3. package/dist/src/activities/contracts/event-schema.d.ts +314 -8
  4. package/dist/src/activities/contracts/event-schema.js +20 -2
  5. package/dist/src/activities/contracts/events.d.ts +10 -0
  6. package/dist/src/activities/contracts/vocabulary.d.ts +2 -0
  7. package/dist/src/activities/contracts/vocabulary.js +2 -0
  8. package/dist/src/activities/index.d.ts +2 -0
  9. package/dist/src/activities/index.js +2 -0
  10. package/dist/src/activities/pr/activity-support.d.ts +1 -1
  11. package/dist/src/activities/pr/activity-support.js +10 -0
  12. package/dist/src/activities/pr/application.js +8 -1
  13. package/dist/src/activities/pr/approve.d.ts +2 -1
  14. package/dist/src/activities/pr/approve.js +33 -11
  15. package/dist/src/activities/pr/check-evidence.d.ts +10 -0
  16. package/dist/src/activities/pr/check-evidence.js +16 -0
  17. package/dist/src/activities/pr/contracts.d.ts +14 -0
  18. package/dist/src/activities/pr/event-data.js +5 -1
  19. package/dist/src/activities/pr/merge.d.ts +2 -1
  20. package/dist/src/activities/pr/merge.js +54 -38
  21. package/dist/src/activities/pr/parent-scope.d.ts +65 -0
  22. package/dist/src/activities/pr/parent-scope.js +24 -0
  23. package/dist/src/activities/pr/parent-target.d.ts +45 -0
  24. package/dist/src/activities/pr/parent-target.js +59 -0
  25. package/dist/src/activities/pr/projection.js +10 -2
  26. package/dist/src/activities/pr/vocabulary.d.ts +8 -0
  27. package/dist/src/activities/pr/vocabulary.js +8 -0
  28. package/dist/src/bootstrap/activity-registry.d.ts +2 -2
  29. package/dist/src/bootstrap/activity-registry.js +3 -3
  30. package/dist/src/bootstrap/composition-root.js +11 -2
  31. package/dist/src/bootstrap/config/root-schema.d.ts +22 -0
  32. package/dist/src/bootstrap/delegation-authority.js +17 -0
  33. package/dist/src/bootstrap/delivery-integration.d.ts +9 -0
  34. package/dist/src/bootstrap/delivery-integration.js +46 -0
  35. package/dist/src/bootstrap/surface-api-delivery.js +52 -0
  36. package/dist/src/bootstrap/version.js +1 -1
  37. package/dist/src/control-plane/application/activation-scheduler-ports.d.ts +5 -1
  38. package/dist/src/control-plane/application/advance-once-dispatch.js +12 -6
  39. package/dist/src/execution/application/candidate-workspaces.d.ts +13 -0
  40. package/dist/src/execution/application/candidate-workspaces.js +75 -0
  41. package/dist/src/execution/application/execution-service.js +37 -11
  42. package/dist/src/execution/application/maintenance-workspaces.d.ts +17 -0
  43. package/dist/src/execution/application/maintenance-workspaces.js +84 -0
  44. package/dist/src/execution/application/run-lifecycle.js +2 -0
  45. package/dist/src/execution/contracts/candidate.d.ts +31 -0
  46. package/dist/src/execution/contracts/candidate.js +40 -0
  47. package/dist/src/execution/contracts/commands.d.ts +4 -0
  48. package/dist/src/execution/contracts/events.d.ts +24 -0
  49. package/dist/src/execution/contracts/events.js +4 -0
  50. package/dist/src/execution/contracts/maintenance.d.ts +36 -0
  51. package/dist/src/execution/contracts/maintenance.js +44 -0
  52. package/dist/src/execution/contracts/repository-assignment.d.ts +5 -0
  53. package/dist/src/execution/contracts/repository-assignment.js +8 -0
  54. package/dist/src/execution/contracts/views.d.ts +4 -0
  55. package/dist/src/execution/contracts/vocabulary.d.ts +5 -0
  56. package/dist/src/execution/contracts/vocabulary.js +4 -0
  57. package/dist/src/execution/contracts/workspace.d.ts +8 -0
  58. package/dist/src/execution/index.d.ts +2 -0
  59. package/dist/src/execution/index.js +2 -0
  60. package/dist/src/execution/infrastructure/workspace/git-source.d.ts +2 -2
  61. package/dist/src/execution/infrastructure/workspace/git-source.js +18 -1
  62. package/dist/src/execution/infrastructure/workspace/git-workspace.d.ts +2 -4
  63. package/dist/src/execution/infrastructure/workspace/git-workspace.js +12 -1
  64. package/dist/src/integrations/application/delegation-outputs.js +1 -1
  65. package/dist/src/integrations/application/delivery-integration-verification.d.ts +13 -0
  66. package/dist/src/integrations/application/delivery-integration-verification.js +68 -0
  67. package/dist/src/integrations/delivery/application/delivery-projector.js +3 -0
  68. package/dist/src/integrations/delivery/application/merged-delivery-evidence.js +9 -1
  69. package/dist/src/integrations/delivery/contracts/views.d.ts +2 -0
  70. package/dist/src/integrations/fake/external-source.d.ts +5 -2
  71. package/dist/src/integrations/fake/external-source.js +12 -2
  72. package/dist/src/integrations/fake/inbound-translator.js +7 -2
  73. package/dist/src/integrations/fake/provider.d.ts +17 -0
  74. package/dist/src/integrations/fake/provider.js +18 -2
  75. package/dist/src/integrations/github/application/pull-request-translation.js +2 -0
  76. package/dist/src/integrations/github/contracts/events.d.ts +3 -1
  77. package/dist/src/integrations/github/contracts/events.js +3 -1
  78. package/dist/src/integrations/github/contracts/payloads.d.ts +23 -0
  79. package/dist/src/integrations/github/infrastructure/check-execution.d.ts +9 -0
  80. package/dist/src/integrations/github/infrastructure/check-execution.js +68 -0
  81. package/dist/src/integrations/github/infrastructure/checkout-revision.d.ts +2 -0
  82. package/dist/src/integrations/github/infrastructure/checkout-revision.js +23 -0
  83. package/dist/src/integrations/github/infrastructure/client.d.ts +2 -0
  84. package/dist/src/integrations/github/infrastructure/client.js +4 -0
  85. package/dist/src/integrations/github/infrastructure/pr-check-subject.d.ts +7 -0
  86. package/dist/src/integrations/github/infrastructure/pr-check-subject.js +77 -0
  87. package/dist/src/integrations/github/infrastructure/pr-evidence.d.ts +6 -3
  88. package/dist/src/integrations/github/infrastructure/pr-evidence.js +1 -1
  89. package/dist/src/integrations/github/infrastructure/pr-source.d.ts +3 -5
  90. package/dist/src/integrations/github/infrastructure/pr-source.js +11 -1
  91. package/dist/src/integrations/github/infrastructure/workflow-run-evidence.d.ts +5 -0
  92. package/dist/src/integrations/github/infrastructure/workflow-run-evidence.js +22 -0
  93. package/dist/src/integrations/index.d.ts +1 -0
  94. package/dist/src/integrations/index.js +1 -0
  95. package/dist/src/orchestration/application/delegated-work.d.ts +5 -0
  96. package/dist/src/orchestration/application/delegated-work.js +10 -0
  97. package/dist/src/orchestration/application/delegation-commands.d.ts +16 -0
  98. package/dist/src/orchestration/application/delivery-coordinator.d.ts +348 -0
  99. package/dist/src/orchestration/application/delivery-coordinator.js +239 -0
  100. package/dist/src/orchestration/application/delivery-facts-reader.d.ts +9 -0
  101. package/dist/src/orchestration/application/delivery-facts-reader.js +47 -0
  102. package/dist/src/orchestration/application/delivery-integration-reader.d.ts +9 -0
  103. package/dist/src/orchestration/application/delivery-integration-reader.js +23 -0
  104. package/dist/src/orchestration/application/delivery-integration-service.d.ts +50 -0
  105. package/dist/src/orchestration/application/delivery-integration-service.js +228 -0
  106. package/dist/src/orchestration/application/delivery-preparation.d.ts +16 -0
  107. package/dist/src/orchestration/application/delivery-preparation.js +105 -0
  108. package/dist/src/orchestration/application/delivery-sources.d.ts +10 -0
  109. package/dist/src/orchestration/application/delivery-sources.js +41 -0
  110. package/dist/src/orchestration/application/orchestration-repository.d.ts +3 -1
  111. package/dist/src/orchestration/application/orchestration-repository.js +10 -1
  112. package/dist/src/orchestration/application/orchestration-service.d.ts +341 -2
  113. package/dist/src/orchestration/application/orchestration-service.js +86 -4
  114. package/dist/src/orchestration/contracts/config.d.ts +22 -0
  115. package/dist/src/orchestration/contracts/config.js +13 -1
  116. package/dist/src/orchestration/contracts/delegation-ports.d.ts +4 -0
  117. package/dist/src/orchestration/contracts/delegation.d.ts +13 -1
  118. package/dist/src/orchestration/contracts/delegation.js +5 -0
  119. package/dist/src/orchestration/contracts/delivery-ports.d.ts +53 -0
  120. package/dist/src/orchestration/contracts/delivery-ports.js +1 -0
  121. package/dist/src/orchestration/contracts/delivery.d.ts +310 -0
  122. package/dist/src/orchestration/contracts/delivery.js +186 -0
  123. package/dist/src/orchestration/contracts/event-decoder.js +14 -1
  124. package/dist/src/orchestration/contracts/event-factory.js +8 -0
  125. package/dist/src/orchestration/contracts/events.d.ts +10 -0
  126. package/dist/src/orchestration/contracts/events.js +4 -0
  127. package/dist/src/orchestration/contracts/views.d.ts +3 -0
  128. package/dist/src/orchestration/contracts/vocabulary.d.ts +90 -0
  129. package/dist/src/orchestration/contracts/vocabulary.js +82 -0
  130. package/dist/src/orchestration/domain/compile-diagnostics.d.ts +1 -1
  131. package/dist/src/orchestration/domain/compile-diagnostics.js +5 -0
  132. package/dist/src/orchestration/domain/compiler.js +2 -0
  133. package/dist/src/orchestration/domain/delivery-candidate.d.ts +9 -0
  134. package/dist/src/orchestration/domain/delivery-candidate.js +105 -0
  135. package/dist/src/orchestration/domain/delivery-facts.d.ts +89 -0
  136. package/dist/src/orchestration/domain/delivery-facts.js +66 -0
  137. package/dist/src/orchestration/domain/delivery-integration-policy.d.ts +7 -0
  138. package/dist/src/orchestration/domain/delivery-integration-policy.js +15 -0
  139. package/dist/src/orchestration/domain/delivery-integration.d.ts +54 -0
  140. package/dist/src/orchestration/domain/delivery-integration.js +144 -0
  141. package/dist/src/orchestration/domain/delivery-qa.d.ts +33 -0
  142. package/dist/src/orchestration/domain/delivery-qa.js +97 -0
  143. package/dist/src/orchestration/domain/delivery-replacement.d.ts +9 -0
  144. package/dist/src/orchestration/domain/delivery-replacement.js +54 -0
  145. package/dist/src/orchestration/domain/delivery-selection.d.ts +17 -0
  146. package/dist/src/orchestration/domain/delivery-selection.js +132 -0
  147. package/dist/src/orchestration/domain/delivery-workflow-policy.d.ts +6 -0
  148. package/dist/src/orchestration/domain/delivery-workflow-policy.js +32 -0
  149. package/dist/src/orchestration/domain/operator-retry-policy.js +24 -13
  150. package/dist/src/orchestration/domain/workflow-instance-events.d.ts +1 -0
  151. package/dist/src/orchestration/domain/workflow-instance-events.js +12 -0
  152. package/dist/src/orchestration/index.d.ts +3 -0
  153. package/dist/src/orchestration/index.js +1 -0
  154. package/dist/src/surfaces/api/contracts/transport-values.js +1 -0
  155. package/dist/src/surfaces/api/contracts/work.d.ts +42 -0
  156. package/dist/src/surfaces/api/presenters/execution.js +1 -0
  157. package/dist/src/surfaces/mcp/delegation.js +36 -1
  158. package/dist/src/surfaces/web-assets/assets/index-ih1h3dxC.js +1192 -0
  159. package/dist/src/surfaces/web-assets/index.html +1 -1
  160. package/package.json +1 -1
  161. package/dist/src/surfaces/web-assets/assets/index-C5R-aWzH.js +0 -1192
@@ -0,0 +1,13 @@
1
+ import { type PullRequestService } from '../../activities/index.js';
2
+ import type { RunView } from '../../execution/index.js';
3
+ import type { DeliveryIntegration } from '../../orchestration/index.js';
4
+ import { type ResourceService } from '../../resources/index.js';
5
+ import type { ProviderInstance } from '../contracts/provider.js';
6
+ export type DeliveryIntegrationVerification = Pick<DeliveryIntegration, 'verifyTarget'>;
7
+ /** Reuses provider artifact verification and the target's own current review/check authority. */
8
+ export declare function createDeliveryIntegrationVerification(input: {
9
+ readonly resources: ResourceService;
10
+ readonly pullRequests: PullRequestService;
11
+ readonly runs: () => Promise<readonly RunView[]>;
12
+ readonly providers: () => Promise<readonly ProviderInstance[]>;
13
+ }): DeliveryIntegrationVerification;
@@ -0,0 +1,68 @@
1
+ import { ActivityEventType, decidePullRequestOutputAuthority, } from '../../activities/index.js';
2
+ import { BuiltInResourceKind, resourceId } from '../../resources/index.js';
3
+ /** Reuses provider artifact verification and the target's own current review/check authority. */
4
+ export function createDeliveryIntegrationVerification(input) {
5
+ return {
6
+ async verifyTarget(request) {
7
+ const resource = await input.resources.get(resourceId(request.resourceId));
8
+ const repository = await input.resources.get(resourceId(request.repositoryResourceId));
9
+ const owner = await input.resources.primaryCorrelation(resourceId(request.resourceId));
10
+ if (resource === null || repository === null || owner?.workItemId !== request.ownerWorkItemId)
11
+ return false;
12
+ const provider = (await input.providers()).find((entry) => entry.adapter === resource.externalKey.adapter);
13
+ if (provider === undefined)
14
+ return false;
15
+ const verified = await provider.verifyArtifact(BuiltInResourceKind.PullRequest, resource.externalKey, {
16
+ repository: repository.externalKey,
17
+ workspaceBranch: request.branch,
18
+ workspaceRevision: request.revision,
19
+ pullRequestBase: request.pullRequestBase,
20
+ });
21
+ if (!matchesVerifiedTarget(verified, resource.externalKey, request.revision))
22
+ return false;
23
+ if (!(await freshEvidence(request, input, resource.resourceId)))
24
+ return false;
25
+ const decision = decidePullRequestOutputAuthority(await input.pullRequests.authorityInput(owner.workItemId), {
26
+ target: { resourceId: resource.resourceId },
27
+ requireAcceptedReview: request.requireReview,
28
+ requireChecks: request.requireChecks,
29
+ });
30
+ return decision.allowed && decision.revision.toLowerCase() === request.revision.toLowerCase();
31
+ },
32
+ };
33
+ }
34
+ async function freshEvidence(request, input, id) {
35
+ if (request.maintenanceRunId === undefined)
36
+ return true;
37
+ const run = (await input.runs()).find((entry) => entry.runId === request.maintenanceRunId);
38
+ if (run === undefined)
39
+ return false;
40
+ if (!(await freshChecks(request, input.pullRequests, id, run)))
41
+ return false;
42
+ if (!request.requireReview)
43
+ return true;
44
+ return (await input.pullRequests.factsFor(id)).some(({ event }) => event.eventType === ActivityEventType.ReviewAcceptanceSignalRecorded &&
45
+ event.payload.trusted &&
46
+ event.payload.revision.toLowerCase() === request.revision.toLowerCase() &&
47
+ event.occurredAt >= (run.executionStartedAt ?? run.startedAt));
48
+ }
49
+ function matchesVerifiedTarget(verified, key, revision) {
50
+ return (typeof verified !== 'string' &&
51
+ verified.kind === BuiltInResourceKind.PullRequest &&
52
+ verified.externalKey.adapter === key.adapter &&
53
+ verified.externalKey.key === key.key &&
54
+ verified.revision?.toLowerCase() === revision.toLowerCase());
55
+ }
56
+ async function freshChecks(request, pullRequests, id, run) {
57
+ if (!request.requireChecks)
58
+ return true;
59
+ const view = await pullRequests.get(id);
60
+ const evidence = view?.checkEvidence;
61
+ if (evidence?.testedRevision === undefined || request.baseRevision === undefined)
62
+ return false;
63
+ return (evidence.headRevision.toLowerCase() === request.revision.toLowerCase() &&
64
+ evidence.baseRevision.toLowerCase() === request.baseRevision.toLowerCase() &&
65
+ evidence.baseRevision.toLowerCase() === view.baseRevision.toLowerCase() &&
66
+ Date.parse(evidence.startedAt) >=
67
+ Math.max(Date.parse(request.maintenanceRecordedAt ?? run.finishedAt ?? ''), Date.parse(run.executionStartedAt ?? run.startedAt)));
68
+ }
@@ -105,6 +105,9 @@ function activityIntentView(event) {
105
105
  revision: intent.event.payload.revision,
106
106
  method: intent.event.payload.method,
107
107
  autoMerge: intent.event.payload.autoMerge,
108
+ ...(intent.event.payload.parent === undefined
109
+ ? {}
110
+ : { ownerWorkItemId: intent.event.payload.parent.ownerWorkItemId }),
108
111
  },
109
112
  state: DeliveryState.Pending,
110
113
  attempts: 0,
@@ -1,6 +1,7 @@
1
1
  import { EventActorKind, EventSourceKind, } from '@atolis-hq/eventing';
2
2
  import { ActivityEventType, PullRequestState, selectPrimaryPullRequest, } from '../../../activities/index.js';
3
3
  import { ActivityActivationStatus, workflowInstanceId, } from '../../../orchestration/index.js';
4
+ import { workItemId } from '../../../work/index.js';
4
5
  import { deliveryStream, IntegrationStreamKind } from '../../contracts/streams.js';
5
6
  import { createDeliveryEventData } from '../contracts/event-factory.js';
6
7
  import { DeliveryEventType, selectDeliveryEvent } from '../contracts/events.js';
@@ -10,6 +11,12 @@ export async function reconcileMergedDeliveries(input) {
10
11
  await confirmMergedDelivery(entry.value, input.journal, input.orchestration, input.pullRequests);
11
12
  }
12
13
  }
14
+ /** A parent delivery merges a pull request its child owns; the requester never becomes owner. */
15
+ function owningWorkItem(payload, requester) {
16
+ return 'ownerWorkItemId' in payload && payload.ownerWorkItemId !== undefined
17
+ ? workItemId(payload.ownerWorkItemId)
18
+ : requester;
19
+ }
13
20
  /** Reconcile durable merged evidence only after the exact intent's wait exists. */
14
21
  export async function confirmMergedDelivery(intent, journal, orchestration, pullRequests) {
15
22
  if (intent.payload.kind !== DeliveryIntentKind.PrMerge ||
@@ -19,7 +26,8 @@ export async function confirmMergedDelivery(intent, journal, orchestration, pull
19
26
  const instance = await orchestration.get(workflowInstanceId(intent.workflowInstanceId));
20
27
  if (!isMatchingWait(instance, intent))
21
28
  return;
22
- const selected = selectPrimaryPullRequest(await pullRequests.authorityInput(instance.workItemId), instance.workItemId);
29
+ const owner = owningWorkItem(intent.payload, instance.workItemId);
30
+ const selected = selectPrimaryPullRequest(await pullRequests.authorityInput(owner), owner);
23
31
  if (selected?.pullRequest.resourceId !== intent.resourceId ||
24
32
  selected.pullRequest.state !== PullRequestState.Merged ||
25
33
  selected.pullRequest.headRevision !== intent.payload.revision)
@@ -20,6 +20,8 @@ export interface DeliveryIntentView {
20
20
  readonly revision: string;
21
21
  readonly method: MergeMethod;
22
22
  readonly autoMerge: boolean;
23
+ /** Set when a parent delivery merges a child-owned PR: the owner, not the requester. */
24
+ readonly ownerWorkItemId?: string;
23
25
  } | {
24
26
  readonly kind: typeof DeliveryIntentKind.IssueComplete;
25
27
  } | {
@@ -1,5 +1,5 @@
1
- import type { ReviewActorKind } from '../../activities/index.js';
2
- import { PullRequestCheckState } from '../../activities/index.js';
1
+ import type { PullRequestCheckEvidence, PullRequestMergeability, ReviewActorKind } from '../../activities/index.js';
2
+ import { PullRequestCheckState, PullRequestState } from '../../activities/index.js';
3
3
  import type { AdapterId } from '../contracts/identifiers.js';
4
4
  import type { ExternalEventSource, ProviderEventData } from '../contracts/intake.js';
5
5
  export declare const FakeEventType: {
@@ -13,7 +13,10 @@ export interface FakeWorkEvidence {
13
13
  readonly kind?: 'issue' | 'pull-request' | undefined;
14
14
  readonly revision?: string | undefined;
15
15
  readonly baseBranch?: string | undefined;
16
+ readonly checkEvidence?: PullRequestCheckEvidence | undefined;
16
17
  readonly baseRevision?: string | undefined;
18
+ readonly state?: PullRequestState | undefined;
19
+ readonly mergeability?: PullRequestMergeability | undefined;
17
20
  readonly checks?: typeof PullRequestCheckState.Unknown | typeof PullRequestCheckState.Pending | typeof PullRequestCheckState.Passing | typeof PullRequestCheckState.Failing | undefined;
18
21
  readonly acceptedReview?: boolean | undefined;
19
22
  readonly reviewActorId?: string | undefined;
@@ -1,10 +1,20 @@
1
1
  import { causationId, correlationId, EventActorKind, eventId, EventSourceKind, } from '@atolis-hq/eventing';
2
- import { PullRequestCheckState } from '../../activities/index.js';
2
+ import { PullRequestCheckState, PullRequestState } from '../../activities/index.js';
3
3
  export const FakeEventType = {
4
4
  WorkObserved: 'fake.work-observed',
5
5
  ReviewRequested: 'fake.review-requested',
6
6
  };
7
7
  const missingIdentityPart = '_';
8
+ // New provider facts about an unchanged head (merged, moved base) must not collapse into the old event.
9
+ function observationIdentity(payload) {
10
+ const parts = [
11
+ payload.state === undefined || payload.state === PullRequestState.Open ? '' : payload.state,
12
+ payload.baseRevision ?? '',
13
+ payload.checkEvidence?.startedAt ?? '',
14
+ payload.mergeability ?? '',
15
+ ];
16
+ return parts.every((part) => part === '') ? '' : `:${parts.join(':')}`;
17
+ }
8
18
  export class FakeExternalEventSource {
9
19
  adapter;
10
20
  events;
@@ -15,7 +25,7 @@ export class FakeExternalEventSource {
15
25
  async poll(signal) {
16
26
  void signal;
17
27
  return this.events.flatMap((payload, ordinal) => {
18
- const identity = `fake:${this.adapter}:${payload.key}:${payload.revision ?? missingIdentityPart}:${payload.checks ?? PullRequestCheckState.Unknown}:${payload.watchEvent ?? missingIdentityPart}:${ordinal}`;
28
+ const identity = `fake:${this.adapter}:${payload.key}:${payload.revision ?? missingIdentityPart}:${payload.checks ?? PullRequestCheckState.Unknown}:${payload.watchEvent ?? missingIdentityPart}:${ordinal}${observationIdentity(payload)}`;
19
29
  const metadata = {
20
30
  schemaVersion: 1,
21
31
  occurredAt: '2026-08-01T00:00:00.000Z',
@@ -1,6 +1,6 @@
1
1
  import { correlationId, defineEventProcessor, EventActorKind, EventProcessorCategory, EventProcessorReplayPolicy, } from '@atolis-hq/eventing';
2
2
  import { z } from 'zod';
3
- import { PullRequestCheckState, PullRequestState, ReviewActorKind, ReviewerAuthorizationSource, } from '../../activities/index.js';
3
+ import { pullRequestCheckEvidenceSchema, PullRequestCheckState, PullRequestState, ReviewActorKind, ReviewerAuthorizationSource, } from '../../activities/index.js';
4
4
  import { BuiltInResourceCapability, BuiltInResourceKind, ResourceCorrelationRole, resourceId, } from '../../resources/index.js';
5
5
  import { workItemId } from '../../work/index.js';
6
6
  import { admitObservedWork } from '../application/work-admission.js';
@@ -16,6 +16,9 @@ const evidenceSchema = z
16
16
  branch: z.string().min(1).optional(),
17
17
  baseBranch: z.string().min(1).optional(),
18
18
  baseRevision: z.string().min(1).optional(),
19
+ checkEvidence: pullRequestCheckEvidenceSchema.optional(),
20
+ state: z.enum(['open', 'closed', 'merged']).optional(),
21
+ mergeability: z.enum(['unknown', 'clean', 'conflicting']).optional(),
19
22
  checks: z.enum(['unknown', 'pending', 'passing', 'failing']).optional(),
20
23
  acceptedReview: z.boolean().optional(),
21
24
  reviewActorId: z.string().min(1).optional(),
@@ -134,10 +137,12 @@ export class FakeInboundTranslator {
134
137
  await this.services.pullRequests.observe({
135
138
  resourceId,
136
139
  workItemId,
137
- state: PullRequestState.Open,
140
+ state: evidence.state ?? PullRequestState.Open,
138
141
  headRevision: revision,
142
+ checkEvidence: evidence.checkEvidence,
139
143
  baseRevision: evidence.baseRevision ?? 'unknown',
140
144
  checks: evidence.checks ?? PullRequestCheckState.Unknown,
145
+ ...(evidence.mergeability === undefined ? {} : { mergeability: evidence.mergeability }),
141
146
  ...(evidence.changedFiles === undefined ? {} : { changedFiles: evidence.changedFiles }),
142
147
  }, context);
143
148
  if (evidence.acceptedReview === true)
@@ -13,6 +13,22 @@ declare const configSchema: z.ZodObject<{
13
13
  branch: z.ZodOptional<z.ZodString>;
14
14
  baseBranch: z.ZodOptional<z.ZodString>;
15
15
  baseRevision: z.ZodOptional<z.ZodString>;
16
+ checkEvidence: z.ZodOptional<z.ZodObject<{
17
+ testedRevision: z.ZodOptional<z.ZodString>;
18
+ headRevision: z.ZodString;
19
+ baseRevision: z.ZodString;
20
+ startedAt: z.ZodString;
21
+ }, z.core.$strict>>;
22
+ state: z.ZodOptional<z.ZodEnum<{
23
+ open: "open";
24
+ closed: "closed";
25
+ merged: "merged";
26
+ }>>;
27
+ mergeability: z.ZodOptional<z.ZodEnum<{
28
+ unknown: "unknown";
29
+ clean: "clean";
30
+ conflicting: "conflicting";
31
+ }>>;
16
32
  checks: z.ZodOptional<z.ZodEnum<{
17
33
  unknown: "unknown";
18
34
  pending: "pending";
@@ -31,6 +47,7 @@ declare const configSchema: z.ZodObject<{
31
47
  eligible: z.ZodOptional<z.ZodBoolean>;
32
48
  }, z.core.$strict>>>;
33
49
  deliveryEffects: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
50
+ eventsFile: z.ZodOptional<z.ZodString>;
34
51
  effectsFile: z.ZodOptional<z.ZodString>;
35
52
  connectivityError: z.ZodOptional<z.ZodString>;
36
53
  createError: z.ZodOptional<z.ZodString>;
@@ -1,5 +1,6 @@
1
+ import { readFile } from 'node:fs/promises';
1
2
  import { z } from 'zod';
2
- import { PullRequestCheckState, ReviewActorKind } from '../../activities/index.js';
3
+ import { pullRequestCheckEvidenceSchema, PullRequestCheckState, PullRequestMergeability, PullRequestState, ReviewActorKind, } from '../../activities/index.js';
3
4
  import { BuiltInResourceCapability, BuiltInResourceKind } from '../../resources/index.js';
4
5
  import { matchesArtifactSource } from '../application/artifact-source.js';
5
6
  import { ArtifactVerificationResult } from '../contracts/artifact-vocabulary.js';
@@ -19,6 +20,17 @@ const configSchema = z
19
20
  branch: z.string().min(1).optional(),
20
21
  baseBranch: z.string().min(1).optional(),
21
22
  baseRevision: z.string().min(1).optional(),
23
+ checkEvidence: pullRequestCheckEvidenceSchema.optional(),
24
+ state: z
25
+ .enum([PullRequestState.Open, PullRequestState.Closed, PullRequestState.Merged])
26
+ .optional(),
27
+ mergeability: z
28
+ .enum([
29
+ PullRequestMergeability.Unknown,
30
+ PullRequestMergeability.Mergeable,
31
+ PullRequestMergeability.Conflicting,
32
+ ])
33
+ .optional(),
22
34
  checks: z
23
35
  .enum([
24
36
  PullRequestCheckState.Unknown,
@@ -38,6 +50,7 @@ const configSchema = z
38
50
  .strict())
39
51
  .default([]),
40
52
  deliveryEffects: z.record(z.string(), z.string()).default({}),
53
+ eventsFile: z.string().min(1).optional(),
41
54
  effectsFile: z.string().min(1).optional(),
42
55
  // Deterministic test hook: when set, checkConnectivity rejects with this
43
56
  // message instead of resolving, so doctor's failure path is exercisable
@@ -73,7 +86,10 @@ export const fakeProviderDefinition = {
73
86
  verifyArtifact: async (kind, externalKey, context) => {
74
87
  if (kind !== BuiltInResourceKind.PullRequest)
75
88
  return ArtifactVerificationResult.NotFound;
76
- const evidence = config.events.find((event) => event.key === externalKey.key);
89
+ const events = config.eventsFile === undefined
90
+ ? config.events
91
+ : configSchema.shape.events.parse(JSON.parse(await readFile(config.eventsFile, 'utf8')));
92
+ const evidence = events.find((event) => event.key === externalKey.key);
77
93
  if (evidence === undefined || (evidence.kind ?? 'issue') !== 'pull-request')
78
94
  return ArtifactVerificationResult.NotFound;
79
95
  if (!matchesArtifactSource(externalKey, {
@@ -3,9 +3,11 @@ export function observePullRequest(resourceId, workItemId, payload) {
3
3
  resourceId,
4
4
  workItemId,
5
5
  state: payload.state,
6
+ ...(payload.mergeRevision === undefined ? {} : { mergeRevision: payload.mergeRevision }),
6
7
  ...(payload.mergeability === undefined ? {} : { mergeability: payload.mergeability }),
7
8
  headRevision: payload.headRevision ?? payload.revision,
8
9
  baseRevision: payload.baseRevision ?? 'unknown',
10
+ ...(payload.checkEvidence === undefined ? {} : { checkEvidence: payload.checkEvidence }),
9
11
  checks: payload.checks ?? 'unknown',
10
12
  ...(payload.changedFiles === undefined ? {} : { changedFiles: payload.changedFiles }),
11
13
  };
@@ -1,5 +1,5 @@
1
1
  import { type EventDataUnion, type EventEnvelope, type EventUnion } from '@atolis-hq/eventing';
2
- import { ProviderPermission, PullRequestCheckState, PullRequestMergeability, PullRequestState, ReviewActorKind, ReviewerAuthorizationSource, type ReviewerAuthorizationEvidence } from '../../../activities/index.js';
2
+ import { ProviderPermission, PullRequestCheckState, PullRequestMergeability, PullRequestState, ReviewActorKind, ReviewerAuthorizationSource, type PullRequestCheckEvidence, type ReviewerAuthorizationEvidence } from '../../../activities/index.js';
3
3
  import { type ResourceId } from '../../../resources/index.js';
4
4
  import { type WorkItemId } from '../../../work/index.js';
5
5
  import { ExternalWorkOutcome } from '../../contracts/outcome-vocabulary.js';
@@ -26,7 +26,9 @@ export interface ExternalWorkObservedPayload {
26
26
  readonly outcome?: ExternalWorkOutcome | undefined;
27
27
  readonly revision: string;
28
28
  readonly headRevision?: string | undefined;
29
+ readonly checkEvidence?: PullRequestCheckEvidence | undefined;
29
30
  readonly baseRevision?: string | undefined;
31
+ readonly mergeRevision?: string | undefined;
30
32
  readonly checks?: typeof PullRequestCheckState.Unknown | typeof PullRequestCheckState.Pending | typeof PullRequestCheckState.Passing | typeof PullRequestCheckState.Failing | undefined;
31
33
  readonly actor: {
32
34
  readonly id: string;
@@ -1,6 +1,6 @@
1
1
  import { eventDataSchema, eventEnvelopeSchema, } from '@atolis-hq/eventing';
2
2
  import { z } from 'zod';
3
- import { ProviderPermission, PullRequestCheckState, PullRequestMergeability, PullRequestState, ReviewActorKind, ReviewerAuthorizationSource, } from '../../../activities/index.js';
3
+ import { ProviderPermission, pullRequestCheckEvidenceSchema, PullRequestCheckState, PullRequestMergeability, PullRequestState, ReviewActorKind, ReviewerAuthorizationSource, } from '../../../activities/index.js';
4
4
  import { brandedStringSchema } from '../../../kernel/index.js';
5
5
  import { resourceId } from '../../../resources/index.js';
6
6
  import { workItemId } from '../../../work/index.js';
@@ -72,6 +72,8 @@ const githubEventSchemas = {
72
72
  .optional(),
73
73
  headRevision: z.string().optional(),
74
74
  baseRevision: z.string().optional(),
75
+ checkEvidence: pullRequestCheckEvidenceSchema.optional(),
76
+ mergeRevision: z.string().min(1).optional(),
75
77
  checks: z
76
78
  .enum([
77
79
  PullRequestCheckState.Unknown,
@@ -43,8 +43,13 @@ export interface GitHubPullRequestPayload extends GitHubIssuePayload {
43
43
  readonly sha?: string;
44
44
  };
45
45
  readonly merged_at?: string | null;
46
+ readonly merge_commit_sha?: string | null;
46
47
  }
47
48
  export interface GitHubCheckRunPayload {
49
+ readonly check_suite?: {
50
+ readonly id: number;
51
+ } | null;
52
+ readonly head_sha?: string;
48
53
  readonly id?: number;
49
54
  readonly name?: string;
50
55
  readonly status?: string;
@@ -73,3 +78,21 @@ export interface GitHubReviewPayload {
73
78
  readonly type?: string;
74
79
  } | null;
75
80
  }
81
+ export interface GitHubWorkflowRunPayload {
82
+ readonly run_attempt?: number;
83
+ readonly id: number;
84
+ readonly check_suite_id?: number;
85
+ readonly head_sha: string;
86
+ readonly event: string;
87
+ readonly status: string | null;
88
+ readonly conclusion: string | null;
89
+ readonly pull_requests?: readonly {
90
+ readonly number: number;
91
+ readonly head: {
92
+ readonly sha: string;
93
+ };
94
+ readonly base: {
95
+ readonly sha: string;
96
+ };
97
+ }[] | null;
98
+ }
@@ -0,0 +1,9 @@
1
+ import type { Octokit } from '@octokit/rest';
2
+ export interface TestedCommit {
3
+ readonly sha: string;
4
+ readonly parents: readonly {
5
+ readonly sha: string;
6
+ }[];
7
+ }
8
+ /** Completed job logs and Git objects are immutable; failed reads are never cached. */
9
+ export declare function createCheckExecutionReader(octokit: Octokit): (owner: string, repo: string, runId: number, attempt: number, checkId: number) => Promise<TestedCommit | undefined>;
@@ -0,0 +1,68 @@
1
+ import { GitHubCheckRunStatus } from '../contracts/vocabulary.js';
2
+ import { checkoutRevision } from './checkout-revision.js';
3
+ /** Completed job logs and Git objects are immutable; failed reads are never cached. */
4
+ export function createCheckExecutionReader(octokit) {
5
+ const jobs = new Map();
6
+ const commits = new Map();
7
+ const checkouts = new Map();
8
+ async function loadJobs(owner, repo, runId) {
9
+ const result = await octokit.rest.actions.listJobsForWorkflowRun({
10
+ owner,
11
+ repo,
12
+ run_id: runId,
13
+ per_page: 100,
14
+ });
15
+ return result.data.total_count >= 100 ? [] : result.data.jobs;
16
+ }
17
+ function completeJobs(entries) {
18
+ return (entries.length > 0 && entries.every((job) => job.status === GitHubCheckRunStatus.Completed));
19
+ }
20
+ return async (owner, repo, runId, attempt, checkId) => {
21
+ const prefix = `${owner}/${repo}`;
22
+ const key = `${prefix}:${runId}:${attempt}`;
23
+ let entries = jobs.get(key);
24
+ if (entries === undefined) {
25
+ entries = await loadJobs(owner, repo, runId);
26
+ if (completeJobs(entries))
27
+ remember(jobs, key, entries);
28
+ }
29
+ const matches = entries.filter((job) => job.check_run_url?.endsWith(`/check-runs/${checkId}`));
30
+ if (matches.length !== 1)
31
+ return undefined;
32
+ const job = matches[0];
33
+ if (job.run_id !== runId ||
34
+ job.status !== GitHubCheckRunStatus.Completed ||
35
+ job.conclusion !== 'success')
36
+ return undefined;
37
+ const jobKey = `${prefix}:${job.id}`;
38
+ let revision = checkouts.get(jobKey);
39
+ if (revision === undefined) {
40
+ const response = await octokit.rest.actions.downloadJobLogsForWorkflowRun({
41
+ owner,
42
+ repo,
43
+ job_id: job.id,
44
+ });
45
+ if (typeof response.data !== 'string')
46
+ return undefined;
47
+ revision = checkoutRevision(response.data);
48
+ if (revision === undefined)
49
+ return undefined;
50
+ remember(checkouts, jobKey, revision);
51
+ }
52
+ const commitKey = `${prefix}:${revision}`;
53
+ let commit = commits.get(commitKey);
54
+ if (commit === undefined) {
55
+ const result = await octokit.rest.git.getCommit({ owner, repo, commit_sha: revision });
56
+ if (result.data.sha !== revision)
57
+ return undefined;
58
+ commit = { sha: result.data.sha, parents: result.data.parents.map(({ sha }) => ({ sha })) };
59
+ remember(commits, commitKey, commit);
60
+ }
61
+ return commit;
62
+ };
63
+ }
64
+ function remember(cache, key, value) {
65
+ if (cache.size >= 1000)
66
+ cache.delete(cache.keys().next().value);
67
+ cache.set(key, value);
68
+ }
@@ -0,0 +1,2 @@
1
+ /** Read actions/checkout's full Git log result, never the mutable PR merge ref. */
2
+ export declare function checkoutRevision(log: string): string | undefined;
@@ -0,0 +1,23 @@
1
+ /** Read actions/checkout's full Git log result, never the mutable PR merge ref. */
2
+ export function checkoutRevision(log) {
3
+ let checkout = false;
4
+ let expectingSha = false;
5
+ const revisions = [];
6
+ for (const line of log.split('\n')) {
7
+ const message = line.replace(/^\S+\s/, '').trim();
8
+ if (message.startsWith('##[group]Run ')) {
9
+ checkout = message.startsWith('##[group]Run actions/checkout@');
10
+ expectingSha = false;
11
+ }
12
+ if (!checkout)
13
+ continue;
14
+ if (expectingSha) {
15
+ if (/^[a-f0-9]{40}$/.test(message))
16
+ revisions.push(message);
17
+ expectingSha = false;
18
+ }
19
+ if (/^\[command\].*\/git log -1 --format=%H$/.test(message))
20
+ expectingSha = true;
21
+ }
22
+ return revisions.length === 1 ? revisions[0] : undefined;
23
+ }
@@ -113,6 +113,8 @@ export declare function createGitHubClient(token: string): {
113
113
  listIssueComments: (owner: string, repo: string, issueNumber: number, pageSize: number, since?: string, maxResults?: number) => Promise<readonly import("../index.js").GitHubIssueCommentPayload[]>;
114
114
  listReviewComments: (owner: string, repo: string, pullNumber: number, pageSize: number, maxResults?: number) => Promise<readonly import("../index.js").GitHubIssueCommentPayload[]>;
115
115
  getIssueLabels: (owner: string, repo: string, issueNumber: number) => Promise<readonly string[]>;
116
+ checkExecution: (owner: string, repo: string, runId: number, attempt: number, checkId: number) => Promise<import("./check-execution.js").TestedCommit | undefined>;
117
+ workflowRunsForSuite: (owner: string, repo: string, suiteId: number) => Promise<readonly import("../index.js").GitHubWorkflowRunPayload[]>;
116
118
  getPullRequest: (owner: string, repo: string, pullNumber: number) => Promise<{
117
119
  url: string;
118
120
  id: number;
@@ -2,8 +2,10 @@ import { Octokit } from '@octokit/rest';
2
2
  import { MergeMethod, ProviderPermission, PullRequestState } from '../../../activities/index.js';
3
3
  import { GitHubOutboundAction } from '../contracts/vocabulary.js';
4
4
  import { createBoundedGitHubFetch } from './bounded-fetch.js';
5
+ import { createCheckExecutionReader } from './check-execution.js';
5
6
  import { branch, findIssueCommentByMarker, getCombinedStatusForRef, getIssueLabels, getPullRequest, listCheckRunsForRef, listIssueComments, listIssues, listPullRequestFiles, listPullRequests, listReviewComments, listReviews, } from './client-reads.js';
6
7
  import { createEtagCache } from './etag-cache.js';
8
+ import { workflowRunsForSuite } from './workflow-run-evidence.js';
7
9
  /* eslint-disable max-lines */
8
10
  // Octokit's request-log plugin reports every non-2xx response through this
9
11
  // callback, including the expected 304 responses produced by conditional ETag
@@ -114,6 +116,8 @@ function createGitHubReadClient(octokit, cache) {
114
116
  ...(maxResults === undefined ? {} : { maxResults }),
115
117
  }),
116
118
  getIssueLabels: (owner, repo, issueNumber) => getIssueLabels(octokit, cache, owner, repo, issueNumber),
119
+ checkExecution: createCheckExecutionReader(octokit),
120
+ workflowRunsForSuite: (owner, repo, suiteId) => workflowRunsForSuite(octokit, cache, owner, repo, suiteId),
117
121
  getPullRequest: (owner, repo, pullNumber) => getPullRequest(octokit, cache, owner, repo, pullNumber),
118
122
  listReviews: (owner, repo, pullNumber, pageSize, maxResults) => listReviews(octokit, cache, owner, repo, pullNumber, {
119
123
  pageSize,
@@ -0,0 +1,7 @@
1
+ import type { PullRequestCheckEvidence } from '../../../activities/index.js';
2
+ import type { GitHubPullRequestPayload } from '../contracts/payloads.js';
3
+ import type { CheckEvidence, PullRequestEvidenceClient } from './pr-evidence.js';
4
+ /** Join head-SHA checks to their actual checkout, never mutable linked PR metadata. */
5
+ export declare function verifiedCheckSubject(client: PullRequestEvidenceClient, owner: string, repo: string, pullRequest: GitHubPullRequestPayload, evidence: CheckEvidence): Promise<{
6
+ readonly checkEvidence?: PullRequestCheckEvidence;
7
+ }>;
@@ -0,0 +1,77 @@
1
+ import { GitHubCheckRunStatus } from '../contracts/vocabulary.js';
2
+ /** Join head-SHA checks to their actual checkout, never mutable linked PR metadata. */
3
+ export async function verifiedCheckSubject(client, owner, repo, pullRequest, evidence) {
4
+ if (!eligibleEvidence(evidence, client))
5
+ return {};
6
+ try {
7
+ const suites = new Map();
8
+ const testedRevisions = [];
9
+ for (const check of evidence.checkRuns) {
10
+ if (!qualifyingCheck(check, pullRequest.head?.sha))
11
+ return {};
12
+ const suiteId = check.check_suite.id;
13
+ if (!suites.has(suiteId))
14
+ suites.set(suiteId, await client.workflowRunsForSuite(owner, repo, suiteId));
15
+ const matching = suites
16
+ .get(suiteId)
17
+ .filter((run) => matchesExecution(run, suiteId, pullRequest));
18
+ if (matching.length !== 1)
19
+ return {};
20
+ if (check.conclusion !== 'success')
21
+ continue;
22
+ const commit = await readCheckout(client.checkExecution, owner, repo, matching[0], check);
23
+ if (!matchesCheckout(commit, pullRequest))
24
+ return {};
25
+ testedRevisions.push(commit.sha);
26
+ }
27
+ if (testedRevisions.length === 0)
28
+ return {};
29
+ return {
30
+ checkEvidence: {
31
+ testedRevision: testedRevisions[0],
32
+ headRevision: pullRequest.head.sha,
33
+ baseRevision: pullRequest.base.sha,
34
+ startedAt: new Date(Math.min(...evidence.checkRuns.map((run) => Date.parse(run.started_at)))).toISOString(),
35
+ },
36
+ };
37
+ }
38
+ catch {
39
+ return {};
40
+ }
41
+ }
42
+ function eligibleEvidence(evidence, client) {
43
+ return (client.workflowRunsForSuite !== undefined &&
44
+ client.checkExecution !== undefined &&
45
+ evidence.available &&
46
+ evidence.complete &&
47
+ evidence.statuses.length === 0 &&
48
+ evidence.checkRuns.length > 0);
49
+ }
50
+ function qualifyingCheck(check, head) {
51
+ return (head !== undefined &&
52
+ check.head_sha === head &&
53
+ check.check_suite != null &&
54
+ check.status === GitHubCheckRunStatus.Completed &&
55
+ passingConclusions.has(check.conclusion ?? '') &&
56
+ typeof check.started_at === 'string' &&
57
+ Number.isFinite(Date.parse(check.started_at)));
58
+ }
59
+ function matchesExecution(run, suiteId, pr) {
60
+ return (run.check_suite_id === suiteId &&
61
+ run.event === 'pull_request' &&
62
+ run.head_sha === pr.head?.sha &&
63
+ run.status === GitHubCheckRunStatus.Completed &&
64
+ run.conclusion === 'success');
65
+ }
66
+ const passingConclusions = new Set(['success', 'neutral', 'skipped']);
67
+ function matchesCheckout(commit, pr) {
68
+ return (commit !== undefined &&
69
+ commit.parents.length === 2 &&
70
+ commit.parents[0]?.sha === pr.base?.sha &&
71
+ commit.parents[1]?.sha === pr.head?.sha);
72
+ }
73
+ async function readCheckout(reader, owner, repo, execution, check) {
74
+ if (check.id === undefined)
75
+ return undefined;
76
+ return reader(owner, repo, execution.id, execution.run_attempt ?? 1, check.id);
77
+ }
@@ -1,4 +1,5 @@
1
- import type { GitHubCheckRunPayload, GitHubCommitStatusPayload } from '../contracts/payloads.js';
1
+ import type { GitHubCheckRunPayload, GitHubCommitStatusPayload, GitHubWorkflowRunPayload } from '../contracts/payloads.js';
2
+ import type { TestedCommit } from './check-execution.js';
2
3
  export interface CheckEvidence {
3
4
  readonly available: boolean;
4
5
  readonly complete: boolean;
@@ -9,10 +10,12 @@ export interface ChangedFiles {
9
10
  readonly files: readonly string[] | undefined;
10
11
  readonly complete: boolean;
11
12
  }
12
- interface PullRequestEvidenceClient {
13
+ export interface PullRequestEvidenceClient {
14
+ checkExecution?(owner: string, repo: string, runId: number, attempt: number, checkId: number): Promise<TestedCommit | undefined>;
15
+ workflowRunsForSuite?(owner: string, repo: string, suiteId: number): Promise<readonly GitHubWorkflowRunPayload[]>;
13
16
  listCheckRunsForRef(owner: string, repo: string, ref: string, maxResults?: number): Promise<readonly GitHubCheckRunPayload[]>;
14
17
  getCombinedStatusForRef(owner: string, repo: string, ref: string, maxResults?: number): Promise<readonly GitHubCommitStatusPayload[]>;
15
18
  listPullRequestFiles(owner: string, repo: string, pullNumber: number, maxResults?: number): Promise<readonly string[]>;
16
19
  }
17
20
  export declare function readPullRequestEvidence(client: PullRequestEvidenceClient, owner: string, repo: string, headRevision: string, pullNumber: number, maxResults: number): Promise<readonly [CheckEvidence, ChangedFiles]>;
18
- export {};
21
+ export declare function readCheckEvidence(client: PullRequestEvidenceClient, owner: string, repo: string, headRevision: string, maxResults: number): Promise<CheckEvidence>;
@@ -4,7 +4,7 @@ export async function readPullRequestEvidence(client, owner, repo, headRevision,
4
4
  readChangedFiles(client, owner, repo, pullNumber, maxResults),
5
5
  ]);
6
6
  }
7
- async function readCheckEvidence(client, owner, repo, headRevision, maxResults) {
7
+ export async function readCheckEvidence(client, owner, repo, headRevision, maxResults) {
8
8
  try {
9
9
  const [checkRuns, statuses] = await Promise.all([
10
10
  client.listCheckRunsForRef(owner, repo, headRevision, maxResults),