mandrel 2.117.0 → 2.119.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/docs/agentrc-reference.json +2 -1
- package/.agents/docs/configuration.md +14 -5
- package/.agents/schemas/agentrc.schema.json +25 -2
- package/.agents/schemas/story-deliver-terminal.schema.json +15 -1
- package/.agents/scripts/lib/baselines/coverage-updater-cli.js +2 -6
- package/.agents/scripts/lib/baselines/crap-preview-coverage.js +17 -0
- package/.agents/scripts/lib/baselines/crap-preview-scan.js +11 -6
- package/.agents/scripts/lib/baselines/preview-gates.js +2 -0
- package/.agents/scripts/lib/baselines/refresh-service.js +23 -12
- package/.agents/scripts/lib/baselines/seat-missing.js +2 -9
- package/.agents/scripts/lib/close-validation/base-sync-revalidation.js +152 -0
- package/.agents/scripts/lib/close-validation/ci-deferral.js +23 -5
- package/.agents/scripts/lib/close-validation/gates.js +8 -2
- package/.agents/scripts/lib/close-validation/runner.js +8 -10
- package/.agents/scripts/lib/config-settings-schema-delivery.js +22 -2
- package/.agents/scripts/lib/coverage-baseline.js +20 -9
- package/.agents/scripts/lib/coverage-deferral.js +17 -0
- package/.agents/scripts/lib/generated/agentrc-validator.js +2 -2
- package/.agents/scripts/lib/observability/story-outcome.js +5 -4
- package/.agents/scripts/lib/orchestration/handoff-rescore.js +95 -25
- package/.agents/scripts/lib/orchestration/merge-block-class.js +12 -1
- package/.agents/scripts/lib/orchestration/merge-poll.js +9 -0
- package/.agents/scripts/lib/orchestration/merge-queue.js +14 -7
- package/.agents/scripts/lib/orchestration/single-story-close/phases/auto-merge.js +2 -25
- package/.agents/scripts/lib/orchestration/single-story-close/phases/base-sync.js +8 -1
- package/.agents/scripts/lib/orchestration/single-story-close/phases/close-validation.js +26 -7
- package/.agents/scripts/lib/orchestration/single-story-close/phases/confirm-merge.js +50 -8
- package/.agents/scripts/lib/orchestration/single-story-close/phases/finish.js +3 -2
- package/.agents/scripts/lib/orchestration/single-story-close/phases/pre-push.js +9 -3
- package/.agents/scripts/lib/orchestration/single-story-close/result.js +9 -6
- package/.agents/scripts/lib/orchestration/single-story-close/runner.js +1 -0
- package/.agents/scripts/lib/orchestration/story-close/duplication-close-rescore.js +158 -71
- package/.agents/scripts/lib/orchestration/story-deliver-terminal.js +4 -0
- package/.agents/scripts/lib/orchestration/story-handoff.js +100 -25
- package/.agents/scripts/quality-preview.js +57 -8
- package/.agents/workflows/helpers/deliver-reference.md +10 -1
- package/docs/CHANGELOG.md +17 -0
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
COVERAGE_OVER_BUDGET_EXIT_CODE,
|
|
10
10
|
COVERAGE_TIMEOUT_EXIT_CODE,
|
|
11
11
|
} from '../coverage-capture.js';
|
|
12
|
+
import { SUITE_GATE_NAMES, suiteGateDeferral } from '../coverage-deferral.js';
|
|
12
13
|
import {
|
|
13
14
|
fullSuiteLockPolicy,
|
|
14
15
|
LOCK_WAIT_EXPIRED_EXIT_CODE,
|
|
@@ -142,12 +143,12 @@ export function applyChangedFileScope({ gate, spawnCwd, log }) {
|
|
|
142
143
|
* shouldSkip?: typeof defaultShouldSkip,
|
|
143
144
|
* }} opts An expired full-suite lock wait spawns nothing (here or in any gate
|
|
144
145
|
* child) and reports `LOCK_WAIT_EXPIRED_EXIT_CODE`.
|
|
145
|
-
* @returns {{ ok: boolean, failed: Array<{ gate: Gate, status: number, cwd: string, outcome: 'deferred'|'timeout'|'over-budget'|'host-resources'|'failed' }>, skipped: Array<{ gate: Gate, reason: string }>, deferred: Array<{ gate: Gate, status: number|null, reason: 'over-budget'|'suite-of-record-ci' }> }}
|
|
146
|
+
* @returns {{ ok: boolean, failed: Array<{ gate: Gate, status: number, cwd: string, outcome: 'deferred'|'timeout'|'over-budget'|'host-resources'|'failed' }>, skipped: Array<{ gate: Gate, reason: string }>, deferred: Array<{ gate: Gate, status: number|null, reason: 'over-budget'|'suite-of-record-ci'|'base-sync-ci' }> }}
|
|
146
147
|
* `outcome` classifies the exit: `deferred` (75), `timeout` (124),
|
|
147
148
|
* `over-budget` (76 under `block`), `host-resources` (77 from a suite gate),
|
|
148
149
|
* else `failed`. `deferred[]` holds a
|
|
149
|
-
* `deferOnOverBudget` gate that exited 76, or a `suiteOfRecordCi` capture
|
|
150
|
-
* never spawned: not a failure, no evidence.
|
|
150
|
+
* `deferOnOverBudget` gate that exited 76, or a `suiteOfRecordCi` capture or
|
|
151
|
+
* `ciDeferred` gate never spawned: not a failure, no evidence.
|
|
151
152
|
*/
|
|
152
153
|
export async function runCloseValidation({
|
|
153
154
|
cwd,
|
|
@@ -508,7 +509,7 @@ function isDeferredOverBudget(gate, status) {
|
|
|
508
509
|
/** A suite gate's exit 76 the policy blocks. @param {Gate} gate @param {number} status */
|
|
509
510
|
function isBlockedOverBudget(gate, status) {
|
|
510
511
|
return (
|
|
511
|
-
status === COVERAGE_OVER_BUDGET_EXIT_CODE &&
|
|
512
|
+
status === COVERAGE_OVER_BUDGET_EXIT_CODE && SUITE_GATE_NAMES.has(gate.name)
|
|
512
513
|
);
|
|
513
514
|
}
|
|
514
515
|
|
|
@@ -516,9 +517,6 @@ function isBlockedOverBudget(gate, status) {
|
|
|
516
517
|
const GATE_HOST_RESOURCES_HINT =
|
|
517
518
|
'The suite lost workers to host memory (exit 77) and no test failed — do not re-run it unchanged on this host. Use fewer workers or a larger host, or — when CI runs the suite with a coverage floor — have the capture script declare the slice over budget (exit 76) under `delivery.quality.gates.coverage.onOverBudget: "defer-to-ci"`.';
|
|
518
519
|
|
|
519
|
-
/** The gates that run the suite, the only ones whose 77 means lost workers. */
|
|
520
|
-
const SUITE_GATES = new Set(['test', 'coverage-capture']);
|
|
521
|
-
|
|
522
520
|
/**
|
|
523
521
|
* A non-failure exit that carries its own hint in place of the gate's: a
|
|
524
522
|
* killed suite (124), a suite that lost workers to host memory (77), or a
|
|
@@ -546,7 +544,7 @@ function overBudgetExit(gate, status) {
|
|
|
546
544
|
/** A suite gate's 77; any other gate's 77 is an ordinary failure. @param {Gate} gate @param {number} status */
|
|
547
545
|
function hostResourcesExit(gate, status) {
|
|
548
546
|
if (status !== COVERAGE_HOST_RESOURCES_EXIT_CODE) return null;
|
|
549
|
-
if (!
|
|
547
|
+
if (!SUITE_GATE_NAMES.has(gate.name)) return null;
|
|
550
548
|
const line = `⛔ ${gate.name} lost workers to host memory (exit ${status}) — no test failed`;
|
|
551
549
|
return { outcome: 'host-resources', hint: GATE_HOST_RESOURCES_HINT, line };
|
|
552
550
|
}
|
|
@@ -558,11 +556,11 @@ function reportHintedExit({ gate, status, cwd, log, outcome, hint, line }) {
|
|
|
558
556
|
}
|
|
559
557
|
|
|
560
558
|
/**
|
|
561
|
-
* The gate's execution: a skip once a
|
|
559
|
+
* The gate's execution: a skip once a suite gate deferred and the gate reads
|
|
562
560
|
* its artifact, else its changed-file scope.
|
|
563
561
|
*/
|
|
564
562
|
function resolveSerialExecution({ gate, spawnCwd, log, deferred }) {
|
|
565
|
-
if (
|
|
563
|
+
if (!(gate.readsCoverageArtifact && suiteGateDeferral(deferred))) {
|
|
566
564
|
return applyChangedFileScope({ gate, spawnCwd, log });
|
|
567
565
|
}
|
|
568
566
|
log(
|
|
@@ -108,7 +108,7 @@ const EXECUTION_SCHEMA = {
|
|
|
108
108
|
minimum: 1,
|
|
109
109
|
default: 1,
|
|
110
110
|
description:
|
|
111
|
-
"Story #5997. The most handoff preflight checks that may run at once. `1` (the default) is the serial preflight. Above 1, typecheck, lint and format (close's independent gates) may also run in up to N − 1 extra lanes, each admitted through suite admission with no wait under close's argv for that gate; a miss hands the check back to the serial lane. Set it per host in `.agentrc.local.json`: whether a host can afford a second CPU-heavy check is a per-host fact.",
|
|
111
|
+
"Story #5997. The most handoff preflight checks that may run at once. `1` (the default) is the serial preflight. Above 1, typecheck, lint and format (close's independent gates) may also run in up to N − 1 extra lanes, each admitted through suite admission with no wait under close's argv for that gate; a miss hands the check back to the serial lane. When lanes are admitted (and not under `--report-all`), the handoff's duplication re-score scan also overlaps preflight instead of running before it: a moved row is committed at a join before the independent baseline compare runs, and the preflight credits re-key onto that commit. Set it per host in `.agentrc.local.json`: whether a host can afford a second CPU-heavy check is a per-host fact.",
|
|
112
112
|
},
|
|
113
113
|
},
|
|
114
114
|
additionalProperties: false,
|
|
@@ -222,7 +222,7 @@ const WORKTREE_ISOLATION_SCHEMA = {
|
|
|
222
222
|
const CLOSE_SCHEMA = {
|
|
223
223
|
type: 'object',
|
|
224
224
|
description:
|
|
225
|
-
'Close-time posture (Story #5954). `baseSync` decides whether close and a handoff re-run merge `origin/<baseBranch>` before validating.',
|
|
225
|
+
'Close-time posture (Story #5954). `baseSync` decides whether close and a handoff re-run merge `origin/<baseBranch>` before validating; the `revalidate*` keys decide what close re-runs after that merge.',
|
|
226
226
|
properties: {
|
|
227
227
|
baseSync: {
|
|
228
228
|
type: 'string',
|
|
@@ -231,6 +231,26 @@ const CLOSE_SCHEMA = {
|
|
|
231
231
|
"`always` (default) merges `origin/<baseBranch>` on every close, as before. `on-conflict` first runs a conflict-only probe and skips the merge when it is conflict-free (`git merge-tree --write-tree`) and the incoming and Story paths are disjoint (raw paths, `baselines/` and renames included); `check-baselines` then compares against the merge-base and the terminal envelope's `baseSync` says why. Any other probe answer merges as today. A handoff applies the probe only on a re-run. Opt in only behind a merge queue that re-tests the merged tree and with no up-to-date-branch requirement: a semantic conflict the probe cannot see surfaces in CI, and coverage is measured on the pre-merge tree.",
|
|
232
232
|
default: 'always',
|
|
233
233
|
},
|
|
234
|
+
revalidateAfterBaseSync: {
|
|
235
|
+
type: 'string',
|
|
236
|
+
enum: ['full', 'ci'],
|
|
237
|
+
description:
|
|
238
|
+
"What close re-runs after base-sync merged `origin/<baseBranch>`. `full` (default) re-runs every gate, as before. `ci` defers `typecheck`, `lint` and the coverage capture to the CI checks named in `revalidateCiChecks` — never spawned, reported `deferred`, the capture writing `Coverage-deferred: base-sync-ci` — but only for a conflict-free merge commit whose pre-sync head carries `typecheck` and `lint` pass evidence, with no incoming path under `revalidateAlwaysPaths` and, when the capture is registered, a `coverage.ciRatchetCheck`. Any other close re-runs everything and the terminal envelope's `revalidation` names why.",
|
|
239
|
+
default: 'full',
|
|
240
|
+
},
|
|
241
|
+
revalidateCiChecks: {
|
|
242
|
+
type: 'array',
|
|
243
|
+
items: { type: 'string', minLength: 1 },
|
|
244
|
+
uniqueItems: true,
|
|
245
|
+
description:
|
|
246
|
+
'The CI check names (check-run or status context) a `revalidateAfterBaseSync: "ci"` deferral leans on. Absent or empty, the mode falls back to a full re-run.',
|
|
247
|
+
},
|
|
248
|
+
revalidateAlwaysPaths: {
|
|
249
|
+
type: 'array',
|
|
250
|
+
items: { type: 'string', minLength: 1 },
|
|
251
|
+
description:
|
|
252
|
+
'Globs (picomatch, dotfiles included) for whole-repo invariants: a base merge bringing in any matching path always re-runs every gate under `revalidateAfterBaseSync: "ci"`.',
|
|
253
|
+
},
|
|
234
254
|
},
|
|
235
255
|
additionalProperties: false,
|
|
236
256
|
};
|
|
@@ -149,16 +149,27 @@ export function readBaseline(cwd, fsImpl = fs) {
|
|
|
149
149
|
*/
|
|
150
150
|
const NO_DENOMINATOR_PCT = 100;
|
|
151
151
|
|
|
152
|
+
/**
|
|
153
|
+
* One baseline row from a file's `scoreEntry` scores. Every writer builds
|
|
154
|
+
* its rows here, so a 0/0 axis persists as 100 on every path.
|
|
155
|
+
*
|
|
156
|
+
* @param {string} file Repo-relative path.
|
|
157
|
+
* @param {{ lines?: number|null, branches?: number|null, functions?: number|null }|null|undefined} scores
|
|
158
|
+
* @returns {{ path: string, lines: number, branches: number, functions: number }}
|
|
159
|
+
*/
|
|
160
|
+
export function coverageRowFromScores(file, scores) {
|
|
161
|
+
return {
|
|
162
|
+
path: file,
|
|
163
|
+
lines: scores?.lines ?? NO_DENOMINATOR_PCT,
|
|
164
|
+
branches: scores?.branches ?? NO_DENOMINATOR_PCT,
|
|
165
|
+
functions: scores?.functions ?? NO_DENOMINATOR_PCT,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
152
169
|
function projectFlatToRows(baseline) {
|
|
153
|
-
return Object.entries(baseline ?? {}).map(([file, scores]) =>
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
path: file,
|
|
157
|
-
lines: rest.lines ?? NO_DENOMINATOR_PCT,
|
|
158
|
-
branches: rest.branches ?? NO_DENOMINATOR_PCT,
|
|
159
|
-
functions: rest.functions ?? NO_DENOMINATOR_PCT,
|
|
160
|
-
};
|
|
161
|
-
});
|
|
170
|
+
return Object.entries(baseline ?? {}).map(([file, scores]) =>
|
|
171
|
+
coverageRowFromScores(file, scores),
|
|
172
|
+
);
|
|
162
173
|
}
|
|
163
174
|
|
|
164
175
|
function writeEnvelopeViaFsImpl(abs, envelope, fsImpl) {
|
|
@@ -13,14 +13,30 @@ const COVERAGE_DEFERRED_KEY = 'Coverage-deferred';
|
|
|
13
13
|
export const COVERAGE_DEFERRED_REASONS = Object.freeze({
|
|
14
14
|
overBudget: 'over-budget',
|
|
15
15
|
suiteOfRecordCi: 'suite-of-record-ci',
|
|
16
|
+
baseSyncCi: 'base-sync-ci',
|
|
16
17
|
});
|
|
17
18
|
|
|
19
|
+
/** The gates that run the suite: only their deferral is a coverage deferral. */
|
|
20
|
+
export const SUITE_GATE_NAMES = new Set(['test', 'coverage-capture']);
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The suite gate's entry among a close's `deferred[]`, else `undefined`; a
|
|
24
|
+
* typecheck or lint deferral never stands for the suite.
|
|
25
|
+
*
|
|
26
|
+
* @param {Array<{ gate: { name: string }, reason: string }>|undefined} deferred
|
|
27
|
+
*/
|
|
28
|
+
export function suiteGateDeferral(deferred) {
|
|
29
|
+
return (deferred ?? []).find((d) => SUITE_GATE_NAMES.has(d.gate.name));
|
|
30
|
+
}
|
|
31
|
+
|
|
18
32
|
/** The prose line each reason adds beneath `Closes #<id>`. */
|
|
19
33
|
const PROSE = Object.freeze({
|
|
20
34
|
[COVERAGE_DEFERRED_REASONS.overBudget]:
|
|
21
35
|
"Coverage deferred to CI: the capture slice was over this host's budget (exit 76, onOverBudget: defer-to-ci).",
|
|
22
36
|
[COVERAGE_DEFERRED_REASONS.suiteOfRecordCi]:
|
|
23
37
|
'Coverage deferred to CI: CI is the coverage and CRAP ratchet of record (suiteOfRecord: ci).',
|
|
38
|
+
[COVERAGE_DEFERRED_REASONS.baseSyncCi]:
|
|
39
|
+
'Coverage deferred to CI: close merged the base conflict-free and CI revalidates the merged tree (revalidateAfterBaseSync: ci).',
|
|
24
40
|
});
|
|
25
41
|
|
|
26
42
|
const PROSE_LINES = new Set(Object.values(PROSE));
|
|
@@ -29,6 +45,7 @@ const PROSE_LINES = new Set(Object.values(PROSE));
|
|
|
29
45
|
const POLICY = Object.freeze({
|
|
30
46
|
[COVERAGE_DEFERRED_REASONS.overBudget]: 'defer-to-ci',
|
|
31
47
|
[COVERAGE_DEFERRED_REASONS.suiteOfRecordCi]: 'suite-of-record',
|
|
48
|
+
[COVERAGE_DEFERRED_REASONS.baseSyncCi]: 'base-sync',
|
|
32
49
|
});
|
|
33
50
|
|
|
34
51
|
/**
|