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
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* scored for the branch's own work, not everything the base landed.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import path from 'node:path';
|
|
9
10
|
import process from 'node:process';
|
|
10
11
|
import {
|
|
11
12
|
runCrapPreview,
|
|
@@ -14,10 +15,11 @@ import {
|
|
|
14
15
|
import { resolveMergeHead } from './lib/changed-files.js';
|
|
15
16
|
import { runAsCli } from './lib/cli-utils.js';
|
|
16
17
|
import { CODING_GUARDRAILS } from './lib/config/quality.js';
|
|
18
|
+
import { loadCoverage } from './lib/coverage-utils.js';
|
|
17
19
|
|
|
18
20
|
const USAGE = {
|
|
19
21
|
invocation:
|
|
20
|
-
'node .agents/scripts/quality-preview.js [--staged | --changed-since <ref>] [--only mi|crap] [--json]',
|
|
22
|
+
'node .agents/scripts/quality-preview.js [--staged | --changed-since <ref>] [--only mi|crap] [--coverage-artifact <path>] [--json]',
|
|
21
23
|
summary:
|
|
22
24
|
'Preview the per-file maintainability and CRAP deltas for the change set, and exit non-zero on any threshold violation.',
|
|
23
25
|
flags: [
|
|
@@ -33,6 +35,10 @@ const USAGE = {
|
|
|
33
35
|
'--only mi|crap',
|
|
34
36
|
'Run one half only — maintainability (`mi`) or CRAP (`crap`); the other half is reported as not run. Default: both, serially.',
|
|
35
37
|
],
|
|
38
|
+
[
|
|
39
|
+
'--coverage-artifact <path>',
|
|
40
|
+
'Score the CRAP half against this coverage-final.json (e.g. a CI artifact) instead of the configured one, without checking its capture stamp. Read-only; exit 2 when it cannot be loaded.',
|
|
41
|
+
],
|
|
36
42
|
['--json', 'Emit both gate envelopes plus the merged table as JSON.'],
|
|
37
43
|
],
|
|
38
44
|
};
|
|
@@ -91,6 +97,27 @@ function parseOnlyArg(argv) {
|
|
|
91
97
|
return at === -1 ? null : (argv[at + 1] ?? '');
|
|
92
98
|
}
|
|
93
99
|
|
|
100
|
+
/** `--coverage-artifact` (last wins): `null` absent, `''` bare, else `{ given, path }`. */
|
|
101
|
+
function parseCoverageArtifactArg(argv, cwd) {
|
|
102
|
+
const at = argv.lastIndexOf('--coverage-artifact');
|
|
103
|
+
if (at === -1) return null;
|
|
104
|
+
const given = argv[at + 1];
|
|
105
|
+
if (!given || given.startsWith('--')) return '';
|
|
106
|
+
return { given, path: path.resolve(cwd, given) };
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** The refusal for an unusable argv, or `null`. */
|
|
110
|
+
function usageError({ only, artifact }) {
|
|
111
|
+
if (isUnknownHalf(only)) {
|
|
112
|
+
return `--only takes mi or crap (got "${only}").`;
|
|
113
|
+
}
|
|
114
|
+
if (artifact === '') return '--coverage-artifact needs a path.';
|
|
115
|
+
if (artifact && !loadCoverage(artifact.path)) {
|
|
116
|
+
return `--coverage-artifact ${artifact.given} is missing or not a coverage JSON object.`;
|
|
117
|
+
}
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
|
|
94
121
|
/**
|
|
95
122
|
* @param {string|null} only
|
|
96
123
|
* @returns {boolean}
|
|
@@ -120,6 +147,17 @@ function onlyField(only) {
|
|
|
120
147
|
return only ? { only } : {};
|
|
121
148
|
}
|
|
122
149
|
|
|
150
|
+
/** The `--json` field naming the scored artifact; empty without the flag. */
|
|
151
|
+
function coverageArtifactField(artifact) {
|
|
152
|
+
return artifact ? { coverageArtifact: artifact.path } : {};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** The scope header, then the named artifact's line when there is one. */
|
|
156
|
+
function withArtifactLine(scopeLine, artifact) {
|
|
157
|
+
if (!artifact) return scopeLine;
|
|
158
|
+
return `${scopeLine.trimEnd()}\ncoverage=${artifact.given} (named artifact; capture stamp not checked)\n\n`;
|
|
159
|
+
}
|
|
160
|
+
|
|
123
161
|
/**
|
|
124
162
|
* The report line naming the selected half; empty for the default run.
|
|
125
163
|
*
|
|
@@ -380,7 +418,7 @@ export function renderTable(merged) {
|
|
|
380
418
|
* A thrown runner degrades to the `{ exitCode: 1, envelope: null }` shape.
|
|
381
419
|
*
|
|
382
420
|
* @param {(args: object) => Promise<{exitCode: number, envelope: object|null}>} runner
|
|
383
|
-
* @param {{cwd: string, staged: boolean, changedSinceRef: string|null}} args
|
|
421
|
+
* @param {{cwd: string, staged: boolean, changedSinceRef: string|null, coverageArtifact: string|null}} args
|
|
384
422
|
* @param {'MI'|'CRAP'} label
|
|
385
423
|
* @param {{ write: (s: string) => void }} stderr
|
|
386
424
|
* @returns {Promise<{exitCode: number, envelope: object|null}>}
|
|
@@ -419,6 +457,7 @@ function stagedScopeLine({ staged, ref, cwd }) {
|
|
|
419
457
|
* @param {{
|
|
420
458
|
* json: boolean,
|
|
421
459
|
* only: string|null,
|
|
460
|
+
* artifact: { given: string, path: string } | null,
|
|
422
461
|
* staged: boolean,
|
|
423
462
|
* ref: string|null,
|
|
424
463
|
* cwd: string,
|
|
@@ -433,6 +472,7 @@ function stagedScopeLine({ staged, ref, cwd }) {
|
|
|
433
472
|
function emitReport({
|
|
434
473
|
json,
|
|
435
474
|
only,
|
|
475
|
+
artifact,
|
|
436
476
|
staged,
|
|
437
477
|
ref,
|
|
438
478
|
cwd,
|
|
@@ -451,6 +491,7 @@ function emitReport({
|
|
|
451
491
|
ref: staged ? null : ref,
|
|
452
492
|
staged,
|
|
453
493
|
...onlyField(only),
|
|
494
|
+
...coverageArtifactField(artifact),
|
|
454
495
|
mi: { exit: miExit, envelope: miResult.envelope },
|
|
455
496
|
crap: { exit: crapExit, envelope: crapResult.envelope },
|
|
456
497
|
merged,
|
|
@@ -463,7 +504,9 @@ function emitReport({
|
|
|
463
504
|
}
|
|
464
505
|
stdout.write('\n--- quality:preview ---\n');
|
|
465
506
|
stdout.write(halfLine(only));
|
|
466
|
-
stdout.write(
|
|
507
|
+
stdout.write(
|
|
508
|
+
withArtifactLine(stagedScopeLine({ staged, ref, cwd }), artifact),
|
|
509
|
+
);
|
|
467
510
|
stdout.write(`${renderTable(merged)}\n`);
|
|
468
511
|
writeAdvisories(merged.advisories, stdout);
|
|
469
512
|
const diagnostics = renderDiagnostics([miResult, crapResult]);
|
|
@@ -498,16 +541,21 @@ export async function runCli({
|
|
|
498
541
|
const staged = parseStagedFlag(argv);
|
|
499
542
|
const ref = resolveRef(argv, staged);
|
|
500
543
|
const only = parseOnlyArg(argv);
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
);
|
|
544
|
+
const artifact = parseCoverageArtifactArg(argv, cwd);
|
|
545
|
+
const refusal = usageError({ only, artifact });
|
|
546
|
+
if (refusal) {
|
|
547
|
+
stderr.write(`[quality:preview] ${refusal}\n`);
|
|
505
548
|
return { exitCode: 2, merged: mergeEnvelopes(null, null) };
|
|
506
549
|
}
|
|
507
550
|
|
|
508
551
|
const { miResult, crapResult } = await runHalves({
|
|
509
552
|
only,
|
|
510
|
-
args: {
|
|
553
|
+
args: {
|
|
554
|
+
cwd,
|
|
555
|
+
staged,
|
|
556
|
+
changedSinceRef: ref,
|
|
557
|
+
coverageArtifact: artifact?.path ?? null,
|
|
558
|
+
},
|
|
511
559
|
runMi,
|
|
512
560
|
runCrap,
|
|
513
561
|
stderr,
|
|
@@ -520,6 +568,7 @@ export async function runCli({
|
|
|
520
568
|
emitReport({
|
|
521
569
|
json,
|
|
522
570
|
only,
|
|
571
|
+
artifact,
|
|
523
572
|
staged,
|
|
524
573
|
ref,
|
|
525
574
|
cwd,
|
|
@@ -576,7 +576,16 @@ Digest § 5 states the rule and both invocations; this is what surrounds them.
|
|
|
576
576
|
no lint/format credit, `test` credit or capture stamp, and close's re-score
|
|
577
577
|
over the same tree and base reports `unchanged`. Best-effort: a failed scan
|
|
578
578
|
or refused commit settles `error` and the run continues; close's re-score
|
|
579
|
-
stays authoritative. A re-run at the HEAD it settled skips it.
|
|
579
|
+
stays authoritative. A re-run at the HEAD it settled skips it. When
|
|
580
|
+
preflight lanes are admitted (`delivery.execution.preflightConcurrency`
|
|
581
|
+
above 1, suite admission on, not inside a suite reservation, not
|
|
582
|
+
`--report-all`), the re-score scan instead overlaps preflight: it writes
|
|
583
|
+
nothing while the checks run, and a moved row is committed at a join
|
|
584
|
+
before the independent baseline compare, which then scores the new HEAD.
|
|
585
|
+
The commit touches only the duplication baseline, so the preflight credits,
|
|
586
|
+
a held lint and the static-seat marker re-key onto it. `steps[]` lists
|
|
587
|
+
`duplication-rescore` just before `preflight`, with
|
|
588
|
+
`concurrentWith: "preflight"` and its own scan time as `durationMs`.
|
|
580
589
|
- **Post-capture checks.** After depositor and seat, the handoff runs close's
|
|
581
590
|
`quality-preview-crap` entry — only when the depositor is
|
|
582
591
|
`coverage-capture`, so a project with no capture keeps its CRAP behaviour —
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,23 @@ 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.119.0](https://github.com/dsj1984/mandrel/compare/mandrel-v2.118.0...mandrel-v2.119.0) (2026-11-11)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
* arm a merge-queue base through the CCR route over REST, and name a green-but-unlanded merge wait honestly ([#6054](https://github.com/dsj1984/mandrel/issues/6054)) ([#6058](https://github.com/dsj1984/mandrel/issues/6058)) ([c065158](https://github.com/dsj1984/mandrel/commit/c065158420e4ab4c3cdb4f20faf7481cb6deacb4))
|
|
24
|
+
* close defers typecheck, lint and the coverage capture to CI after a conflict-free base merge when delivery.close.revalidateAfterBaseSync is ci ([#6050](https://github.com/dsj1984/mandrel/issues/6050)) ([#6057](https://github.com/dsj1984/mandrel/issues/6057)) ([23e0a72](https://github.com/dsj1984/mandrel/commit/23e0a727fe7ad8aec802670353a822e3971d2650))
|
|
25
|
+
* overlap the handoff duplication re-score with preflight under the lanes opt-in ([#6051](https://github.com/dsj1984/mandrel/issues/6051)) ([#6059](https://github.com/dsj1984/mandrel/issues/6059)) ([c2fe41f](https://github.com/dsj1984/mandrel/commit/c2fe41f086378fca8c5d6afba754083390e24186))
|
|
26
|
+
* quality-preview: score CRAP against a named coverage artifact, read-only (--coverage-artifact) ([#6052](https://github.com/dsj1984/mandrel/issues/6052)) ([#6055](https://github.com/dsj1984/mandrel/issues/6055)) ([c4fdddc](https://github.com/dsj1984/mandrel/commit/c4fdddc7324e21a30c4085dd51972c1afda08c34))
|
|
27
|
+
|
|
28
|
+
## [2.118.0](https://github.com/dsj1984/mandrel/compare/mandrel-v2.117.0...mandrel-v2.118.0) (2026-11-11)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
|
|
33
|
+
* **baselines:** every coverage writer scores a 0/0 axis as 100 (refs [#6047](https://github.com/dsj1984/mandrel/issues/6047)) ([#6048](https://github.com/dsj1984/mandrel/issues/6048)) ([cd2d1fb](https://github.com/dsj1984/mandrel/commit/cd2d1fb6fb6ce854dca51c017b0ecc68d977c4f7))
|
|
34
|
+
|
|
18
35
|
## [2.117.0](https://github.com/dsj1984/mandrel/compare/mandrel-v2.116.0...mandrel-v2.117.0) (2026-11-11)
|
|
19
36
|
|
|
20
37
|
|
package/package.json
CHANGED