spec-controller 0.1.0-alpha.4 → 0.1.0-alpha.41
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/README.md +34 -6
- package/dist/cli-allocate/cli.d.ts +2 -0
- package/dist/cli-allocate/cli.d.ts.map +1 -0
- package/dist/cli-allocate/cli.js +57 -0
- package/dist/cli-allocate/cli.js.map +1 -0
- package/dist/cli-allocate/readHistory.d.ts +29 -0
- package/dist/cli-allocate/readHistory.d.ts.map +1 -0
- package/dist/cli-allocate/readHistory.js +136 -0
- package/dist/cli-allocate/readHistory.js.map +1 -0
- package/dist/cli-allocate/readParts.d.ts +3 -0
- package/dist/cli-allocate/readParts.d.ts.map +1 -0
- package/dist/cli-allocate/readParts.js +28 -0
- package/dist/cli-allocate/readParts.js.map +1 -0
- package/dist/cli-allocate/readTree.d.ts +16 -0
- package/dist/cli-allocate/readTree.d.ts.map +1 -0
- package/dist/cli-allocate/readTree.js +106 -0
- package/dist/cli-allocate/readTree.js.map +1 -0
- package/dist/cli-allocate/refStore.d.ts +3 -0
- package/dist/cli-allocate/refStore.d.ts.map +1 -0
- package/dist/cli-allocate/refStore.js +47 -0
- package/dist/cli-allocate/refStore.js.map +1 -0
- package/dist/cli-allocate/request.d.ts +11 -0
- package/dist/cli-allocate/request.d.ts.map +1 -0
- package/dist/cli-allocate/request.js +29 -0
- package/dist/cli-allocate/request.js.map +1 -0
- package/dist/cli-allocate/stderr.d.ts +14 -0
- package/dist/cli-allocate/stderr.d.ts.map +1 -0
- package/dist/cli-allocate/stderr.js +33 -0
- package/dist/cli-allocate/stderr.js.map +1 -0
- package/dist/cli-allocate/unreadable.d.ts +24 -0
- package/dist/cli-allocate/unreadable.d.ts.map +1 -0
- package/dist/cli-allocate/unreadable.js +43 -0
- package/dist/cli-allocate/unreadable.js.map +1 -0
- package/dist/cli-args.d.ts +73 -18
- package/dist/cli-args.d.ts.map +1 -1
- package/dist/cli-args.js +244 -22
- package/dist/cli-args.js.map +1 -1
- package/dist/cli-balance/cli.d.ts +31 -13
- package/dist/cli-balance/cli.d.ts.map +1 -1
- package/dist/cli-balance/cli.js +206 -251
- package/dist/cli-balance/cli.js.map +1 -1
- package/dist/cli-balance/emit/format.d.ts +18 -1
- package/dist/cli-balance/emit/format.d.ts.map +1 -1
- package/dist/cli-balance/emit/format.js +27 -2
- package/dist/cli-balance/emit/format.js.map +1 -1
- package/dist/cli-balance/emit/writer.d.ts +11 -25
- package/dist/cli-balance/emit/writer.d.ts.map +1 -1
- package/dist/cli-balance/emit/writer.js +58 -33
- package/dist/cli-balance/emit/writer.js.map +1 -1
- package/dist/cli-balance/exitStatus.d.ts +3 -0
- package/dist/cli-balance/exitStatus.d.ts.map +1 -0
- package/dist/cli-balance/exitStatus.js +12 -0
- package/dist/cli-balance/exitStatus.js.map +1 -0
- package/dist/cli-balance/reRender.d.ts +22 -0
- package/dist/cli-balance/reRender.d.ts.map +1 -0
- package/dist/cli-balance/reRender.js +36 -0
- package/dist/cli-balance/reRender.js.map +1 -0
- package/dist/cli-balance/unreadableInputs.d.ts +35 -0
- package/dist/cli-balance/unreadableInputs.d.ts.map +1 -0
- package/dist/cli-balance/unreadableInputs.js +101 -0
- package/dist/cli-balance/unreadableInputs.js.map +1 -0
- package/dist/cli-registry.d.ts +28 -0
- package/dist/cli-registry.d.ts.map +1 -1
- package/dist/cli-registry.js +40 -35
- package/dist/cli-registry.js.map +1 -1
- package/dist/cli.d.ts +4 -5
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +38 -22
- package/dist/cli.js.map +1 -1
- package/dist/host.d.ts +33 -3
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +153 -17
- package/dist/host.js.map +1 -1
- package/dist/ingest/gherkinValidation.d.ts +3 -7
- package/dist/ingest/gherkinValidation.d.ts.map +1 -1
- package/dist/ingest/gherkinValidation.js +3 -7
- package/dist/ingest/gherkinValidation.js.map +1 -1
- package/dist/ingest/ingestQualityChecks.d.ts +25 -54
- package/dist/ingest/ingestQualityChecks.d.ts.map +1 -1
- package/dist/ingest/ingestQualityChecks.js +112 -145
- package/dist/ingest/ingestQualityChecks.js.map +1 -1
- package/dist/ingest/ingestScenarios.d.ts +11 -17
- package/dist/ingest/ingestScenarios.d.ts.map +1 -1
- package/dist/ingest/ingestScenarios.js +52 -62
- package/dist/ingest/ingestScenarios.js.map +1 -1
- package/dist/ingest/inputShapes.d.ts +47 -0
- package/dist/ingest/inputShapes.d.ts.map +1 -0
- package/dist/ingest/inputShapes.js +143 -0
- package/dist/ingest/inputShapes.js.map +1 -0
- package/dist/outputLocation.d.ts +48 -0
- package/dist/outputLocation.d.ts.map +1 -0
- package/dist/outputLocation.js +140 -0
- package/dist/outputLocation.js.map +1 -0
- package/dist/run-management/keptRun.d.ts +29 -25
- package/dist/run-management/keptRun.d.ts.map +1 -1
- package/dist/run-management/keptRun.js +25 -21
- package/dist/run-management/keptRun.js.map +1 -1
- package/dist/storedRun.d.ts +27 -0
- package/dist/storedRun.d.ts.map +1 -0
- package/dist/storedRun.js +49 -0
- package/dist/storedRun.js.map +1 -0
- package/package.json +2 -2
- package/dist/corpus/cli.d.ts +0 -34
- package/dist/corpus/cli.d.ts.map +0 -1
- package/dist/corpus/cli.js +0 -128
- package/dist/corpus/cli.js.map +0 -1
- package/dist/mutation-ratchet/index.d.ts +0 -51
- package/dist/mutation-ratchet/index.d.ts.map +0 -1
- package/dist/mutation-ratchet/index.js +0 -51
- package/dist/mutation-ratchet/index.js.map +0 -1
- package/dist/mutation-ratchet/record.d.ts +0 -178
- package/dist/mutation-ratchet/record.d.ts.map +0 -1
- package/dist/mutation-ratchet/record.js +0 -314
- package/dist/mutation-ratchet/record.js.map +0 -1
- package/dist/mutation-ratchet/report.d.ts +0 -109
- package/dist/mutation-ratchet/report.d.ts.map +0 -1
- package/dist/mutation-ratchet/report.js +0 -156
- package/dist/mutation-ratchet/report.js.map +0 -1
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* THE MODULE'S OWN SURFACE — curated symbol by symbol, never a re-export of the tree behind it
|
|
3
|
-
* (3F-2804, 3F-3337).
|
|
4
|
-
*
|
|
5
|
-
* WHAT IS BEHIND THIS BARREL NOW IS TWO READERS, AND THE RATCHET THEY WERE BUILT FOR IS GONE
|
|
6
|
-
* (3F-3337). `record.ts` reads a target's banked gate record and hands back the kill floor it
|
|
7
|
-
* implies; `report.ts` counts a mutation report's own mutants into a measurement. What left with
|
|
8
|
-
* the ratchet is everything that COMPARED the two — the verdicts, the up-only recorder, the
|
|
9
|
-
* reconciliation entry and the command that ended on it — because this repository's gate is now a
|
|
10
|
-
* per-mutant comparison the runner keeps, and nothing types a mutation count here any more.
|
|
11
|
-
*
|
|
12
|
-
* ITS TWO CONSUMERS ARE BOTH IN THIS TREE, AND THEY WANT DIFFERENT HALVES. `ingest/
|
|
13
|
-
* ingestQualityChecks.ts` wants the RECORD half: the engine's `mutationGate` bar kind lets a target
|
|
14
|
-
* author a fitness row naming a gate instead of a figure, which is a published capability decided
|
|
15
|
-
* over a target's own record (@SCN-MUT-012, @SCN-MUT-013). `tests/checks/mutationScoreCli.ts` wants
|
|
16
|
-
* the REPORT half: `pnpm mutation:score` takes the two counts out of a sweep's report and divides
|
|
17
|
-
* them (@SCN-MUT-007, @SCN-MUT-008). Neither wants the other's, which is why both are named here
|
|
18
|
-
* rather than the tree behind them being passed on wholesale.
|
|
19
|
-
*
|
|
20
|
-
* A BARREL THAT RE-EXPORTED EVERY MODULE WOULD BE A CONTRACT NOBODY WROTE. Each module below
|
|
21
|
-
* exports what its own siblings need from it, and sibling-visibility is a much wider set than
|
|
22
|
-
* consumer-visibility. Passing that set on wholesale would freeze every one of them as something a
|
|
23
|
-
* caller may depend on, and the first refactor that moved one would be a breaking change nobody
|
|
24
|
-
* meant to make. So this file names what a caller may hold and the omissions are decisions.
|
|
25
|
-
*
|
|
26
|
-
* THE KILL FLOOR IS THE BAR, AND IT IS NOT A SCORE (3F-2788). `killFloorOf` answers a ledger
|
|
27
|
-
* holding a measured row to the figure a gate's own record implies, in mutants — a percentage would
|
|
28
|
-
* fold the kill lost and the population grown into one number, which is the distinction a bar on
|
|
29
|
-
* this axis exists to keep. A consumer that derived it instead would be the second place knowing
|
|
30
|
-
* how an allowance is spent.
|
|
31
|
-
*
|
|
32
|
-
* THE TYPES ARE SPELLED FOR A CONSUMER'S NAMESPACE RATHER THAN FOR THIS MODULE'S. `GateRecord` is
|
|
33
|
-
* unambiguous inside a directory about nothing else; imported into a repository that has gates of
|
|
34
|
-
* several kinds it is not, so it crosses this line under the fuller name. The aliasing is
|
|
35
|
-
* deliberate and one-directional: the internal spelling stays internal.
|
|
36
|
-
*
|
|
37
|
-
* AND NO DRIFT GUARD STANDS OVER IT, WHICH IS A DECISION RATHER THAN AN OPEN QUESTION. 3F-2859
|
|
38
|
-
* stopped publishing this barrel: no manifest key resolves here, and no caller outside this
|
|
39
|
-
* repository can spell the specifier at all. Freezing the list would make every refactor behind it
|
|
40
|
-
* a change to a contract nobody holds.
|
|
41
|
-
*
|
|
42
|
-
* THE COMPARISON THIS PARAGRAPH USED TO DRAW IS GONE, AND SAYING SO IS THE POINT. It read: the
|
|
43
|
-
* sibling core package's barrel IS reflected and compared against a frozen list in both directions,
|
|
44
|
-
* so a symbol quietly added or dropped reds — that being what a PUBLISHED surface is owed, and this
|
|
45
|
-
* one is not published. At 3F-3449 that arm was deleted with the rest of the packaging checks this
|
|
46
|
-
* repository wrote for itself, so NEITHER barrel is guarded now and the contrast no longer carries
|
|
47
|
-
* the argument. What still carries it is the second sentence above, which never depended on it.
|
|
48
|
-
*/
|
|
49
|
-
export { floorOf, gateRecordFor, killFloorOf, MalformedRecordError, parseGateRecords, RECORD_FILE, } from "./record.js";
|
|
50
|
-
export { measurementFromReport, readMutationReport, } from "./report.js";
|
|
51
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mutation-ratchet/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,EACL,OAAO,EACP,aAAa,EACb,WAAW,EACX,oBAAoB,EACpB,gBAAgB,EAChB,WAAW,GAEZ,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,qBAAqB,EACrB,kBAAkB,GAGnB,MAAM,aAAa,CAAC"}
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A GATE'S RECORD — the pair of counts it last banked, and the allowance stated against them
|
|
3
|
-
* (@SCN-MUT-012, 3F-2790, 3F-3337).
|
|
4
|
-
*
|
|
5
|
-
* THE RATCHET THAT ONCE RECONCILED AGAINST THIS IS GONE; THE READER IS NOT (3F-3337). What reaches
|
|
6
|
-
* this module now is the engine's `mutationGate` bar kind, through `ingestQualityChecks.ts`: a
|
|
7
|
-
* target may author a fitness row whose bar names a gate rather than a figure, and the kill floor
|
|
8
|
-
* that gate's record implies is the bar the ledger then holds it to. That is a published
|
|
9
|
-
* capability, decided over a TARGET'S record, and this repository no longer keeps one of its own.
|
|
10
|
-
* @SCN-MUT-012 and @SCN-MUT-013 are what specify it — the second carrying, as its own Examples,
|
|
11
|
-
* the record that holds no gate of that name, the record that is not there to be read and the
|
|
12
|
-
* record holding text nothing can read as a record.
|
|
13
|
-
*
|
|
14
|
-
* THE RECORD IS TWO COUNTS, NEVER A BARE SCORE, and that is the load-bearing choice this whole
|
|
15
|
-
* module exists to make possible. A mutation score is detected over total, so it falls for two
|
|
16
|
-
* entirely unrelated reasons: a mutant this suite used to kill now survives, which is the fault
|
|
17
|
-
* the gate exists for; or new mutable code arrived carrying survivors with it, which is no fault
|
|
18
|
-
* at all. One number reds on both, and the only cheap way out of a red for the second is to widen
|
|
19
|
-
* the bar — which is how a floor loses its teeth. Keeping `detected` and `total` apart is what
|
|
20
|
-
* lets the verdict tell them apart: kills lost is stated directly, and a growing population moves
|
|
21
|
-
* `total` while leaving `detected` alone.
|
|
22
|
-
*
|
|
23
|
-
* NOTHING HERE NAMES A PROJECT, A CHECK, A RUNNER, A WORKFLOW OR A REPOSITORY. The record's text
|
|
24
|
-
* arrives as a string and the name it is filed under arrives beside it, because which file holds a
|
|
25
|
-
* project's bars, and what its gates are called, are that project's own facts. This module has an
|
|
26
|
-
* opinion about the SHAPE of a record and none about whose it is.
|
|
27
|
-
*
|
|
28
|
-
* MALFORMED MEANS NO BAR, NEVER A DEFAULTED ONE. Every refusal below is a record a lenient reader
|
|
29
|
-
* answers with a bar nobody wrote — an absent section read as "no gates to enforce", a gate that
|
|
30
|
-
* measured nothing read as scoring zero, an allowance nobody justified read as justified. The bar
|
|
31
|
-
* is then enforced as though somebody had written it, and the only symptom is a build that has
|
|
32
|
-
* quietly stopped being able to red. So each one is refused by name, and the refusal says which
|
|
33
|
-
* record it read and where in that record the fault is (@SCN-MUT-013, 3F-2792).
|
|
34
|
-
*
|
|
35
|
-
* IT IS NOT A STATIC CHECK, and takes no `static-check:` prefix. A static check is a pure function
|
|
36
|
-
* of the checked-out tree; the record this reads feeds a reconciler that judges a MEASUREMENT,
|
|
37
|
-
* which by construction is not in the tree — the standing ruling every scheduled-sweep reader in
|
|
38
|
-
* this portfolio already carries.
|
|
39
|
-
*/
|
|
40
|
-
/**
|
|
41
|
-
* The name a record is filed under when its caller does not choose one.
|
|
42
|
-
*
|
|
43
|
-
* A DEFAULT, NEVER A CONSTANT THE READER GOES LOOKING FOR. Which file holds a project's bars is
|
|
44
|
-
* that project's own fact, and a caller naming its own is answered by that name — this is only
|
|
45
|
-
* what stands in when none is given, and it is exported so a caller happy with the convention does
|
|
46
|
-
* not have to respell it and get one character of it wrong.
|
|
47
|
-
*
|
|
48
|
-
* IT MOVED HERE FROM `reconcile.ts` WHEN THE RATCHET LEFT (3F-3337), unchanged. The entry that used
|
|
49
|
-
* to sit beside it reconciled a gate against this record; what is left reading a record is this
|
|
50
|
-
* module, so the default name sits with the reader that defaults to it.
|
|
51
|
-
*/
|
|
52
|
-
export declare const RECORD_FILE = "quality-thresholds.yml";
|
|
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
|
-
/**
|
|
111
|
-
* The failing floor: the record's counts with its allowance spent out of the DETECTED count.
|
|
112
|
-
*
|
|
113
|
-
* SPENT FROM THE NUMERATOR, not subtracted from the score, because the allowance is counted in
|
|
114
|
-
* mutants and a mutant is worth a different number of points in every gate — the same allowance
|
|
115
|
-
* taken off two scores would mean two different things in two gates of different sizes.
|
|
116
|
-
*
|
|
117
|
-
* A REPORTED FIGURE, NOT THE DECISION VARIABLE. The verdict decides on COUNTS — fewer kills than
|
|
118
|
-
* the record less its allowance — and prints this floor beside it so a reader has the bar in the
|
|
119
|
-
* units the sweep speaks. The two agree exactly while the mutant population is unchanged, and part
|
|
120
|
-
* company the moment it moves: a grown population drags the measured score below this floor with
|
|
121
|
-
* no kill lost at all, and that case is green. Reading this floor AS the gate would put the
|
|
122
|
-
* judgement back on the score, which is the confusion the counts model exists to prevent.
|
|
123
|
-
*/
|
|
124
|
-
export declare function floorOf(record: GateRecord): number;
|
|
125
|
-
/**
|
|
126
|
-
* The failing floor in MUTANTS: the record's kills with its allowance spent out of them.
|
|
127
|
-
*
|
|
128
|
-
* `floorOf`'s TWIN WITHOUT THE DIVISION, and the division is the whole difference. A percentage is
|
|
129
|
-
* two facts folded into one, and folding them is what makes a floor fall when new mutable code
|
|
130
|
-
* arrives carrying survivors — no kill lost, and the bar missed anyway. Subtracting the allowance
|
|
131
|
-
* and stopping leaves a whole number of mutants that moves only when a mutant this suite used to
|
|
132
|
-
* kill stops dying, which is the one fact a bar on this axis is about.
|
|
133
|
-
*
|
|
134
|
-
* `total` NEVER ENTERS IT, and that is the population-independence rather than a simplification.
|
|
135
|
-
* A reader holding this number can be handed a run over any population at all and still be asking
|
|
136
|
-
* the only question worth asking of it.
|
|
137
|
-
*
|
|
138
|
-
* HERE RATHER THAN AT ITS CALLER, for the reason `floorOf` is here: how an allowance is spent is a
|
|
139
|
-
* fact about the record, and a caller computing `detected - slack` itself would be a second place
|
|
140
|
-
* holding it — agreeing until the day one of them is edited.
|
|
141
|
-
*/
|
|
142
|
-
export declare function killFloorOf(record: GateRecord): number;
|
|
143
|
-
/**
|
|
144
|
-
* Read every gate's record out of a record file's text.
|
|
145
|
-
*
|
|
146
|
-
* @param text the record file's own bytes, as authored
|
|
147
|
-
* @param recordFile the name the record is filed under, so a refusal can say which file it read
|
|
148
|
-
* @throws MalformedRecordError when the text cannot be read as a bar — one type for every fault,
|
|
149
|
-
* the YAML parser's own included, so a caller told to catch this catches all of them.
|
|
150
|
-
*/
|
|
151
|
-
export declare function parseGateRecords(text: string, recordFile: string): Map<string, GateRecord>;
|
|
152
|
-
/**
|
|
153
|
-
* The bar the record holds for one named gate, refused when the record holds no such gate.
|
|
154
|
-
*
|
|
155
|
-
* A GATE WITH NO RECORD IS THE ONE FAULT IN THIS MODULE THAT LOOKS LIKE NOTHING AT ALL. Every
|
|
156
|
-
* refusal above is a record somebody wrote badly, sitting in the file a reader would go and open.
|
|
157
|
-
* This one is a record that reads perfectly, asked for a gate it never held — a gate name mistyped
|
|
158
|
-
* where the caller states it. The lenient answer is not a wrong bar but NO bar, which reads
|
|
159
|
-
* downstream as a gate with nothing to enforce, and it greens for as long as the typo survives.
|
|
160
|
-
* Nothing about the record is wrong, so nobody is ever sent to look at it (@SCN-MUT-013, 3F-2793).
|
|
161
|
-
*
|
|
162
|
-
* AND THE REFUSAL LISTS THE GATES THE RECORD DOES HOLD. A record's gates are near-neighbours by
|
|
163
|
-
* construction — a project names them after the scopes it is quarantining from each other — so a
|
|
164
|
-
* refusal naming only the gate that was asked for sends its reader to open the file and compare
|
|
165
|
-
* spellings by eye. Listing what is held turns the typo into a one-line diagnosis.
|
|
166
|
-
*
|
|
167
|
-
* UNDER THE ONE REFUSAL TYPE, like every fault above it. A caller is told to catch
|
|
168
|
-
* `MalformedRecordError` and nothing else, so an unrecorded gate raised under a second type is a
|
|
169
|
-
* fault that caller sails straight past — the very hole the YAML parser's own errors are
|
|
170
|
-
* normalised to close.
|
|
171
|
-
*
|
|
172
|
-
* @param gate the gate to resolve, as the caller names it — never a name this module knows
|
|
173
|
-
* @param records every gate the record holds, as `parseGateRecords` read them
|
|
174
|
-
* @param recordFile the name the record is filed under, so a refusal can say which file it read
|
|
175
|
-
* @throws MalformedRecordError when the record holds no such gate, listing the gates it does hold
|
|
176
|
-
*/
|
|
177
|
-
export declare function gateRecordFor(gate: string, records: Map<string, GateRecord>, recordFile: string): GateRecord;
|
|
178
|
-
//# sourceMappingURL=record.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/mutation-ratchet/record.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAIH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,WAAW,2BAA2B,CAAC;AA0CpD;;;;;;;;;;;;GAYG;AACH,q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,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,EAChC,UAAU,EAAE,MAAM,GACjB,UAAU,CAYZ"}
|
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A GATE'S RECORD — the pair of counts it last banked, and the allowance stated against them
|
|
3
|
-
* (@SCN-MUT-012, 3F-2790, 3F-3337).
|
|
4
|
-
*
|
|
5
|
-
* THE RATCHET THAT ONCE RECONCILED AGAINST THIS IS GONE; THE READER IS NOT (3F-3337). What reaches
|
|
6
|
-
* this module now is the engine's `mutationGate` bar kind, through `ingestQualityChecks.ts`: a
|
|
7
|
-
* target may author a fitness row whose bar names a gate rather than a figure, and the kill floor
|
|
8
|
-
* that gate's record implies is the bar the ledger then holds it to. That is a published
|
|
9
|
-
* capability, decided over a TARGET'S record, and this repository no longer keeps one of its own.
|
|
10
|
-
* @SCN-MUT-012 and @SCN-MUT-013 are what specify it — the second carrying, as its own Examples,
|
|
11
|
-
* the record that holds no gate of that name, the record that is not there to be read and the
|
|
12
|
-
* record holding text nothing can read as a record.
|
|
13
|
-
*
|
|
14
|
-
* THE RECORD IS TWO COUNTS, NEVER A BARE SCORE, and that is the load-bearing choice this whole
|
|
15
|
-
* module exists to make possible. A mutation score is detected over total, so it falls for two
|
|
16
|
-
* entirely unrelated reasons: a mutant this suite used to kill now survives, which is the fault
|
|
17
|
-
* the gate exists for; or new mutable code arrived carrying survivors with it, which is no fault
|
|
18
|
-
* at all. One number reds on both, and the only cheap way out of a red for the second is to widen
|
|
19
|
-
* the bar — which is how a floor loses its teeth. Keeping `detected` and `total` apart is what
|
|
20
|
-
* lets the verdict tell them apart: kills lost is stated directly, and a growing population moves
|
|
21
|
-
* `total` while leaving `detected` alone.
|
|
22
|
-
*
|
|
23
|
-
* NOTHING HERE NAMES A PROJECT, A CHECK, A RUNNER, A WORKFLOW OR A REPOSITORY. The record's text
|
|
24
|
-
* arrives as a string and the name it is filed under arrives beside it, because which file holds a
|
|
25
|
-
* project's bars, and what its gates are called, are that project's own facts. This module has an
|
|
26
|
-
* opinion about the SHAPE of a record and none about whose it is.
|
|
27
|
-
*
|
|
28
|
-
* MALFORMED MEANS NO BAR, NEVER A DEFAULTED ONE. Every refusal below is a record a lenient reader
|
|
29
|
-
* answers with a bar nobody wrote — an absent section read as "no gates to enforce", a gate that
|
|
30
|
-
* measured nothing read as scoring zero, an allowance nobody justified read as justified. The bar
|
|
31
|
-
* is then enforced as though somebody had written it, and the only symptom is a build that has
|
|
32
|
-
* quietly stopped being able to red. So each one is refused by name, and the refusal says which
|
|
33
|
-
* record it read and where in that record the fault is (@SCN-MUT-013, 3F-2792).
|
|
34
|
-
*
|
|
35
|
-
* IT IS NOT A STATIC CHECK, and takes no `static-check:` prefix. A static check is a pure function
|
|
36
|
-
* of the checked-out tree; the record this reads feeds a reconciler that judges a MEASUREMENT,
|
|
37
|
-
* which by construction is not in the tree — the standing ruling every scheduled-sweep reader in
|
|
38
|
-
* this portfolio already carries.
|
|
39
|
-
*/
|
|
40
|
-
import { parse } from "yaml";
|
|
41
|
-
/**
|
|
42
|
-
* The name a record is filed under when its caller does not choose one.
|
|
43
|
-
*
|
|
44
|
-
* A DEFAULT, NEVER A CONSTANT THE READER GOES LOOKING FOR. Which file holds a project's bars is
|
|
45
|
-
* that project's own fact, and a caller naming its own is answered by that name — this is only
|
|
46
|
-
* what stands in when none is given, and it is exported so a caller happy with the convention does
|
|
47
|
-
* not have to respell it and get one character of it wrong.
|
|
48
|
-
*
|
|
49
|
-
* IT MOVED HERE FROM `reconcile.ts` WHEN THE RATCHET LEFT (3F-3337), unchanged. The entry that used
|
|
50
|
-
* to sit beside it reconciled a gate against this record; what is left reading a record is this
|
|
51
|
-
* module, so the default name sits with the reader that defaults to it.
|
|
52
|
-
*/
|
|
53
|
-
export const RECORD_FILE = "quality-thresholds.yml";
|
|
54
|
-
/**
|
|
55
|
-
* The section of a record file that holds every gate's counts.
|
|
56
|
-
*
|
|
57
|
-
* EXPORTED SO THE RECORDER CANNOT HOLD A SECOND COPY OF IT. `ratchet.ts` finds the same section in
|
|
58
|
-
* the same text in order to rewrite two of its lines, and two spellings of one name is the
|
|
59
|
-
* agreeing-until-somebody-edits-one shape this whole library exists to remove.
|
|
60
|
-
*
|
|
61
|
-
* The SECTION name is this module's, and the gate names inside it are the project's. A record file
|
|
62
|
-
* is a project's own document and may hold whatever else that project keeps in it; what this module
|
|
63
|
-
* asks of it is one section, under one name, so a project can file its mutation bars beside the
|
|
64
|
-
* rest of its policy rather than in a file of their own.
|
|
65
|
-
*/
|
|
66
|
-
const MUTATION_GATES = "mutation-gates";
|
|
67
|
-
/**
|
|
68
|
-
* The document itself, when the fault is above any one gate — a record whose top level is not a
|
|
69
|
-
* mapping of sections, or one the YAML parser could not read at all.
|
|
70
|
-
*
|
|
71
|
-
* A PLACEHOLDER RATHER THAN A GATE NAME, and it is spelled here so the two readers that use it
|
|
72
|
-
* cannot drift apart. A refusal always names a section and a key so that a reader who has one
|
|
73
|
-
* message in front of them never has to work out which shape of message they are holding.
|
|
74
|
-
*/
|
|
75
|
-
const WHOLE_DOCUMENT = "<document>";
|
|
76
|
-
/** The key a document-level refusal names, there being no gate to name. */
|
|
77
|
-
const DOCUMENT_ROOT = "root";
|
|
78
|
-
/** The key a section-level refusal names, the fault being the section itself rather than a gate. */
|
|
79
|
-
const WHOLE_SECTION = "<section>";
|
|
80
|
-
/**
|
|
81
|
-
* The field a refusal names when the fault is the ASK rather than a field of a gate's block — a
|
|
82
|
-
* gate the record does not hold at all.
|
|
83
|
-
*
|
|
84
|
-
* EXPORTED FOR THE SAME REASON AS THE SECTION NAME: `ratchet.ts` refuses the same way when it is
|
|
85
|
-
* asked to raise a gate no block is written for, and a refusal a reader has to recognise in two
|
|
86
|
-
* spellings is one they will eventually parse wrongly.
|
|
87
|
-
*/
|
|
88
|
-
const WHOLE_GATE = "<gate>";
|
|
89
|
-
/**
|
|
90
|
-
* Raised when a record cannot be read as a bar.
|
|
91
|
-
*
|
|
92
|
-
* IT NAMES THE SECTION, THE GATE AND THE FIELD, because a record file is a wall of near-identical
|
|
93
|
-
* gate blocks and a bare "invalid config" over one of them leaves a reader opening the file and
|
|
94
|
-
* reading every block to find out which. The four together are enough to put a cursor on the line.
|
|
95
|
-
*
|
|
96
|
-
* ONE TYPE FOR EVERY FAULT, INCLUDING THE ONES THIS MODULE DOES NOT DETECT ITSELF. A caller is
|
|
97
|
-
* told to catch this and nothing else, so anything it does not cover is something that caller
|
|
98
|
-
* sails past — which is why the YAML parser's own errors are normalised into it rather than left
|
|
99
|
-
* to travel under their own name. That is what makes "a malformed record fails loudly" a property
|
|
100
|
-
* of the reader rather than a property of the field checks alone.
|
|
101
|
-
*/
|
|
102
|
-
export class MalformedRecordError extends Error {
|
|
103
|
-
recordFile;
|
|
104
|
-
section;
|
|
105
|
-
key;
|
|
106
|
-
field;
|
|
107
|
-
constructor(
|
|
108
|
-
/** The name the record was filed under, as the caller handed it over. */
|
|
109
|
-
recordFile,
|
|
110
|
-
/** The section the fault sits in, or `<document>` when it sits above every section. */
|
|
111
|
-
section,
|
|
112
|
-
/** The gate the fault sits under, or a placeholder when the fault is the section itself. */
|
|
113
|
-
key,
|
|
114
|
-
/** The field the fault sits at. */
|
|
115
|
-
field, detail) {
|
|
116
|
-
super(`${recordFile}: ${section} "${key}" is malformed at ${field}: ${detail}`);
|
|
117
|
-
this.recordFile = recordFile;
|
|
118
|
-
this.section = section;
|
|
119
|
-
this.key = key;
|
|
120
|
-
this.field = field;
|
|
121
|
-
this.name = "MalformedRecordError";
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
/** A mutation score, as a percentage, computed from counts rather than read off a report. */
|
|
125
|
-
function scoreOf(detected, total) {
|
|
126
|
-
return (detected / total) * 100;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* The failing floor: the record's counts with its allowance spent out of the DETECTED count.
|
|
130
|
-
*
|
|
131
|
-
* SPENT FROM THE NUMERATOR, not subtracted from the score, because the allowance is counted in
|
|
132
|
-
* mutants and a mutant is worth a different number of points in every gate — the same allowance
|
|
133
|
-
* taken off two scores would mean two different things in two gates of different sizes.
|
|
134
|
-
*
|
|
135
|
-
* A REPORTED FIGURE, NOT THE DECISION VARIABLE. The verdict decides on COUNTS — fewer kills than
|
|
136
|
-
* the record less its allowance — and prints this floor beside it so a reader has the bar in the
|
|
137
|
-
* units the sweep speaks. The two agree exactly while the mutant population is unchanged, and part
|
|
138
|
-
* company the moment it moves: a grown population drags the measured score below this floor with
|
|
139
|
-
* no kill lost at all, and that case is green. Reading this floor AS the gate would put the
|
|
140
|
-
* judgement back on the score, which is the confusion the counts model exists to prevent.
|
|
141
|
-
*/
|
|
142
|
-
export function floorOf(record) {
|
|
143
|
-
return scoreOf(record.detected - record.allowance.mutants, record.total);
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* The failing floor in MUTANTS: the record's kills with its allowance spent out of them.
|
|
147
|
-
*
|
|
148
|
-
* `floorOf`'s TWIN WITHOUT THE DIVISION, and the division is the whole difference. A percentage is
|
|
149
|
-
* two facts folded into one, and folding them is what makes a floor fall when new mutable code
|
|
150
|
-
* arrives carrying survivors — no kill lost, and the bar missed anyway. Subtracting the allowance
|
|
151
|
-
* and stopping leaves a whole number of mutants that moves only when a mutant this suite used to
|
|
152
|
-
* kill stops dying, which is the one fact a bar on this axis is about.
|
|
153
|
-
*
|
|
154
|
-
* `total` NEVER ENTERS IT, and that is the population-independence rather than a simplification.
|
|
155
|
-
* A reader holding this number can be handed a run over any population at all and still be asking
|
|
156
|
-
* the only question worth asking of it.
|
|
157
|
-
*
|
|
158
|
-
* HERE RATHER THAN AT ITS CALLER, for the reason `floorOf` is here: how an allowance is spent is a
|
|
159
|
-
* fact about the record, and a caller computing `detected - slack` itself would be a second place
|
|
160
|
-
* holding it — agreeing until the day one of them is edited.
|
|
161
|
-
*/
|
|
162
|
-
export function killFloorOf(record) {
|
|
163
|
-
return record.detected - record.allowance.mutants;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Read the record's text into a document mapping.
|
|
167
|
-
*
|
|
168
|
-
* THE YAML PARSER'S OWN DETECTIONS ARE REAL, AND THEY ARRIVE UNDER SOMEONE ELSE'S NAME. A gate
|
|
169
|
-
* recorded twice raises `YAMLParseError` before this module sees a mapping at all — a genuine
|
|
170
|
-
* catch, and one a caller that was told to catch `MalformedRecordError` walks straight past. So it
|
|
171
|
-
* is caught here and re-raised as this module's own refusal, carrying the parser's message as the
|
|
172
|
-
* detail so nothing about WHAT was wrong is lost on the way across.
|
|
173
|
-
*/
|
|
174
|
-
function documentOf(text, recordFile) {
|
|
175
|
-
let read;
|
|
176
|
-
try {
|
|
177
|
-
read = parse(text);
|
|
178
|
-
}
|
|
179
|
-
catch (cause) {
|
|
180
|
-
const detail = cause instanceof Error ? cause.message : String(cause);
|
|
181
|
-
throw new MalformedRecordError(recordFile, WHOLE_DOCUMENT, DOCUMENT_ROOT, "yaml", detail);
|
|
182
|
-
}
|
|
183
|
-
if (!isMapping(read)) {
|
|
184
|
-
throw new MalformedRecordError(recordFile, WHOLE_DOCUMENT, DOCUMENT_ROOT, DOCUMENT_ROOT, "the top level must be a mapping of sections.");
|
|
185
|
-
}
|
|
186
|
-
return read;
|
|
187
|
-
}
|
|
188
|
-
/** Whether a value read out of the record is a block of named fields, rather than a list or scalar. */
|
|
189
|
-
function isMapping(value) {
|
|
190
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* The section holding every gate, refused when it is absent or holds no gate.
|
|
194
|
-
*
|
|
195
|
-
* REQUIRED, NEVER DEFAULTED, and the two refusals are one fault at two depths. A record with no
|
|
196
|
-
* section reads as "no gates to enforce"; a section with no gate reads as a bar that enforces
|
|
197
|
-
* nothing. Both hand back a green that was never earned, which is the vacuous pass this whole
|
|
198
|
-
* apparatus exists to close, so neither is allowed to be the answer.
|
|
199
|
-
*/
|
|
200
|
-
function gatesSectionOf(text, recordFile) {
|
|
201
|
-
const section = documentOf(text, recordFile)[MUTATION_GATES];
|
|
202
|
-
if (!isMapping(section)) {
|
|
203
|
-
throw new MalformedRecordError(recordFile, MUTATION_GATES, WHOLE_SECTION, MUTATION_GATES, "the section is missing, or is not a mapping of gate name to record.");
|
|
204
|
-
}
|
|
205
|
-
const entries = Object.entries(section);
|
|
206
|
-
if (entries.length === 0) {
|
|
207
|
-
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.");
|
|
208
|
-
}
|
|
209
|
-
return entries;
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* One field, read as a whole, non-negative count of mutants.
|
|
213
|
-
*
|
|
214
|
-
* THE UNIT IS THE MUTANT, so a fraction is not a smaller count — it is a number that came from
|
|
215
|
-
* somewhere other than counting, and the arithmetic downstream is exact precisely because nothing
|
|
216
|
-
* here ever rounds.
|
|
217
|
-
*/
|
|
218
|
-
function countAt(gate, entry, field, recordFile) {
|
|
219
|
-
const raw = entry[field];
|
|
220
|
-
if (typeof raw !== "number" || !Number.isInteger(raw) || raw < 0) {
|
|
221
|
-
throw new MalformedRecordError(recordFile, MUTATION_GATES, gate, field, "expected a whole number of mutants.");
|
|
222
|
-
}
|
|
223
|
-
return raw;
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* The allowance the record states, refused when it cannot be spent or cannot say why it exists.
|
|
227
|
-
*
|
|
228
|
-
* AN ALLOWANCE NOBODY CAN JUSTIFY IS HEAD-ROOM, NOT TOLERANCE, and head-room admitted at read time
|
|
229
|
-
* is a bar nobody wrote being enforced as though somebody had. It is refused HERE rather than left
|
|
230
|
-
* to the reconciler, because by the time a verdict is being computed the unjustified allowance has
|
|
231
|
-
* already become part of the bar. A ZERO allowance needs no reason: there is nothing to justify.
|
|
232
|
-
*
|
|
233
|
-
* WIDER THAN THE KILLS IT IS SPENT FROM IS THE OTHER WAY THE SAME BAR VANISHES. The allowance comes
|
|
234
|
-
* out of the recorded kills, so one wider than them puts the floor below zero, and a gate whose
|
|
235
|
-
* floor is below zero cannot red for any measurement at all.
|
|
236
|
-
*/
|
|
237
|
-
function allowanceOf(gate, entry, detected, recordFile) {
|
|
238
|
-
const mutants = countAt(gate, entry, "slack-mutants", recordFile);
|
|
239
|
-
if (mutants > detected) {
|
|
240
|
-
throw new MalformedRecordError(recordFile, MUTATION_GATES, gate, "slack-mutants", `${mutants} is wider than the ${detected} kills it is spent from.`);
|
|
241
|
-
}
|
|
242
|
-
const stated = entry["slack-reason"];
|
|
243
|
-
const reason = typeof stated === "string" ? stated.trim() : "";
|
|
244
|
-
if (mutants > 0 && reason === "") {
|
|
245
|
-
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.");
|
|
246
|
-
}
|
|
247
|
-
return { mutants, reason };
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* One gate's entry, read into its record.
|
|
251
|
-
*
|
|
252
|
-
* `total` IS READ AND REFUSED BEFORE `detected`, WHICH IS THE ORDER AND NOT AN ACCIDENT. A gate
|
|
253
|
-
* that measured no mutants has no score — the division is undefined — so there is nothing for a
|
|
254
|
-
* kill count to be compared against, and refusing at `detected` first would name the wrong field
|
|
255
|
-
* in the message a reader is trying to act on.
|
|
256
|
-
*/
|
|
257
|
-
function recordOf(gate, raw, recordFile) {
|
|
258
|
-
if (!isMapping(raw)) {
|
|
259
|
-
throw new MalformedRecordError(recordFile, MUTATION_GATES, gate, "<entry>", "expected a block of fields.");
|
|
260
|
-
}
|
|
261
|
-
const total = countAt(gate, raw, "total", recordFile);
|
|
262
|
-
if (total === 0) {
|
|
263
|
-
throw new MalformedRecordError(recordFile, MUTATION_GATES, gate, "total", "a gate that measured no mutants has no score.");
|
|
264
|
-
}
|
|
265
|
-
const detected = countAt(gate, raw, "detected", recordFile);
|
|
266
|
-
if (detected > total) {
|
|
267
|
-
throw new MalformedRecordError(recordFile, MUTATION_GATES, gate, "detected", `${detected} kills over ${total} mutants — a gate cannot detect more than it measured.`);
|
|
268
|
-
}
|
|
269
|
-
return { gate, detected, total, allowance: allowanceOf(gate, raw, detected, recordFile) };
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Read every gate's record out of a record file's text.
|
|
273
|
-
*
|
|
274
|
-
* @param text the record file's own bytes, as authored
|
|
275
|
-
* @param recordFile the name the record is filed under, so a refusal can say which file it read
|
|
276
|
-
* @throws MalformedRecordError when the text cannot be read as a bar — one type for every fault,
|
|
277
|
-
* the YAML parser's own included, so a caller told to catch this catches all of them.
|
|
278
|
-
*/
|
|
279
|
-
export function parseGateRecords(text, recordFile) {
|
|
280
|
-
return new Map(gatesSectionOf(text, recordFile).map(([gate, raw]) => [gate, recordOf(gate, raw, recordFile)]));
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* The bar the record holds for one named gate, refused when the record holds no such gate.
|
|
284
|
-
*
|
|
285
|
-
* A GATE WITH NO RECORD IS THE ONE FAULT IN THIS MODULE THAT LOOKS LIKE NOTHING AT ALL. Every
|
|
286
|
-
* refusal above is a record somebody wrote badly, sitting in the file a reader would go and open.
|
|
287
|
-
* This one is a record that reads perfectly, asked for a gate it never held — a gate name mistyped
|
|
288
|
-
* where the caller states it. The lenient answer is not a wrong bar but NO bar, which reads
|
|
289
|
-
* downstream as a gate with nothing to enforce, and it greens for as long as the typo survives.
|
|
290
|
-
* Nothing about the record is wrong, so nobody is ever sent to look at it (@SCN-MUT-013, 3F-2793).
|
|
291
|
-
*
|
|
292
|
-
* AND THE REFUSAL LISTS THE GATES THE RECORD DOES HOLD. A record's gates are near-neighbours by
|
|
293
|
-
* construction — a project names them after the scopes it is quarantining from each other — so a
|
|
294
|
-
* refusal naming only the gate that was asked for sends its reader to open the file and compare
|
|
295
|
-
* spellings by eye. Listing what is held turns the typo into a one-line diagnosis.
|
|
296
|
-
*
|
|
297
|
-
* UNDER THE ONE REFUSAL TYPE, like every fault above it. A caller is told to catch
|
|
298
|
-
* `MalformedRecordError` and nothing else, so an unrecorded gate raised under a second type is a
|
|
299
|
-
* fault that caller sails straight past — the very hole the YAML parser's own errors are
|
|
300
|
-
* normalised to close.
|
|
301
|
-
*
|
|
302
|
-
* @param gate the gate to resolve, as the caller names it — never a name this module knows
|
|
303
|
-
* @param records every gate the record holds, as `parseGateRecords` read them
|
|
304
|
-
* @param recordFile the name the record is filed under, so a refusal can say which file it read
|
|
305
|
-
* @throws MalformedRecordError when the record holds no such gate, listing the gates it does hold
|
|
306
|
-
*/
|
|
307
|
-
export function gateRecordFor(gate, records, recordFile) {
|
|
308
|
-
const record = records.get(gate);
|
|
309
|
-
if (record === undefined) {
|
|
310
|
-
throw new MalformedRecordError(recordFile, MUTATION_GATES, gate, WHOLE_GATE, `no bar is recorded for this gate (recorded: ${[...records.keys()].join(", ")}).`);
|
|
311
|
-
}
|
|
312
|
-
return record;
|
|
313
|
-
}
|
|
314
|
-
//# sourceMappingURL=record.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"record.js","sourceRoot":"","sources":["../../src/mutation-ratchet/record.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAE7B;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,wBAAwB,CAAC;AAEpD;;;;;;;;;;;GAWG;AACH,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAExC;;;;;;;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,UA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