@atolis-hq/wake 0.4.105 → 0.4.107
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.
- package/dist/src/activities/agent/agent-activity.js +7 -0
- package/dist/src/activities/contracts/activity.d.ts +12 -0
- package/dist/src/activities/contracts/event-schema.d.ts +314 -8
- package/dist/src/activities/contracts/event-schema.js +20 -2
- package/dist/src/activities/contracts/events.d.ts +10 -0
- package/dist/src/activities/contracts/vocabulary.d.ts +2 -0
- package/dist/src/activities/contracts/vocabulary.js +2 -0
- package/dist/src/activities/index.d.ts +2 -0
- package/dist/src/activities/index.js +2 -0
- package/dist/src/activities/pr/activity-support.d.ts +1 -1
- package/dist/src/activities/pr/activity-support.js +10 -0
- package/dist/src/activities/pr/application.js +31 -10
- package/dist/src/activities/pr/approve.d.ts +2 -1
- package/dist/src/activities/pr/approve.js +33 -11
- package/dist/src/activities/pr/check-evidence.d.ts +10 -0
- package/dist/src/activities/pr/check-evidence.js +16 -0
- package/dist/src/activities/pr/contracts.d.ts +14 -0
- package/dist/src/activities/pr/event-data.js +5 -1
- package/dist/src/activities/pr/merge.d.ts +2 -1
- package/dist/src/activities/pr/merge.js +54 -38
- package/dist/src/activities/pr/parent-scope.d.ts +65 -0
- package/dist/src/activities/pr/parent-scope.js +24 -0
- package/dist/src/activities/pr/parent-target.d.ts +45 -0
- package/dist/src/activities/pr/parent-target.js +59 -0
- package/dist/src/activities/pr/projection.js +10 -2
- package/dist/src/activities/pr/vocabulary.d.ts +8 -0
- package/dist/src/activities/pr/vocabulary.js +8 -0
- package/dist/src/bootstrap/activity-registry.d.ts +2 -2
- package/dist/src/bootstrap/activity-registry.js +3 -3
- package/dist/src/bootstrap/composition-root.js +12 -3
- package/dist/src/bootstrap/config/root-schema.d.ts +6 -0
- package/dist/src/bootstrap/delivery-integration.d.ts +9 -0
- package/dist/src/bootstrap/delivery-integration.js +46 -0
- package/dist/src/bootstrap/surface-api-delivery.js +27 -0
- package/dist/src/bootstrap/version.js +1 -1
- package/dist/src/control-plane/application/activation-scheduler-ports.d.ts +3 -1
- package/dist/src/control-plane/application/advance-once-dispatch.js +10 -6
- package/dist/src/conversations/application/conversation-repository.d.ts +1 -1
- package/dist/src/conversations/application/conversation-repository.js +3 -1
- package/dist/src/execution/application/execution-service.js +10 -0
- package/dist/src/execution/application/maintenance-workspaces.d.ts +17 -0
- package/dist/src/execution/application/maintenance-workspaces.js +84 -0
- package/dist/src/execution/application/run-lifecycle.js +1 -0
- package/dist/src/execution/application/run-repository.js +27 -10
- package/dist/src/execution/contracts/commands.d.ts +2 -0
- package/dist/src/execution/contracts/events.d.ts +13 -0
- package/dist/src/execution/contracts/events.js +2 -0
- package/dist/src/execution/contracts/maintenance.d.ts +36 -0
- package/dist/src/execution/contracts/maintenance.js +44 -0
- package/dist/src/execution/contracts/views.d.ts +2 -0
- package/dist/src/execution/contracts/workspace.d.ts +2 -0
- package/dist/src/execution/index.d.ts +1 -0
- package/dist/src/execution/index.js +1 -0
- package/dist/src/integrations/application/artifact-registration-reactor.js +7 -14
- package/dist/src/integrations/application/delegation-outputs.js +1 -1
- package/dist/src/integrations/application/delivery-integration-verification.d.ts +13 -0
- package/dist/src/integrations/application/delivery-integration-verification.js +68 -0
- package/dist/src/integrations/application/latest-unresolved-artifacts.d.ts +3 -0
- package/dist/src/integrations/application/latest-unresolved-artifacts.js +16 -0
- package/dist/src/integrations/delivery/application/delivery-projector.js +3 -0
- package/dist/src/integrations/delivery/application/merged-delivery-evidence.js +9 -1
- package/dist/src/integrations/delivery/contracts/views.d.ts +2 -0
- package/dist/src/integrations/fake/external-source.d.ts +5 -2
- package/dist/src/integrations/fake/external-source.js +12 -2
- package/dist/src/integrations/fake/inbound-translator.js +7 -2
- package/dist/src/integrations/fake/provider.d.ts +17 -0
- package/dist/src/integrations/fake/provider.js +18 -2
- package/dist/src/integrations/github/application/comment-history-reader.d.ts +1 -1
- package/dist/src/integrations/github/application/comment-history-reader.js +56 -39
- package/dist/src/integrations/github/application/pull-request-translation.js +2 -0
- package/dist/src/integrations/github/contracts/events.d.ts +3 -1
- package/dist/src/integrations/github/contracts/events.js +3 -1
- package/dist/src/integrations/github/contracts/payloads.d.ts +23 -0
- package/dist/src/integrations/github/infrastructure/check-execution.d.ts +9 -0
- package/dist/src/integrations/github/infrastructure/check-execution.js +68 -0
- package/dist/src/integrations/github/infrastructure/checkout-revision.d.ts +2 -0
- package/dist/src/integrations/github/infrastructure/checkout-revision.js +23 -0
- package/dist/src/integrations/github/infrastructure/client.d.ts +2 -0
- package/dist/src/integrations/github/infrastructure/client.js +4 -0
- package/dist/src/integrations/github/infrastructure/pr-check-subject.d.ts +7 -0
- package/dist/src/integrations/github/infrastructure/pr-check-subject.js +77 -0
- package/dist/src/integrations/github/infrastructure/pr-evidence.d.ts +6 -3
- package/dist/src/integrations/github/infrastructure/pr-evidence.js +1 -1
- package/dist/src/integrations/github/infrastructure/pr-source.d.ts +3 -5
- package/dist/src/integrations/github/infrastructure/pr-source.js +11 -1
- package/dist/src/integrations/github/infrastructure/workflow-run-evidence.d.ts +5 -0
- package/dist/src/integrations/github/infrastructure/workflow-run-evidence.js +22 -0
- package/dist/src/integrations/index.d.ts +1 -0
- package/dist/src/integrations/index.js +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/index.d.ts +1 -1
- package/dist/src/node_modules/@atolis-hq/eventing/dist/index.d.ts.map +1 -1
- package/dist/src/node_modules/@atolis-hq/eventing/dist/index.js +1 -1
- package/dist/src/node_modules/@atolis-hq/eventing/dist/projections/projection-processor.d.ts +14 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/projections/projection-processor.d.ts.map +1 -1
- package/dist/src/node_modules/@atolis-hq/eventing/dist/projections/projection-processor.js +31 -1
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/journal-view.d.ts +22 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/journal-view.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/journal-view.js +60 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-event-journal.d.ts +2 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-event-journal.d.ts.map +1 -1
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-event-journal.js +82 -15
- package/dist/src/orchestration/application/advance-workflow.js +7 -2
- package/dist/src/orchestration/application/deferred-signals.js +2 -6
- package/dist/src/orchestration/application/delegation-commands.d.ts +3 -0
- package/dist/src/orchestration/application/delivery-coordinator.d.ts +70 -1
- package/dist/src/orchestration/application/delivery-coordinator.js +31 -5
- package/dist/src/orchestration/application/delivery-facts-reader.js +1 -0
- package/dist/src/orchestration/application/delivery-integration-reader.d.ts +9 -0
- package/dist/src/orchestration/application/delivery-integration-reader.js +23 -0
- package/dist/src/orchestration/application/delivery-integration-service.d.ts +50 -0
- package/dist/src/orchestration/application/delivery-integration-service.js +228 -0
- package/dist/src/orchestration/application/delivery-preparation.d.ts +1 -0
- package/dist/src/orchestration/application/delivery-preparation.js +7 -2
- package/dist/src/orchestration/application/orchestration-repository.d.ts +14 -9
- package/dist/src/orchestration/application/orchestration-repository.js +139 -64
- package/dist/src/orchestration/application/orchestration-service.d.ts +74 -3
- package/dist/src/orchestration/application/orchestration-service.js +55 -2
- package/dist/src/orchestration/contracts/config.d.ts +6 -0
- package/dist/src/orchestration/contracts/config.js +6 -0
- package/dist/src/orchestration/contracts/delivery-ports.d.ts +44 -0
- package/dist/src/orchestration/contracts/delivery.d.ts +58 -0
- package/dist/src/orchestration/contracts/delivery.js +53 -1
- package/dist/src/orchestration/contracts/event-decoder.js +2 -1
- package/dist/src/orchestration/contracts/event-factory.js +2 -0
- package/dist/src/orchestration/contracts/events.d.ts +3 -1
- package/dist/src/orchestration/contracts/events.js +1 -0
- package/dist/src/orchestration/contracts/vocabulary.d.ts +44 -1
- package/dist/src/orchestration/contracts/vocabulary.js +40 -1
- package/dist/src/orchestration/domain/compile-diagnostics.d.ts +1 -1
- package/dist/src/orchestration/domain/compile-diagnostics.js +5 -0
- package/dist/src/orchestration/domain/delivery-candidate.js +13 -0
- package/dist/src/orchestration/domain/delivery-facts.d.ts +7 -1
- package/dist/src/orchestration/domain/delivery-facts.js +33 -1
- package/dist/src/orchestration/domain/delivery-integration-policy.d.ts +7 -0
- package/dist/src/orchestration/domain/delivery-integration-policy.js +15 -0
- package/dist/src/orchestration/domain/delivery-integration.d.ts +54 -0
- package/dist/src/orchestration/domain/delivery-integration.js +144 -0
- package/dist/src/orchestration/domain/delivery-qa.d.ts +2 -1
- package/dist/src/orchestration/domain/delivery-qa.js +24 -4
- package/dist/src/orchestration/domain/delivery-workflow-policy.d.ts +3 -1
- package/dist/src/orchestration/domain/delivery-workflow-policy.js +19 -0
- package/dist/src/orchestration/domain/workflow-instance-events.js +1 -0
- package/dist/src/orchestration/index.d.ts +3 -2
- package/dist/src/orchestration/index.js +1 -1
- package/dist/src/resources/application/resource-lookup.d.ts +2 -1
- package/dist/src/resources/application/resource-lookup.js +3 -11
- package/dist/src/resources/application/resource-repository.js +10 -10
- package/dist/src/surfaces/api/contracts/transport-values.js +1 -0
- package/dist/src/surfaces/api/contracts/work.d.ts +26 -0
- package/dist/src/surfaces/api/presenters/execution.js +1 -0
- package/dist/src/surfaces/mcp/delegation.js +5 -1
- package/dist/src/surfaces/web-assets/assets/index-ih1h3dxC.js +1192 -0
- package/dist/src/surfaces/web-assets/index.html +1 -1
- package/package.json +1 -1
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/cached-journal-view.d.ts +0 -16
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/cached-journal-view.d.ts.map +0 -1
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/cached-journal-view.js +0 -79
- package/dist/src/surfaces/web-assets/assets/index-BfhxlN_h.js +0 -1192
|
@@ -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
|
|
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, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type EventJournal } from '@atolis-hq/eventing';
|
|
2
2
|
import { type ResourceService } from '../../../resources/index.js';
|
|
3
3
|
import type { WorkItemId } from '../../../work/index.js';
|
|
4
4
|
export interface CommentHistoryEntry {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { foldedJournalView } from '@atolis-hq/eventing';
|
|
1
2
|
import { ResourceCorrelationRole } from '../../../resources/index.js';
|
|
2
3
|
import { adapterId } from '../../contracts/identifiers.js';
|
|
3
4
|
import { DeliveryEventType, selectDeliveryEvent } from '../../delivery/contracts/events.js';
|
|
@@ -16,6 +17,10 @@ export function deliveryIntentIdForComment(entry) {
|
|
|
16
17
|
return deliveryIntentIds.get(entry);
|
|
17
18
|
}
|
|
18
19
|
export function createCommentHistoryReader(journal, resources, readerOptions = {}) {
|
|
20
|
+
const facts = foldedJournalView(journal, {
|
|
21
|
+
initial: emptyCommentFacts,
|
|
22
|
+
extend: extendCommentFacts,
|
|
23
|
+
});
|
|
19
24
|
return {
|
|
20
25
|
async forWorkItem(workItemId, options) {
|
|
21
26
|
const resourcesById = new Map((await Promise.all((await resources.correlationsForWork(workItemId))
|
|
@@ -30,51 +35,64 @@ export function createCommentHistoryReader(journal, resources, readerOptions = {
|
|
|
30
35
|
return [];
|
|
31
36
|
const githubAdapters = new Set(readerOptions.githubAdapters ?? [GitHubAdapter]);
|
|
32
37
|
const githubResourceIds = new Set([...resourcesById.entries()].flatMap(([resourceId, resource]) => githubAdapters.has(resource.externalKey.adapter) ? [resourceId] : []));
|
|
33
|
-
|
|
38
|
+
const known = await facts.get();
|
|
39
|
+
const intents = new Map([...known.intents].filter(([, intent]) => githubResourceIds.has(intent.event.payload.resourceId)));
|
|
40
|
+
const observed = new Map();
|
|
41
|
+
for (const key of keys)
|
|
42
|
+
for (const [messageId, comment] of known.observedByResource.get(key) ?? [])
|
|
43
|
+
observed.set(messageId, comment);
|
|
44
|
+
const confirmed = new Map();
|
|
45
|
+
for (const [intentEventId, event] of known.confirmations) {
|
|
46
|
+
const intent = intents.get(intentEventId);
|
|
47
|
+
if (intent !== undefined)
|
|
48
|
+
confirmed.set(intentEventId, { event, intent });
|
|
49
|
+
}
|
|
50
|
+
return reconcileCommentHistory(observed, confirmed, resourcesById, options?.observedSince, readerOptions.publicUiUrl);
|
|
34
51
|
},
|
|
35
52
|
};
|
|
36
53
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
54
|
+
const emptyCommentFacts = {
|
|
55
|
+
intents: new Map(),
|
|
56
|
+
observedByResource: new Map(),
|
|
57
|
+
confirmations: new Map(),
|
|
58
|
+
};
|
|
59
|
+
function extendCommentFacts(state, events) {
|
|
60
|
+
let intents = state.intents;
|
|
61
|
+
let observedByResource = state.observedByResource;
|
|
62
|
+
let confirmations = state.confirmations;
|
|
45
63
|
for (const event of events) {
|
|
46
64
|
const intent = selectDeliveryIntentEvent(event);
|
|
47
|
-
if (intent !== null
|
|
48
|
-
isCommentIntent(intent)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const observed = new Map();
|
|
56
|
-
for (const event of events) {
|
|
57
|
-
const comment = providerComment(event, keys);
|
|
58
|
-
if (comment !== null)
|
|
59
|
-
observed.set(comment.messageId, comment);
|
|
60
|
-
}
|
|
61
|
-
return observed;
|
|
62
|
-
}
|
|
63
|
-
function confirmations(events, intents) {
|
|
64
|
-
const confirmed = new Map();
|
|
65
|
-
for (const event of events) {
|
|
65
|
+
if (intent !== null) {
|
|
66
|
+
if (isCommentIntent(intent)) {
|
|
67
|
+
if (intents === state.intents)
|
|
68
|
+
intents = new Map(intents);
|
|
69
|
+
intents.set(intent.event.eventId, intent);
|
|
70
|
+
}
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
66
73
|
const delivery = selectDeliveryEvent(event);
|
|
67
|
-
if (delivery
|
|
74
|
+
if (delivery !== null) {
|
|
75
|
+
if (!isConfirmed(delivery))
|
|
76
|
+
continue;
|
|
77
|
+
const key = delivery.event.payload.intentEventId;
|
|
78
|
+
const current = confirmations.get(key);
|
|
79
|
+
if (current === undefined || event.globalPosition < current.globalPosition) {
|
|
80
|
+
if (confirmations === state.confirmations)
|
|
81
|
+
confirmations = new Map(confirmations);
|
|
82
|
+
confirmations.set(key, event);
|
|
83
|
+
}
|
|
68
84
|
continue;
|
|
69
|
-
|
|
70
|
-
|
|
85
|
+
}
|
|
86
|
+
const comment = providerComment(event);
|
|
87
|
+
if (comment === null)
|
|
71
88
|
continue;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
89
|
+
if (observedByResource === state.observedByResource)
|
|
90
|
+
observedByResource = new Map(observedByResource);
|
|
91
|
+
const forResource = new Map(observedByResource.get(comment.resourceKey));
|
|
92
|
+
forResource.set(comment.messageId, comment);
|
|
93
|
+
observedByResource.set(comment.resourceKey, forResource);
|
|
76
94
|
}
|
|
77
|
-
return
|
|
95
|
+
return { intents, observedByResource, confirmations };
|
|
78
96
|
}
|
|
79
97
|
function reconcileCommentHistory(observed, confirmed, resourcesById, observedSince, publicUiUrl) {
|
|
80
98
|
const history = new Map();
|
|
@@ -114,10 +132,9 @@ function isConfirmed(value) {
|
|
|
114
132
|
(value.event.eventType === DeliveryEventType.Reconciled &&
|
|
115
133
|
value.event.payload.result === DeliveryResultKind.Confirmed));
|
|
116
134
|
}
|
|
117
|
-
function providerComment(event
|
|
135
|
+
function providerComment(event) {
|
|
118
136
|
const observed = selectGitHubAdapterEvent(event);
|
|
119
|
-
if (!isCommentObserved(observed)
|
|
120
|
-
!keys.has(`${observed.stream.id}:${observed.event.payload.externalKey}`))
|
|
137
|
+
if (!isCommentObserved(observed))
|
|
121
138
|
return null;
|
|
122
139
|
return {
|
|
123
140
|
event,
|
|
@@ -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,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),
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type { AdapterId } from '../../contracts/identifiers.js';
|
|
2
2
|
import type { ExternalEventSource } from '../application/poll-service.js';
|
|
3
|
-
import { type
|
|
3
|
+
import { type GitHubPullRequestPayload } from '../contracts/payloads.js';
|
|
4
4
|
import type { PollBatch } from './poll-watermark.js';
|
|
5
|
-
|
|
5
|
+
import { type PullRequestEvidenceClient } from './pr-evidence.js';
|
|
6
|
+
export interface GitHubPullRequestSourceClient extends PullRequestEvidenceClient {
|
|
6
7
|
listPullRequests(owner: string, repo: string, maxResults: number): Promise<readonly GitHubPullRequestPayload[]>;
|
|
7
|
-
listCheckRunsForRef(owner: string, repo: string, ref: string, maxResults?: number): Promise<readonly GitHubCheckRunPayload[]>;
|
|
8
|
-
getCombinedStatusForRef(owner: string, repo: string, ref: string, maxResults?: number): Promise<readonly GitHubCommitStatusPayload[]>;
|
|
9
|
-
listPullRequestFiles(owner: string, repo: string, pullNumber: number, maxResults?: number): Promise<readonly string[]>;
|
|
10
8
|
}
|
|
11
9
|
interface GitHubPullRequestSourceInput {
|
|
12
10
|
readonly client: GitHubPullRequestSourceClient;
|