mandrel 2.100.0 → 2.101.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/.agents/agents/story-worker.md +7 -1
- package/.agents/docs/agentrc-reference.json +3 -0
- package/.agents/docs/configuration.md +3 -0
- package/.agents/rules/ci-remediation.md +8 -0
- package/.agents/schemas/agentrc.schema.json +26 -0
- package/.agents/schemas/story-deliver-terminal.schema.json +17 -3
- package/.agents/schemas/validation-evidence.schema.json +10 -0
- package/.agents/scripts/lib/close-lock-events.js +18 -5
- package/.agents/scripts/lib/close-validation/gates.js +6 -1
- package/.agents/scripts/lib/close-validation/runner.js +10 -11
- package/.agents/scripts/lib/close-validation/test-delta.js +124 -0
- package/.agents/scripts/lib/config/pull-request.js +25 -0
- package/.agents/scripts/lib/config-settings-schema-delivery.js +22 -0
- package/.agents/scripts/lib/config-settings-schema.js +5 -0
- package/.agents/scripts/lib/coverage-capture-delta.js +2 -1
- package/.agents/scripts/lib/generated/agentrc-validator.js +2 -2
- package/.agents/scripts/lib/git/sync-from-base.js +4 -2
- package/.agents/scripts/lib/orchestration/ci-red-handling.js +4 -3
- package/.agents/scripts/lib/orchestration/ci-rerun-guard.js +81 -25
- package/.agents/scripts/lib/orchestration/handoff-state.js +41 -0
- package/.agents/scripts/lib/orchestration/review-providers/code-review.js +97 -28
- package/.agents/scripts/lib/orchestration/single-story-close/phases/base-sync.js +7 -0
- package/.agents/scripts/lib/orchestration/single-story-close/phases/close-validation.js +22 -4
- package/.agents/scripts/lib/orchestration/single-story-close/phases/confirm-merge.js +104 -57
- package/.agents/scripts/lib/orchestration/single-story-close/phases/merge-wait-recovery.js +16 -16
- package/.agents/scripts/lib/orchestration/single-story-close/phases/normalize-pr-title.js +28 -13
- package/.agents/scripts/lib/orchestration/single-story-close/phases/open-pr.js +1 -0
- package/.agents/scripts/lib/orchestration/single-story-close/phases/pr-body-trailers.js +38 -0
- package/.agents/scripts/lib/orchestration/single-story-close/phases/pre-push.js +24 -16
- package/.agents/scripts/lib/orchestration/single-story-close/phases/pull-request.js +18 -7
- package/.agents/scripts/lib/orchestration/single-story-close/runner.js +60 -34
- package/.agents/scripts/lib/orchestration/story-deliver-terminal.js +1 -1
- package/.agents/scripts/lib/orchestration/story-handoff.js +36 -9
- package/.agents/scripts/lib/test-run-credit.js +26 -0
- package/.agents/scripts/lib/validation-evidence.js +6 -0
- package/.agents/workflows/helpers/deliver-reference.md +28 -1
- package/docs/CHANGELOG.md +18 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { sourcedTimings } from '../../close-lock-events.js';
|
|
1
2
|
import { buildDefaultGates } from '../../close-validation/gates.js';
|
|
2
3
|
import { runCloseValidation } from '../../close-validation/runner.js';
|
|
3
4
|
import { getCiDelivery } from '../../config/ci.js';
|
|
4
|
-
import { resolveWorktreeEnabled } from '../../config/runtime.js';
|
|
5
5
|
import { resolveConfig } from '../../config-resolver.js';
|
|
6
6
|
import { gh as defaultGh } from '../../gh-exec.js';
|
|
7
7
|
import { getStoryBranch, gitSpawn, gitSync } from '../../git-utils.js';
|
|
@@ -15,6 +15,7 @@ import { createProvider } from '../../provider-factory.js';
|
|
|
15
15
|
import { flipLabelAndNotify } from '../../single-story/story-merged-notify.js';
|
|
16
16
|
import { WorktreeManager } from '../../worktree-manager.js';
|
|
17
17
|
import { runCodeReview as runCodeReviewDefault } from '../code-review.js';
|
|
18
|
+
import { readCreditTimings } from '../handoff-state.js';
|
|
18
19
|
import { resolveOperatorFromCandidates } from '../lease-guard-shared.js';
|
|
19
20
|
import { resolveRunScopedConfig } from '../run-scoped-config.js';
|
|
20
21
|
import {
|
|
@@ -38,10 +39,7 @@ import { parseCloseOptions, resolveWaitForMerge } from './phases/options.js';
|
|
|
38
39
|
import { runPrePushPhases } from './phases/pre-push.js';
|
|
39
40
|
import { pickHeadPullRequest } from './phases/pull-request.js';
|
|
40
41
|
import { reconcileDoneLabel } from './phases/reconcile-done.js';
|
|
41
|
-
import {
|
|
42
|
-
existingWorktreePath,
|
|
43
|
-
resolveStoryWorktree,
|
|
44
|
-
} from './phases/worktree-restore.js';
|
|
42
|
+
import { resolveStoryWorktree } from './phases/worktree-restore.js';
|
|
45
43
|
import {
|
|
46
44
|
alreadyClosedResult,
|
|
47
45
|
closeEnvelopeGates,
|
|
@@ -260,16 +258,28 @@ async function resolveBasePhase(ctx, deps) {
|
|
|
260
258
|
return null;
|
|
261
259
|
}
|
|
262
260
|
|
|
261
|
+
/** First SHA of a `show-ref` / `ls-remote` line; `''` on an empty read. */
|
|
262
|
+
function firstSha(stdout) {
|
|
263
|
+
return String(stdout ?? '')
|
|
264
|
+
.trim()
|
|
265
|
+
.split(/\s+/)[0];
|
|
266
|
+
}
|
|
267
|
+
|
|
263
268
|
/**
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
269
|
+
* Tip SHAs of the surviving story refs (local, then origin). Only
|
|
270
|
+
* `ls-remote`'s "no such ref" (exit 2) proves the remote gone; any other
|
|
271
|
+
* failure yields `''`, which matches no PR head.
|
|
267
272
|
*/
|
|
268
|
-
function
|
|
273
|
+
function survivingStoryHeads(ctx) {
|
|
269
274
|
const cwd = ctx.options.cwd;
|
|
270
|
-
const
|
|
271
|
-
const local = gitSpawn(
|
|
272
|
-
|
|
275
|
+
const heads = [];
|
|
276
|
+
const local = gitSpawn(
|
|
277
|
+
cwd,
|
|
278
|
+
'show-ref',
|
|
279
|
+
'--verify',
|
|
280
|
+
`refs/heads/${ctx.storyBranch}`,
|
|
281
|
+
);
|
|
282
|
+
if (local.status === 0) heads.push(firstSha(local.stdout));
|
|
273
283
|
const remote = gitSpawn(
|
|
274
284
|
cwd,
|
|
275
285
|
'ls-remote',
|
|
@@ -278,28 +288,38 @@ function storyBranchSurvives(ctx) {
|
|
|
278
288
|
'origin',
|
|
279
289
|
ctx.storyBranch,
|
|
280
290
|
);
|
|
281
|
-
|
|
291
|
+
if (remote.status !== 2)
|
|
292
|
+
heads.push(remote.status === 0 ? firstSha(remote.stdout) : '');
|
|
293
|
+
return heads;
|
|
282
294
|
}
|
|
283
295
|
|
|
284
296
|
/**
|
|
285
|
-
* The Story's PR, when it already merged and nothing newer is in flight
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
* Any read failure reads as "not merged"
|
|
297
|
+
* The Story's PR, when it already merged and nothing newer is in flight. A
|
|
298
|
+
* surviving branch is not evidence of unlanded work (the land tail's reap may
|
|
299
|
+
* be pending or failed), but a surviving tip past the merged PR's head is: it
|
|
300
|
+
* takes the normal path. An OPEN PR on the head wins (a re-delivery), as
|
|
301
|
+
* `ensurePullRequestWith` decides. Any read failure reads as "not merged".
|
|
290
302
|
*
|
|
291
|
-
* @returns {Promise<{ prUrl: string, prNumber: number|null }|null>}
|
|
303
|
+
* @returns {Promise<{ prUrl: string, prNumber: number|null, mergedAt: string }|null>}
|
|
292
304
|
*/
|
|
293
305
|
async function findLandedPr(ctx, deps) {
|
|
294
|
-
if (storyBranchSurvives(ctx)) return null;
|
|
295
306
|
try {
|
|
296
307
|
const rows = await (deps.gh ?? defaultGh).pr.list(
|
|
297
308
|
['--head', ctx.storyBranch, '--state', 'all'],
|
|
298
|
-
['url', 'state', 'mergedAt'],
|
|
309
|
+
['url', 'state', 'mergedAt', 'headRefOid'],
|
|
299
310
|
);
|
|
300
311
|
const head = pickHeadPullRequest(rows);
|
|
301
|
-
|
|
302
|
-
|
|
312
|
+
if (head?.state !== 'MERGED') return null;
|
|
313
|
+
const row = rows.find((r) => String(r?.url ?? '').trim() === head.url);
|
|
314
|
+
const landed = survivingStoryHeads(ctx).every(
|
|
315
|
+
(sha) => sha === row.headRefOid,
|
|
316
|
+
);
|
|
317
|
+
return landed
|
|
318
|
+
? {
|
|
319
|
+
prUrl: head.url,
|
|
320
|
+
prNumber: parsePrNumber(head.url),
|
|
321
|
+
mergedAt: row.mergedAt ?? 'an unknown time',
|
|
322
|
+
}
|
|
303
323
|
: null;
|
|
304
324
|
} catch {
|
|
305
325
|
return null;
|
|
@@ -307,22 +327,17 @@ async function findLandedPr(ctx, deps) {
|
|
|
307
327
|
}
|
|
308
328
|
|
|
309
329
|
/**
|
|
310
|
-
* A
|
|
311
|
-
*
|
|
330
|
+
* A head whose PR already merged short-circuits to the confirm before any
|
|
331
|
+
* worktree restore; otherwise a missing worktree is recreated.
|
|
312
332
|
*/
|
|
313
333
|
async function resolveCloseWorktree(ctx, deps) {
|
|
314
|
-
|
|
315
|
-
const wtIsolation = deps.config.delivery?.worktreeIsolation;
|
|
316
|
-
const missing =
|
|
317
|
-
!existingWorktreePath({ cwd, wtIsolation, storyId: ctx.storyId }) &&
|
|
318
|
-
resolveWorktreeEnabled({ config: deps.config });
|
|
319
|
-
ctx.landedPr = missing ? await findLandedPr(ctx, deps) : null;
|
|
334
|
+
ctx.landedPr = await findLandedPr(ctx, deps);
|
|
320
335
|
if (ctx.landedPr) {
|
|
321
336
|
ctx.recordPrNumber(ctx.landedPr.prNumber);
|
|
322
337
|
return null;
|
|
323
338
|
}
|
|
324
339
|
return await resolveStoryWorktree({
|
|
325
|
-
cwd,
|
|
340
|
+
cwd: ctx.options.cwd,
|
|
326
341
|
config: deps.config,
|
|
327
342
|
storyId: ctx.storyId,
|
|
328
343
|
storyBranch: ctx.storyBranch,
|
|
@@ -340,7 +355,7 @@ function unlessLanded(phase, onLanded) {
|
|
|
340
355
|
function landedPrePush(ctx) {
|
|
341
356
|
progress(
|
|
342
357
|
'INIT',
|
|
343
|
-
`⏭ PR ${ctx.landedPr.prUrl} already merged — skipping validation, sync and push.`,
|
|
358
|
+
`⏭ PR ${ctx.landedPr.prUrl} already merged at ${ctx.landedPr.mergedAt} — skipping validation, sync and push.`,
|
|
344
359
|
);
|
|
345
360
|
ctx.options = { ...ctx.options, skipValidation: true, skipSync: true };
|
|
346
361
|
ctx.prePush = {
|
|
@@ -433,7 +448,7 @@ function buildPrContext(ctx, deps) {
|
|
|
433
448
|
phaseTimer: ctx.phaseTimer,
|
|
434
449
|
worker: ctx.worker,
|
|
435
450
|
lockWait: ctx.prePush.lockWait,
|
|
436
|
-
suiteTimings: ctx
|
|
451
|
+
suiteTimings: envelopeSuiteTimings(ctx, deps),
|
|
437
452
|
gates: closeEnvelopeGates(
|
|
438
453
|
options,
|
|
439
454
|
ctx.prePush.validationGates,
|
|
@@ -443,6 +458,17 @@ function buildPrContext(ctx, deps) {
|
|
|
443
458
|
};
|
|
444
459
|
}
|
|
445
460
|
|
|
461
|
+
/**
|
|
462
|
+
* The suite close spawned (`source: 'close'`), else — when its gates ran and
|
|
463
|
+
* honoured the handoff's credit — the credited run's figures.
|
|
464
|
+
*/
|
|
465
|
+
function envelopeSuiteTimings(ctx, deps) {
|
|
466
|
+
const { validationGates, suiteTimings } = ctx.prePush;
|
|
467
|
+
if (suiteTimings || !validationGates) return suiteTimings;
|
|
468
|
+
const credit = readCreditTimings(ctx.storyId, deps.config);
|
|
469
|
+
return credit && sourcedTimings(credit, 'credited-run');
|
|
470
|
+
}
|
|
471
|
+
|
|
446
472
|
function decideWaitForMerge(ctx, deps) {
|
|
447
473
|
const { options, arm } = ctx;
|
|
448
474
|
const decision = resolveWaitForMerge({
|
|
@@ -116,7 +116,7 @@ function compact(obj) {
|
|
|
116
116
|
* @param {object|null} [args.waitBudget]
|
|
117
117
|
* @param {{ waitedSeconds: number, expired: boolean, holder?: object }|null} [args.lockWait]
|
|
118
118
|
* Full-suite lock wait; `waitBudget` is merge-wait only.
|
|
119
|
-
* @param {{ lockWaitMs: number, hostWaitMs: number|null, testRunMs: number }|null} [args.suiteTimings]
|
|
119
|
+
* @param {{ lockWaitMs: number, hostWaitMs: number|null, testRunMs: number, source: 'close'|'credited-run', spawns: object[] }|null} [args.suiteTimings]
|
|
120
120
|
* @param {Record<string, number>|null} [args.phaseDurations] Seconds per phase.
|
|
121
121
|
* @param {string} [args.timestamp]
|
|
122
122
|
* @param {{ schema: object|null, error: string|null }} [args.schemaSource]
|
|
@@ -23,7 +23,10 @@ import path from 'node:path';
|
|
|
23
23
|
import { fileURLToPath } from 'node:url';
|
|
24
24
|
|
|
25
25
|
import { spawnStreamAsync } from '../child-exec.js';
|
|
26
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
createLockEventChannel,
|
|
28
|
+
summarizeLockEvents,
|
|
29
|
+
} from '../close-lock-events.js';
|
|
27
30
|
import {
|
|
28
31
|
resolveGateCommand,
|
|
29
32
|
resolveTestGateArgv,
|
|
@@ -48,6 +51,7 @@ import { describeBlocking } from '../suite-admission.js';
|
|
|
48
51
|
import { writeFileAtomic } from '../util/atomic-write.js';
|
|
49
52
|
import { defaultSleep } from '../util/sleep.js';
|
|
50
53
|
import { runStreamed } from './evidence-stream.js';
|
|
54
|
+
import { handoffStatePath } from './handoff-state.js';
|
|
51
55
|
import { probeHeldReviewDiff } from './review-deposit.js';
|
|
52
56
|
import { createStoryProgress, handoffStepName } from './story-progress.js';
|
|
53
57
|
import {
|
|
@@ -254,11 +258,16 @@ function durations({ waitMs, executionMs }) {
|
|
|
254
258
|
/**
|
|
255
259
|
* Tail a fresh lock-event channel while `run(env)` runs, forwarding each
|
|
256
260
|
* `lock-progress` event once; never the child's output, which can be forged.
|
|
261
|
+
* `timings` summarizes every event drained (the lock wait and suite spawns).
|
|
262
|
+
*
|
|
263
|
+
* @returns {Promise<{ result: any, timings: ReturnType<typeof summarizeLockEvents> }>}
|
|
257
264
|
*/
|
|
258
265
|
async function withLockProgress(ctx, run) {
|
|
259
266
|
const channel = ctx.createLockChannel();
|
|
267
|
+
const events = [];
|
|
260
268
|
const forward = () => {
|
|
261
269
|
for (const event of channel.drain()) {
|
|
270
|
+
events.push(event);
|
|
262
271
|
if (event.kind === 'lock-progress') {
|
|
263
272
|
ctx.progress('LOCK', describeLockProgress(event));
|
|
264
273
|
}
|
|
@@ -272,13 +281,15 @@ async function withLockProgress(ctx, run) {
|
|
|
272
281
|
if (running) forward();
|
|
273
282
|
}
|
|
274
283
|
})().catch(() => {});
|
|
284
|
+
let result;
|
|
275
285
|
try {
|
|
276
|
-
|
|
286
|
+
result = await run({ ...ctx.env, ...channel.env });
|
|
277
287
|
} finally {
|
|
278
288
|
running = false;
|
|
279
289
|
forward();
|
|
280
290
|
channel.dispose();
|
|
281
291
|
}
|
|
292
|
+
return { result, timings: summarizeLockEvents(events) };
|
|
282
293
|
}
|
|
283
294
|
|
|
284
295
|
/**
|
|
@@ -477,22 +488,29 @@ async function stepCreditedRun(ctx) {
|
|
|
477
488
|
// Close's `test` gate argv, so the deposit keys on its credit identity.
|
|
478
489
|
...testGateArgv(ctx.config),
|
|
479
490
|
];
|
|
480
|
-
const run = await withLockProgress(ctx, (env) =>
|
|
491
|
+
const { result: run, timings } = await withLockProgress(ctx, (env) =>
|
|
481
492
|
runLogged(ctx, 'credited-run', 'node', args, env),
|
|
482
493
|
);
|
|
483
|
-
const
|
|
494
|
+
const { lockWait, suiteTimings, spawns } = timings;
|
|
495
|
+
const extra = {
|
|
496
|
+
evidencePath: run.evidencePath,
|
|
497
|
+
depositor: ctx.depositor,
|
|
498
|
+
lockWait,
|
|
499
|
+
suiteTimings,
|
|
500
|
+
};
|
|
484
501
|
if (run.status !== 0) {
|
|
485
502
|
return fixRequired(name, describeSuiteFailure(run.status), extra);
|
|
486
503
|
}
|
|
487
504
|
const [ranSignal, freshSignal] = capture
|
|
488
505
|
? [SIGNALS.captureRan, SIGNALS.captureFresh]
|
|
489
506
|
: [SIGNALS.testRan, SIGNALS.testFresh];
|
|
507
|
+
const credit = { head: ctx.head, lockWait, suiteTimings, spawns };
|
|
490
508
|
if (ranSignal.test(run.output)) {
|
|
491
|
-
ctx
|
|
509
|
+
recordCredit(ctx, credit);
|
|
492
510
|
return ran(name, `${ctx.depositor} deposited credit`, extra);
|
|
493
511
|
}
|
|
494
512
|
if (freshSignal.test(run.output)) {
|
|
495
|
-
ctx
|
|
513
|
+
recordCredit(ctx, credit);
|
|
496
514
|
return skipped(name, `${ctx.depositor} credit already fresh`, extra);
|
|
497
515
|
}
|
|
498
516
|
return fixRequired(
|
|
@@ -502,6 +520,12 @@ async function stepCreditedRun(ctx) {
|
|
|
502
520
|
);
|
|
503
521
|
}
|
|
504
522
|
|
|
523
|
+
/** Credit and its run's figures move together, keyed by the credited head. */
|
|
524
|
+
function recordCredit(ctx, creditTimings) {
|
|
525
|
+
ctx.state.creditHead = creditTimings.head;
|
|
526
|
+
ctx.state.creditTimings = creditTimings;
|
|
527
|
+
}
|
|
528
|
+
|
|
505
529
|
/**
|
|
506
530
|
* @param {Function} git
|
|
507
531
|
* @param {string} cwd
|
|
@@ -547,7 +571,7 @@ async function commitSeatedRows(ctx, total, evidencePath) {
|
|
|
547
571
|
// Both capture-stamp digests leave `baselines/` out, so a baseline-JSON-only
|
|
548
572
|
// commit keeps the credit it already holds.
|
|
549
573
|
if (creditedPrior && ctx.depositor === 'coverage-capture') {
|
|
550
|
-
ctx.state.
|
|
574
|
+
recordCredit(ctx, { ...ctx.state.creditTimings, head: ctx.head });
|
|
551
575
|
}
|
|
552
576
|
return ran(name, `seated ${total} row(s) and committed them`, {
|
|
553
577
|
evidencePath,
|
|
@@ -822,7 +846,7 @@ function precheck(ctx) {
|
|
|
822
846
|
*
|
|
823
847
|
* @param {string} statePath
|
|
824
848
|
* @param {(tag: string, msg: string) => void} progress
|
|
825
|
-
* @returns {{ preflightHead?: string, creditHead?: string, seatHead?: string }}
|
|
849
|
+
* @returns {{ preflightHead?: string, creditHead?: string, creditTimings?: object, seatHead?: string }}
|
|
826
850
|
*/
|
|
827
851
|
function readState(statePath, progress) {
|
|
828
852
|
let raw;
|
|
@@ -934,7 +958,7 @@ export async function runStoryHandoff({ storyId, cwd, config }, deps) {
|
|
|
934
958
|
warn: (m) => progress('BLOCK', m),
|
|
935
959
|
}));
|
|
936
960
|
fs.mkdirSync(logDir, { recursive: true });
|
|
937
|
-
const statePath =
|
|
961
|
+
const statePath = handoffStatePath(logDir, storyId);
|
|
938
962
|
const branch = getStoryBranch(storyId);
|
|
939
963
|
const evidencePathFor = (name) =>
|
|
940
964
|
path.join(logDir, `story-handoff-${storyId}-${name}.log`);
|
|
@@ -1001,6 +1025,7 @@ export async function runStoryHandoff({ storyId, cwd, config }, deps) {
|
|
|
1001
1025
|
}
|
|
1002
1026
|
|
|
1003
1027
|
const status = stop?.stop ?? HANDOFF_STATUS.READY;
|
|
1028
|
+
const credited = steps.find((s) => s.name === 'credited-run');
|
|
1004
1029
|
if (status === HANDOFF_STATUS.BLOCKED) {
|
|
1005
1030
|
await block({ storyId, config, reason: stop.reason, detail: stop.detail });
|
|
1006
1031
|
}
|
|
@@ -1013,6 +1038,8 @@ export async function runStoryHandoff({ storyId, cwd, config }, deps) {
|
|
|
1013
1038
|
depositor: ctx.depositor,
|
|
1014
1039
|
steps: steps.map(({ stop: _stop, ...rest }) => rest),
|
|
1015
1040
|
review: ctx.review,
|
|
1041
|
+
lockWait: credited?.lockWait ?? null,
|
|
1042
|
+
suiteTimings: credited?.suiteTimings ?? null,
|
|
1016
1043
|
...(stop
|
|
1017
1044
|
? {
|
|
1018
1045
|
failedStep: stop.name,
|
|
@@ -201,6 +201,32 @@ export function predictsTestEvidenceCredit({
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
+
/** Does `sha` hold `test` credit under the full-suite identity? Uncertainty is `false`. */
|
|
205
|
+
export function hasTestCreditAt({
|
|
206
|
+
config,
|
|
207
|
+
storyId,
|
|
208
|
+
cwd,
|
|
209
|
+
evidenceCwd,
|
|
210
|
+
sha,
|
|
211
|
+
shouldSkipImpl = defaultShouldSkip,
|
|
212
|
+
} = {}) {
|
|
213
|
+
if (!sha) return false;
|
|
214
|
+
try {
|
|
215
|
+
const verdict = shouldSkipImpl(
|
|
216
|
+
{
|
|
217
|
+
storyId,
|
|
218
|
+
gateName: GATE_NAME,
|
|
219
|
+
currentSha: sha,
|
|
220
|
+
configHash: testGateConfigHash(config, cwd),
|
|
221
|
+
},
|
|
222
|
+
{ cwd: evidenceCwd ?? cwd, standalone: true },
|
|
223
|
+
);
|
|
224
|
+
return verdict.skip === true;
|
|
225
|
+
} catch {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
204
230
|
/**
|
|
205
231
|
* @param {{ storyId: number, sha: string, cwd: string, config: object|null, evidenceRoot: string, durationMs: number|null, gitSpawnFn: Function, recordPassFn: Function }} args
|
|
206
232
|
* @returns {{ deposited: boolean, reason: string, storyId: number, sha: string }}
|
|
@@ -165,6 +165,8 @@ export function loadEvidence(scopeId, opts = {}) {
|
|
|
165
165
|
* configHash: string,
|
|
166
166
|
* exitCode?: number,
|
|
167
167
|
* durationMs?: number|null,
|
|
168
|
+
* scope?: 'full'|'delta',
|
|
169
|
+
* since?: string,
|
|
168
170
|
* }} input
|
|
169
171
|
* @param {{ cwd?: string, tempDir?: string, standalone?: boolean, fs?: object, now?: Function }} opts
|
|
170
172
|
* @returns {object} The persisted record.
|
|
@@ -178,6 +180,8 @@ export function recordPass(
|
|
|
178
180
|
exitCode = 0,
|
|
179
181
|
durationMs = null,
|
|
180
182
|
inputFingerprint = null,
|
|
183
|
+
scope,
|
|
184
|
+
since,
|
|
181
185
|
},
|
|
182
186
|
opts = {},
|
|
183
187
|
) {
|
|
@@ -201,6 +205,8 @@ export function recordPass(
|
|
|
201
205
|
inputFingerprint: isNonEmptyString(inputFingerprint)
|
|
202
206
|
? inputFingerprint
|
|
203
207
|
: null,
|
|
208
|
+
...(scope ? { scope } : {}),
|
|
209
|
+
...(since ? { since } : {}),
|
|
204
210
|
timestamp: resolved.now().toISOString(),
|
|
205
211
|
};
|
|
206
212
|
doc.records = [...doc.records.filter((r) => r.gateName !== gateName), record];
|
|
@@ -485,8 +485,35 @@ full-suite lock wait expired) logs a deferred line and the close settles
|
|
|
485
485
|
line naming host contention — neither is reported as failing tests.
|
|
486
486
|
|
|
487
487
|
Every full-suite run ends on `⏲ suite timings: lockWaitMs=… hostWaitMs=…
|
|
488
|
-
testRunMs
|
|
488
|
+
testRunMs=…`. The handoff envelope carries its credited run's figures as
|
|
489
|
+
top-level `lockWait` / `suiteTimings` (null when the depositor ran no suite).
|
|
490
|
+
The close terminal's `suiteTimings` names its `source`: `close` when close
|
|
491
|
+
spawned the suite, `credited-run` when it honoured the handoff's credit;
|
|
492
|
+
`spawns[]` lists every spawn of that run. A `lockWaitMs` large next to
|
|
493
|
+
`testRunMs` is serialization behind sibling suites, not a slow suite — the
|
|
494
|
+
cue for `delivery.execution.workloads`. The
|
|
489
495
|
`coverage.timeoutMs` clock starts at spawn, never in the lock queue; a suite
|
|
490
496
|
that writes `$MANDREL_SUITE_READY_FILE` when its tests start (after a
|
|
491
497
|
consumer load gate) gets a fresh bound for them, so worst-case wall is lock
|
|
492
498
|
wait + 2 × `timeoutMs`.
|
|
499
|
+
|
|
500
|
+
**Delta re-credit after a base move.** When close's base sync merged
|
|
501
|
+
incoming paths (`BASE MOVED`), the `test` gate is the suite gate, the
|
|
502
|
+
pre-sync head holds `test` credit and `project.commands.testChanged` is set,
|
|
503
|
+
close runs that command instead of the full suite, with the pre-sync head in
|
|
504
|
+
`MANDREL_CHANGED_SINCE`, under the full-suite lock. Its log and progress line
|
|
505
|
+
read `test (delta since <sha12>, <n> incoming path(s))`; a green run deposits
|
|
506
|
+
`test` evidence for the merged tree (`scope: delta`, `since: <sha>`) under
|
|
507
|
+
the full-suite identity, so a re-close is credited, and a red one fails the
|
|
508
|
+
close like a red full run. An incoming coverage-config file or Story file,
|
|
509
|
+
no credit, no command, or coverage-capture running the suite logs
|
|
510
|
+
`test delta re-credit not eligible (<reason>)` and runs the full suite — the
|
|
511
|
+
same delta rules as the coverage capture's own delta refresh.
|
|
512
|
+
|
|
513
|
+
**PR-body trailers.** Close appends each git trailer named in
|
|
514
|
+
`delivery.pullRequest.bodyTrailers` (last branch commit carrying it wins) to
|
|
515
|
+
the PR body it opens; workers record one with `git commit --trailer`.
|
|
516
|
+
|
|
517
|
+
**Early merged-PR probe.** Before any sync or gate, close reads the head's
|
|
518
|
+
pull requests; a merged one whose head every surviving branch tip equals
|
|
519
|
+
short-circuits to the land tail instead of re-validating landed work.
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,24 @@ All notable changes to this project will be documented in this file.
|
|
|
15
15
|
-->
|
|
16
16
|
<!-- markdownlint-disable-file MD004 MD012 MD037 -->
|
|
17
17
|
|
|
18
|
+
## [2.101.0](https://github.com/dsj1984/mandrel/compare/mandrel-v2.100.0...mandrel-v2.101.0) (2026-10-23)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
* close lifts consumer-declared git trailers from the branch commits into the pull-request body ([#5875](https://github.com/dsj1984/mandrel/issues/5875)) ([#5885](https://github.com/dsj1984/mandrel/issues/5885)) ([443ee08](https://github.com/dsj1984/mandrel/commit/443ee08ace3ba785a34577b5b6a4822eeb238c61))
|
|
24
|
+
* confirm-merge re-arms auto-merge once the advisory check that disarmed it reports green on the same head, and the block names that check ([#5876](https://github.com/dsj1984/mandrel/issues/5876)) ([#5886](https://github.com/dsj1984/mandrel/issues/5886)) ([85a8aac](https://github.com/dsj1984/mandrel/commit/85a8aacfc6e4525d4b3d10aae859ac9dffd55c31))
|
|
25
|
+
* handoff and close envelopes carry the credited run's lock wait and suite timings, so the serialization cost of a delivery is visible per run ([#5879](https://github.com/dsj1984/mandrel/issues/5879)) ([#5888](https://github.com/dsj1984/mandrel/issues/5888)) ([68e9683](https://github.com/dsj1984/mandrel/commit/68e9683ccc2c41b16ecaf0b71485ae951d4b5ec1))
|
|
26
|
+
* the code-review provider reviews a large diff file by file within the prompt cap instead of truncating it ([#5878](https://github.com/dsj1984/mandrel/issues/5878)) ([#5882](https://github.com/dsj1984/mandrel/issues/5882)) ([e64a84e](https://github.com/dsj1984/mandrel/commit/e64a84e780c6546723466d9c4df1d46cbfb3ee46))
|
|
27
|
+
* the lint driver names every task that failed, with its exit code, and flags a crash exit ([#5889](https://github.com/dsj1984/mandrel/issues/5889)) ([#5891](https://github.com/dsj1984/mandrel/issues/5891)) ([7db5a92](https://github.com/dsj1984/mandrel/commit/7db5a923679fbe8158c4eb1541ed4cc7cc51447e))
|
|
28
|
+
* when the base moves between handoff and close, the `test` gate re-credits by running only the tests the incoming commits affect ([#5880](https://github.com/dsj1984/mandrel/issues/5880)) ([#5890](https://github.com/dsj1984/mandrel/issues/5890)) ([66423e3](https://github.com/dsj1984/mandrel/commit/66423e36c06dcfdb44564516c74d1cc829bc932d))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
|
|
33
|
+
* close probes the head's pull request before validation and short-circuits to the land tail when it already merged ([#5877](https://github.com/dsj1984/mandrel/issues/5877)) ([#5887](https://github.com/dsj1984/mandrel/issues/5887)) ([ddc1b52](https://github.com/dsj1984/mandrel/commit/ddc1b52c2f081928c6eff297803c5e60a34ece9c))
|
|
34
|
+
* **deps:** drop the braces audit exception now that GHSA-vfj7-8cjw-p6xm is withdrawn ([#5883](https://github.com/dsj1984/mandrel/issues/5883)) ([364f547](https://github.com/dsj1984/mandrel/commit/364f54705372e26d1b5d1c8d628fc9628940efbf))
|
|
35
|
+
|
|
18
36
|
## [2.100.0](https://github.com/dsj1984/mandrel/compare/mandrel-v2.99.0...mandrel-v2.100.0) (2026-10-23)
|
|
19
37
|
|
|
20
38
|
|
package/package.json
CHANGED