@cleocode/core 2026.11.1-canary.9 → 2026.11.1
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/.source-stamp.json +1 -1
- package/dist/build-provenance.json +2 -2
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -1
- package/dist/doctor/db-substrate.js +14 -6
- package/dist/doctor/db-substrate.js.map +1 -1
- package/dist/doctor/migrations.d.ts +16 -0
- package/dist/doctor/migrations.js +85 -1
- package/dist/doctor/migrations.js.map +1 -1
- package/dist/doctor/system-health.d.ts +77 -1
- package/dist/doctor/system-health.js +145 -0
- package/dist/doctor/system-health.js.map +1 -1
- package/dist/errors-to-engine.d.ts +8 -4
- package/dist/errors-to-engine.js +9 -5
- package/dist/errors-to-engine.js.map +1 -1
- package/dist/errors.d.ts +14 -0
- package/dist/errors.js +10 -0
- package/dist/errors.js.map +1 -1
- package/dist/git/work-tree.js +1 -1
- package/dist/git/work-tree.js.map +1 -1
- package/dist/hygiene/census.d.ts +181 -12
- package/dist/hygiene/census.js +564 -86
- package/dist/hygiene/census.js.map +1 -1
- package/dist/hygiene/prune-plan-worker.d.ts +17 -0
- package/dist/hygiene/prune-plan-worker.js +42 -0
- package/dist/hygiene/prune-plan-worker.js.map +1 -0
- package/dist/hygiene/task-status.d.ts +20 -0
- package/dist/hygiene/task-status.js +71 -0
- package/dist/hygiene/task-status.js.map +1 -0
- package/dist/memory/pipeline-manifest-sqlite.d.ts +2 -1
- package/dist/memory/pipeline-manifest-sqlite.js +3 -2
- package/dist/memory/pipeline-manifest-sqlite.js.map +1 -1
- package/dist/orchestrate/agentmbx.d.ts +5 -2
- package/dist/orchestrate/agentmbx.js +7 -4
- package/dist/orchestrate/agentmbx.js.map +1 -1
- package/dist/orchestrate/dispatch-workers.d.ts +10 -3
- package/dist/orchestrate/dispatch-workers.js +26 -14
- package/dist/orchestrate/dispatch-workers.js.map +1 -1
- package/dist/orchestrate/lead.d.ts +3 -0
- package/dist/orchestrate/lead.js +1 -0
- package/dist/orchestrate/lead.js.map +1 -1
- package/dist/orchestrate/orca-execution.d.ts +151 -0
- package/dist/orchestrate/orca-execution.js +571 -0
- package/dist/orchestrate/orca-execution.js.map +1 -0
- package/dist/orchestrate/orca-routing.d.ts +13 -0
- package/dist/orchestrate/orca-routing.js +142 -0
- package/dist/orchestrate/orca-routing.js.map +1 -0
- package/dist/orchestrate/spawn-ops.d.ts +50 -20
- package/dist/orchestrate/spawn-ops.js +332 -86
- package/dist/orchestrate/spawn-ops.js.map +1 -1
- package/dist/orchestrate/worker-records.d.ts +97 -5
- package/dist/orchestrate/worker-records.js +503 -11
- package/dist/orchestrate/worker-records.js.map +1 -1
- package/dist/orchestrate/worker-report.js +1 -0
- package/dist/orchestrate/worker-report.js.map +1 -1
- package/dist/orchestration/index.d.ts +8 -2
- package/dist/orchestration/index.js +70 -17
- package/dist/orchestration/index.js.map +1 -1
- package/dist/orchestration/spawn-prompt.d.ts +9 -2
- package/dist/orchestration/spawn-prompt.js +47 -18
- package/dist/orchestration/spawn-prompt.js.map +1 -1
- package/dist/orchestration/spawn.d.ts +20 -6
- package/dist/orchestration/spawn.js +14 -6
- package/dist/orchestration/spawn.js.map +1 -1
- package/dist/release/ci-evidence.d.ts +55 -2
- package/dist/release/ci-evidence.js +161 -51
- package/dist/release/ci-evidence.js.map +1 -1
- package/dist/resources/admission-ledger.d.ts +6 -0
- package/dist/resources/admission-ledger.js +100 -10
- package/dist/resources/admission-ledger.js.map +1 -1
- package/dist/resources/agent-lease.d.ts +7 -0
- package/dist/resources/agent-lease.js +37 -4
- package/dist/resources/agent-lease.js.map +1 -1
- package/dist/resources/hook-footprint.d.ts +22 -0
- package/dist/resources/hook-footprint.js +49 -2
- package/dist/resources/hook-footprint.js.map +1 -1
- package/dist/resources/run-class.d.ts +9 -1
- package/dist/resources/run-class.js +87 -6
- package/dist/resources/run-class.js.map +1 -1
- package/dist/spawn/adapter-registry.js +5 -0
- package/dist/spawn/adapter-registry.js.map +1 -1
- package/dist/spawn/branch-integration.d.ts +4 -0
- package/dist/spawn/branch-integration.js +10 -1
- package/dist/spawn/branch-integration.js.map +1 -1
- package/dist/store/open-cleo-db.d.ts +17 -0
- package/dist/store/open-cleo-db.js +39 -0
- package/dist/store/open-cleo-db.js.map +1 -1
- package/dist/store/restore-marker.js +4 -0
- package/dist/store/restore-marker.js.map +1 -1
- package/dist/store/sqlite.d.ts +21 -0
- package/dist/store/sqlite.js +33 -0
- package/dist/store/sqlite.js.map +1 -1
- package/dist/store/worktree-build-guard.js +3 -0
- package/dist/store/worktree-build-guard.js.map +1 -1
- package/dist/tasks/add.js +8 -0
- package/dist/tasks/add.js.map +1 -1
- package/dist/tasks/complete.d.ts +7 -3
- package/dist/tasks/complete.js +5 -0
- package/dist/tasks/complete.js.map +1 -1
- package/dist/tasks/engine-wrap.d.ts +3 -1
- package/dist/tasks/engine-wrap.js +6 -18
- package/dist/tasks/engine-wrap.js.map +1 -1
- package/dist/tasks/merge-close.d.ts +5 -3
- package/dist/tasks/merge-close.js +30 -10
- package/dist/tasks/merge-close.js.map +1 -1
- package/dist/tasks/pipeline-stage.d.ts +7 -1
- package/dist/tasks/pipeline-stage.js +44 -0
- package/dist/tasks/pipeline-stage.js.map +1 -1
- package/dist/tasks/update.js +8 -0
- package/dist/tasks/update.js.map +1 -1
- package/dist/upgrade.d.ts +4 -0
- package/dist/upgrade.js +32 -0
- package/dist/upgrade.js.map +1 -1
- package/dist/worktree/in-use-probe.d.ts +19 -0
- package/dist/worktree/in-use-probe.js +87 -0
- package/dist/worktree/in-use-probe.js.map +1 -1
- package/dist/worktree/list.d.ts +6 -6
- package/dist/worktree/list.js +42 -30
- package/dist/worktree/list.js.map +1 -1
- package/dist/worktree/own-project.d.ts +32 -0
- package/dist/worktree/own-project.js +68 -0
- package/dist/worktree/own-project.js.map +1 -0
- package/dist/worktree/prune.d.ts +11 -1
- package/dist/worktree/prune.js +83 -2
- package/dist/worktree/prune.js.map +1 -1
- package/package.json +12 -12
- package/templates/CLEO-INJECTION.md +1 -1
- package/templates/CLEO-REFERENCE.md +2 -2
|
@@ -47,6 +47,14 @@
|
|
|
47
47
|
* merge stands in, whatever the merge's own run concluded and whatever later
|
|
48
48
|
* commits touched. See {@link findGreenCurrentHead}.
|
|
49
49
|
*
|
|
50
|
+
* A fifth (T14434, owner decision D11241, extending D11192): the same
|
|
51
|
+
* current-head run stands in for a SCOPED change too, when the merge commit's
|
|
52
|
+
* red or cancelled run is not the PR's (the T12742, T13453, T13809 and T14049
|
|
53
|
+
* judgements), the PR head's own CI was green, and every hunk the PR added is
|
|
54
|
+
* still there at the stand-in. It runs today's CI definition: the owner
|
|
55
|
+
* accepted that a later change weakening a check also releases the tasks
|
|
56
|
+
* waiting behind it. A failure that is the PR's still refuses.
|
|
57
|
+
*
|
|
50
58
|
* @task T12634
|
|
51
59
|
*/
|
|
52
60
|
import { execFileSync } from 'node:child_process';
|
|
@@ -71,6 +79,15 @@ export const TARGETED_RUN_COVERAGE = 'every affected package that has tests —
|
|
|
71
79
|
export const CI_DESCENDANT_MAX_CANDIDATES = 20;
|
|
72
80
|
/** Latest committer time after the merge commit a stand-in may have (T12742): 7 days. */
|
|
73
81
|
export const CI_DESCENDANT_MAX_AGE_SECONDS = 7 * 24 * 60 * 60;
|
|
82
|
+
/**
|
|
83
|
+
* What a `ci:` refusal says while the current-head stand-in is still open
|
|
84
|
+
* (T14032, T14434): nothing on the merge commit is the PR's to fix, and the
|
|
85
|
+
* task closes once the default branch's head has green CI. The merge sweep
|
|
86
|
+
* reads it to keep waiting instead of refusing.
|
|
87
|
+
*
|
|
88
|
+
* @task T14434
|
|
89
|
+
*/
|
|
90
|
+
export const CURRENT_HEAD_STAND_IN_OPEN = 'a green push run of the required checks on the default branch head will stand in';
|
|
74
91
|
/** Merge-commit verdicts a later green main run may stand in for (T12742). */
|
|
75
92
|
const SUPERSEDED_VERDICTS = new Set(['cancelled', 'skipped']);
|
|
76
93
|
/** Conclusions that never indicate a real failure on the merge commit (T12742). */
|
|
@@ -1280,19 +1297,26 @@ export async function findGreenDescendant(input) {
|
|
|
1280
1297
|
return { ok: false, reason: onHead.reason };
|
|
1281
1298
|
headChecks = onHead.checks;
|
|
1282
1299
|
}
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
reason: `${name}: ${verdict.verdict === 'missing' ? 'no pull_request run' : verdict.verdict} on PR head ${head.slice(0, 12)} — a later main run never stands in for a PR whose own CI was not green`,
|
|
1290
|
-
};
|
|
1291
|
-
}
|
|
1300
|
+
const redHead = head ? notGreenOnPrHead(supersededNames, headChecks, head, pins) : null;
|
|
1301
|
+
if (redHead !== null) {
|
|
1302
|
+
return {
|
|
1303
|
+
ok: false,
|
|
1304
|
+
reason: `${redHead} — a later main run never stands in for a PR whose own CI was not green`,
|
|
1305
|
+
};
|
|
1292
1306
|
}
|
|
1307
|
+
// T14434: from here only the walk can refuse; what was proven above lets the
|
|
1308
|
+
// caller try the current-head stand-in.
|
|
1309
|
+
const cleared = {
|
|
1310
|
+
...(head ? { prHeadSha: head } : {}),
|
|
1311
|
+
headChecks,
|
|
1312
|
+
...(inherited ? { inherited } : {}),
|
|
1313
|
+
...(nonTest ? { nonTest } : {}),
|
|
1314
|
+
...(untested ? { untested } : {}),
|
|
1315
|
+
};
|
|
1316
|
+
const refuse = (reason) => ({ ok: false, reason, cleared });
|
|
1293
1317
|
const candidates = input.listDescendants(merge, input.ref, cwd);
|
|
1294
1318
|
if (candidates === null) {
|
|
1295
|
-
return
|
|
1319
|
+
return refuse(`cannot list commits on ${input.ref} after ${merge.slice(0, 12)}`);
|
|
1296
1320
|
}
|
|
1297
1321
|
const scope = pinnedScope(required, pins);
|
|
1298
1322
|
const ciPaths = ciDefinitionPaths(required, pins);
|
|
@@ -1309,33 +1333,27 @@ export async function findGreenDescendant(input) {
|
|
|
1309
1333
|
for (const [what, paths] of guarded) {
|
|
1310
1334
|
const touching = input.touchingCommits(merge, sha, paths, cwd);
|
|
1311
1335
|
if (touching === null)
|
|
1312
|
-
return
|
|
1336
|
+
return refuse(`cannot read history ${range}`);
|
|
1313
1337
|
const first = touching[0];
|
|
1314
1338
|
if (!first)
|
|
1315
1339
|
continue;
|
|
1316
1340
|
const by = `${first.parents > 1 ? 'merge' : 'commit'} ${first.sha.slice(0, 12)}`;
|
|
1317
1341
|
if (paths !== input.changedPaths) {
|
|
1318
|
-
return {
|
|
1319
|
-
ok: false,
|
|
1320
|
-
reason: `${what} changed on ${input.ref} by ${by} in ${range}, so a later run no longer tests what the PR merged`,
|
|
1321
|
-
};
|
|
1342
|
+
return refuse(`${what} changed on ${input.ref} by ${by} in ${range}, so a later run no longer tests what the PR merged`);
|
|
1322
1343
|
}
|
|
1323
1344
|
// T14119: later edits elsewhere in the PR's files leave its change
|
|
1324
1345
|
// standing; the run still tests it while every hunk it added is there.
|
|
1325
1346
|
const missing = input.missingPrHunk(merge, sha, paths, cwd);
|
|
1326
1347
|
if (missing !== null) {
|
|
1327
|
-
return {
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
'the PR merged. Prove testsPassed on a main HEAD with tool:test-affected, or a ' +
|
|
1332
|
-
`test-run there covering ${TARGETED_RUN_COVERAGE}`,
|
|
1333
|
-
};
|
|
1348
|
+
return refuse(`the PR's change is no longer intact at ${sha.slice(0, 12)}: ${missing} (the PR's files ` +
|
|
1349
|
+
`changed on ${input.ref} from ${by} in ${range}), so a later run no longer tests what ` +
|
|
1350
|
+
'the PR merged. Prove testsPassed on a main HEAD with tool:test-affected, or a ' +
|
|
1351
|
+
`test-run there covering ${TARGETED_RUN_COVERAGE}`);
|
|
1334
1352
|
}
|
|
1335
1353
|
}
|
|
1336
1354
|
const fetched = await input.fetchChecks(sha, cwd);
|
|
1337
1355
|
if (!fetched.ok)
|
|
1338
|
-
return
|
|
1356
|
+
return refuse(fetched.reason);
|
|
1339
1357
|
const failedJob = firstRealFailure(fetched.checks, sha, scope);
|
|
1340
1358
|
if (failedJob && input.fetchJobLog) {
|
|
1341
1359
|
// T13809: a later run red only for the quarantine budget, cancelled with
|
|
@@ -1374,10 +1392,7 @@ export async function findGreenDescendant(input) {
|
|
|
1374
1392
|
}
|
|
1375
1393
|
}
|
|
1376
1394
|
if (failedJob) {
|
|
1377
|
-
return {
|
|
1378
|
-
ok: false,
|
|
1379
|
-
reason: `${failedJob.name}: ${failedJob.conclusion} on later ${input.ref} commit ${sha.slice(0, 12)}`,
|
|
1380
|
-
};
|
|
1395
|
+
return refuse(`${failedJob.name}: ${failedJob.conclusion} on later ${input.ref} commit ${sha.slice(0, 12)}`);
|
|
1381
1396
|
}
|
|
1382
1397
|
const verdict = judgeStandIn(fetched.checks, sha, supersededNames, pins, input.jobs, input.ref);
|
|
1383
1398
|
if ('undecided' in verdict) {
|
|
@@ -1385,7 +1400,7 @@ export async function findGreenDescendant(input) {
|
|
|
1385
1400
|
continue;
|
|
1386
1401
|
}
|
|
1387
1402
|
if (!verdict.ok)
|
|
1388
|
-
return verdict;
|
|
1403
|
+
return refuse(verdict.reason);
|
|
1389
1404
|
return {
|
|
1390
1405
|
ok: true,
|
|
1391
1406
|
sha,
|
|
@@ -1396,13 +1411,25 @@ export async function findGreenDescendant(input) {
|
|
|
1396
1411
|
...(nonTest ? { nonTest } : {}),
|
|
1397
1412
|
...(untested ? { untested } : {}),
|
|
1398
1413
|
...(passedOver.length > 0 ? { passedOver } : {}),
|
|
1414
|
+
cleared,
|
|
1399
1415
|
};
|
|
1400
1416
|
}
|
|
1401
|
-
return {
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1417
|
+
return refuse(`no later ${input.ref} commit (first ${CI_DESCENDANT_MAX_CANDIDATES} within 7 days) has a completed push run of ${supersededNames.join(', ')}` +
|
|
1418
|
+
(lastUndecided ? ` that ran the gates' jobs (first one passed over: ${lastUndecided})` : ''));
|
|
1419
|
+
}
|
|
1420
|
+
/**
|
|
1421
|
+
* The first of `names` whose latest `pull_request` run on the PR head is not
|
|
1422
|
+
* green, described; null when every one is (T12742, T14434).
|
|
1423
|
+
*/
|
|
1424
|
+
function notGreenOnPrHead(names, headChecks, head, pins) {
|
|
1425
|
+
for (const name of names) {
|
|
1426
|
+
const pinned = headChecks.filter((c) => c.name === name && pinMatches(c, pins[name]));
|
|
1427
|
+
const verdict = judgeOnSha(pinned, head, 'pull_request');
|
|
1428
|
+
if (!verdict.ok) {
|
|
1429
|
+
return `${name}: ${verdict.verdict === 'missing' ? 'no pull_request run' : verdict.verdict} on PR head ${head.slice(0, 12)}`;
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
return null;
|
|
1406
1433
|
}
|
|
1407
1434
|
/**
|
|
1408
1435
|
* Judge one later default-branch commit's own `push` runs as a stand-in
|
|
@@ -1486,6 +1513,10 @@ function judgeStandIn(checks, sha, names, pins, jobs, ref) {
|
|
|
1486
1513
|
* runs (and the gates' jobs run, T13846) accepts; a failed or pending one
|
|
1487
1514
|
* refuses; cancelled, skipped or missing runs move to the parent.
|
|
1488
1515
|
*
|
|
1516
|
+
* The same run stands in for a scoped change (T14434, owner decision D11241)
|
|
1517
|
+
* once the caller has shown the merge commit's failure is not the PR's, the PR
|
|
1518
|
+
* head's own CI was green and the PR's hunks are intact at the stand-in.
|
|
1519
|
+
*
|
|
1489
1520
|
* @param input - Required checks, pins, merge commit and injected I/O.
|
|
1490
1521
|
* @returns The stand-in commit, its checks and the head, or the refusal reason.
|
|
1491
1522
|
* @task T14032
|
|
@@ -1495,6 +1526,12 @@ export async function findGreenCurrentHead(input) {
|
|
|
1495
1526
|
const head = input.defaultBranchHead(ref, cwd);
|
|
1496
1527
|
if (!head)
|
|
1497
1528
|
return { ok: false, reason: `cannot read the current head of ${ref}` };
|
|
1529
|
+
if (head === merge) {
|
|
1530
|
+
return {
|
|
1531
|
+
ok: false,
|
|
1532
|
+
reason: `${ref} HEAD ${head.slice(0, 12)} is the merge commit itself, so no later push run exists yet`,
|
|
1533
|
+
};
|
|
1534
|
+
}
|
|
1498
1535
|
let sha = head;
|
|
1499
1536
|
// T14177: the first commit stepped past whose run decided nothing for a
|
|
1500
1537
|
// reason other than CI's change filter skipping the gates' jobs.
|
|
@@ -2031,8 +2068,9 @@ export async function defaultFetchRunAttemptJobs(sha, cwd, event = 'push') {
|
|
|
2031
2068
|
* adds a newer attempt that can go red. Every check judged on the
|
|
2032
2069
|
* descendant is re-fetched and its latest `push` attempt (same app and
|
|
2033
2070
|
* workflow) must still be `success`; each such check's latest
|
|
2034
|
-
* `pull_request` attempt on the recorded PR head must be too
|
|
2035
|
-
* `
|
|
2071
|
+
* `pull_request` attempt on the recorded PR head must be too; for a
|
|
2072
|
+
* `currentHead` atom (T14434) every required check on that head must be.
|
|
2073
|
+
* Atoms without `descendantSha` pass untouched.
|
|
2036
2074
|
*
|
|
2037
2075
|
* @param atom - The recorded `ci:` atom.
|
|
2038
2076
|
* @param cwd - Repository work tree for `gh`.
|
|
@@ -2071,7 +2109,9 @@ export async function recheckCiDescendantAtom(atom, cwd, fetchChecks = defaultFe
|
|
|
2071
2109
|
reason: `cannot re-check ci:${atom.prNumber} on ${sha.slice(0, 12)}: ${fetched.reason}`,
|
|
2072
2110
|
};
|
|
2073
2111
|
}
|
|
2074
|
-
|
|
2112
|
+
// T14434: a current-head atom rests on every required check of the PR
|
|
2113
|
+
// head, not only on those the head run stood in for.
|
|
2114
|
+
for (const c of event === 'pull_request' && atom.currentHead ? atom.checks : stoodIn) {
|
|
2075
2115
|
const verdict = judgeOnSha(fetched.checks.filter((run) => sameSource(run, c)), sha, event);
|
|
2076
2116
|
if (!verdict.ok) {
|
|
2077
2117
|
return {
|
|
@@ -2305,6 +2345,8 @@ export async function resolveCiEvidenceAtom(prNumber, roots, opts = {}) {
|
|
|
2305
2345
|
// or a CI definition. That run proves the DESCENDANT's tree, not the merge's.
|
|
2306
2346
|
let descendant;
|
|
2307
2347
|
let descendantReason;
|
|
2348
|
+
// T14434: set when only the walk refused, so the current-head run may stand in.
|
|
2349
|
+
let cleared;
|
|
2308
2350
|
// T13846: a code task's gates need their jobs to have run, so the stand-in
|
|
2309
2351
|
// must be a later main run where they did — not merely the first one whose
|
|
2310
2352
|
// required checks are green (a scripts-only merge skips the test jobs).
|
|
@@ -2357,10 +2399,12 @@ export async function resolveCiEvidenceAtom(prNumber, roots, opts = {}) {
|
|
|
2357
2399
|
}
|
|
2358
2400
|
else {
|
|
2359
2401
|
descendantReason = `later commit ${found.sha.slice(0, 12)} was green, but re-judging with it still fails: ${rejudged.reasons.join('; ')}`;
|
|
2402
|
+
cleared = found.cleared;
|
|
2360
2403
|
}
|
|
2361
2404
|
}
|
|
2362
2405
|
else {
|
|
2363
2406
|
descendantReason = found.reason;
|
|
2407
|
+
cleared = found.cleared;
|
|
2364
2408
|
}
|
|
2365
2409
|
}
|
|
2366
2410
|
// T14032 (owner decision D11192): a workspace-wide change, which only a full
|
|
@@ -2368,12 +2412,33 @@ export async function resolveCiEvidenceAtom(prNumber, roots, opts = {}) {
|
|
|
2368
2412
|
// check on the default branch's current head, descending from the merge,
|
|
2369
2413
|
// whatever the merge's own run concluded and whatever later commits touched:
|
|
2370
2414
|
// that run tested the merged change as it is now (as the T13673 test-run
|
|
2371
|
-
// stand-in does).
|
|
2415
|
+
// stand-in does).
|
|
2416
|
+
// T14434 (owner decision D11241, extending D11192): the same run stands in
|
|
2417
|
+
// for a scoped change too, when the walk above showed the merge commit's
|
|
2418
|
+
// failure is not the PR's and the PR head's own CI was green (`cleared`),
|
|
2419
|
+
// and every hunk the PR added is still there at the stand-in.
|
|
2372
2420
|
let workspaceWide;
|
|
2421
|
+
let currentHead = false;
|
|
2373
2422
|
let currentHeadReason;
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2423
|
+
// Whether a later green head can still close this: the route applies and only its run is missing.
|
|
2424
|
+
let standInOpen = false;
|
|
2425
|
+
if (!judgedChecks.ok && onDefault.ref !== null) {
|
|
2426
|
+
const wide = docsOnlyDiff
|
|
2427
|
+
? null
|
|
2428
|
+
: await (opts.workspaceWideReason ?? defaultWorkspaceWideReason)(cwd, pr.changedPaths);
|
|
2429
|
+
// D11241 asks that the PR head's own required CI was green: every required
|
|
2430
|
+
// check there, not only those the walk stood in for. A main-only PR has no
|
|
2431
|
+
// PR-head run to consult (T13174), so it never takes the scoped route.
|
|
2432
|
+
const scopedHead = wide === null ? cleared?.prHeadSha : undefined;
|
|
2433
|
+
const scoped = cleared && scopedHead ? { ...cleared, prHeadSha: scopedHead } : undefined;
|
|
2434
|
+
const redHead = scoped
|
|
2435
|
+
? notGreenOnPrHead(required.workflows, scoped.headChecks, scoped.prHeadSha, pins)
|
|
2436
|
+
: null;
|
|
2437
|
+
const scopedLead = `the merge commit's run is not the PR's failure, so a green push run of the required checks on the current ${onDefault.ref} HEAD would stand in (D11241), but `;
|
|
2438
|
+
if (redHead !== null) {
|
|
2439
|
+
currentHeadReason = `${scopedLead}${redHead}: the PR head's own required CI was not green`;
|
|
2440
|
+
}
|
|
2441
|
+
else if (wide !== null || scoped) {
|
|
2377
2442
|
const found = await findGreenCurrentHead({
|
|
2378
2443
|
...(jobSpecs.length > 0 ? { jobs: jobSpecs } : {}),
|
|
2379
2444
|
required: required.workflows,
|
|
@@ -2387,8 +2452,22 @@ export async function resolveCiEvidenceAtom(prNumber, roots, opts = {}) {
|
|
|
2387
2452
|
firstParentOf: opts.firstParentOf ?? defaultFirstParentOf,
|
|
2388
2453
|
isAncestor: opts.isAncestor ?? defaultIsAncestor,
|
|
2389
2454
|
});
|
|
2390
|
-
|
|
2391
|
-
|
|
2455
|
+
// The run that is accepted can sit on a parent of the tip (the tip
|
|
2456
|
+
// differs from it only in documentation, or CI's filter skipped it): the
|
|
2457
|
+
// PR's hunks must be intact at both.
|
|
2458
|
+
let missing = null;
|
|
2459
|
+
for (const at of found.ok && scoped ? new Set([found.sha, found.head]) : []) {
|
|
2460
|
+
const hunk = (opts.missingPrHunk ?? missingPrHunk)(pr.mergeCommitSha, at, pr.changedPaths, cwd);
|
|
2461
|
+
if (hunk !== null) {
|
|
2462
|
+
missing = { at, hunk };
|
|
2463
|
+
break;
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
const withHead = found.ok
|
|
2467
|
+
? [...checks, ...found.checks, ...(scoped?.headChecks ?? [])]
|
|
2468
|
+
: checks;
|
|
2469
|
+
const rejudged = found.ok && missing === null
|
|
2470
|
+
? evaluateMergeCommitChecks(required.workflows, withHead, pr.mergeCommitSha, {
|
|
2392
2471
|
...(treeEqualHead ? { treeEquivalentSha: treeEqualHead } : {}),
|
|
2393
2472
|
pins,
|
|
2394
2473
|
descendantSha: found.sha,
|
|
@@ -2396,21 +2475,51 @@ export async function resolveCiEvidenceAtom(prNumber, roots, opts = {}) {
|
|
|
2396
2475
|
})
|
|
2397
2476
|
: null;
|
|
2398
2477
|
if (found.ok && rejudged?.ok) {
|
|
2399
|
-
checks =
|
|
2478
|
+
checks = withHead;
|
|
2400
2479
|
judgedChecks = rejudged;
|
|
2401
|
-
descendant = {
|
|
2402
|
-
|
|
2480
|
+
descendant = {
|
|
2481
|
+
sha: found.sha,
|
|
2482
|
+
range: found.range,
|
|
2483
|
+
...(scoped?.prHeadSha ? { prHeadSha: scoped.prHeadSha } : {}),
|
|
2484
|
+
...(scoped?.inherited ? { inherited: scoped.inherited } : {}),
|
|
2485
|
+
...(scoped?.nonTest ? { nonTest: scoped.nonTest } : {}),
|
|
2486
|
+
...(scoped?.untested ? { untested: scoped.untested } : {}),
|
|
2487
|
+
};
|
|
2488
|
+
if (wide !== null)
|
|
2489
|
+
workspaceWide = wide;
|
|
2490
|
+
else
|
|
2491
|
+
currentHead = true;
|
|
2403
2492
|
}
|
|
2404
2493
|
else {
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2494
|
+
standInOpen = !found.ok;
|
|
2495
|
+
const why = !found.ok
|
|
2496
|
+
? found.reason
|
|
2497
|
+
: missing !== null
|
|
2498
|
+
? `the PR's change is no longer intact at ${missing.at.slice(0, 12)}: ${missing.hunk}`
|
|
2499
|
+
: `${found.sha.slice(0, 12)} was green, but re-judging with it still fails: ${rejudged && !rejudged.ok ? rejudged.reasons.join('; ') : ''}`;
|
|
2500
|
+
currentHeadReason =
|
|
2501
|
+
(wide !== null
|
|
2502
|
+
? `the change is workspace-wide (${wide}), so a green push run of the required checks on the current ${onDefault.ref} HEAD would stand in (T14032), but `
|
|
2503
|
+
: scopedLead) + why;
|
|
2409
2504
|
}
|
|
2410
2505
|
}
|
|
2411
2506
|
}
|
|
2412
2507
|
if (!judgedChecks.ok) {
|
|
2413
|
-
|
|
2508
|
+
// T14434: a check "not found" beside one that finished red never ran, so
|
|
2509
|
+
// only an unfinished run, or no run at all, is worth waiting for.
|
|
2510
|
+
const waiting = judgedChecks.reasons.some((r) => r.includes('pending')) ||
|
|
2511
|
+
judgedChecks.reasons.every((r) => /pending|not found|missing/.test(r));
|
|
2512
|
+
// T14434: name what still closes the task, never the atom just refused.
|
|
2513
|
+
const targeted = gateLists
|
|
2514
|
+
.map((g) => g.gate === 'testsPassed'
|
|
2515
|
+
? `a test-run covering ${TARGETED_RUN_COVERAGE}, for testsPassed`
|
|
2516
|
+
: "a qa-run of typecheck and lint over the change's roots (or tool:lint;tool:typecheck) for qaPassed")
|
|
2517
|
+
.join(' and ');
|
|
2518
|
+
const next = waiting
|
|
2519
|
+
? ''
|
|
2520
|
+
: standInOpen
|
|
2521
|
+
? ` Next: ${CURRENT_HEAD_STAND_IN_OPEN}; verify again once ${onDefault.ref} HEAD's CI is green.`
|
|
2522
|
+
: ` Next: no later run stands in for it; on ${onDefault.ref} after the merge, record ${targeted}.`;
|
|
2414
2523
|
const merge12 = pr.mergeCommitSha.slice(0, 12);
|
|
2415
2524
|
// T14042: the decisive reason and the next step lead; the detail follows,
|
|
2416
2525
|
// so a truncated refusal still says what to do.
|
|
@@ -2424,7 +2533,7 @@ export async function resolveCiEvidenceAtom(prNumber, roots, opts = {}) {
|
|
|
2424
2533
|
return {
|
|
2425
2534
|
ok: false,
|
|
2426
2535
|
codeName: 'E_EVIDENCE_TESTS_FAILED',
|
|
2427
|
-
reason: `${lead}\n Required checks (source: ${describeRequiredWorkflowsSource(required.source)}):\n - ${judgedChecks.reasons.join('\n - ')}` +
|
|
2536
|
+
reason: `${lead}${next}\n Required checks (source: ${describeRequiredWorkflowsSource(required.source)}):\n - ${judgedChecks.reasons.join('\n - ')}` +
|
|
2428
2537
|
(descendantReason ? `\n No later main run stands in: ${descendantReason}` : '') +
|
|
2429
2538
|
(currentHeadReason ? `\n No current-HEAD run stands in: ${currentHeadReason}` : ''),
|
|
2430
2539
|
};
|
|
@@ -2546,6 +2655,7 @@ export async function resolveCiEvidenceAtom(prNumber, roots, opts = {}) {
|
|
|
2546
2655
|
}
|
|
2547
2656
|
: {}),
|
|
2548
2657
|
...(workspaceWide ? { workspaceWide } : {}),
|
|
2658
|
+
...(currentHead ? { currentHead: true } : {}),
|
|
2549
2659
|
...(mainOnly ? { mainOnly: true } : {}),
|
|
2550
2660
|
...(Object.keys(filterSkipped).length > 0 ? { filterSkippedJobs: filterSkipped } : {}),
|
|
2551
2661
|
requiredSource: required.source.tier,
|