mandrel 2.116.0 → 2.118.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/scripts/lib/baselines/coverage-updater-cli.js +2 -6
- package/.agents/scripts/lib/baselines/refresh-service.js +2 -6
- package/.agents/scripts/lib/baselines/seat-missing.js +2 -9
- package/.agents/scripts/lib/coverage-baseline.js +28 -9
- package/docs/CHANGELOG.md +14 -0
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ import path from 'node:path';
|
|
|
10
10
|
import { getBaselineEpsilon } from '../config/quality.js';
|
|
11
11
|
import {
|
|
12
12
|
buildScopePredicate,
|
|
13
|
+
coverageRowFromScores,
|
|
13
14
|
readCoverageFinal,
|
|
14
15
|
scoreCoverageFinal,
|
|
15
16
|
} from '../coverage-baseline.js';
|
|
@@ -108,12 +109,7 @@ function projectScoredRows(scores, files, opts, logger) {
|
|
|
108
109
|
: null;
|
|
109
110
|
const rows = Object.entries(scores)
|
|
110
111
|
.filter(([relPath]) => inScope === null || inScope.has(relPath))
|
|
111
|
-
.map(([relPath, s]) => (
|
|
112
|
-
path: relPath,
|
|
113
|
-
lines: s?.lines ?? 0,
|
|
114
|
-
branches: s?.branches ?? 0,
|
|
115
|
-
functions: s?.functions ?? 0,
|
|
116
|
-
}));
|
|
112
|
+
.map(([relPath, s]) => coverageRowFromScores(relPath, s));
|
|
117
113
|
logger.info(
|
|
118
114
|
`[Coverage] Scored ${Object.keys(scores).length} file(s)${inScope ? ` (${rows.length} in scope)` : ''}.`,
|
|
119
115
|
);
|
|
@@ -16,6 +16,7 @@ import { COVERAGE_GATE_DEFAULTS } from '../config/quality.js';
|
|
|
16
16
|
import { getQuality, resolveConfig } from '../config-resolver.js';
|
|
17
17
|
import {
|
|
18
18
|
buildScopePredicate,
|
|
19
|
+
coverageRowFromScores,
|
|
19
20
|
scoreCoverageFinal,
|
|
20
21
|
} from '../coverage-baseline.js';
|
|
21
22
|
import { MissingCoverageArtifactError } from '../coverage-capture.js';
|
|
@@ -181,12 +182,7 @@ function buildDefaultCoverageScorer({ cwd, config, quality } = {}) {
|
|
|
181
182
|
: null;
|
|
182
183
|
return Object.entries(scores)
|
|
183
184
|
.filter(([relPath]) => inScope === null || inScope.has(relPath))
|
|
184
|
-
.map(([relPath, score]) => (
|
|
185
|
-
path: relPath,
|
|
186
|
-
lines: score?.lines ?? 0,
|
|
187
|
-
branches: score?.branches ?? 0,
|
|
188
|
-
functions: score?.functions ?? 0,
|
|
189
|
-
}));
|
|
185
|
+
.map(([relPath, score]) => coverageRowFromScores(relPath, score));
|
|
190
186
|
};
|
|
191
187
|
}
|
|
192
188
|
|
|
@@ -12,6 +12,7 @@ import { execFileCaptureAsync } from '../child-exec.js';
|
|
|
12
12
|
import { getBaselines, getQuality, resolveConfig } from '../config-resolver.js';
|
|
13
13
|
import {
|
|
14
14
|
buildScopePredicate,
|
|
15
|
+
coverageRowFromScores,
|
|
15
16
|
scoreCoverageFinal,
|
|
16
17
|
} from '../coverage-baseline.js';
|
|
17
18
|
import { isCoverageFresh } from '../coverage-capture.js';
|
|
@@ -313,14 +314,6 @@ export function seatMaintainabilityBaseline(
|
|
|
313
314
|
});
|
|
314
315
|
}
|
|
315
316
|
|
|
316
|
-
/** One coverage baseline row from a file's scores. */
|
|
317
|
-
const coverageRow = (relPath, s) => ({
|
|
318
|
-
path: relPath,
|
|
319
|
-
lines: s?.lines ?? 0,
|
|
320
|
-
branches: s?.branches ?? 0,
|
|
321
|
-
functions: s?.functions ?? 0,
|
|
322
|
-
});
|
|
323
|
-
|
|
324
317
|
/** @param {string} coveragePath @param {string[]} inScope @param {string} cwd */
|
|
325
318
|
function staleRefusal(coveragePath, inScope, cwd) {
|
|
326
319
|
return new SeatRefusal(
|
|
@@ -339,7 +332,7 @@ function measuredRows(scores, inScope, logger) {
|
|
|
339
332
|
`[Coverage] not seated — the fresh artifact did not measure: ${unmeasured.join(', ')}`,
|
|
340
333
|
);
|
|
341
334
|
}
|
|
342
|
-
return measured.map((file) =>
|
|
335
|
+
return measured.map((file) => coverageRowFromScores(file, scores[file]));
|
|
343
336
|
}
|
|
344
337
|
|
|
345
338
|
/**
|
|
@@ -141,16 +141,35 @@ export function readBaseline(cwd, fsImpl = fs) {
|
|
|
141
141
|
return normaliseParsedBaseline(JSON.parse(fsImpl.readFileSync(abs, 'utf8')));
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
/**
|
|
145
|
+
* An axis with no denominator (`null` from `scoreEntry`: a file with no
|
|
146
|
+
* branches, functions or statements) persists as 100, the istanbul/c8
|
|
147
|
+
* convention for 0/0. Persisting 0 would score a branch-free file as fully
|
|
148
|
+
* uncovered and drag the unweighted `*` rollup below its floor.
|
|
149
|
+
*/
|
|
150
|
+
const NO_DENOMINATOR_PCT = 100;
|
|
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
|
+
|
|
144
169
|
function projectFlatToRows(baseline) {
|
|
145
|
-
return Object.entries(baseline ?? {}).map(([file, scores]) =>
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
path: file,
|
|
149
|
-
lines: rest.lines ?? 0,
|
|
150
|
-
branches: rest.branches ?? 0,
|
|
151
|
-
functions: rest.functions ?? 0,
|
|
152
|
-
};
|
|
153
|
-
});
|
|
170
|
+
return Object.entries(baseline ?? {}).map(([file, scores]) =>
|
|
171
|
+
coverageRowFromScores(file, scores),
|
|
172
|
+
);
|
|
154
173
|
}
|
|
155
174
|
|
|
156
175
|
function writeEnvelopeViaFsImpl(abs, envelope, fsImpl) {
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,20 @@ 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.118.0](https://github.com/dsj1984/mandrel/compare/mandrel-v2.117.0...mandrel-v2.118.0) (2026-11-11)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
* **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))
|
|
24
|
+
|
|
25
|
+
## [2.117.0](https://github.com/dsj1984/mandrel/compare/mandrel-v2.116.0...mandrel-v2.117.0) (2026-11-11)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
* **baselines:** persist a 0/0 coverage axis as 100, not 0 (refs [#6044](https://github.com/dsj1984/mandrel/issues/6044)) ([#6045](https://github.com/dsj1984/mandrel/issues/6045)) ([e577cd4](https://github.com/dsj1984/mandrel/commit/e577cd41fac39b68228111a4a79565d090218d62))
|
|
31
|
+
|
|
18
32
|
## [2.116.0](https://github.com/dsj1984/mandrel/compare/mandrel-v2.115.0...mandrel-v2.116.0) (2026-11-10)
|
|
19
33
|
|
|
20
34
|
|
package/package.json
CHANGED