@oss-autopilot/core 3.36.0 → 3.37.0
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/cli-registry.js +1 -1
- package/dist/cli.bundle.cjs +123 -110
- package/dist/commands/daily.js +17 -1
- package/dist/commands/ledger-backfill.d.ts +7 -0
- package/dist/commands/ledger-backfill.js +116 -6
- package/dist/commands/vet-list.js +18 -17
- package/dist/commands/vet.js +27 -2
- package/dist/core/daily-logic.d.ts +33 -0
- package/dist/core/daily-logic.js +102 -0
- package/dist/core/eval-report.d.ts +8 -0
- package/dist/core/eval-report.js +81 -4
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js +3 -3
- package/dist/core/issue-verification.d.ts +12 -0
- package/dist/core/issue-verification.js +18 -0
- package/dist/core/pick-snapshot.d.ts +19 -2
- package/dist/core/pick-snapshot.js +27 -1
- package/dist/core/pr-monitor.d.ts +0 -6
- package/dist/core/pr-monitor.js +0 -13
- package/dist/core/repo-score-manager.d.ts +0 -13
- package/dist/core/repo-score-manager.js +0 -24
- package/dist/core/review-analysis.d.ts +34 -14
- package/dist/core/review-analysis.js +61 -32
- package/dist/core/state-schema.d.ts +46 -0
- package/dist/core/state-schema.js +28 -0
- package/dist/core/state.d.ts +8 -15
- package/dist/core/state.js +19 -24
- package/dist/formatters/json.d.ts +4 -0
- package/dist/formatters/json.js +4 -0
- package/package.json +1 -1
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
* Extracted from PRMonitor to isolate review-related logic (#263).
|
|
5
5
|
*/
|
|
6
6
|
import { isBotAuthor, isAcknowledgmentComment } from './comment-utils.js';
|
|
7
|
+
/** True when a review's author is a bot (#1840); bots never set the review decision. */
|
|
8
|
+
function isBotReview(review) {
|
|
9
|
+
return isBotAuthor(review.user?.login ?? '', review.user?.type);
|
|
10
|
+
}
|
|
7
11
|
/**
|
|
8
12
|
* Determine review decision from reviews list.
|
|
9
13
|
* Groups reviews by user, keeping each user's latest verdict, then checks
|
|
@@ -12,6 +16,9 @@ import { isBotAuthor, isAcknowledgmentComment } from './comment-utils.js';
|
|
|
12
16
|
* Only APPROVED, CHANGES_REQUESTED and DISMISSED change a reviewer's standing
|
|
13
17
|
* verdict on GitHub. COMMENTED is also what GitHub records for every inline
|
|
14
18
|
* reply, so it must not overwrite an earlier verdict from the same reviewer.
|
|
19
|
+
*
|
|
20
|
+
* Bot-authored reviews (e.g. an AI review bot posting APPROVE) are ignored so a
|
|
21
|
+
* bot alone never reads as maintainer approval or a changes request (#1840).
|
|
15
22
|
*/
|
|
16
23
|
export function determineReviewDecision(reviews) {
|
|
17
24
|
if (reviews.length === 0) {
|
|
@@ -22,7 +29,7 @@ export function determineReviewDecision(reviews) {
|
|
|
22
29
|
for (const review of reviews) {
|
|
23
30
|
const login = review.user?.login;
|
|
24
31
|
const state = review.state;
|
|
25
|
-
if (!login || !state)
|
|
32
|
+
if (!login || !state || isBotReview(review))
|
|
26
33
|
continue;
|
|
27
34
|
if (state === 'DISMISSED') {
|
|
28
35
|
latestByUser.delete(login);
|
|
@@ -41,13 +48,17 @@ export function determineReviewDecision(reviews) {
|
|
|
41
48
|
return 'review_required';
|
|
42
49
|
}
|
|
43
50
|
/**
|
|
44
|
-
* Get the date of the latest CHANGES_REQUESTED review (from any reviewer).
|
|
51
|
+
* Get the date of the latest CHANGES_REQUESTED review (from any human reviewer).
|
|
45
52
|
* Used to detect needs_changes status when review feedback is in inline comments.
|
|
53
|
+
* Bot reviews are skipped (#1840): a bot re-reviewing every push would otherwise
|
|
54
|
+
* move the date past the author's fix commit.
|
|
46
55
|
*/
|
|
47
56
|
export function getLatestChangesRequestedDate(reviews) {
|
|
48
57
|
let latest;
|
|
49
58
|
for (const review of reviews) {
|
|
50
|
-
if (review.state
|
|
59
|
+
if (review.state !== 'CHANGES_REQUESTED' || isBotReview(review))
|
|
60
|
+
continue;
|
|
61
|
+
if (review.submitted_at && (!latest || review.submitted_at > latest)) {
|
|
51
62
|
latest = review.submitted_at;
|
|
52
63
|
}
|
|
53
64
|
}
|
|
@@ -106,30 +117,22 @@ export function reviewHasInlineComments(reviewId, reviewComments) {
|
|
|
106
117
|
}
|
|
107
118
|
/**
|
|
108
119
|
* Earliest maintainer response timestamp across issue comments and submitted
|
|
109
|
-
* reviews (#1461).
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
120
|
+
* reviews (#1461). "Maintainer" is the same rule the dormancy clock uses
|
|
121
|
+
* ({@link isMaintainerEngagement}): issue comments count only from OWNER /
|
|
122
|
+
* MEMBER / COLLABORATOR (any non-bot non-contributor when the association is
|
|
123
|
+
* unknown), reviews from any non-bot non-contributor. Acknowledgments and
|
|
124
|
+
* approvals count. Returns undefined when no maintainer has responded yet.
|
|
114
125
|
*/
|
|
115
126
|
export function getFirstMaintainerResponseAt(comments, reviews, username) {
|
|
116
|
-
const
|
|
127
|
+
const times = [
|
|
128
|
+
...comments.filter((c) => isMaintainerEngagement(c, username, 'issue-comment')).map((c) => c.created_at),
|
|
129
|
+
...reviews.filter((r) => isMaintainerEngagement(r, username, 'review')).map((r) => r.submitted_at),
|
|
130
|
+
];
|
|
117
131
|
let earliest;
|
|
118
|
-
const
|
|
119
|
-
if (!
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
return;
|
|
123
|
-
if (isBotAuthor(author))
|
|
124
|
-
return;
|
|
125
|
-
if (!earliest || new Date(createdAt).getTime() < new Date(earliest).getTime()) {
|
|
126
|
-
earliest = createdAt;
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
for (const comment of comments)
|
|
130
|
-
consider(comment.user?.login, comment.created_at);
|
|
131
|
-
for (const review of reviews)
|
|
132
|
-
consider(review.user?.login, review.submitted_at);
|
|
132
|
+
for (const t of times) {
|
|
133
|
+
if (t && Number.isFinite(Date.parse(t)) && (!earliest || Date.parse(t) < Date.parse(earliest)))
|
|
134
|
+
earliest = t;
|
|
135
|
+
}
|
|
133
136
|
return earliest;
|
|
134
137
|
}
|
|
135
138
|
/**
|
|
@@ -244,6 +247,30 @@ const MAINTAINER_ASSOCIATIONS = new Set(['OWNER', 'MEMBER', 'COLLABORATOR']);
|
|
|
244
247
|
* is conversation, not a nudge.
|
|
245
248
|
*/
|
|
246
249
|
export const PING_MIN_GAP_DAYS = 7;
|
|
250
|
+
/**
|
|
251
|
+
* Version of {@link isMaintainerEngagement}. Bump it when the rule changes so
|
|
252
|
+
* ledger-backfill recomputes stored `firstMaintainerResponseAt` values. Rule 1
|
|
253
|
+
* (implicit, unstamped) counted any non-author non-bot issue comment.
|
|
254
|
+
*/
|
|
255
|
+
export const MAINTAINER_RESPONSE_RULE = 2;
|
|
256
|
+
/**
|
|
257
|
+
* Whether a comment or review counts as maintainer engagement. Shared by the
|
|
258
|
+
* dormancy clock ({@link getLastMaintainerActivity}, #1842) and first-response
|
|
259
|
+
* latency ({@link getFirstMaintainerResponseAt}) so both agree on who a
|
|
260
|
+
* maintainer is: never the contributor or a bot; an issue comment additionally
|
|
261
|
+
* needs an OWNER / MEMBER / COLLABORATOR association when one is known, so
|
|
262
|
+
* drive-by "+1"s don't count. Reviews and inline review comments count from
|
|
263
|
+
* any other account, since codeowners often show as CONTRIBUTOR.
|
|
264
|
+
*/
|
|
265
|
+
export function isMaintainerEngagement(actor, username, kind) {
|
|
266
|
+
const login = actor.user?.login;
|
|
267
|
+
if (!login || login.toLowerCase() === username.toLowerCase())
|
|
268
|
+
return false;
|
|
269
|
+
if (isBotAuthor(login, actor.user?.type))
|
|
270
|
+
return false;
|
|
271
|
+
const association = actor.author_association;
|
|
272
|
+
return kind === 'review' || !association || MAINTAINER_ASSOCIATIONS.has(association);
|
|
273
|
+
}
|
|
247
274
|
/**
|
|
248
275
|
* Latest maintainer activity on a PR, falling back to `createdAt` when no
|
|
249
276
|
* maintainer has engaged, plus the number of contributor pings since then.
|
|
@@ -286,15 +313,17 @@ export function getLastMaintainerActivity(comments, reviews, reviewComments, eve
|
|
|
286
313
|
}
|
|
287
314
|
};
|
|
288
315
|
for (const c of comments) {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
316
|
+
if (isMaintainerEngagement(c, username, 'issue-comment'))
|
|
317
|
+
consider(c.user?.login, c.user?.type, c.created_at);
|
|
318
|
+
}
|
|
319
|
+
for (const r of reviews) {
|
|
320
|
+
if (isMaintainerEngagement(r, username, 'review'))
|
|
321
|
+
consider(r.user?.login, r.user?.type, r.submitted_at);
|
|
322
|
+
}
|
|
323
|
+
for (const c of reviewComments) {
|
|
324
|
+
if (isMaintainerEngagement(c, username, 'review'))
|
|
325
|
+
consider(c.user?.login, c.user?.type, c.created_at);
|
|
293
326
|
}
|
|
294
|
-
for (const r of reviews)
|
|
295
|
-
consider(r.user?.login, r.user?.type, r.submitted_at);
|
|
296
|
-
for (const c of reviewComments)
|
|
297
|
-
consider(c.user?.login, c.user?.type, c.created_at);
|
|
298
327
|
for (const e of events)
|
|
299
328
|
consider(e.login, e.type, e.at, e.isPush);
|
|
300
329
|
const authorCommentTimes = comments
|
|
@@ -78,6 +78,13 @@ export declare const PickSnapshotSchema: z.ZodObject<{
|
|
|
78
78
|
stargazersCount: z.ZodOptional<z.ZodNumber>;
|
|
79
79
|
source: z.ZodCustom<(string & {}) | "vet" | "vet-list" | "list", (string & {}) | "vet" | "vet-list" | "list">;
|
|
80
80
|
capturedAt: z.ZodOptional<z.ZodString>;
|
|
81
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
82
|
+
issueAuthorAssociation: z.ZodOptional<z.ZodCustom<(string & {}) | "OWNER" | "MEMBER" | "COLLABORATOR" | "CONTRIBUTOR" | "FIRST_TIMER" | "FIRST_TIME_CONTRIBUTOR" | "MANNEQUIN" | "NONE", (string & {}) | "OWNER" | "MEMBER" | "COLLABORATOR" | "CONTRIBUTOR" | "FIRST_TIMER" | "FIRST_TIME_CONTRIBUTOR" | "MANNEQUIN" | "NONE">>;
|
|
83
|
+
issueAuthorIsBot: z.ZodOptional<z.ZodBoolean>;
|
|
84
|
+
competingPRs: z.ZodOptional<z.ZodNumber>;
|
|
85
|
+
mentioningPRs: z.ZodOptional<z.ZodNumber>;
|
|
86
|
+
firstInRepo: z.ZodOptional<z.ZodBoolean>;
|
|
87
|
+
commentCount: z.ZodOptional<z.ZodNumber>;
|
|
81
88
|
}, z.core.$loose>;
|
|
82
89
|
export declare const StoredMergedPRSchema: z.ZodObject<{
|
|
83
90
|
issueUrl: z.ZodOptional<z.ZodString>;
|
|
@@ -88,10 +95,18 @@ export declare const StoredMergedPRSchema: z.ZodObject<{
|
|
|
88
95
|
stargazersCount: z.ZodOptional<z.ZodNumber>;
|
|
89
96
|
source: z.ZodCustom<(string & {}) | "vet" | "vet-list" | "list", (string & {}) | "vet" | "vet-list" | "list">;
|
|
90
97
|
capturedAt: z.ZodOptional<z.ZodString>;
|
|
98
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
99
|
+
issueAuthorAssociation: z.ZodOptional<z.ZodCustom<(string & {}) | "OWNER" | "MEMBER" | "COLLABORATOR" | "CONTRIBUTOR" | "FIRST_TIMER" | "FIRST_TIME_CONTRIBUTOR" | "MANNEQUIN" | "NONE", (string & {}) | "OWNER" | "MEMBER" | "COLLABORATOR" | "CONTRIBUTOR" | "FIRST_TIMER" | "FIRST_TIME_CONTRIBUTOR" | "MANNEQUIN" | "NONE">>;
|
|
100
|
+
issueAuthorIsBot: z.ZodOptional<z.ZodBoolean>;
|
|
101
|
+
competingPRs: z.ZodOptional<z.ZodNumber>;
|
|
102
|
+
mentioningPRs: z.ZodOptional<z.ZodNumber>;
|
|
103
|
+
firstInRepo: z.ZodOptional<z.ZodBoolean>;
|
|
104
|
+
commentCount: z.ZodOptional<z.ZodNumber>;
|
|
91
105
|
}, z.core.$loose>>;
|
|
92
106
|
lastReviewDecision: z.ZodOptional<z.ZodString>;
|
|
93
107
|
lastCiStatus: z.ZodOptional<z.ZodString>;
|
|
94
108
|
backfilledAt: z.ZodOptional<z.ZodString>;
|
|
109
|
+
responseRule: z.ZodOptional<z.ZodNumber>;
|
|
95
110
|
url: z.ZodString;
|
|
96
111
|
title: z.ZodString;
|
|
97
112
|
mergedAt: z.ZodString;
|
|
@@ -111,10 +126,18 @@ export declare const StoredClosedPRSchema: z.ZodObject<{
|
|
|
111
126
|
stargazersCount: z.ZodOptional<z.ZodNumber>;
|
|
112
127
|
source: z.ZodCustom<(string & {}) | "vet" | "vet-list" | "list", (string & {}) | "vet" | "vet-list" | "list">;
|
|
113
128
|
capturedAt: z.ZodOptional<z.ZodString>;
|
|
129
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
130
|
+
issueAuthorAssociation: z.ZodOptional<z.ZodCustom<(string & {}) | "OWNER" | "MEMBER" | "COLLABORATOR" | "CONTRIBUTOR" | "FIRST_TIMER" | "FIRST_TIME_CONTRIBUTOR" | "MANNEQUIN" | "NONE", (string & {}) | "OWNER" | "MEMBER" | "COLLABORATOR" | "CONTRIBUTOR" | "FIRST_TIMER" | "FIRST_TIME_CONTRIBUTOR" | "MANNEQUIN" | "NONE">>;
|
|
131
|
+
issueAuthorIsBot: z.ZodOptional<z.ZodBoolean>;
|
|
132
|
+
competingPRs: z.ZodOptional<z.ZodNumber>;
|
|
133
|
+
mentioningPRs: z.ZodOptional<z.ZodNumber>;
|
|
134
|
+
firstInRepo: z.ZodOptional<z.ZodBoolean>;
|
|
135
|
+
commentCount: z.ZodOptional<z.ZodNumber>;
|
|
114
136
|
}, z.core.$loose>>;
|
|
115
137
|
lastReviewDecision: z.ZodOptional<z.ZodString>;
|
|
116
138
|
lastCiStatus: z.ZodOptional<z.ZodString>;
|
|
117
139
|
backfilledAt: z.ZodOptional<z.ZodString>;
|
|
140
|
+
responseRule: z.ZodOptional<z.ZodNumber>;
|
|
118
141
|
url: z.ZodString;
|
|
119
142
|
title: z.ZodString;
|
|
120
143
|
closedAt: z.ZodString;
|
|
@@ -924,10 +947,18 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
924
947
|
stargazersCount: z.ZodOptional<z.ZodNumber>;
|
|
925
948
|
source: z.ZodCustom<(string & {}) | "vet" | "vet-list" | "list", (string & {}) | "vet" | "vet-list" | "list">;
|
|
926
949
|
capturedAt: z.ZodOptional<z.ZodString>;
|
|
950
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
951
|
+
issueAuthorAssociation: z.ZodOptional<z.ZodCustom<(string & {}) | "OWNER" | "MEMBER" | "COLLABORATOR" | "CONTRIBUTOR" | "FIRST_TIMER" | "FIRST_TIME_CONTRIBUTOR" | "MANNEQUIN" | "NONE", (string & {}) | "OWNER" | "MEMBER" | "COLLABORATOR" | "CONTRIBUTOR" | "FIRST_TIMER" | "FIRST_TIME_CONTRIBUTOR" | "MANNEQUIN" | "NONE">>;
|
|
952
|
+
issueAuthorIsBot: z.ZodOptional<z.ZodBoolean>;
|
|
953
|
+
competingPRs: z.ZodOptional<z.ZodNumber>;
|
|
954
|
+
mentioningPRs: z.ZodOptional<z.ZodNumber>;
|
|
955
|
+
firstInRepo: z.ZodOptional<z.ZodBoolean>;
|
|
956
|
+
commentCount: z.ZodOptional<z.ZodNumber>;
|
|
927
957
|
}, z.core.$loose>>;
|
|
928
958
|
lastReviewDecision: z.ZodOptional<z.ZodString>;
|
|
929
959
|
lastCiStatus: z.ZodOptional<z.ZodString>;
|
|
930
960
|
backfilledAt: z.ZodOptional<z.ZodString>;
|
|
961
|
+
responseRule: z.ZodOptional<z.ZodNumber>;
|
|
931
962
|
url: z.ZodString;
|
|
932
963
|
title: z.ZodString;
|
|
933
964
|
mergedAt: z.ZodString;
|
|
@@ -947,10 +978,18 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
947
978
|
stargazersCount: z.ZodOptional<z.ZodNumber>;
|
|
948
979
|
source: z.ZodCustom<(string & {}) | "vet" | "vet-list" | "list", (string & {}) | "vet" | "vet-list" | "list">;
|
|
949
980
|
capturedAt: z.ZodOptional<z.ZodString>;
|
|
981
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
982
|
+
issueAuthorAssociation: z.ZodOptional<z.ZodCustom<(string & {}) | "OWNER" | "MEMBER" | "COLLABORATOR" | "CONTRIBUTOR" | "FIRST_TIMER" | "FIRST_TIME_CONTRIBUTOR" | "MANNEQUIN" | "NONE", (string & {}) | "OWNER" | "MEMBER" | "COLLABORATOR" | "CONTRIBUTOR" | "FIRST_TIMER" | "FIRST_TIME_CONTRIBUTOR" | "MANNEQUIN" | "NONE">>;
|
|
983
|
+
issueAuthorIsBot: z.ZodOptional<z.ZodBoolean>;
|
|
984
|
+
competingPRs: z.ZodOptional<z.ZodNumber>;
|
|
985
|
+
mentioningPRs: z.ZodOptional<z.ZodNumber>;
|
|
986
|
+
firstInRepo: z.ZodOptional<z.ZodBoolean>;
|
|
987
|
+
commentCount: z.ZodOptional<z.ZodNumber>;
|
|
950
988
|
}, z.core.$loose>>;
|
|
951
989
|
lastReviewDecision: z.ZodOptional<z.ZodString>;
|
|
952
990
|
lastCiStatus: z.ZodOptional<z.ZodString>;
|
|
953
991
|
backfilledAt: z.ZodOptional<z.ZodString>;
|
|
992
|
+
responseRule: z.ZodOptional<z.ZodNumber>;
|
|
954
993
|
url: z.ZodString;
|
|
955
994
|
title: z.ZodString;
|
|
956
995
|
closedAt: z.ZodString;
|
|
@@ -1044,6 +1083,13 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
1044
1083
|
stargazersCount: z.ZodOptional<z.ZodNumber>;
|
|
1045
1084
|
source: z.ZodCustom<(string & {}) | "vet" | "vet-list" | "list", (string & {}) | "vet" | "vet-list" | "list">;
|
|
1046
1085
|
capturedAt: z.ZodOptional<z.ZodString>;
|
|
1086
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1087
|
+
issueAuthorAssociation: z.ZodOptional<z.ZodCustom<(string & {}) | "OWNER" | "MEMBER" | "COLLABORATOR" | "CONTRIBUTOR" | "FIRST_TIMER" | "FIRST_TIME_CONTRIBUTOR" | "MANNEQUIN" | "NONE", (string & {}) | "OWNER" | "MEMBER" | "COLLABORATOR" | "CONTRIBUTOR" | "FIRST_TIMER" | "FIRST_TIME_CONTRIBUTOR" | "MANNEQUIN" | "NONE">>;
|
|
1088
|
+
issueAuthorIsBot: z.ZodOptional<z.ZodBoolean>;
|
|
1089
|
+
competingPRs: z.ZodOptional<z.ZodNumber>;
|
|
1090
|
+
mentioningPRs: z.ZodOptional<z.ZodNumber>;
|
|
1091
|
+
firstInRepo: z.ZodOptional<z.ZodBoolean>;
|
|
1092
|
+
commentCount: z.ZodOptional<z.ZodNumber>;
|
|
1047
1093
|
}, z.core.$loose>>>;
|
|
1048
1094
|
lastOvernight: z.ZodOptional<z.ZodObject<{
|
|
1049
1095
|
runAt: z.ZodString;
|
|
@@ -69,6 +69,27 @@ export const PickSnapshotSchema = z
|
|
|
69
69
|
source: openEnum(['vet', 'vet-list', 'list']),
|
|
70
70
|
/** When the vet ran. Absent for `list` picks: the list does not record vet dates reliably. */
|
|
71
71
|
capturedAt: z.string().optional(),
|
|
72
|
+
// Issue traits at vet time, for the eval's trait cuts. Older snapshots lack them.
|
|
73
|
+
labels: z.array(z.string()).optional(),
|
|
74
|
+
/** Raw GitHub author association of the issue author; the eval buckets it. */
|
|
75
|
+
issueAuthorAssociation: openEnum([
|
|
76
|
+
'OWNER',
|
|
77
|
+
'MEMBER',
|
|
78
|
+
'COLLABORATOR',
|
|
79
|
+
'CONTRIBUTOR',
|
|
80
|
+
'FIRST_TIMER',
|
|
81
|
+
'FIRST_TIME_CONTRIBUTOR',
|
|
82
|
+
'MANNEQUIN',
|
|
83
|
+
'NONE',
|
|
84
|
+
]).optional(),
|
|
85
|
+
issueAuthorIsBot: z.boolean().optional(),
|
|
86
|
+
/** Open, non-draft PRs by others that close the issue (claims). */
|
|
87
|
+
competingPRs: z.number().optional(),
|
|
88
|
+
/** Open PRs by others that only cross-reference the issue (not claims). */
|
|
89
|
+
mentioningPRs: z.number().optional(),
|
|
90
|
+
/** The user had no merged PR in the repo yet. */
|
|
91
|
+
firstInRepo: z.boolean().optional(),
|
|
92
|
+
commentCount: z.number().optional(),
|
|
72
93
|
})
|
|
73
94
|
.passthrough();
|
|
74
95
|
/**
|
|
@@ -86,6 +107,13 @@ const LedgerPredictionFields = {
|
|
|
86
107
|
lastCiStatus: z.string().optional(),
|
|
87
108
|
/** When ledger-backfill got GitHub's answer for this PR; later runs skip it. */
|
|
88
109
|
backfilledAt: z.string().optional(),
|
|
110
|
+
/**
|
|
111
|
+
* Version of the maintainer rule (`MAINTAINER_RESPONSE_RULE`) ledger-backfill
|
|
112
|
+
* last computed `firstMaintainerResponseAt` under. Entries with an older or
|
|
113
|
+
* missing version are re-queried once and their value overwritten; a PR
|
|
114
|
+
* nobody answered carries the current version without the field.
|
|
115
|
+
*/
|
|
116
|
+
responseRule: z.number().int().optional(),
|
|
89
117
|
};
|
|
90
118
|
export const StoredMergedPRSchema = z
|
|
91
119
|
.object({
|
package/dist/core/state.d.ts
CHANGED
|
@@ -292,6 +292,14 @@ export declare class StateManager {
|
|
|
292
292
|
* No-op when no PR with that URL is stored.
|
|
293
293
|
*/
|
|
294
294
|
markPRCommentsFetched(url: string, fetchedAt: string): void;
|
|
295
|
+
/**
|
|
296
|
+
* Overwrite the first-response lookup on the merged or closed PR matching
|
|
297
|
+
* `url`. Unlike addMergedPRs/addClosedPRs, which only fill missing fields,
|
|
298
|
+
* this replaces `firstMaintainerResponseAt` (clearing it when `at` is
|
|
299
|
+
* undefined) so ledger-backfill can recompute values recorded under an older
|
|
300
|
+
* maintainer rule. No-op when no PR with that URL is stored.
|
|
301
|
+
*/
|
|
302
|
+
setLedgerResponse(url: string, at: string | undefined, rule: number): void;
|
|
295
303
|
/**
|
|
296
304
|
* Stamp `learningsExtractedAt` on the merged or closed PR matching `url` (#867).
|
|
297
305
|
* No-op when no PR with that URL is stored.
|
|
@@ -440,21 +448,6 @@ export declare class StateManager {
|
|
|
440
448
|
* @param updates - Partial score fields to merge
|
|
441
449
|
*/
|
|
442
450
|
updateRepoScore(repo: string, updates: RepoScoreUpdate): void;
|
|
443
|
-
/**
|
|
444
|
-
* Increment the merged PR count for a repository.
|
|
445
|
-
* @param repo - Repository in "owner/repo" format
|
|
446
|
-
*/
|
|
447
|
-
incrementMergedCount(repo: string): void;
|
|
448
|
-
/**
|
|
449
|
-
* Increment the closed-without-merge PR count.
|
|
450
|
-
* @param repo - Repository in "owner/repo" format
|
|
451
|
-
*/
|
|
452
|
-
incrementClosedCount(repo: string): void;
|
|
453
|
-
/**
|
|
454
|
-
* Mark a repository as hostile (score zeroed).
|
|
455
|
-
* @param repo - Repository in "owner/repo" format
|
|
456
|
-
*/
|
|
457
|
-
markRepoHostile(repo: string): void;
|
|
458
451
|
/** Returns repository names that have at least one merged PR. */
|
|
459
452
|
getReposWithMergedPRs(): string[];
|
|
460
453
|
/** Returns repository names with open PRs but no merged PRs yet. */
|
package/dist/core/state.js
CHANGED
|
@@ -46,6 +46,7 @@ const LEDGER_FIELDS = [
|
|
|
46
46
|
'lastReviewDecision',
|
|
47
47
|
'lastCiStatus',
|
|
48
48
|
'backfilledAt',
|
|
49
|
+
'responseRule',
|
|
49
50
|
'closeReason',
|
|
50
51
|
'selfCloseReason',
|
|
51
52
|
];
|
|
@@ -713,6 +714,24 @@ export class StateManager {
|
|
|
713
714
|
this.autoSave();
|
|
714
715
|
}
|
|
715
716
|
}
|
|
717
|
+
/**
|
|
718
|
+
* Overwrite the first-response lookup on the merged or closed PR matching
|
|
719
|
+
* `url`. Unlike addMergedPRs/addClosedPRs, which only fill missing fields,
|
|
720
|
+
* this replaces `firstMaintainerResponseAt` (clearing it when `at` is
|
|
721
|
+
* undefined) so ledger-backfill can recompute values recorded under an older
|
|
722
|
+
* maintainer rule. No-op when no PR with that URL is stored.
|
|
723
|
+
*/
|
|
724
|
+
setLedgerResponse(url, at, rule) {
|
|
725
|
+
const entry = this.state.mergedPRs?.find((pr) => pr.url === url) ?? this.state.closedPRs?.find((pr) => pr.url === url);
|
|
726
|
+
if (!entry)
|
|
727
|
+
return;
|
|
728
|
+
if (at === undefined)
|
|
729
|
+
delete entry.firstMaintainerResponseAt;
|
|
730
|
+
else
|
|
731
|
+
entry.firstMaintainerResponseAt = at;
|
|
732
|
+
entry.responseRule = rule;
|
|
733
|
+
this.autoSave();
|
|
734
|
+
}
|
|
716
735
|
/**
|
|
717
736
|
* Stamp `learningsExtractedAt` on the merged or closed PR matching `url` (#867).
|
|
718
737
|
* No-op when no PR with that URL is stored.
|
|
@@ -1040,30 +1059,6 @@ export class StateManager {
|
|
|
1040
1059
|
repoScoring.updateRepoScore(this.state, repo, updates);
|
|
1041
1060
|
this.autoSave();
|
|
1042
1061
|
}
|
|
1043
|
-
/**
|
|
1044
|
-
* Increment the merged PR count for a repository.
|
|
1045
|
-
* @param repo - Repository in "owner/repo" format
|
|
1046
|
-
*/
|
|
1047
|
-
incrementMergedCount(repo) {
|
|
1048
|
-
repoScoring.incrementMergedCount(this.state, repo);
|
|
1049
|
-
this.autoSave();
|
|
1050
|
-
}
|
|
1051
|
-
/**
|
|
1052
|
-
* Increment the closed-without-merge PR count.
|
|
1053
|
-
* @param repo - Repository in "owner/repo" format
|
|
1054
|
-
*/
|
|
1055
|
-
incrementClosedCount(repo) {
|
|
1056
|
-
repoScoring.incrementClosedCount(this.state, repo);
|
|
1057
|
-
this.autoSave();
|
|
1058
|
-
}
|
|
1059
|
-
/**
|
|
1060
|
-
* Mark a repository as hostile (score zeroed).
|
|
1061
|
-
* @param repo - Repository in "owner/repo" format
|
|
1062
|
-
*/
|
|
1063
|
-
markRepoHostile(repo) {
|
|
1064
|
-
repoScoring.markRepoHostile(this.state, repo);
|
|
1065
|
-
this.autoSave();
|
|
1066
|
-
}
|
|
1067
1062
|
/** Returns repository names that have at least one merged PR. */
|
|
1068
1063
|
getReposWithMergedPRs() {
|
|
1069
1064
|
return repoScoring.getReposWithMergedPRs(this.state);
|
|
@@ -921,6 +921,10 @@ export declare const VerifyIssueOutputSchema: z.ZodObject<{
|
|
|
921
921
|
}>>;
|
|
922
922
|
closedAt: z.ZodNullable<z.ZodString>;
|
|
923
923
|
assignees: z.ZodArray<z.ZodString>;
|
|
924
|
+
author: z.ZodNullable<z.ZodString>;
|
|
925
|
+
authorAssociation: z.ZodNullable<z.ZodString>;
|
|
926
|
+
authorIsBot: z.ZodBoolean;
|
|
927
|
+
commentCount: z.ZodNullable<z.ZodNumber>;
|
|
924
928
|
linkedPRs: z.ZodArray<z.ZodObject<{
|
|
925
929
|
number: z.ZodNumber;
|
|
926
930
|
url: z.ZodString;
|
package/dist/formatters/json.js
CHANGED
|
@@ -490,6 +490,10 @@ export const VerifyIssueOutputSchema = z.object({
|
|
|
490
490
|
stateReason: z.enum(['completed', 'not_planned', 'reopened', 'duplicate']).nullable(),
|
|
491
491
|
closedAt: z.string().nullable(),
|
|
492
492
|
assignees: z.array(z.string()),
|
|
493
|
+
author: z.string().nullable(),
|
|
494
|
+
authorAssociation: z.string().nullable(),
|
|
495
|
+
authorIsBot: z.boolean(),
|
|
496
|
+
commentCount: z.number().int().nonnegative().nullable(),
|
|
493
497
|
linkedPRs: z.array(z.object({
|
|
494
498
|
number: z.number().int().positive(),
|
|
495
499
|
url: z.string(),
|