@oss-autopilot/core 3.35.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 +25 -2
- package/dist/cli.bundle.cjs +142 -118
- package/dist/commands/daily.js +21 -2
- package/dist/commands/ledger-backfill.d.ts +7 -0
- package/dist/commands/ledger-backfill.js +116 -6
- package/dist/commands/repo-cap.d.ts +10 -0
- package/dist/commands/repo-cap.js +23 -0
- package/dist/commands/scout-bridge.js +8 -2
- package/dist/commands/search.js +7 -1
- package/dist/commands/setup.js +6 -4
- package/dist/commands/vet-list.js +20 -17
- package/dist/commands/vet.js +29 -2
- package/dist/core/ci-analysis.js +14 -1
- package/dist/core/comment-utils.d.ts +5 -2
- package/dist/core/comment-utils.js +11 -3
- package/dist/core/config-registry.js +12 -0
- package/dist/core/daily-logic.d.ts +36 -1
- package/dist/core/daily-logic.js +113 -3
- package/dist/core/eval-report.d.ts +8 -0
- package/dist/core/eval-report.js +81 -4
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +4 -4
- 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-assembly.d.ts +11 -1
- package/dist/core/pr-assembly.js +21 -4
- package/dist/core/pr-attention.d.ts +14 -0
- package/dist/core/pr-attention.js +18 -0
- package/dist/core/pr-graphql.d.ts +31 -1
- package/dist/core/pr-graphql.js +49 -5
- package/dist/core/pr-monitor.d.ts +37 -6
- package/dist/core/pr-monitor.js +41 -12
- package/dist/core/repo-cap.d.ts +46 -0
- package/dist/core/repo-cap.js +102 -0
- 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 +98 -14
- package/dist/core/review-analysis.js +145 -25
- package/dist/core/state-schema.d.ts +58 -0
- package/dist/core/state-schema.js +37 -0
- package/dist/core/state.d.ts +8 -15
- package/dist/core/state.js +19 -24
- package/dist/core/status-determination.js +11 -11
- package/dist/core/types.d.ts +32 -2
- package/dist/formatters/json.d.ts +29 -0
- package/dist/formatters/json.js +17 -0
- package/package.json +1 -1
|
@@ -119,6 +119,39 @@ export declare function groupPRsByRepo(prs: FetchedPR[]): RepoGroup[];
|
|
|
119
119
|
* @returns Map of repo names to maintainer responsiveness signals
|
|
120
120
|
*/
|
|
121
121
|
export declare function computeRepoSignals(prs: FetchedPR[]): Map<string, ComputedRepoSignals>;
|
|
122
|
+
/**
|
|
123
|
+
* Per-repo signals derived from the outcome ledger, recomputed each daily run
|
|
124
|
+
* so a corrected ledger entry corrects the score (no one-way latching):
|
|
125
|
+
* - avgResponseDays: MEDIAN days to first maintainer response (name kept for
|
|
126
|
+
* the schema; median so one forgotten PR doesn't skew it). Unanswered PRs
|
|
127
|
+
* are censored, not dropped, so a repo that ignores most PRs can't grade
|
|
128
|
+
* fast off the one it answered. Each PR opened in the last 12 months gives:
|
|
129
|
+
* - answered: openedAt -> firstMaintainerResponseAt
|
|
130
|
+
* - merged with no recorded response: openedAt -> mergedAt (the merge was
|
|
131
|
+
* the response; errs slow, since any earlier reply went unrecorded)
|
|
132
|
+
* - closed and confirmed unanswered under the current maintainer rule
|
|
133
|
+
* (responseRule), except self-closes: openedAt -> closedAt, a lower bound
|
|
134
|
+
* - open and still waiting: createdAt -> now, a lower bound
|
|
135
|
+
* Lower bounds count only from 14 days (CENSORED_MIN_DAYS): a PR opened
|
|
136
|
+
* yesterday or closed within days says nothing yet and would grade fast.
|
|
137
|
+
* Null below 3 samples.
|
|
138
|
+
* - hasHostileComments: any closed PR here has closeReason 'ai-policy'.
|
|
139
|
+
*
|
|
140
|
+
* Repos with no ledger or open PR data are absent; callers treat absent as
|
|
141
|
+
* `{ avgResponseDays: null, hasHostileComments: false }`.
|
|
142
|
+
*/
|
|
143
|
+
export declare function computeLedgerRepoSignals(ledger: ReadonlyArray<{
|
|
144
|
+
url: string;
|
|
145
|
+
openedAt?: string;
|
|
146
|
+
firstMaintainerResponseAt?: string;
|
|
147
|
+
mergedAt?: string;
|
|
148
|
+
closedAt?: string;
|
|
149
|
+
responseRule?: number;
|
|
150
|
+
closeReason?: string;
|
|
151
|
+
}>, openPRs: ReadonlyArray<Pick<FetchedPR, 'url' | 'createdAt' | 'firstMaintainerResponseAt'>>, nowMs?: number): Map<string, {
|
|
152
|
+
avgResponseDays: number | null;
|
|
153
|
+
hasHostileComments: boolean;
|
|
154
|
+
}>;
|
|
122
155
|
/**
|
|
123
156
|
* Assess whether user has capacity for new issues.
|
|
124
157
|
* Only active (non-shelved) PRs count against the limit.
|
|
@@ -159,5 +192,7 @@ export declare function collectActionableIssues(prs: FetchedPR[], lastDigestAt?:
|
|
|
159
192
|
* @param unextractedMergeCount - Recently merged PRs whose learnings have not been extracted yet (#1463); non-zero adds an extract_learnings item
|
|
160
193
|
* @returns Action menu with context flags for orchestration
|
|
161
194
|
*/
|
|
162
|
-
export declare function computeActionMenu(actionableIssues: ActionableIssue[], capacity: CapacityAssessment, commentedIssues?: CommentedIssue[], attention?: Pick<AttentionSummary, 'stuckCI' | 'dormantFollowup'
|
|
195
|
+
export declare function computeActionMenu(actionableIssues: ActionableIssue[], capacity: CapacityAssessment, commentedIssues?: CommentedIssue[], attention?: Pick<AttentionSummary, 'stuckCI' | 'dormantFollowup'> & {
|
|
196
|
+
closeSuggested?: number;
|
|
197
|
+
}, unextractedMergeCount?: number): ActionMenu;
|
|
163
198
|
export { formatActionHint, formatBriefSummary, formatSummary, printDigest } from '../commands/daily-render.js';
|
package/dist/core/daily-logic.js
CHANGED
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
import { warn } from './logger.js';
|
|
18
18
|
import { errorMessage } from './errors.js';
|
|
19
19
|
import { getStateManager } from './state.js';
|
|
20
|
+
import { parseGitHubUrl } from './urls.js';
|
|
21
|
+
import { MAINTAINER_RESPONSE_RULE } from './review-analysis.js';
|
|
20
22
|
// ---------------------------------------------------------------------------
|
|
21
23
|
// Constants
|
|
22
24
|
// ---------------------------------------------------------------------------
|
|
@@ -230,6 +232,106 @@ export function computeRepoSignals(prs) {
|
|
|
230
232
|
}
|
|
231
233
|
return result;
|
|
232
234
|
}
|
|
235
|
+
const MS_PER_DAY = 24 * 60 * 60 * 1000;
|
|
236
|
+
/** Fewer samples than this and avgResponseDays stays null (unknown). */
|
|
237
|
+
const MIN_RESPONSE_SAMPLES = 3;
|
|
238
|
+
/** Only PRs opened within this window feed avgResponseDays. */
|
|
239
|
+
const RESPONSE_WINDOW_DAYS = 365;
|
|
240
|
+
/**
|
|
241
|
+
* A lower bound (unanswered PR) counts only at or above this many days: the
|
|
242
|
+
* top of the 7-point band in issue-grading's gradeResponsiveness. A shorter
|
|
243
|
+
* wait says nothing about the repo yet and would only pull the median fast.
|
|
244
|
+
*/
|
|
245
|
+
const CENSORED_MIN_DAYS = 14;
|
|
246
|
+
const toMs = (t) => (t ? Date.parse(t) : undefined);
|
|
247
|
+
/** Days from `openedAt` to `endMs`, or undefined when unusable or opened before `windowStart`. */
|
|
248
|
+
function responseDays(openedAt, endMs, windowStart) {
|
|
249
|
+
if (endMs === undefined || !openedAt)
|
|
250
|
+
return undefined;
|
|
251
|
+
const startMs = Date.parse(openedAt);
|
|
252
|
+
if (startMs < windowStart)
|
|
253
|
+
return undefined;
|
|
254
|
+
const days = (endMs - startMs) / MS_PER_DAY;
|
|
255
|
+
return Number.isFinite(days) && days >= 0 ? days : undefined;
|
|
256
|
+
}
|
|
257
|
+
/** Where a ledger entry's response sample ends, and whether that end is only a lower bound. */
|
|
258
|
+
function ledgerSampleEnd(e) {
|
|
259
|
+
// mergedAt stands in when no response was recorded; it errs slow.
|
|
260
|
+
const exact = toMs(e.firstMaintainerResponseAt) ?? toMs(e.mergedAt);
|
|
261
|
+
if (exact !== undefined)
|
|
262
|
+
return { endMs: exact, isLowerBound: false };
|
|
263
|
+
const isConfirmedUnanswered = e.responseRule === MAINTAINER_RESPONSE_RULE && e.closeReason !== 'self-closed';
|
|
264
|
+
return { endMs: isConfirmedUnanswered ? toMs(e.closedAt) : undefined, isLowerBound: true };
|
|
265
|
+
}
|
|
266
|
+
/** Median of `values` (sorts in place), or null with fewer than `minCount`. */
|
|
267
|
+
function medianOf(values, minCount) {
|
|
268
|
+
if (values.length < minCount)
|
|
269
|
+
return null;
|
|
270
|
+
values.sort((a, b) => a - b);
|
|
271
|
+
const mid = Math.floor(values.length / 2);
|
|
272
|
+
if (values.length % 2 === 1)
|
|
273
|
+
return values[mid];
|
|
274
|
+
return (values[mid - 1] + values[mid]) / 2;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Per-repo signals derived from the outcome ledger, recomputed each daily run
|
|
278
|
+
* so a corrected ledger entry corrects the score (no one-way latching):
|
|
279
|
+
* - avgResponseDays: MEDIAN days to first maintainer response (name kept for
|
|
280
|
+
* the schema; median so one forgotten PR doesn't skew it). Unanswered PRs
|
|
281
|
+
* are censored, not dropped, so a repo that ignores most PRs can't grade
|
|
282
|
+
* fast off the one it answered. Each PR opened in the last 12 months gives:
|
|
283
|
+
* - answered: openedAt -> firstMaintainerResponseAt
|
|
284
|
+
* - merged with no recorded response: openedAt -> mergedAt (the merge was
|
|
285
|
+
* the response; errs slow, since any earlier reply went unrecorded)
|
|
286
|
+
* - closed and confirmed unanswered under the current maintainer rule
|
|
287
|
+
* (responseRule), except self-closes: openedAt -> closedAt, a lower bound
|
|
288
|
+
* - open and still waiting: createdAt -> now, a lower bound
|
|
289
|
+
* Lower bounds count only from 14 days (CENSORED_MIN_DAYS): a PR opened
|
|
290
|
+
* yesterday or closed within days says nothing yet and would grade fast.
|
|
291
|
+
* Null below 3 samples.
|
|
292
|
+
* - hasHostileComments: any closed PR here has closeReason 'ai-policy'.
|
|
293
|
+
*
|
|
294
|
+
* Repos with no ledger or open PR data are absent; callers treat absent as
|
|
295
|
+
* `{ avgResponseDays: null, hasHostileComments: false }`.
|
|
296
|
+
*/
|
|
297
|
+
export function computeLedgerRepoSignals(ledger, openPRs, nowMs = Date.now()) {
|
|
298
|
+
const byRepo = new Map();
|
|
299
|
+
const windowStart = nowMs - RESPONSE_WINDOW_DAYS * MS_PER_DAY;
|
|
300
|
+
const add = (url, openedAt, endMs, isLowerBound, closeReason) => {
|
|
301
|
+
const ref = parseGitHubUrl(url);
|
|
302
|
+
if (!ref)
|
|
303
|
+
return;
|
|
304
|
+
const repo = `${ref.owner}/${ref.repo}`;
|
|
305
|
+
const entry = byRepo.get(repo) ?? { samples: [], hostile: false };
|
|
306
|
+
byRepo.set(repo, entry);
|
|
307
|
+
if (closeReason === 'ai-policy')
|
|
308
|
+
entry.hostile = true;
|
|
309
|
+
const days = responseDays(openedAt, endMs, windowStart);
|
|
310
|
+
if (days !== undefined && (!isLowerBound || days >= CENSORED_MIN_DAYS))
|
|
311
|
+
entry.samples.push(days);
|
|
312
|
+
};
|
|
313
|
+
const seen = new Set();
|
|
314
|
+
for (const e of ledger) {
|
|
315
|
+
seen.add(e.url);
|
|
316
|
+
const { endMs, isLowerBound } = ledgerSampleEnd(e);
|
|
317
|
+
add(e.url, e.openedAt, endMs, isLowerBound, e.closeReason);
|
|
318
|
+
}
|
|
319
|
+
for (const pr of openPRs) {
|
|
320
|
+
if (seen.has(pr.url))
|
|
321
|
+
continue;
|
|
322
|
+
const exact = toMs(pr.firstMaintainerResponseAt);
|
|
323
|
+
add(pr.url, pr.createdAt, exact ?? nowMs, exact === undefined);
|
|
324
|
+
}
|
|
325
|
+
const result = new Map();
|
|
326
|
+
for (const [repo, { samples, hostile }] of byRepo) {
|
|
327
|
+
const median = medianOf(samples, MIN_RESPONSE_SAMPLES);
|
|
328
|
+
result.set(repo, {
|
|
329
|
+
avgResponseDays: median === null ? null : Math.round(median * 10) / 10,
|
|
330
|
+
hasHostileComments: hostile,
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
return result;
|
|
334
|
+
}
|
|
233
335
|
/**
|
|
234
336
|
* Assess whether user has capacity for new issues.
|
|
235
337
|
* Only active (non-shelved) PRs count against the limit.
|
|
@@ -416,19 +518,27 @@ export function computeActionMenu(actionableIssues, capacity, commentedIssues =
|
|
|
416
518
|
// summarizeAttentionBuckets get a menu path to workflows/dormant-pr-follow-up.md
|
|
417
519
|
// instead of only a headline count. Emitted only when a bucket is non-zero,
|
|
418
520
|
// so menus without stuck/dormant PRs are unchanged.
|
|
521
|
+
// closeSuggested (shouldSuggestClose) counts dormant PRs already pinged
|
|
522
|
+
// twice with no reply; they are usually auto-shelved, so they would
|
|
523
|
+
// otherwise never reach this menu.
|
|
419
524
|
const stuckCI = attention?.stuckCI ?? 0;
|
|
420
525
|
const dormantFollowup = attention?.dormantFollowup ?? 0;
|
|
421
|
-
|
|
526
|
+
const closeSuggested = attention?.closeSuggested ?? 0;
|
|
527
|
+
if (stuckCI > 0 || dormantFollowup > 0 || closeSuggested > 0) {
|
|
422
528
|
const parts = [];
|
|
423
529
|
if (stuckCI > 0)
|
|
424
530
|
parts.push(`${stuckCI} stuck-CI`);
|
|
425
531
|
if (dormantFollowup > 0)
|
|
426
532
|
parts.push(`${dormantFollowup} dormant`);
|
|
427
|
-
|
|
533
|
+
if (closeSuggested > 0)
|
|
534
|
+
parts.push(`${closeSuggested} close-candidate`);
|
|
535
|
+
const total = stuckCI + dormantFollowup + closeSuggested;
|
|
428
536
|
items.push({
|
|
429
537
|
key: 'follow_up',
|
|
430
538
|
label: `Follow up on ${parts.join(' and ')} PR${total === 1 ? '' : 's'}`,
|
|
431
|
-
description:
|
|
539
|
+
description: closeSuggested > 0
|
|
540
|
+
? 'Waiting PRs that may need a nudge, or a close with an offer to reopen after repeated unanswered pings'
|
|
541
|
+
: 'Waiting PRs that may need a nudge (pending CI or no review activity)',
|
|
432
542
|
});
|
|
433
543
|
}
|
|
434
544
|
// Extract-learnings nudge (#1463) — recently merged PRs whose ledger
|
|
@@ -40,6 +40,14 @@ export interface EvalReport {
|
|
|
40
40
|
byGrade: EvalBucket[];
|
|
41
41
|
byStars: EvalBucket[];
|
|
42
42
|
byMonth: EvalBucket[];
|
|
43
|
+
/** All outcomes: first PR in the repo vs returning. */
|
|
44
|
+
byFirstInRepo: EvalBucket[];
|
|
45
|
+
/** Picks only; picks recorded before the trait existed land in `not recorded`. */
|
|
46
|
+
byIssueAuthorRole: EvalBucket[];
|
|
47
|
+
/** Picks only: open PRs by others on the issue at pick time. */
|
|
48
|
+
byCompetingPRs: EvalBucket[];
|
|
49
|
+
/** Picks with labels only; one pick can count in several label groups. */
|
|
50
|
+
byLabel: EvalBucket[];
|
|
43
51
|
closeReasons: Record<string, number>;
|
|
44
52
|
quality: {
|
|
45
53
|
withReviewState: number;
|
package/dist/core/eval-report.js
CHANGED
|
@@ -76,13 +76,58 @@ function starRange(stars) {
|
|
|
76
76
|
return '1k-10k';
|
|
77
77
|
return '10k+';
|
|
78
78
|
}
|
|
79
|
+
/** Normalized label groups for the label cut; a label matches by substring. */
|
|
80
|
+
// Word boundaries by letters only: `\b` treats `_` as a word char, so
|
|
81
|
+
// `good_first_issue` / `type_bug` would never match.
|
|
82
|
+
const wordRe = (alternatives) => new RegExp(`(?:^|[^a-z])(?:${alternatives})(?![a-z])`);
|
|
83
|
+
const LABEL_GROUPS = [
|
|
84
|
+
['good first issue', wordRe('good[ _-]?first|beginners?|easy|first.?timers?|starter(?![_-][a-z])')],
|
|
85
|
+
['help wanted', wordRe('help[ _-]?wanted')],
|
|
86
|
+
['bug', wordRe('bugs?')],
|
|
87
|
+
['enhancement', wordRe('enhancements?|features?')],
|
|
88
|
+
['documentation', wordRe('docs?|documentation')],
|
|
89
|
+
];
|
|
90
|
+
const MAINTAINER_ASSOCIATIONS = new Set(['OWNER', 'MEMBER', 'COLLABORATOR']);
|
|
91
|
+
const OUTSIDER_ASSOCIATIONS = new Set(['NONE', 'FIRST_TIMER', 'FIRST_TIME_CONTRIBUTOR', 'MANNEQUIN']);
|
|
92
|
+
/** Issue-author bucket from the raw association recorded at pick time. */
|
|
93
|
+
function authorRole(pick) {
|
|
94
|
+
if (pick.issueAuthorIsBot)
|
|
95
|
+
return 'bot';
|
|
96
|
+
const a = pick.issueAuthorAssociation;
|
|
97
|
+
if (a === undefined)
|
|
98
|
+
return NOT_RECORDED;
|
|
99
|
+
if (MAINTAINER_ASSOCIATIONS.has(a))
|
|
100
|
+
return 'maintainer';
|
|
101
|
+
if (a === 'CONTRIBUTOR')
|
|
102
|
+
return 'contributor';
|
|
103
|
+
return OUTSIDER_ASSOCIATIONS.has(a) ? 'outsider' : 'unknown';
|
|
104
|
+
}
|
|
105
|
+
const NO_LABEL_GROUP = 'none of these';
|
|
106
|
+
const NOT_RECORDED = 'not recorded';
|
|
107
|
+
function labelGroups(labels) {
|
|
108
|
+
const lower = labels.map((l) => l.toLowerCase());
|
|
109
|
+
const groups = LABEL_GROUPS.filter(([, re]) => lower.some((l) => re.test(l))).map(([g]) => g);
|
|
110
|
+
return groups.length > 0 ? groups : [NO_LABEL_GROUP];
|
|
111
|
+
}
|
|
79
112
|
function collectRows(state) {
|
|
80
113
|
const starsOf = (repo) => state.repoScores[repo]?.stargazersCount;
|
|
81
|
-
|
|
114
|
+
// Merge times per repo, so a PR is first-in-repo when no merge in the same
|
|
115
|
+
// repo precedes its opening. Works for entries recorded before picks existed.
|
|
116
|
+
// ponytail: only sees merges the ledger holds; older merges count as none.
|
|
117
|
+
const mergeTimes = new Map();
|
|
118
|
+
const mergedLedger = state.mergedPRs ?? [];
|
|
119
|
+
for (const e of mergedLedger) {
|
|
120
|
+
const repo = repoOf(e.url).toLowerCase();
|
|
121
|
+
mergeTimes.set(repo, [...(mergeTimes.get(repo) ?? []), Date.parse(e.mergedAt)]);
|
|
122
|
+
}
|
|
123
|
+
const isFirstAt = (repo, at) => (mergeTimes.get(repo.toLowerCase()) ?? []).every((t) => t >= at);
|
|
124
|
+
const common = (e, at) => {
|
|
82
125
|
const repo = repoOf(e.url);
|
|
83
126
|
return {
|
|
84
127
|
url: e.url,
|
|
85
128
|
repo,
|
|
129
|
+
firstInRepo: e.pick?.firstInRepo ?? isFirstAt(repo, Date.parse(e.openedAt ?? at)),
|
|
130
|
+
pick: e.pick,
|
|
86
131
|
grade: e.pick?.grade,
|
|
87
132
|
gradeSource: e.pick ? (e.pick.source === 'list' ? 'list' : 'vet') : undefined,
|
|
88
133
|
stars: e.pick?.stargazersCount ?? starsOf(repo),
|
|
@@ -92,13 +137,13 @@ function collectRows(state) {
|
|
|
92
137
|
};
|
|
93
138
|
};
|
|
94
139
|
const merged = (state.mergedPRs ?? []).map((e) => ({
|
|
95
|
-
...common(e),
|
|
140
|
+
...common(e, e.mergedAt),
|
|
96
141
|
outcome: 'merged',
|
|
97
142
|
month: e.mergedAt.slice(0, 7),
|
|
98
143
|
hoursToMerge: hoursBetween(e.openedAt, e.mergedAt),
|
|
99
144
|
}));
|
|
100
145
|
const closed = (state.closedPRs ?? []).map((e) => ({
|
|
101
|
-
...common(e),
|
|
146
|
+
...common(e, e.closedAt),
|
|
102
147
|
outcome: 'closed',
|
|
103
148
|
month: e.closedAt.slice(0, 7),
|
|
104
149
|
closeReason: e.closeReason,
|
|
@@ -106,7 +151,13 @@ function collectRows(state) {
|
|
|
106
151
|
}));
|
|
107
152
|
const dormant = (state.lastDigest?.openPRs ?? [])
|
|
108
153
|
.filter((pr) => pr.stalenessTier === 'dormant')
|
|
109
|
-
.map((pr) => ({
|
|
154
|
+
.map((pr) => ({
|
|
155
|
+
url: pr.url,
|
|
156
|
+
repo: pr.repo,
|
|
157
|
+
outcome: 'dormant',
|
|
158
|
+
stars: starsOf(pr.repo),
|
|
159
|
+
firstInRepo: isFirstAt(pr.repo, Date.parse(pr.createdAt)),
|
|
160
|
+
}));
|
|
110
161
|
return [...merged, ...closed, ...dormant];
|
|
111
162
|
}
|
|
112
163
|
const pct = (v) => (v === null ? 'n/a' : `${Math.round(v * 100)}%`);
|
|
@@ -130,6 +181,7 @@ export function computeEvalReport(state, now = new Date()) {
|
|
|
130
181
|
approachClosuresByMonth[r.month] = (approachClosuresByMonth[r.month] ?? 0) + 1;
|
|
131
182
|
}
|
|
132
183
|
}
|
|
184
|
+
const picked = rows.filter((r) => r.pick);
|
|
133
185
|
const reviewed = rows.filter((r) => r.changesRequested !== undefined);
|
|
134
186
|
const ciKnown = rows.filter((r) => r.ciFailing !== undefined);
|
|
135
187
|
const byGrade = groupBy(rows, (r) => (r.gradeSource ? `${r.gradeSource} ${gradeRange(r.grade)}` : 'no prediction'), [
|
|
@@ -160,6 +212,27 @@ export function computeEvalReport(state, now = new Date()) {
|
|
|
160
212
|
byGrade,
|
|
161
213
|
byStars: groupBy(rows, (r) => starRange(r.stars), ['10k+', '1k-10k', '100-1k', '<100', 'unknown']),
|
|
162
214
|
byMonth: groupBy(rows.filter((r) => r.month), (r) => r.month).sort((a, b) => b.key.localeCompare(a.key)),
|
|
215
|
+
byFirstInRepo: groupBy(rows, (r) => (r.firstInRepo ? 'first in repo' : 'returning'), [
|
|
216
|
+
'first in repo',
|
|
217
|
+
'returning',
|
|
218
|
+
]),
|
|
219
|
+
byIssueAuthorRole: groupBy(picked, (r) => authorRole(r.pick), [
|
|
220
|
+
'maintainer',
|
|
221
|
+
'contributor',
|
|
222
|
+
'outsider',
|
|
223
|
+
'bot',
|
|
224
|
+
'unknown',
|
|
225
|
+
NOT_RECORDED,
|
|
226
|
+
]),
|
|
227
|
+
byCompetingPRs: groupBy(picked, (r) => {
|
|
228
|
+
const n = r.pick.competingPRs;
|
|
229
|
+
if (n === undefined)
|
|
230
|
+
return NOT_RECORDED;
|
|
231
|
+
return n === 0 ? '0' : '1+';
|
|
232
|
+
}, ['0', '1+', NOT_RECORDED]),
|
|
233
|
+
byLabel: [...LABEL_GROUPS.map(([g]) => g), NO_LABEL_GROUP]
|
|
234
|
+
.map((g) => bucket(g, picked.filter((r) => r.pick.labels && labelGroups(r.pick.labels).includes(g))))
|
|
235
|
+
.filter((b) => b.n > 0),
|
|
163
236
|
closeReasons,
|
|
164
237
|
quality: {
|
|
165
238
|
withReviewState: reviewed.length,
|
|
@@ -197,6 +270,10 @@ export function formatEvalMarkdown(r) {
|
|
|
197
270
|
...table('By grade at pick time', r.byGrade),
|
|
198
271
|
...table('By repo stars', r.byStars),
|
|
199
272
|
...table('By month', r.byMonth.slice(0, 12)),
|
|
273
|
+
...table('First PR in repo vs returning', r.byFirstInRepo),
|
|
274
|
+
...table('By issue author (picks)', r.byIssueAuthorRole),
|
|
275
|
+
...table('By competing PRs at pick time (picks)', r.byCompetingPRs),
|
|
276
|
+
...table('By issue label (picks; one pick can match several)', r.byLabel),
|
|
200
277
|
'## Close reasons',
|
|
201
278
|
'',
|
|
202
279
|
...Object.entries(r.closeReasons)
|
package/dist/core/index.d.ts
CHANGED
|
@@ -19,16 +19,16 @@ export { DEFAULT_CONCURRENCY } from './concurrency.js';
|
|
|
19
19
|
export { OssAutopilotError, ConfigurationError, ValidationError, GistPermissionError, ConcurrencyError, GistConcurrencyError, GistFileSizeError, GIST_FILE_SIZE_REMEDY, errorMessage, getHttpStatusCode, isRateLimitError, isRateLimitOrAuthError, nonFatalCatch, resolveErrorCode, } from './errors.js';
|
|
20
20
|
export { enableDebug, isDebugEnabled, debug, info, warn, timed } from './logger.js';
|
|
21
21
|
export { HttpCache, getHttpCache, cachedRequest, type CacheEntry } from './http-cache.js';
|
|
22
|
-
export { CRITICAL_STATUSES, applyStatusOverrides, computeRepoSignals, groupPRsByRepo, assessCapacity, collectActionableIssues, computeActionMenu, toShelvedPRRef, buildStarFilter, firstMaintainerResponseFromDigest, lastReviewStateFromDigest, formatActionHint, formatBriefSummary, formatSummary, printDigest, } from './daily-logic.js';
|
|
22
|
+
export { CRITICAL_STATUSES, applyStatusOverrides, computeRepoSignals, computeLedgerRepoSignals, groupPRsByRepo, assessCapacity, collectActionableIssues, computeActionMenu, toShelvedPRRef, buildStarFilter, firstMaintainerResponseFromDigest, lastReviewStateFromDigest, formatActionHint, formatBriefSummary, formatSummary, printDigest, } from './daily-logic.js';
|
|
23
23
|
export { computeContributionStats, type ContributionStats, type ComputeStatsInput } from './stats.js';
|
|
24
24
|
export { fetchPRTemplate, type PRTemplateResult } from './pr-template.js';
|
|
25
25
|
export { classifyLinkedPR, isLinkedPRStalled, STALLED_PR_THRESHOLD_DAYS, type LinkedPR, type LinkedPRClassification, type LinkedPRState, } from './linked-pr-classification.js';
|
|
26
|
-
export { classifyIssueAvailability, fetchIssueVerification, verifyIssuesBatch, MAX_VERIFY_CONCURRENCY, type BatchVerificationResult, type IssueAvailabilityVerdict, type IssueVerification, type LinkedPRLinkType, type VerifiedLinkedPR, type VerifyIssueParams, } from './issue-verification.js';
|
|
27
|
-
export { classifyAttentionBucket, summarizeAttentionBuckets, STUCK_CI_THRESHOLD_DAYS, DORMANT_FOLLOWUP_THRESHOLD_DAYS, type AttentionBucket, type AttentionInput, type AttentionSummary, } from './pr-attention.js';
|
|
26
|
+
export { classifyIssueAvailability, fetchIssueVerification, verifyIssuesBatch, MAX_VERIFY_CONCURRENCY, RULED_OUT_VERDICTS, type BatchVerificationResult, type IssueAvailabilityVerdict, type IssueVerification, type LinkedPRLinkType, type VerifiedLinkedPR, type VerifyIssueParams, } from './issue-verification.js';
|
|
27
|
+
export { classifyAttentionBucket, summarizeAttentionBuckets, shouldSuggestClose, STUCK_CI_THRESHOLD_DAYS, DORMANT_FOLLOWUP_THRESHOLD_DAYS, type AttentionBucket, type AttentionInput, type AttentionSummary, } from './pr-attention.js';
|
|
28
28
|
export { scanForAntiLLMPolicy, type AntiLLMCategory, type AntiLLMMatch, type AntiLLMScanResult, } from './anti-llm-policy.js';
|
|
29
29
|
export { detectFormatters, diagnoseCIFormatterFailure, getPreferredFormatter, type DetectedFormatter, type FormatterDetectionResult, type CIFormatterDiagnosis, type FormatterName, } from './formatter-detection.js';
|
|
30
30
|
export { CONFIG_KEY_REGISTRY, type ConfigKeyDef, type SettableVia, isKnownKey, getKeyDef, getSetupKeys, getConfigKeys, suggestKey, formatUnknownKeyError, } from './config-registry.js';
|
|
31
31
|
export { DashboardDataSchema, DashboardStatsSchema, validateDashboardData, type DashboardDataParsed, } from './dashboard-data-schema.js';
|
|
32
32
|
export { fetchPRCommentBundle, fetchPRCommentBundlesBatch, type PRCommentBundle, type PRReviewEntry, type PRReviewCommentEntry, type PRIssueCommentEntry, } from './pr-comments-fetcher.js';
|
|
33
33
|
export * from './types.js';
|
|
34
|
-
export { pickSnapshotFromVet, persistPickSnapshots } from './pick-snapshot.js';
|
|
34
|
+
export { pickSnapshotFromVet, persistPickSnapshots, traitsFromVerification, isFirstInRepo } from './pick-snapshot.js';
|
package/dist/core/index.js
CHANGED
|
@@ -20,12 +20,12 @@ export { DEFAULT_CONCURRENCY } from './concurrency.js';
|
|
|
20
20
|
export { OssAutopilotError, ConfigurationError, ValidationError, GistPermissionError, ConcurrencyError, GistConcurrencyError, GistFileSizeError, GIST_FILE_SIZE_REMEDY, errorMessage, getHttpStatusCode, isRateLimitError, isRateLimitOrAuthError, nonFatalCatch, resolveErrorCode, } from './errors.js';
|
|
21
21
|
export { enableDebug, isDebugEnabled, debug, info, warn, timed } from './logger.js';
|
|
22
22
|
export { HttpCache, getHttpCache, cachedRequest } from './http-cache.js';
|
|
23
|
-
export { CRITICAL_STATUSES, applyStatusOverrides, computeRepoSignals, groupPRsByRepo, assessCapacity, collectActionableIssues, computeActionMenu, toShelvedPRRef, buildStarFilter, firstMaintainerResponseFromDigest, lastReviewStateFromDigest, formatActionHint, formatBriefSummary, formatSummary, printDigest, } from './daily-logic.js';
|
|
23
|
+
export { CRITICAL_STATUSES, applyStatusOverrides, computeRepoSignals, computeLedgerRepoSignals, groupPRsByRepo, assessCapacity, collectActionableIssues, computeActionMenu, toShelvedPRRef, buildStarFilter, firstMaintainerResponseFromDigest, lastReviewStateFromDigest, formatActionHint, formatBriefSummary, formatSummary, printDigest, } from './daily-logic.js';
|
|
24
24
|
export { computeContributionStats } from './stats.js';
|
|
25
25
|
export { fetchPRTemplate } from './pr-template.js';
|
|
26
26
|
export { classifyLinkedPR, isLinkedPRStalled, STALLED_PR_THRESHOLD_DAYS, } from './linked-pr-classification.js';
|
|
27
|
-
export { classifyIssueAvailability, fetchIssueVerification, verifyIssuesBatch, MAX_VERIFY_CONCURRENCY, } from './issue-verification.js';
|
|
28
|
-
export { classifyAttentionBucket, summarizeAttentionBuckets, STUCK_CI_THRESHOLD_DAYS, DORMANT_FOLLOWUP_THRESHOLD_DAYS, } from './pr-attention.js';
|
|
27
|
+
export { classifyIssueAvailability, fetchIssueVerification, verifyIssuesBatch, MAX_VERIFY_CONCURRENCY, RULED_OUT_VERDICTS, } from './issue-verification.js';
|
|
28
|
+
export { classifyAttentionBucket, summarizeAttentionBuckets, shouldSuggestClose, STUCK_CI_THRESHOLD_DAYS, DORMANT_FOLLOWUP_THRESHOLD_DAYS, } from './pr-attention.js';
|
|
29
29
|
export { scanForAntiLLMPolicy, } from './anti-llm-policy.js';
|
|
30
30
|
export { detectFormatters, diagnoseCIFormatterFailure, getPreferredFormatter, } from './formatter-detection.js';
|
|
31
31
|
export { CONFIG_KEY_REGISTRY, isKnownKey, getKeyDef, getSetupKeys, getConfigKeys, suggestKey, formatUnknownKeyError, } from './config-registry.js';
|
|
@@ -35,4 +35,4 @@ export { DashboardDataSchema, DashboardStatsSchema, validateDashboardData, } fro
|
|
|
35
35
|
// silently drift (#1208 M5).
|
|
36
36
|
export { fetchPRCommentBundle, fetchPRCommentBundlesBatch, } from './pr-comments-fetcher.js';
|
|
37
37
|
export * from './types.js';
|
|
38
|
-
export { pickSnapshotFromVet, persistPickSnapshots } from './pick-snapshot.js';
|
|
38
|
+
export { pickSnapshotFromVet, persistPickSnapshots, traitsFromVerification, isFirstInRepo } from './pick-snapshot.js';
|
|
@@ -46,6 +46,11 @@ export interface VerifiedLinkedPR {
|
|
|
46
46
|
* - `available` — open, unassigned, no claiming PRs.
|
|
47
47
|
*/
|
|
48
48
|
export type IssueAvailabilityVerdict = 'closed' | 'own-open-pr' | 'taken' | 'at-risk' | 'available';
|
|
49
|
+
/**
|
|
50
|
+
* Verdicts that conclusively rule an issue out as a new opportunity: nothing
|
|
51
|
+
* to grade, and no pick to record. Shared by `vet` and `vet-list`.
|
|
52
|
+
*/
|
|
53
|
+
export declare const RULED_OUT_VERDICTS: ReadonlySet<IssueAvailabilityVerdict>;
|
|
49
54
|
export interface IssueVerification {
|
|
50
55
|
url: string;
|
|
51
56
|
owner: string;
|
|
@@ -61,6 +66,13 @@ export interface IssueVerification {
|
|
|
61
66
|
stateReason: 'completed' | 'not_planned' | 'reopened' | 'duplicate' | null;
|
|
62
67
|
closedAt: string | null;
|
|
63
68
|
assignees: string[];
|
|
69
|
+
/** Issue author login; null for ghost (deleted) accounts. */
|
|
70
|
+
author: string | null;
|
|
71
|
+
/** GitHub CommentAuthorAssociation of the issue author (OWNER, MEMBER, NONE, ...). */
|
|
72
|
+
authorAssociation: string | null;
|
|
73
|
+
/** The issue was opened by a GitHub App / bot account. */
|
|
74
|
+
authorIsBot: boolean;
|
|
75
|
+
commentCount: number | null;
|
|
64
76
|
linkedPRs: VerifiedLinkedPR[];
|
|
65
77
|
verdict: IssueAvailabilityVerdict;
|
|
66
78
|
verdictReason: string;
|
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
* "Taken" verdict.
|
|
17
17
|
*/
|
|
18
18
|
import { ValidationError } from './errors.js';
|
|
19
|
+
/**
|
|
20
|
+
* Verdicts that conclusively rule an issue out as a new opportunity: nothing
|
|
21
|
+
* to grade, and no pick to record. Shared by `vet` and `vet-list`.
|
|
22
|
+
*/
|
|
23
|
+
export const RULED_OUT_VERDICTS = new Set(['closed', 'taken', 'own-open-pr']);
|
|
19
24
|
function isSameLogin(a, b) {
|
|
20
25
|
return a !== null && a !== '' && b !== '' && a.toLowerCase() === b.toLowerCase();
|
|
21
26
|
}
|
|
@@ -92,6 +97,14 @@ const VERIFY_ISSUE_QUERY = /* GraphQL */ `
|
|
|
92
97
|
state
|
|
93
98
|
stateReason
|
|
94
99
|
closedAt
|
|
100
|
+
authorAssociation
|
|
101
|
+
author {
|
|
102
|
+
__typename
|
|
103
|
+
login
|
|
104
|
+
}
|
|
105
|
+
comments {
|
|
106
|
+
totalCount
|
|
107
|
+
}
|
|
95
108
|
assignees(first: 10) {
|
|
96
109
|
nodes {
|
|
97
110
|
login
|
|
@@ -245,6 +258,7 @@ export async function fetchIssueVerification(octokit, params) {
|
|
|
245
258
|
const state = issue.state.toLowerCase();
|
|
246
259
|
const stateReason = (issue.stateReason?.toLowerCase() ?? null);
|
|
247
260
|
const assignees = issue.assignees.nodes.flatMap((n) => (n ? [n.login] : []));
|
|
261
|
+
const issueAuthor = issue.author?.login ?? null;
|
|
248
262
|
const { verdict, verdictReason } = classifyIssueAvailability({
|
|
249
263
|
state,
|
|
250
264
|
stateReason,
|
|
@@ -262,6 +276,10 @@ export async function fetchIssueVerification(octokit, params) {
|
|
|
262
276
|
stateReason,
|
|
263
277
|
closedAt: issue.closedAt,
|
|
264
278
|
assignees,
|
|
279
|
+
author: issueAuthor,
|
|
280
|
+
authorAssociation: issue.authorAssociation ?? null,
|
|
281
|
+
authorIsBot: issue.author?.__typename === 'Bot' || (issueAuthor?.endsWith('[bot]') ?? false),
|
|
282
|
+
commentCount: issue.comments?.totalCount ?? null,
|
|
265
283
|
linkedPRs,
|
|
266
284
|
verdict,
|
|
267
285
|
verdictReason,
|
|
@@ -4,14 +4,31 @@
|
|
|
4
4
|
* the PR that closed the issue actually ended.
|
|
5
5
|
*/
|
|
6
6
|
import type { VetOutput } from '../formatters/json.js';
|
|
7
|
+
import type { IssueVerification } from './issue-verification.js';
|
|
7
8
|
import { type StateManager } from './state.js';
|
|
8
|
-
import type { PickSnapshot } from './types.js';
|
|
9
|
+
import type { PickSnapshot, RepoScore, StoredMergedPR } from './types.js';
|
|
9
10
|
/**
|
|
10
11
|
* The prediction to keep for a vetted issue, or undefined when the user's own
|
|
11
12
|
* PR is already linked: scout then grades the issue as taken, which is a
|
|
12
13
|
* post-hoc verdict, not the prediction that picked it.
|
|
13
14
|
*/
|
|
14
|
-
export declare function pickSnapshotFromVet(vet: VetOutput, source: PickSnapshot['source']): PickSnapshot | undefined;
|
|
15
|
+
export declare function pickSnapshotFromVet(vet: VetOutput, source: PickSnapshot['source'], traits?: PickTraits): PickSnapshot | undefined;
|
|
16
|
+
/** Vet-time facts the vet output itself does not carry. All optional: each is best-effort. */
|
|
17
|
+
export interface PickTraits {
|
|
18
|
+
/** GitHub author association of the issue author, raw (OWNER, NONE, ...). */
|
|
19
|
+
issueAuthorAssociation?: string;
|
|
20
|
+
issueAuthorIsBot?: boolean;
|
|
21
|
+
commentCount?: number;
|
|
22
|
+
/** Open, non-draft closing PRs by others, when the caller has a verification. */
|
|
23
|
+
competingPRs?: number;
|
|
24
|
+
/** Open PRs by others that only cross-reference the issue. */
|
|
25
|
+
mentioningPRs?: number;
|
|
26
|
+
firstInRepo?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/** The pick traits a verification already carries, so a pick costs no extra API call. */
|
|
29
|
+
export declare function traitsFromVerification(v: IssueVerification): PickTraits;
|
|
30
|
+
/** True when neither the repo score nor the merged ledger shows a merged PR by the user in `repo`. */
|
|
31
|
+
export declare function isFirstInRepo(repo: string, repoScore: Pick<RepoScore, 'mergedPRCount'> | undefined, mergedPRs: ReadonlyArray<Pick<StoredMergedPR, 'url'>> | undefined): boolean;
|
|
15
32
|
/**
|
|
16
33
|
* Persist predictions without ever failing the vet that produced them. `vet`
|
|
17
34
|
* used to be read-only, so a state save here can race another writer; that
|
|
@@ -15,10 +15,15 @@ const MODULE = 'pick-snapshot';
|
|
|
15
15
|
// ponytail: scout reports only the first linked PR, so a standalone `vet` of an
|
|
16
16
|
// issue whose first reference is someone else's PR can still miss the user's
|
|
17
17
|
// own. First-wins in recordPickSnapshots limits this to never-vetted issues.
|
|
18
|
-
export function pickSnapshotFromVet(vet, source) {
|
|
18
|
+
export function pickSnapshotFromVet(vet, source, traits = {}) {
|
|
19
19
|
if (vet.linkedPRClassification?.startsWith('user_'))
|
|
20
20
|
return undefined;
|
|
21
21
|
const stars = vet.projectHealth?.stargazersCount;
|
|
22
|
+
// ponytail: when verification failed, scout's first linked PR gives a 0/1
|
|
23
|
+
// lower bound; callers pass the verified count otherwise.
|
|
24
|
+
const fromScout = vet.linkedPRClassification && Number(vet.linkedPRClassification === 'other_open');
|
|
25
|
+
const { competingPRs = fromScout, ...rest } = traits;
|
|
26
|
+
const recorded = Object.entries({ ...rest, competingPRs }).filter(([, value]) => value !== undefined);
|
|
22
27
|
return {
|
|
23
28
|
issueUrl: vet.issue.url,
|
|
24
29
|
grade: vet.grade.score,
|
|
@@ -27,8 +32,29 @@ export function pickSnapshotFromVet(vet, source) {
|
|
|
27
32
|
...(typeof stars === 'number' && { stargazersCount: stars }),
|
|
28
33
|
source,
|
|
29
34
|
capturedAt: new Date().toISOString(),
|
|
35
|
+
labels: vet.issue.labels,
|
|
36
|
+
...Object.fromEntries(recorded),
|
|
30
37
|
};
|
|
31
38
|
}
|
|
39
|
+
/** The pick traits a verification already carries, so a pick costs no extra API call. */
|
|
40
|
+
export function traitsFromVerification(v) {
|
|
41
|
+
const open = v.linkedPRs.filter((pr) => pr.state === 'open' && !pr.isOwn);
|
|
42
|
+
return {
|
|
43
|
+
...(v.authorAssociation !== null && { issueAuthorAssociation: v.authorAssociation }),
|
|
44
|
+
issueAuthorIsBot: v.authorIsBot,
|
|
45
|
+
...(v.commentCount !== null && { commentCount: v.commentCount }),
|
|
46
|
+
// Only a closing PR is a claim; a cross-reference is a mention (see issue-verification).
|
|
47
|
+
competingPRs: open.filter((pr) => pr.linkType === 'closing' && !pr.isDraft).length,
|
|
48
|
+
mentioningPRs: open.filter((pr) => pr.linkType === 'cross-referenced').length,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/** True when neither the repo score nor the merged ledger shows a merged PR by the user in `repo`. */
|
|
52
|
+
export function isFirstInRepo(repo, repoScore, mergedPRs) {
|
|
53
|
+
if ((repoScore?.mergedPRCount ?? 0) > 0)
|
|
54
|
+
return false;
|
|
55
|
+
const prefix = `https://github.com/${repo}/`.toLowerCase();
|
|
56
|
+
return (mergedPRs ?? []).every((pr) => !pr.url.toLowerCase().startsWith(prefix));
|
|
57
|
+
}
|
|
32
58
|
/**
|
|
33
59
|
* Persist predictions without ever failing the vet that produced them. `vet`
|
|
34
60
|
* used to be read-only, so a state save here can race another writer; that
|
|
@@ -10,12 +10,14 @@
|
|
|
10
10
|
* regardless of the transport used to fetch the data.
|
|
11
11
|
*/
|
|
12
12
|
import { FetchedPR, CIStatusResult } from './types.js';
|
|
13
|
-
import { type ReviewComment } from './review-analysis.js';
|
|
13
|
+
import { type ReviewComment, type ActivityEvent } from './review-analysis.js';
|
|
14
14
|
/** Issue comment in the shape `checkUnrespondedComments`/`getFirstMaintainerResponseAt` read. */
|
|
15
15
|
export interface AssemblyComment {
|
|
16
16
|
user?: {
|
|
17
17
|
login?: string;
|
|
18
|
+
type?: string | null;
|
|
18
19
|
} | null;
|
|
20
|
+
author_association?: string | null;
|
|
19
21
|
body?: string | null;
|
|
20
22
|
created_at: string;
|
|
21
23
|
}
|
|
@@ -23,7 +25,9 @@ export interface AssemblyComment {
|
|
|
23
25
|
export interface AssemblyReview {
|
|
24
26
|
user?: {
|
|
25
27
|
login?: string;
|
|
28
|
+
type?: string | null;
|
|
26
29
|
} | null;
|
|
30
|
+
author_association?: string | null;
|
|
27
31
|
body?: string | null;
|
|
28
32
|
submitted_at?: string | null;
|
|
29
33
|
state?: string | null;
|
|
@@ -51,6 +55,12 @@ export interface PRSignals {
|
|
|
51
55
|
comments: AssemblyComment[];
|
|
52
56
|
reviews: AssemblyReview[];
|
|
53
57
|
reviewComments: ReviewComment[];
|
|
58
|
+
/**
|
|
59
|
+
* Non-comment activity that can mark maintainer engagement: commits (by
|
|
60
|
+
* author and committer), force-pushes, review requests, labels. Optional;
|
|
61
|
+
* absent means comments/reviews alone drive the dormancy clock.
|
|
62
|
+
*/
|
|
63
|
+
activityEvents?: ActivityEvent[];
|
|
54
64
|
ciStatus: CIStatusResult;
|
|
55
65
|
}
|
|
56
66
|
/** Config subset the assembly needs — the fields `determineStatus` and comment analysis consume. */
|
package/dist/core/pr-assembly.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { daysBetween } from './dates.js';
|
|
13
13
|
import { determineStatus } from './status-determination.js';
|
|
14
|
-
import { determineReviewDecision, getLatestChangesRequestedDate, checkUnrespondedComments, getFirstMaintainerResponseAt, } from './review-analysis.js';
|
|
14
|
+
import { determineReviewDecision, getLatestChangesRequestedDate, checkUnrespondedComments, getFirstMaintainerResponseAt, getLastMaintainerActivity, } from './review-analysis.js';
|
|
15
15
|
import { analyzeChecklist } from './checklist-analysis.js';
|
|
16
16
|
import { extractMaintainerActionHints } from './maintainer-analysis.js';
|
|
17
17
|
import { categorizeCIStatus, classifyFailingChecks } from './ci-analysis.js';
|
|
@@ -53,8 +53,16 @@ export async function assembleFetchedPR(signals, config, commitInfo) {
|
|
|
53
53
|
const { hasIncompleteChecklist, checklistStats } = analyzeChecklist(signals.body || '');
|
|
54
54
|
// Extract maintainer action hints from comments (delegated to maintainer-analysis module)
|
|
55
55
|
const maintainerActionHints = extractMaintainerActionHints(lastMaintainerComment?.body, reviewDecision);
|
|
56
|
-
//
|
|
57
|
-
|
|
56
|
+
// Days since ANY activity (updatedAt). The contributor's own pings and
|
|
57
|
+
// rebases reset this, so it drives follow-up timing and stale-CI demotion,
|
|
58
|
+
// not dormancy.
|
|
59
|
+
const now = new Date();
|
|
60
|
+
const daysSinceActivity = daysBetween(new Date(signals.updatedAt), now);
|
|
61
|
+
// Days since the last non-contributor, non-bot activity (or PR creation).
|
|
62
|
+
// This drives stalenessTier so a PR the maintainers ignore goes dormant
|
|
63
|
+
// even while the contributor keeps pinging it.
|
|
64
|
+
const { lastMaintainerActivityAt, authorPingsSinceMaintainerActivity } = getLastMaintainerActivity(comments, reviews, reviewComments, signals.activityEvents ?? [], config.githubUsername, signals.createdAt);
|
|
65
|
+
const daysSinceMaintainerActivity = daysBetween(new Date(lastMaintainerActivityAt), now);
|
|
58
66
|
// Find the date of the latest changes_requested review (delegated to review-analysis module)
|
|
59
67
|
const latestChangesRequestedDate = getLatestChangesRequestedDate(reviews);
|
|
60
68
|
const { status: ciStatus, failingCheckNames, failingCheckConclusions } = signals.ciStatus;
|
|
@@ -71,6 +79,7 @@ export async function assembleFetchedPR(signals, config, commitInfo) {
|
|
|
71
79
|
hasIncompleteChecklist,
|
|
72
80
|
reviewDecision,
|
|
73
81
|
daysSinceActivity,
|
|
82
|
+
daysSinceMaintainerActivity,
|
|
74
83
|
dormantThreshold: config.dormantThresholdDays,
|
|
75
84
|
approachingThreshold: config.approachingDormantDays,
|
|
76
85
|
latestCommitDate,
|
|
@@ -95,6 +104,9 @@ export async function assembleFetchedPR(signals, config, commitInfo) {
|
|
|
95
104
|
updatedAt: signals.updatedAt,
|
|
96
105
|
firstMaintainerResponseAt,
|
|
97
106
|
daysSinceActivity,
|
|
107
|
+
lastMaintainerActivityAt,
|
|
108
|
+
daysSinceMaintainerActivity,
|
|
109
|
+
authorPingsSinceMaintainerActivity,
|
|
98
110
|
ciStatus,
|
|
99
111
|
failingCheckNames,
|
|
100
112
|
classifiedChecks,
|
|
@@ -113,6 +125,11 @@ export async function assembleFetchedPR(signals, config, commitInfo) {
|
|
|
113
125
|
// Compute display labels (#79) — delegated to display-utils module
|
|
114
126
|
const { displayLabel, displayDescription } = computeDisplayLabel(pr);
|
|
115
127
|
pr.displayLabel = displayLabel;
|
|
116
|
-
|
|
128
|
+
// Incomplete checklist is informational, never needs_addressing on its own
|
|
129
|
+
// (see collectAllActionReasons); keep it visible as a note.
|
|
130
|
+
pr.displayDescription =
|
|
131
|
+
hasIncompleteChecklist && checklistStats
|
|
132
|
+
? `${displayDescription} (note: checklist ${checklistStats.checked}/${checklistStats.total})`
|
|
133
|
+
: displayDescription;
|
|
117
134
|
return pr;
|
|
118
135
|
}
|