spec-controller 0.1.0-alpha.1 → 0.1.0-alpha.10

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.
Files changed (69) hide show
  1. package/README.md +112 -0
  2. package/dist/cli-args.d.ts +73 -0
  3. package/dist/cli-args.d.ts.map +1 -0
  4. package/dist/cli-args.js +114 -0
  5. package/dist/cli-args.js.map +1 -0
  6. package/dist/cli-balance/cli.d.ts +20 -20
  7. package/dist/cli-balance/cli.d.ts.map +1 -1
  8. package/dist/cli-balance/cli.js +221 -202
  9. package/dist/cli-balance/cli.js.map +1 -1
  10. package/dist/cli-balance/emit/writer.d.ts +1 -1
  11. package/dist/cli-registry.d.ts +35 -12
  12. package/dist/cli-registry.d.ts.map +1 -1
  13. package/dist/cli-registry.js +95 -36
  14. package/dist/cli-registry.js.map +1 -1
  15. package/dist/cli.d.ts +5 -3
  16. package/dist/cli.d.ts.map +1 -1
  17. package/dist/cli.js +9 -3
  18. package/dist/cli.js.map +1 -1
  19. package/dist/corpus/cli.d.ts +34 -0
  20. package/dist/corpus/cli.d.ts.map +1 -0
  21. package/dist/corpus/cli.js +125 -0
  22. package/dist/corpus/cli.js.map +1 -0
  23. package/dist/deferralTags.d.ts +3 -3
  24. package/dist/deferralTags.js +3 -3
  25. package/dist/ingest/gherkinValidation.d.ts +29 -5
  26. package/dist/ingest/gherkinValidation.d.ts.map +1 -1
  27. package/dist/ingest/gherkinValidation.js +33 -5
  28. package/dist/ingest/gherkinValidation.js.map +1 -1
  29. package/dist/ingest/ingestQualityChecks.d.ts +15 -25
  30. package/dist/ingest/ingestQualityChecks.d.ts.map +1 -1
  31. package/dist/ingest/ingestQualityChecks.js +87 -104
  32. package/dist/ingest/ingestQualityChecks.js.map +1 -1
  33. package/dist/ingest/ingestScenarios.d.ts +2 -1
  34. package/dist/ingest/ingestScenarios.d.ts.map +1 -1
  35. package/dist/ingest/ingestScenarios.js +32 -3
  36. package/dist/ingest/ingestScenarios.js.map +1 -1
  37. package/dist/run-management/resolveRunInputs.d.ts +24 -11
  38. package/dist/run-management/resolveRunInputs.d.ts.map +1 -1
  39. package/dist/run-management/resolveRunInputs.js +49 -13
  40. package/dist/run-management/resolveRunInputs.js.map +1 -1
  41. package/package.json +2 -2
  42. package/dist/mutation-ratchet/index.d.ts +0 -48
  43. package/dist/mutation-ratchet/index.d.ts.map +0 -1
  44. package/dist/mutation-ratchet/index.js +0 -48
  45. package/dist/mutation-ratchet/index.js.map +0 -1
  46. package/dist/mutation-ratchet/ratchet.d.ts +0 -129
  47. package/dist/mutation-ratchet/ratchet.d.ts.map +0 -1
  48. package/dist/mutation-ratchet/ratchet.js +0 -222
  49. package/dist/mutation-ratchet/ratchet.js.map +0 -1
  50. package/dist/mutation-ratchet/ratchetCli.d.ts +0 -57
  51. package/dist/mutation-ratchet/ratchetCli.d.ts.map +0 -1
  52. package/dist/mutation-ratchet/ratchetCli.js +0 -139
  53. package/dist/mutation-ratchet/ratchetCli.js.map +0 -1
  54. package/dist/mutation-ratchet/reconcile.d.ts +0 -82
  55. package/dist/mutation-ratchet/reconcile.d.ts.map +0 -1
  56. package/dist/mutation-ratchet/reconcile.js +0 -67
  57. package/dist/mutation-ratchet/reconcile.js.map +0 -1
  58. package/dist/mutation-ratchet/record.d.ts +0 -210
  59. package/dist/mutation-ratchet/record.d.ts.map +0 -1
  60. package/dist/mutation-ratchet/record.js +0 -330
  61. package/dist/mutation-ratchet/record.js.map +0 -1
  62. package/dist/mutation-ratchet/report.d.ts +0 -83
  63. package/dist/mutation-ratchet/report.d.ts.map +0 -1
  64. package/dist/mutation-ratchet/report.js +0 -148
  65. package/dist/mutation-ratchet/report.js.map +0 -1
  66. package/dist/mutation-ratchet/verdict.d.ts +0 -177
  67. package/dist/mutation-ratchet/verdict.d.ts.map +0 -1
  68. package/dist/mutation-ratchet/verdict.js +0 -387
  69. package/dist/mutation-ratchet/verdict.js.map +0 -1
@@ -1,210 +0,0 @@
1
- /**
2
- * A GATE'S RECORD — the pair of counts it last banked, and the allowance stated against them
3
- * (@SCN-RAT-001, 3F-2790).
4
- *
5
- * THE RECORD IS TWO COUNTS, NEVER A BARE SCORE, and that is the load-bearing choice this whole
6
- * module exists to make possible. A mutation score is detected over total, so it falls for two
7
- * entirely unrelated reasons: a mutant this suite used to kill now survives, which is the fault
8
- * the gate exists for; or new mutable code arrived carrying survivors with it, which is no fault
9
- * at all. One number reds on both, and the only cheap way out of a red for the second is to widen
10
- * the bar — which is how a floor loses its teeth. Keeping `detected` and `total` apart is what
11
- * lets the verdict tell them apart: kills lost is stated directly, and a growing population moves
12
- * `total` while leaving `detected` alone.
13
- *
14
- * NOTHING HERE NAMES A PROJECT, A CHECK, A RUNNER, A WORKFLOW OR A REPOSITORY. The record's text
15
- * arrives as a string and the name it is filed under arrives beside it, because which file holds a
16
- * project's bars, and what its gates are called, are that project's own facts. This module has an
17
- * opinion about the SHAPE of a record and none about whose it is.
18
- *
19
- * MALFORMED MEANS NO BAR, NEVER A DEFAULTED ONE. Every refusal below is a record a lenient reader
20
- * answers with a bar nobody wrote — an absent section read as "no gates to enforce", a gate that
21
- * measured nothing read as scoring zero, an allowance nobody justified read as justified. The bar
22
- * is then enforced as though somebody had written it, and the only symptom is a build that has
23
- * quietly stopped being able to red. So each one is refused by name, and the refusal says which
24
- * record it read and where in that record the fault is (@SCN-RAT-002, 3F-2792).
25
- *
26
- * IT IS NOT A STATIC CHECK, and takes no `static-check:` prefix. A static check is a pure function
27
- * of the checked-out tree; the record this reads feeds a reconciler that judges a MEASUREMENT,
28
- * which by construction is not in the tree — the standing ruling every scheduled-sweep reader in
29
- * this portfolio already carries.
30
- */
31
- /**
32
- * The section of a record file that holds every gate's counts.
33
- *
34
- * EXPORTED SO THE RECORDER CANNOT HOLD A SECOND COPY OF IT. `ratchet.ts` finds the same section in
35
- * the same text in order to rewrite two of its lines, and two spellings of one name is the
36
- * agreeing-until-somebody-edits-one shape this whole library exists to remove.
37
- *
38
- * The SECTION name is this module's, and the gate names inside it are the project's. A record file
39
- * is a project's own document and may hold whatever else that project keeps in it; what this module
40
- * asks of it is one section, under one name, so a project can file its mutation bars beside the
41
- * rest of its policy rather than in a file of their own.
42
- */
43
- export declare const MUTATION_GATES = "mutation-gates";
44
- /**
45
- * The field a refusal names when the fault is the ASK rather than a field of a gate's block — a
46
- * gate the record does not hold at all.
47
- *
48
- * EXPORTED FOR THE SAME REASON AS THE SECTION NAME: `ratchet.ts` refuses the same way when it is
49
- * asked to raise a gate no block is written for, and a refusal a reader has to recognise in two
50
- * spellings is one they will eventually parse wrongly.
51
- */
52
- export declare const WHOLE_GATE = "<gate>";
53
- /**
54
- * Raised when a record cannot be read as a bar.
55
- *
56
- * IT NAMES THE SECTION, THE GATE AND THE FIELD, because a record file is a wall of near-identical
57
- * gate blocks and a bare "invalid config" over one of them leaves a reader opening the file and
58
- * reading every block to find out which. The four together are enough to put a cursor on the line.
59
- *
60
- * ONE TYPE FOR EVERY FAULT, INCLUDING THE ONES THIS MODULE DOES NOT DETECT ITSELF. A caller is
61
- * told to catch this and nothing else, so anything it does not cover is something that caller
62
- * sails past — which is why the YAML parser's own errors are normalised into it rather than left
63
- * to travel under their own name. That is what makes "a malformed record fails loudly" a property
64
- * of the reader rather than a property of the field checks alone.
65
- */
66
- export declare class MalformedRecordError extends Error {
67
- /** The name the record was filed under, as the caller handed it over. */
68
- readonly recordFile: string;
69
- /** The section the fault sits in, or `<document>` when it sits above every section. */
70
- readonly section: string;
71
- /** The gate the fault sits under, or a placeholder when the fault is the section itself. */
72
- readonly key: string;
73
- /** The field the fault sits at. */
74
- readonly field: string;
75
- constructor(
76
- /** The name the record was filed under, as the caller handed it over. */
77
- recordFile: string,
78
- /** The section the fault sits in, or `<document>` when it sits above every section. */
79
- section: string,
80
- /** The gate the fault sits under, or a placeholder when the fault is the section itself. */
81
- key: string,
82
- /** The field the fault sits at. */
83
- field: string, detail: string);
84
- }
85
- /**
86
- * The allowance a record STATES against a gate's counts — how many kills may be lost before the
87
- * gate reds, and why that many.
88
- *
89
- * COUNTED IN MUTANTS, WITH ITS REASON, and the unit is the point. A mutant is the unit the fault
90
- * arrives in, so the arithmetic downstream is exact rather than a rounding argument; and a
91
- * non-zero allowance that cannot say why it exists is head-room rather than tolerance, which is
92
- * why the reason travels with the number rather than in a comment beside it.
93
- */
94
- export interface GateAllowance {
95
- /** Whole mutants of tolerance. Zero seats the floor exactly on the record. */
96
- readonly mutants: number;
97
- /** Why the allowance exists. */
98
- readonly reason: string;
99
- }
100
- /** One gate's last-banked measurement, and the allowance stated against it. */
101
- export interface GateRecord {
102
- /** The gate's name, as the record files it — the project's own word, never this module's. */
103
- readonly gate: string;
104
- /** Mutants the suite detected. */
105
- readonly detected: number;
106
- /** Every mutant the gate measured, detected or not. */
107
- readonly total: number;
108
- readonly allowance: GateAllowance;
109
- }
110
- /** A mutation score, as a percentage, computed from counts rather than read off a report. */
111
- export declare function scoreOf(detected: number, total: number): number;
112
- /** A percentage, at the one precision every figure in this library is stated to. */
113
- export declare function pct(value: number): string;
114
- /**
115
- * `detected/total (score%)` — the one shape every count pair in this library is stated in.
116
- *
117
- * BOTH HALVES, ALWAYS, AND THE SCORE BESIDE THEM. A message naming only the figure that moved
118
- * leaves its reader unable to see WHICH of the two moved, which is the single distinction this
119
- * library exists to make.
120
- *
121
- * IT LIVES HERE, BESIDE THE COUNTS, BECAUSE TWO READERS STATE IT. The reconciler prints it in every
122
- * verdict and the recorder prints it in its refusal, and one sentence spelled twice is the
123
- * agreeing-until-somebody-edits-one shape this library was built to remove.
124
- */
125
- export declare function counts(detected: number, total: number): string;
126
- /**
127
- * Whether one pair of counts scores strictly ABOVE another.
128
- *
129
- * CROSS-MULTIPLIED RATHER THAN DIVIDED, so the comparison is exact. Two scores equal as ratios can
130
- * differ in their last bit once each has been through a division, and a pair that did not move would
131
- * then read as one that did. The counts are whole and small enough that the products are exact.
132
- *
133
- * ONE FUNCTION READ BOTH WAYS ROUND, WHICH IS WHAT LEAVES EQUAL UNCLAIMED. Above and below are the
134
- * same two products with the arguments swapped, so no run can be claimed by both, and — the case
135
- * that matters — none can be claimed by neither. Two comparisons reached by different arithmetic
136
- * could each answer `false` for a run that is genuinely one or the other, and the run would fall out
137
- * of every reader here at once.
138
- */
139
- export declare function scoreRoseOver(detected: number, total: number, overDetected: number, overTotal: number): boolean;
140
- /**
141
- * The failing floor: the record's counts with its allowance spent out of the DETECTED count.
142
- *
143
- * SPENT FROM THE NUMERATOR, not subtracted from the score, because the allowance is counted in
144
- * mutants and a mutant is worth a different number of points in every gate — the same allowance
145
- * taken off two scores would mean two different things in two gates of different sizes.
146
- *
147
- * A REPORTED FIGURE, NOT THE DECISION VARIABLE. The verdict decides on COUNTS — fewer kills than
148
- * the record less its allowance — and prints this floor beside it so a reader has the bar in the
149
- * units the sweep speaks. The two agree exactly while the mutant population is unchanged, and part
150
- * company the moment it moves: a grown population drags the measured score below this floor with
151
- * no kill lost at all, and that case is green. Reading this floor AS the gate would put the
152
- * judgement back on the score, which is the confusion the counts model exists to prevent.
153
- */
154
- export declare function floorOf(record: GateRecord): number;
155
- /**
156
- * The failing floor in MUTANTS: the record's kills with its allowance spent out of them.
157
- *
158
- * `floorOf`'s TWIN WITHOUT THE DIVISION, and the division is the whole difference. A percentage is
159
- * two facts folded into one, and folding them is what makes a floor fall when new mutable code
160
- * arrives carrying survivors — no kill lost, and the bar missed anyway. Subtracting the allowance
161
- * and stopping leaves a whole number of mutants that moves only when a mutant this suite used to
162
- * kill stops dying, which is the one fact a bar on this axis is about.
163
- *
164
- * `total` NEVER ENTERS IT, and that is the population-independence rather than a simplification.
165
- * A reader holding this number can be handed a run over any population at all and still be asking
166
- * the only question worth asking of it.
167
- *
168
- * HERE RATHER THAN AT ITS CALLER, for the reason `floorOf` is here: how an allowance is spent is a
169
- * fact about the record, and a caller computing `detected - slack` itself would be a second place
170
- * holding it — agreeing until the day one of them is edited.
171
- */
172
- export declare function killFloorOf(record: GateRecord): number;
173
- /** The score the record itself states — what the ratchet raises and the verdict compares against. */
174
- export declare function recordedScoreOf(record: GateRecord): number;
175
- /**
176
- * Read every gate's record out of a record file's text.
177
- *
178
- * @param text the record file's own bytes, as authored
179
- * @param recordFile the name the record is filed under, so a refusal can say which file it read
180
- * @throws MalformedRecordError when the text cannot be read as a bar — one type for every fault,
181
- * the YAML parser's own included, so a caller told to catch this catches all of them.
182
- */
183
- export declare function parseGateRecords(text: string, recordFile: string): Map<string, GateRecord>;
184
- /**
185
- * The bar the record holds for one named gate, refused when the record holds no such gate.
186
- *
187
- * A GATE WITH NO RECORD IS THE ONE FAULT IN THIS MODULE THAT LOOKS LIKE NOTHING AT ALL. Every
188
- * refusal above is a record somebody wrote badly, sitting in the file a reader would go and open.
189
- * This one is a record that reads perfectly, asked for a gate it never held — a gate name mistyped
190
- * where the caller states it. The lenient answer is not a wrong bar but NO bar, which reads
191
- * downstream as a gate with nothing to enforce, and it greens for as long as the typo survives.
192
- * Nothing about the record is wrong, so nobody is ever sent to look at it (@SCN-RAT-003, 3F-2793).
193
- *
194
- * AND THE REFUSAL LISTS THE GATES THE RECORD DOES HOLD. A record's gates are near-neighbours by
195
- * construction — a project names them after the scopes it is quarantining from each other — so a
196
- * refusal naming only the gate that was asked for sends its reader to open the file and compare
197
- * spellings by eye. Listing what is held turns the typo into a one-line diagnosis.
198
- *
199
- * UNDER THE ONE REFUSAL TYPE, like every fault above it. A caller is told to catch
200
- * `MalformedRecordError` and nothing else, so an unrecorded gate raised under a second type is a
201
- * fault that caller sails straight past — the very hole the YAML parser's own errors are
202
- * normalised to close.
203
- *
204
- * @param gate the gate to resolve, as the caller names it — never a name this module knows
205
- * @param records every gate the record holds, as `parseGateRecords` read them
206
- * @param recordFile the name the record is filed under, so a refusal can say which file it read
207
- * @throws MalformedRecordError when the record holds no such gate, listing the gates it does hold
208
- */
209
- export declare function gateRecordFor(gate: string, records: Map<string, GateRecord>, recordFile: string): GateRecord;
210
- //# sourceMappingURL=record.d.ts.map
@@ -1 +0,0 @@
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E/D;AAED,oFAAoF;AACpF,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEzC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,GAChB,OAAO,CAET;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAElD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAEtD;AAED,qGAAqG;AACrG,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAE1D;AAiLD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAI1F;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,EAChC,UAAU,EAAE,MAAM,GACjB,UAAU,CAYZ"}
@@ -1,330 +0,0 @@
1
- /**
2
- * A GATE'S RECORD — the pair of counts it last banked, and the allowance stated against them
3
- * (@SCN-RAT-001, 3F-2790).
4
- *
5
- * THE RECORD IS TWO COUNTS, NEVER A BARE SCORE, and that is the load-bearing choice this whole
6
- * module exists to make possible. A mutation score is detected over total, so it falls for two
7
- * entirely unrelated reasons: a mutant this suite used to kill now survives, which is the fault
8
- * the gate exists for; or new mutable code arrived carrying survivors with it, which is no fault
9
- * at all. One number reds on both, and the only cheap way out of a red for the second is to widen
10
- * the bar — which is how a floor loses its teeth. Keeping `detected` and `total` apart is what
11
- * lets the verdict tell them apart: kills lost is stated directly, and a growing population moves
12
- * `total` while leaving `detected` alone.
13
- *
14
- * NOTHING HERE NAMES A PROJECT, A CHECK, A RUNNER, A WORKFLOW OR A REPOSITORY. The record's text
15
- * arrives as a string and the name it is filed under arrives beside it, because which file holds a
16
- * project's bars, and what its gates are called, are that project's own facts. This module has an
17
- * opinion about the SHAPE of a record and none about whose it is.
18
- *
19
- * MALFORMED MEANS NO BAR, NEVER A DEFAULTED ONE. Every refusal below is a record a lenient reader
20
- * answers with a bar nobody wrote — an absent section read as "no gates to enforce", a gate that
21
- * measured nothing read as scoring zero, an allowance nobody justified read as justified. The bar
22
- * is then enforced as though somebody had written it, and the only symptom is a build that has
23
- * quietly stopped being able to red. So each one is refused by name, and the refusal says which
24
- * record it read and where in that record the fault is (@SCN-RAT-002, 3F-2792).
25
- *
26
- * IT IS NOT A STATIC CHECK, and takes no `static-check:` prefix. A static check is a pure function
27
- * of the checked-out tree; the record this reads feeds a reconciler that judges a MEASUREMENT,
28
- * which by construction is not in the tree — the standing ruling every scheduled-sweep reader in
29
- * this portfolio already carries.
30
- */
31
- import { parse } from "yaml";
32
- /**
33
- * The section of a record file that holds every gate's counts.
34
- *
35
- * EXPORTED SO THE RECORDER CANNOT HOLD A SECOND COPY OF IT. `ratchet.ts` finds the same section in
36
- * the same text in order to rewrite two of its lines, and two spellings of one name is the
37
- * agreeing-until-somebody-edits-one shape this whole library exists to remove.
38
- *
39
- * The SECTION name is this module's, and the gate names inside it are the project's. A record file
40
- * is a project's own document and may hold whatever else that project keeps in it; what this module
41
- * asks of it is one section, under one name, so a project can file its mutation bars beside the
42
- * rest of its policy rather than in a file of their own.
43
- */
44
- export const MUTATION_GATES = "mutation-gates";
45
- /**
46
- * The document itself, when the fault is above any one gate — a record whose top level is not a
47
- * mapping of sections, or one the YAML parser could not read at all.
48
- *
49
- * A PLACEHOLDER RATHER THAN A GATE NAME, and it is spelled here so the two readers that use it
50
- * cannot drift apart. A refusal always names a section and a key so that a reader who has one
51
- * message in front of them never has to work out which shape of message they are holding.
52
- */
53
- const WHOLE_DOCUMENT = "<document>";
54
- /** The key a document-level refusal names, there being no gate to name. */
55
- const DOCUMENT_ROOT = "root";
56
- /** The key a section-level refusal names, the fault being the section itself rather than a gate. */
57
- const WHOLE_SECTION = "<section>";
58
- /**
59
- * The field a refusal names when the fault is the ASK rather than a field of a gate's block — a
60
- * gate the record does not hold at all.
61
- *
62
- * EXPORTED FOR THE SAME REASON AS THE SECTION NAME: `ratchet.ts` refuses the same way when it is
63
- * asked to raise a gate no block is written for, and a refusal a reader has to recognise in two
64
- * spellings is one they will eventually parse wrongly.
65
- */
66
- export const WHOLE_GATE = "<gate>";
67
- /**
68
- * Raised when a record cannot be read as a bar.
69
- *
70
- * IT NAMES THE SECTION, THE GATE AND THE FIELD, because a record file is a wall of near-identical
71
- * gate blocks and a bare "invalid config" over one of them leaves a reader opening the file and
72
- * reading every block to find out which. The four together are enough to put a cursor on the line.
73
- *
74
- * ONE TYPE FOR EVERY FAULT, INCLUDING THE ONES THIS MODULE DOES NOT DETECT ITSELF. A caller is
75
- * told to catch this and nothing else, so anything it does not cover is something that caller
76
- * sails past — which is why the YAML parser's own errors are normalised into it rather than left
77
- * to travel under their own name. That is what makes "a malformed record fails loudly" a property
78
- * of the reader rather than a property of the field checks alone.
79
- */
80
- export class MalformedRecordError extends Error {
81
- recordFile;
82
- section;
83
- key;
84
- field;
85
- constructor(
86
- /** The name the record was filed under, as the caller handed it over. */
87
- recordFile,
88
- /** The section the fault sits in, or `<document>` when it sits above every section. */
89
- section,
90
- /** The gate the fault sits under, or a placeholder when the fault is the section itself. */
91
- key,
92
- /** The field the fault sits at. */
93
- field, detail) {
94
- super(`${recordFile}: ${section} "${key}" is malformed at ${field}: ${detail}`);
95
- this.recordFile = recordFile;
96
- this.section = section;
97
- this.key = key;
98
- this.field = field;
99
- this.name = "MalformedRecordError";
100
- }
101
- }
102
- /** A mutation score, as a percentage, computed from counts rather than read off a report. */
103
- export function scoreOf(detected, total) {
104
- return (detected / total) * 100;
105
- }
106
- /** A percentage, at the one precision every figure in this library is stated to. */
107
- export function pct(value) {
108
- return value.toFixed(4);
109
- }
110
- /**
111
- * `detected/total (score%)` — the one shape every count pair in this library is stated in.
112
- *
113
- * BOTH HALVES, ALWAYS, AND THE SCORE BESIDE THEM. A message naming only the figure that moved
114
- * leaves its reader unable to see WHICH of the two moved, which is the single distinction this
115
- * library exists to make.
116
- *
117
- * IT LIVES HERE, BESIDE THE COUNTS, BECAUSE TWO READERS STATE IT. The reconciler prints it in every
118
- * verdict and the recorder prints it in its refusal, and one sentence spelled twice is the
119
- * agreeing-until-somebody-edits-one shape this library was built to remove.
120
- */
121
- export function counts(detected, total) {
122
- return `${detected}/${total} (${pct(scoreOf(detected, total))}%)`;
123
- }
124
- /**
125
- * Whether one pair of counts scores strictly ABOVE another.
126
- *
127
- * CROSS-MULTIPLIED RATHER THAN DIVIDED, so the comparison is exact. Two scores equal as ratios can
128
- * differ in their last bit once each has been through a division, and a pair that did not move would
129
- * then read as one that did. The counts are whole and small enough that the products are exact.
130
- *
131
- * ONE FUNCTION READ BOTH WAYS ROUND, WHICH IS WHAT LEAVES EQUAL UNCLAIMED. Above and below are the
132
- * same two products with the arguments swapped, so no run can be claimed by both, and — the case
133
- * that matters — none can be claimed by neither. Two comparisons reached by different arithmetic
134
- * could each answer `false` for a run that is genuinely one or the other, and the run would fall out
135
- * of every reader here at once.
136
- */
137
- export function scoreRoseOver(detected, total, overDetected, overTotal) {
138
- return detected * overTotal > overDetected * total;
139
- }
140
- /**
141
- * The failing floor: the record's counts with its allowance spent out of the DETECTED count.
142
- *
143
- * SPENT FROM THE NUMERATOR, not subtracted from the score, because the allowance is counted in
144
- * mutants and a mutant is worth a different number of points in every gate — the same allowance
145
- * taken off two scores would mean two different things in two gates of different sizes.
146
- *
147
- * A REPORTED FIGURE, NOT THE DECISION VARIABLE. The verdict decides on COUNTS — fewer kills than
148
- * the record less its allowance — and prints this floor beside it so a reader has the bar in the
149
- * units the sweep speaks. The two agree exactly while the mutant population is unchanged, and part
150
- * company the moment it moves: a grown population drags the measured score below this floor with
151
- * no kill lost at all, and that case is green. Reading this floor AS the gate would put the
152
- * judgement back on the score, which is the confusion the counts model exists to prevent.
153
- */
154
- export function floorOf(record) {
155
- return scoreOf(record.detected - record.allowance.mutants, record.total);
156
- }
157
- /**
158
- * The failing floor in MUTANTS: the record's kills with its allowance spent out of them.
159
- *
160
- * `floorOf`'s TWIN WITHOUT THE DIVISION, and the division is the whole difference. A percentage is
161
- * two facts folded into one, and folding them is what makes a floor fall when new mutable code
162
- * arrives carrying survivors — no kill lost, and the bar missed anyway. Subtracting the allowance
163
- * and stopping leaves a whole number of mutants that moves only when a mutant this suite used to
164
- * kill stops dying, which is the one fact a bar on this axis is about.
165
- *
166
- * `total` NEVER ENTERS IT, and that is the population-independence rather than a simplification.
167
- * A reader holding this number can be handed a run over any population at all and still be asking
168
- * the only question worth asking of it.
169
- *
170
- * HERE RATHER THAN AT ITS CALLER, for the reason `floorOf` is here: how an allowance is spent is a
171
- * fact about the record, and a caller computing `detected - slack` itself would be a second place
172
- * holding it — agreeing until the day one of them is edited.
173
- */
174
- export function killFloorOf(record) {
175
- return record.detected - record.allowance.mutants;
176
- }
177
- /** The score the record itself states — what the ratchet raises and the verdict compares against. */
178
- export function recordedScoreOf(record) {
179
- return scoreOf(record.detected, record.total);
180
- }
181
- /**
182
- * Read the record's text into a document mapping.
183
- *
184
- * THE YAML PARSER'S OWN DETECTIONS ARE REAL, AND THEY ARRIVE UNDER SOMEONE ELSE'S NAME. A gate
185
- * recorded twice raises `YAMLParseError` before this module sees a mapping at all — a genuine
186
- * catch, and one a caller that was told to catch `MalformedRecordError` walks straight past. So it
187
- * is caught here and re-raised as this module's own refusal, carrying the parser's message as the
188
- * detail so nothing about WHAT was wrong is lost on the way across.
189
- */
190
- function documentOf(text, recordFile) {
191
- let read;
192
- try {
193
- read = parse(text);
194
- }
195
- catch (cause) {
196
- const detail = cause instanceof Error ? cause.message : String(cause);
197
- throw new MalformedRecordError(recordFile, WHOLE_DOCUMENT, DOCUMENT_ROOT, "yaml", detail);
198
- }
199
- if (!isMapping(read)) {
200
- throw new MalformedRecordError(recordFile, WHOLE_DOCUMENT, DOCUMENT_ROOT, DOCUMENT_ROOT, "the top level must be a mapping of sections.");
201
- }
202
- return read;
203
- }
204
- /** Whether a value read out of the record is a block of named fields, rather than a list or scalar. */
205
- function isMapping(value) {
206
- return typeof value === "object" && value !== null && !Array.isArray(value);
207
- }
208
- /**
209
- * The section holding every gate, refused when it is absent or holds no gate.
210
- *
211
- * REQUIRED, NEVER DEFAULTED, and the two refusals are one fault at two depths. A record with no
212
- * section reads as "no gates to enforce"; a section with no gate reads as a bar that enforces
213
- * nothing. Both hand back a green that was never earned, which is the vacuous pass this whole
214
- * apparatus exists to close, so neither is allowed to be the answer.
215
- */
216
- function gatesSectionOf(text, recordFile) {
217
- const section = documentOf(text, recordFile)[MUTATION_GATES];
218
- if (!isMapping(section)) {
219
- throw new MalformedRecordError(recordFile, MUTATION_GATES, WHOLE_SECTION, MUTATION_GATES, "the section is missing, or is not a mapping of gate name to record.");
220
- }
221
- const entries = Object.entries(section);
222
- if (entries.length === 0) {
223
- throw new MalformedRecordError(recordFile, MUTATION_GATES, WHOLE_SECTION, MUTATION_GATES, "at least one gate must be recorded — an empty section is a bar that enforces nothing.");
224
- }
225
- return entries;
226
- }
227
- /**
228
- * One field, read as a whole, non-negative count of mutants.
229
- *
230
- * THE UNIT IS THE MUTANT, so a fraction is not a smaller count — it is a number that came from
231
- * somewhere other than counting, and the arithmetic downstream is exact precisely because nothing
232
- * here ever rounds.
233
- */
234
- function countAt(gate, entry, field, recordFile) {
235
- const raw = entry[field];
236
- if (typeof raw !== "number" || !Number.isInteger(raw) || raw < 0) {
237
- throw new MalformedRecordError(recordFile, MUTATION_GATES, gate, field, "expected a whole number of mutants.");
238
- }
239
- return raw;
240
- }
241
- /**
242
- * The allowance the record states, refused when it cannot be spent or cannot say why it exists.
243
- *
244
- * AN ALLOWANCE NOBODY CAN JUSTIFY IS HEAD-ROOM, NOT TOLERANCE, and head-room admitted at read time
245
- * is a bar nobody wrote being enforced as though somebody had. It is refused HERE rather than left
246
- * to the reconciler, because by the time a verdict is being computed the unjustified allowance has
247
- * already become part of the bar. A ZERO allowance needs no reason: there is nothing to justify.
248
- *
249
- * WIDER THAN THE KILLS IT IS SPENT FROM IS THE OTHER WAY THE SAME BAR VANISHES. The allowance comes
250
- * out of the recorded kills, so one wider than them puts the floor below zero, and a gate whose
251
- * floor is below zero cannot red for any measurement at all.
252
- */
253
- function allowanceOf(gate, entry, detected, recordFile) {
254
- const mutants = countAt(gate, entry, "slack-mutants", recordFile);
255
- if (mutants > detected) {
256
- throw new MalformedRecordError(recordFile, MUTATION_GATES, gate, "slack-mutants", `${mutants} is wider than the ${detected} kills it is spent from.`);
257
- }
258
- const stated = entry["slack-reason"];
259
- const reason = typeof stated === "string" ? stated.trim() : "";
260
- if (mutants > 0 && reason === "") {
261
- throw new MalformedRecordError(recordFile, MUTATION_GATES, gate, "slack-reason", "a non-zero allowance must say why it exists — one nobody can justify is head-room.");
262
- }
263
- return { mutants, reason };
264
- }
265
- /**
266
- * One gate's entry, read into its record.
267
- *
268
- * `total` IS READ AND REFUSED BEFORE `detected`, WHICH IS THE ORDER AND NOT AN ACCIDENT. A gate
269
- * that measured no mutants has no score — the division is undefined — so there is nothing for a
270
- * kill count to be compared against, and refusing at `detected` first would name the wrong field
271
- * in the message a reader is trying to act on.
272
- */
273
- function recordOf(gate, raw, recordFile) {
274
- if (!isMapping(raw)) {
275
- throw new MalformedRecordError(recordFile, MUTATION_GATES, gate, "<entry>", "expected a block of fields.");
276
- }
277
- const total = countAt(gate, raw, "total", recordFile);
278
- if (total === 0) {
279
- throw new MalformedRecordError(recordFile, MUTATION_GATES, gate, "total", "a gate that measured no mutants has no score.");
280
- }
281
- const detected = countAt(gate, raw, "detected", recordFile);
282
- if (detected > total) {
283
- throw new MalformedRecordError(recordFile, MUTATION_GATES, gate, "detected", `${detected} kills over ${total} mutants — a gate cannot detect more than it measured.`);
284
- }
285
- return { gate, detected, total, allowance: allowanceOf(gate, raw, detected, recordFile) };
286
- }
287
- /**
288
- * Read every gate's record out of a record file's text.
289
- *
290
- * @param text the record file's own bytes, as authored
291
- * @param recordFile the name the record is filed under, so a refusal can say which file it read
292
- * @throws MalformedRecordError when the text cannot be read as a bar — one type for every fault,
293
- * the YAML parser's own included, so a caller told to catch this catches all of them.
294
- */
295
- export function parseGateRecords(text, recordFile) {
296
- return new Map(gatesSectionOf(text, recordFile).map(([gate, raw]) => [gate, recordOf(gate, raw, recordFile)]));
297
- }
298
- /**
299
- * The bar the record holds for one named gate, refused when the record holds no such gate.
300
- *
301
- * A GATE WITH NO RECORD IS THE ONE FAULT IN THIS MODULE THAT LOOKS LIKE NOTHING AT ALL. Every
302
- * refusal above is a record somebody wrote badly, sitting in the file a reader would go and open.
303
- * This one is a record that reads perfectly, asked for a gate it never held — a gate name mistyped
304
- * where the caller states it. The lenient answer is not a wrong bar but NO bar, which reads
305
- * downstream as a gate with nothing to enforce, and it greens for as long as the typo survives.
306
- * Nothing about the record is wrong, so nobody is ever sent to look at it (@SCN-RAT-003, 3F-2793).
307
- *
308
- * AND THE REFUSAL LISTS THE GATES THE RECORD DOES HOLD. A record's gates are near-neighbours by
309
- * construction — a project names them after the scopes it is quarantining from each other — so a
310
- * refusal naming only the gate that was asked for sends its reader to open the file and compare
311
- * spellings by eye. Listing what is held turns the typo into a one-line diagnosis.
312
- *
313
- * UNDER THE ONE REFUSAL TYPE, like every fault above it. A caller is told to catch
314
- * `MalformedRecordError` and nothing else, so an unrecorded gate raised under a second type is a
315
- * fault that caller sails straight past — the very hole the YAML parser's own errors are
316
- * normalised to close.
317
- *
318
- * @param gate the gate to resolve, as the caller names it — never a name this module knows
319
- * @param records every gate the record holds, as `parseGateRecords` read them
320
- * @param recordFile the name the record is filed under, so a refusal can say which file it read
321
- * @throws MalformedRecordError when the record holds no such gate, listing the gates it does hold
322
- */
323
- export function gateRecordFor(gate, records, recordFile) {
324
- const record = records.get(gate);
325
- if (record === undefined) {
326
- throw new MalformedRecordError(recordFile, MUTATION_GATES, gate, WHOLE_GATE, `no bar is recorded for this gate (recorded: ${[...records.keys()].join(", ")}).`);
327
- }
328
- return record;
329
- }
330
- //# sourceMappingURL=record.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"record.js","sourceRoot":"","sources":["../../src/mutation-ratchet/record.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAE7B;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAE/C;;;;;;;GAOG;AACH,MAAM,cAAc,GAAG,YAAY,CAAC;AAEpC,2EAA2E;AAC3E,MAAM,aAAa,GAAG,MAAM,CAAC;AAE7B,oGAAoG;AACpG,MAAM,aAAa,GAAG,WAAW,CAAC;AAElC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC;AAEnC;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAGlC;IAEA;IAEA;IAEA;IARX;IACE,yEAAyE;IAChE,UAAkB;IAC3B,uFAAuF;IAC9E,OAAe;IACxB,4FAA4F;IACnF,GAAW;IACpB,mCAAmC;IAC1B,KAAa,EACtB,MAAc;QAEd,KAAK,CAAC,GAAG,UAAU,KAAK,OAAO,KAAK,GAAG,qBAAqB,KAAK,KAAK,MAAM,EAAE,CAAC,CAAC;QATvE,eAAU,GAAV,UAAU,CAAQ;QAElB,YAAO,GAAP,OAAO,CAAQ;QAEf,QAAG,GAAH,GAAG,CAAQ;QAEX,UAAK,G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CAAC,CAC/F,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,aAAa,CAC3B,IAAY,EACZ,OAAgC,EAChC,UAAkB;IAElB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,IAAI,oBAAoB,CAC5B,UAAU,EACV,cAAc,EACd,IAAI,EACJ,UAAU,EACV,+CAA+C,CAAC,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAClF,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,83 +0,0 @@
1
- /**
2
- * THE MEASUREMENT — a gate's run, counted out of its mutation report's own mutants
3
- * (@SCN-RAT-010, 3F-2799).
4
- *
5
- * STATED, NEVER INFERRED, AND THAT IS THE WHOLE MODULE. A mutation report groups its mutants by
6
- * the file they were made in and gives each one a status. The metric scores two of those statuses
7
- * over four: the kills are the killed and the timed-out, and the population is those plus the
8
- * survived and the never-covered. Both sets are written down below, member by member, and the four
9
- * statuses left over — a mutant that would not compile, one that faulted at run time, one the run
10
- * was told to ignore, and one that never got as far as being tried — are in neither.
11
- *
12
- * THE LENIENT READING IS ONE SENTENCE LONG, AND IT IS WRONG. "Everything not detected is
13
- * undetected" reaches a population without anybody having to write a second set down, and it folds
14
- * all four of those statuses into the denominator. A mutant that would not compile is not a
15
- * survivor: nobody's assertion failed to catch it, because there was never anything there to catch.
16
- * So that reading answers with a score which disagrees with the one the run itself printed —
17
- * quietly, and in the direction of looking worse — and a reconciler holding a second opinion about
18
- * the very number it is reconciling has stopped being one. Naming the two sets is what makes that
19
- * disagreement impossible rather than merely unlikely.
20
- *
21
- * AND THE REPORT'S OWN THRESHOLDS ARE NOT READ, WHICH IS THE SAME RULING ONE ARTEFACT FURTHER OUT.
22
- * A report carries the thresholds its own run was configured against, and reading them would be
23
- * taking the runner's verdict on its own homework as the measurement. The bar lives in the record
24
- * (`record.ts`), and the report is only ever asked what happened. Every figure produced here is
25
- * counted from the mutants; every other number in the document is left where it lies, however
26
- * conveniently it is shaped.
27
- *
28
- * THE COUNTS ARE TAKEN ACROSS THE WHOLE REPORT RATHER THAN A FILE OF IT. The grouping is
29
- * presentation and nothing more — a gate's population is every mutant under it, wherever the report
30
- * chose to file it. A counter that stopped at the first file would be green against every report
31
- * holding exactly one, which is the shape a small fixture takes by default.
32
- *
33
- * AND A REPORT THAT CANNOT BE READ, OR THAT HOLDS NO SCORED MUTANT AT ALL, IS REFUSED RATHER THAN
34
- * SCORED ZERO (@SCN-RAT-009). Zero is a measurement — a run that mutated the scope and killed none
35
- * of it — and the two must not be spelled the same, because reconciling a zero reaches a regression
36
- * whose message sends its reader hunting kills that in this case never happened. The refusal comes
37
- * back as a value rather than a throw, so a caller cannot drop it by forgetting to catch.
38
- *
39
- * NOTHING HERE NAMES A PROJECT, A CHECK, A RUNNER, A WORKFLOW OR A REPOSITORY. The shape read below
40
- * is the report FORMAT's, which is nobody's installation, and the gate's name arrives from the
41
- * caller rather than out of the document.
42
- */
43
- import type { MutationMeasurement } from "./verdict.js";
44
- /**
45
- * A report read: the measurement, or the reason there is not one (@SCN-RAT-009, 3F-2800).
46
- *
47
- * A REFUSAL IS A RESULT, NEVER AN EXCEPTION THE CALLER MAY FORGET TO CATCH. Reading a report is the
48
- * one step of this library that reaches for something outside its own arguments, so it is the one
49
- * step that can fail for reasons nothing in the record explains. A throw would be a fault every
50
- * caller has to remember to catch, and the caller who forgets reports whatever their surroundings
51
- * do with an uncaught one — on a good day a red nobody can read, on a bad one a step never reached.
52
- * Handed back as a value, the refusal is impossible to drop by omission: there is no measurement to
53
- * read out of it until its `ok` has been asked about.
54
- */
55
- export type MutationReportRead = {
56
- readonly ok: true;
57
- readonly measurement: MutationMeasurement;
58
- } | {
59
- readonly ok: false;
60
- readonly reason: string;
61
- };
62
- /**
63
- * Count a gate's measurement out of its report's text, or say why there is not one.
64
- *
65
- * THE GATE IS THE CALLER'S WORD FOR IT. A report says which files were mutated and nothing about
66
- * which gate was being run, so a name taken from the document would be a name this module invented.
67
- *
68
- * AND SO IS THE PATH, WHICH IS CARRIED PURELY SO A REFUSAL CAN NAME IT — the same reason
69
- * `parseGateRecords` carries the record file's name. Text has no path of its own, and "no
70
- * measurement" over a path nothing writes to and "no measurement" over a sweep that never ran are
71
- * the same sentence with entirely different fixes.
72
- */
73
- export declare function measurementFromReport(gate: string, text: string, reportPath: string): MutationReportRead;
74
- /**
75
- * Read a gate's measurement off the tree, refusing an absent report by the path it was sought at.
76
- *
77
- * THE PATH ARRIVES RESOLVED, AND THAT IS THE WHOLE OF THIS MODULE'S OPINION ABOUT WHERE A TREE IS.
78
- * A reader that joined a root of its own — its own installed location, or wherever the process
79
- * happened to start — is correct only while those coincide with the caller's, which they stop
80
- * doing the moment this ships as something another repository installs.
81
- */
82
- export declare function readMutationReport(gate: string, reportPath: string): MutationReportRead;
83
- //# sourceMappingURL=report.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/mutation-ratchet/report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,kBAAkB,GAC1B;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAA;CAAE,GAChE;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AA+DpD;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,GACjB,kBAAkB,CAoBpB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,kBAAkB,CAWvF"}