spec-controller 0.1.0-alpha.36 → 0.1.0-alpha.38
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 +7 -3
- package/dist/cli-allocate/cli.d.ts.map +1 -1
- package/dist/cli-allocate/cli.js +17 -5
- package/dist/cli-allocate/cli.js.map +1 -1
- package/dist/cli-allocate/readHistory.d.ts +10 -2
- package/dist/cli-allocate/readHistory.d.ts.map +1 -1
- package/dist/cli-allocate/readHistory.js +45 -6
- package/dist/cli-allocate/readHistory.js.map +1 -1
- package/dist/cli-allocate/readParts.d.ts.map +1 -1
- package/dist/cli-allocate/readParts.js +5 -2
- package/dist/cli-allocate/readParts.js.map +1 -1
- package/dist/cli-allocate/readTree.d.ts +4 -5
- package/dist/cli-allocate/readTree.d.ts.map +1 -1
- package/dist/cli-allocate/readTree.js +75 -32
- package/dist/cli-allocate/readTree.js.map +1 -1
- 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/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-balance/cli.d.ts +3 -2
- package/dist/cli-balance/cli.d.ts.map +1 -1
- package/dist/cli-balance/cli.js +36 -13
- package/dist/cli-balance/cli.js.map +1 -1
- 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/ingest/ingestQualityChecks.d.ts +25 -8
- package/dist/ingest/ingestQualityChecks.d.ts.map +1 -1
- package/dist/ingest/ingestQualityChecks.js +93 -33
- package/dist/ingest/ingestQualityChecks.js.map +1 -1
- package/dist/ingest/ingestScenarios.d.ts +4 -4
- package/dist/ingest/ingestScenarios.d.ts.map +1 -1
- package/dist/ingest/ingestScenarios.js +21 -8
- 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/package.json +2 -2
|
@@ -22,11 +22,11 @@ import { DEFAULT_DEFERRAL_TAGS } from "../deferralTags.js";
|
|
|
22
22
|
import { evidenceObligations, } from "@3f-consulting/spec-controller-core";
|
|
23
23
|
import { parseVitestEvidenceObservations, } from "@3f-consulting/spec-controller-core";
|
|
24
24
|
import { parseCucumberEvidenceObservations, } from "@3f-consulting/spec-controller-core";
|
|
25
|
-
// THE WHOLE COMPOSITION, THROUGH THE PUBLIC BARREL AND NOTHING ELSE
|
|
26
|
-
// in the tarball, and
|
|
25
|
+
// THE WHOLE COMPOSITION, THROUGH THE PUBLIC BARREL AND NOTHING ELSE. This module travels
|
|
26
|
+
// in the tarball, and it once reached nine core symbols through the UNPUBLISHED
|
|
27
27
|
// `./internal` subpath to assemble the reconciliation itself — which is why an installed
|
|
28
28
|
// `spec-controller balance --help` threw ERR_PACKAGE_PATH_NOT_EXPORTED while every gate in this
|
|
29
|
-
// workspace stayed green. The nine are still internal
|
|
29
|
+
// workspace stayed green. The nine are still internal; what moved is
|
|
30
30
|
// their CALLER. What is left here is the reads: this edge opens the files and hands the bytes over.
|
|
31
31
|
import { evidenceReconciliationFromSources } from "@3f-consulting/spec-controller-core";
|
|
32
32
|
import { resolveTargetRoot } from "../run-management/resolveRunInputs.js";
|
|
@@ -40,7 +40,7 @@ import { resolveTargetRoot } from "../run-management/resolveRunInputs.js";
|
|
|
40
40
|
const VITEST_QUALITY_CHECK = "unit";
|
|
41
41
|
const CUCUMBER_QUALITY_CHECK = "integration";
|
|
42
42
|
/**
|
|
43
|
-
* THIS TOOL, RUN TO RECONCILE
|
|
43
|
+
* THIS TOOL, RUN TO RECONCILE — the invocation whose step is the
|
|
44
44
|
* reconciler rather than one of the reconciled rows, SET at the CLI edge and injected into the
|
|
45
45
|
* core like the prefixes above and the workflow names below.
|
|
46
46
|
*
|
|
@@ -54,6 +54,10 @@ const CUCUMBER_QUALITY_CHECK = "integration";
|
|
|
54
54
|
* (`parse/commandRuns`), so this names the reconciliation and nothing else the tool can do.
|
|
55
55
|
*/
|
|
56
56
|
const RECONCILER_INVOCATION = "spec-controller balance";
|
|
57
|
+
/** Where the CI workflows are read from when `--ci` is not given. */
|
|
58
|
+
export const DEFAULT_CI_PATH = ".github/workflows";
|
|
59
|
+
/** The target's manifest when `--package-json` is not given: the one in the directory the run is in. */
|
|
60
|
+
export const DEFAULT_PACKAGE_JSON = "package.json";
|
|
57
61
|
/** Read + JSON-parse a file if present, else return undefined. */
|
|
58
62
|
function readJsonIfPresent(path) {
|
|
59
63
|
if (!path || !existsSync(path))
|
|
@@ -61,13 +65,13 @@ function readJsonIfPresent(path) {
|
|
|
61
65
|
return JSON.parse(readFileSync(path, "utf8"));
|
|
62
66
|
}
|
|
63
67
|
/**
|
|
64
|
-
* THE CORPUS `balance` READS — the shared discovery, with an ABSENT directory read as NO CORPUS
|
|
65
|
-
*
|
|
68
|
+
* THE CORPUS `balance` READS — the shared discovery, with an ABSENT directory read as NO CORPUS.
|
|
69
|
+
* The single place this command opts in.
|
|
66
70
|
*
|
|
67
71
|
* `new-client` is a supported adoption state, not a degraded one, and most targets have no
|
|
68
72
|
* `features/` directory at all — so an absent DEFAULT corpus is the target's honest shape and
|
|
69
73
|
* `balance` reports on it. Left to escape it was a raw `ENOENT` landing on Node's default exit 1,
|
|
70
|
-
* the OUT-OF-BALANCE code, which is exactly the collision
|
|
74
|
+
* the OUT-OF-BALANCE code, which is exactly the collision the unreadable-input guards closed on every
|
|
71
75
|
* other input, alive on the one path each new consumer is guaranteed to take.
|
|
72
76
|
*
|
|
73
77
|
* ONE HELPER, NOT FIVE CATCHES, and that is the whole reason it exists: five readers each doing
|
|
@@ -76,12 +80,12 @@ function readJsonIfPresent(path) {
|
|
|
76
80
|
* also why `discoverFeatures` is not the place to be tolerant — see its own note, and
|
|
77
81
|
* `MissingFeatureCorpusError`'s.
|
|
78
82
|
*
|
|
79
|
-
* IT IS `[]`, NOT A VERDICT. Zero rows is what
|
|
83
|
+
* IT IS `[]`, NOT A VERDICT. Zero rows is what the verdict reads as NOTHING TO RECONCILE, and a
|
|
80
84
|
* corpus-less target that still has uncited credits keeps its suspense row and its exit 1
|
|
81
|
-
*
|
|
85
|
+
* — this reader says what it found, never what the run means.
|
|
82
86
|
*
|
|
83
87
|
* A supplied-but-absent `--features` never arrives here: `checkInputsExist` refuses it at the CLI
|
|
84
|
-
* edge, exit 2
|
|
88
|
+
* edge, exit 2. The precedent is `ciSourcePathsOf`, which already answers an absent
|
|
85
89
|
* DEFAULT `.github/workflows` with `[]` for the same reason — the default finding nothing is a fact
|
|
86
90
|
* about the target, not a mistake by its author.
|
|
87
91
|
*/
|
|
@@ -99,7 +103,7 @@ function balanceCorpus(featuresDir) {
|
|
|
99
103
|
* The discovered feature corpus's SOURCES — read once so the two readings a citing run needs (the
|
|
100
104
|
* obligations, and the corpus hop's `check tag → @SCN`) are taken from the same bytes. Two
|
|
101
105
|
* discoveries could disagree about the corpus, and a citation resolved against a corpus the ledger
|
|
102
|
-
* was not built from is exactly the phantom-row fault
|
|
106
|
+
* was not built from is exactly the phantom-row fault.
|
|
103
107
|
*/
|
|
104
108
|
function featureSources(featuresDir) {
|
|
105
109
|
return balanceCorpus(featuresDir).map((f) => readFileSync(f.path, "utf8"));
|
|
@@ -108,7 +112,7 @@ function scenariosFromFeatures(featuresDir, deferralTags = DEFAULT_DEFERRAL_TAGS
|
|
|
108
112
|
return featureSources(featuresDir).flatMap((source) => parseScenarios(source, deferralTags));
|
|
109
113
|
}
|
|
110
114
|
/**
|
|
111
|
-
* The feature corpus's UNTAGGED half
|
|
115
|
+
* The feature corpus's UNTAGGED half — the scenarios `parseScenarios`
|
|
112
116
|
* discards because they carry no `@SCN`. They are REAL scenarios: cucumber runs them, so each
|
|
113
117
|
* owns a real Evidence Obligation — but the obligation has no code for an Evidence Observation to
|
|
114
118
|
* link to, so it can never be discharged. `reconcile` gives each its own out-of-balance row
|
|
@@ -123,7 +127,7 @@ function untaggedScenariosFromFeatures(featuresDir) {
|
|
|
123
127
|
return balanceCorpus(featuresDir).flatMap((f) => parseUntaggedScenarios(readFileSync(f.path, "utf8")).map((scenario) => `${f.slug}.feature : ${scenario}`));
|
|
124
128
|
}
|
|
125
129
|
/**
|
|
126
|
-
* The feature corpus's INTEGRITY CHECKPOINT
|
|
130
|
+
* The feature corpus's INTEGRITY CHECKPOINT — validate every discovered
|
|
127
131
|
* `.feature` with the REAL Gherkin parser and report the files it cannot read.
|
|
128
132
|
*
|
|
129
133
|
* The feature corpus is the ledger's DEBIT side, and it used to be read by a tag-line scan that
|
|
@@ -131,7 +135,7 @@ function untaggedScenariosFromFeatures(featuresDir) {
|
|
|
131
135
|
* spec could read BALANCED. A file the parser rejects is one cucumber would refuse to run: the
|
|
132
136
|
* CLI halts on it (exit 2) rather than reconciling a corpus that is a fiction.
|
|
133
137
|
*
|
|
134
|
-
* THIS IS NOW THE CATCH SITE, NOT THE CALL SITE
|
|
138
|
+
* THIS IS NOW THE CATCH SITE, NOT THE CALL SITE. The validation moved
|
|
135
139
|
* into `discoverFeatures`, which REFUSES an unreadable corpus rather than returning one, so every
|
|
136
140
|
* corpus reader inherits the refusal instead of each restating it. What is left here is the
|
|
137
141
|
* translation back into the list this CLI edge already prints — same files, same order, same
|
|
@@ -149,9 +153,65 @@ export function featureCorpusParseErrors(featuresDir) {
|
|
|
149
153
|
throw err;
|
|
150
154
|
}
|
|
151
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* A read the operating system refused, as a fault naming the path; null for anything else. Every
|
|
158
|
+
* refusal is the same fault to the run, whichever it is: a file where a directory is read or the
|
|
159
|
+
* reverse, a path it is not permitted to read, or any other reason the OS gives.
|
|
160
|
+
*/
|
|
161
|
+
function readFaultOf(err, path) {
|
|
162
|
+
const errno = err;
|
|
163
|
+
if (!(err instanceof Error) || typeof errno.code !== "string")
|
|
164
|
+
return null;
|
|
165
|
+
return { path: errno.path ?? path, reason: err.message };
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* The read of the feature corpus that failed, taken by the same discovery the reconcile uses, or
|
|
169
|
+
* null when it reads. A file the Gherkin parser rejects is not this fault: it is reported by
|
|
170
|
+
* `featureCorpusParseErrors`, after this.
|
|
171
|
+
*/
|
|
172
|
+
export function corpusReadFault(featuresDir) {
|
|
173
|
+
try {
|
|
174
|
+
balanceCorpus(featuresDir);
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
catch (err) {
|
|
178
|
+
if (err instanceof UnreadableFeatureCorpusError)
|
|
179
|
+
return null;
|
|
180
|
+
const fault = readFaultOf(err, featuresDir ?? "features");
|
|
181
|
+
if (fault === null)
|
|
182
|
+
throw err;
|
|
183
|
+
return fault;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/** The read of a CI workflow that failed, over the same files the reconcile reads, or null when they all read. */
|
|
187
|
+
export function ciReadFault(ciPath) {
|
|
188
|
+
const path = ciPath ?? DEFAULT_CI_PATH;
|
|
189
|
+
try {
|
|
190
|
+
for (const source of ciSourcePathsOf(path))
|
|
191
|
+
readCiSource(source);
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
catch (err) {
|
|
195
|
+
const fault = readFaultOf(err, path);
|
|
196
|
+
if (fault === null)
|
|
197
|
+
throw err;
|
|
198
|
+
return fault;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/** One workflow file's read, whose failure carries the file's path, which reading a directory gives none of. */
|
|
202
|
+
function readCiSource(source) {
|
|
203
|
+
try {
|
|
204
|
+
readFileSync(source, "utf8");
|
|
205
|
+
}
|
|
206
|
+
catch (err) {
|
|
207
|
+
const errno = err;
|
|
208
|
+
errno.path ??= source;
|
|
209
|
+
throw err;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
152
212
|
/**
|
|
153
213
|
* Read the target's `feature-code → slug` map over the same `discoverFeatures` corpus
|
|
154
|
-
*
|
|
214
|
+
* — each coded feature file's `@<FFF>` header (`featureCode`)
|
|
155
215
|
* mapped to its filename `slug`, the full feature name. This is the mapping
|
|
156
216
|
* `scenariosFromFeatures` discards (it keeps only the parsed scenarios). A sibling read to
|
|
157
217
|
* the balance, threaded to `renderMarkdown` (via `writeOutputs`) as the 5th sibling arg
|
|
@@ -159,7 +219,7 @@ export function featureCorpusParseErrors(featuresDir) {
|
|
|
159
219
|
* Uncoded files (`featureCode === null`) are omitted, so the by-feature emitter falls
|
|
160
220
|
* back to the bare `FFF` for any id whose code no file registers. When two files carry one
|
|
161
221
|
* code the map keeps the last, and that run lists `duplicate-feature-code` under Scenario code
|
|
162
|
-
* errors and fails
|
|
222
|
+
* errors and fails, so a report whose map is ambiguous never passes.
|
|
163
223
|
*/
|
|
164
224
|
export function readFeatureNames(featuresDir) {
|
|
165
225
|
const map = new Map();
|
|
@@ -174,8 +234,8 @@ export function readFeatureNames(featuresDir) {
|
|
|
174
234
|
* `discoverFeatures` corpus `scenariosFromFeatures` reads): sum the raw @SCN
|
|
175
235
|
* occurrences (`countScnOccurrences`) and the scenario count
|
|
176
236
|
* (`parseScenarios(...).length`) across every file, and build the `EvidenceObligations`
|
|
177
|
-
* sibling
|
|
178
|
-
*
|
|
237
|
+
* sibling. Also collects the UNTAGGED scenarios
|
|
238
|
+
* — `parseUntaggedScenarios` per file, each paired with its feature-file
|
|
179
239
|
* locator, sorted by (feature, scenario). Read alongside the balance in `main()` and
|
|
180
240
|
* threaded to the renderers via `writeOutputs`; `runReconcile` stays unchanged.
|
|
181
241
|
*/
|
|
@@ -203,10 +263,10 @@ export function readEvidenceObligations(features) {
|
|
|
203
263
|
}
|
|
204
264
|
/**
|
|
205
265
|
* Parse the target's RUNTIME observations ONCE — the tag-derived, per-tier observation set
|
|
206
|
-
*
|
|
266
|
+
* fed to BOTH the reconciler and the runtime census, so the
|
|
207
267
|
* two can never disagree. Each source's FALLBACK quality-check is set at the CLI edge
|
|
208
268
|
* (vitest⇒unit, cucumber⇒integration); the parsers DERIVE the level from the cited scenario's tier
|
|
209
|
-
* tag
|
|
269
|
+
* tag, using the fallback only for an untagged scenario. A missing report
|
|
210
270
|
* contributes nothing. Root-relative so a phantom-scenario row's where-to-fix stays portable.
|
|
211
271
|
*/
|
|
212
272
|
function parseRuntimeObservations(opts, root) {
|
|
@@ -221,39 +281,39 @@ function parseRuntimeObservations(opts, root) {
|
|
|
221
281
|
}
|
|
222
282
|
export function runReconcile(opts) {
|
|
223
283
|
// Read the target's package.json ONCE — its `specController.*` config supplies the deferral-tag
|
|
224
|
-
// extension
|
|
284
|
+
// extension and the configured fitness rows, and its `scripts` back the `exists`
|
|
225
285
|
// read. The disk read stays at this impure edge; the engine takes the resolved values as
|
|
226
286
|
// injected params, staying pure.
|
|
227
|
-
const pkgPath = opts.packageJson ??
|
|
287
|
+
const pkgPath = opts.packageJson ?? DEFAULT_PACKAGE_JSON;
|
|
228
288
|
const packageJson = readJsonIfPresent(pkgPath) ?? {};
|
|
229
289
|
// The TARGET repo root — the credit locators are made relative to it, so a phantom-scenario row's
|
|
230
290
|
// where-to-fix (ruling Q5) stays portable in a banked artefact. Resolved ONCE here and threaded,
|
|
231
291
|
// which is also what keeps `execFileSync` and `process.cwd()` out of the engine.
|
|
232
292
|
const root = resolveTargetRoot({ features: opts.features });
|
|
233
293
|
// `--ci` names a workflow FILE or a DIRECTORY of them, and defaults to the directory
|
|
234
|
-
//
|
|
294
|
+
// A pipeline split across files enforces its checks just as one
|
|
235
295
|
// file does, and reading only ci.yml both invents watermelons for named checks enforced
|
|
236
296
|
// elsewhere and drops uncited ones off the books entirely. Path semantics carry the
|
|
237
297
|
// file-vs-directory distinction, so one flag stays one flag and an explicit file is still
|
|
238
|
-
// a narrowing
|
|
239
|
-
const ciPath = opts.ci ??
|
|
240
|
-
// RESOLVED ONCE, READ TWICE
|
|
298
|
+
// a narrowing.
|
|
299
|
+
const ciPath = opts.ci ?? DEFAULT_CI_PATH;
|
|
300
|
+
// RESOLVED ONCE, READ TWICE. The engine takes anonymous source strings and holds
|
|
241
301
|
// no filesystem, so the mapping from a step's source index back to the workflow file it came
|
|
242
302
|
// from is made HERE, where the paths are already in hand — `ciSourcePaths.ts` is explicit that
|
|
243
303
|
// keeping the core that way is the point. Resolving the list twice would be two chances for the
|
|
244
304
|
// bytes and the names to fall out of the order they are paired by.
|
|
245
305
|
const ciPaths = ciSourcePathsOf(ciPath);
|
|
246
306
|
// The corpus, discovered and read ONCE: its bytes, and — paired by index — which file each came
|
|
247
|
-
// from and the header code it carries, for the scenario code errors
|
|
307
|
+
// from and the header code it carries, for the scenario code errors.
|
|
248
308
|
const corpusFiles = balanceCorpus(opts.features).map((f) => ({
|
|
249
309
|
slug: f.slug,
|
|
250
310
|
featureCode: f.featureCode,
|
|
251
311
|
source: readFileSync(f.path, "utf8"),
|
|
252
312
|
}));
|
|
253
313
|
return evidenceReconciliationFromSources({
|
|
254
|
-
// The corpus's bytes, read ONCE at this impure edge
|
|
314
|
+
// The corpus's bytes, read ONCE at this impure edge. The engine composes the three
|
|
255
315
|
// readings a citing run needs from this one array, so they cannot be assembled from two
|
|
256
|
-
// discoveries that disagree about the corpus
|
|
316
|
+
// discoveries that disagree about the corpus.
|
|
257
317
|
featureSources: corpusFiles.map((f) => f.source),
|
|
258
318
|
featureFiles: corpusFiles.map(({ slug, featureCode }) => ({ slug, featureCode })),
|
|
259
319
|
// The untagged half by its `<feature> : <scenario>` locator — parsed here because the locator
|
|
@@ -267,24 +327,24 @@ export function runReconcile(opts) {
|
|
|
267
327
|
// in is the caller's `--ci`, not the consumer's subject, so it is not part of what they write.
|
|
268
328
|
ciSourceNames: ciPaths.map((path) => basename(path)),
|
|
269
329
|
// The CONVERTED checks' credit stream, read at this edge like every other report. Absent it is
|
|
270
|
-
// undefined rather than empty, and that distinction reaches the reader
|
|
330
|
+
// undefined rather than empty, and that distinction reaches the reader: "no
|
|
271
331
|
// record" is a run nobody recorded, "a record holding nothing" is a run that recorded none of
|
|
272
332
|
// these steps, and those are opposite facts.
|
|
273
|
-
// STRUCTURALLY, NOT BY NAME: this module travels in the tarball and reaches core through the PUBLIC barrel alone
|
|
333
|
+
// STRUCTURALLY, NOT BY NAME: this module travels in the tarball and reaches core through the PUBLIC barrel alone, and
|
|
274
334
|
// `CiStepRecord` is not on it. The shape is the document's, which is the consumer's, so what is
|
|
275
335
|
// written here is what the file holds rather than a contract owed to anyone.
|
|
276
336
|
ciStepRecord: readJsonIfPresent(opts.ciSteps),
|
|
277
337
|
runtimeObservations: parseRuntimeObservations(opts, root),
|
|
278
338
|
// The two things the engine's resolvers cannot hold, and each for its own reason: the
|
|
279
339
|
// starter deferral set is the application layer's own policy, and how this tool is invoked to
|
|
280
|
-
// reconcile is a fact about this product's command line. THE PREFIX SET USED TO SIT HERE AND IS GONE
|
|
340
|
+
// reconcile is a fact about this product's command line. THE PREFIX SET USED TO SIT HERE AND IS GONE: the
|
|
281
341
|
// engine no longer decides a check's membership by its name, so there is no convention left
|
|
282
342
|
// for this edge to own.
|
|
283
343
|
deferralTags: DEFAULT_DEFERRAL_TAGS,
|
|
284
344
|
reconcilerInvocation: RECONCILER_INVOCATION,
|
|
285
345
|
});
|
|
286
346
|
}
|
|
287
|
-
// The static-check kind-counts are no longer read as a parallel census
|
|
347
|
+
// The static-check kind-counts are no longer read as a parallel census:
|
|
288
348
|
// the former `readStaticEvidenceObservationCounts` re-built the static check observations and
|
|
289
349
|
// re-derived the running / uncited split from a second read of the CI config. That counting now
|
|
290
350
|
// FOLDS onto the Ledger the reconciler already produced (`staticObservationTally`, an internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ingestQualityChecks.js","sourceRoot":"","sources":["../../src/ingest/ingestQualityChecks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAA0B,MAAM,sBAAsB,CAAC;AAChF,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACd,gBAAgB,GACjB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,yBAAyB,EACzB,4BAA4B,GAE7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EACL,mBAAmB,GAGpB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,+BAA+B,GAEhC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,iCAAiC,GAElC,MAAM,qCAAqC,CAAC;AAC7C,
|
|
1
|
+
{"version":3,"file":"ingestQualityChecks.js","sourceRoot":"","sources":["../../src/ingest/ingestQualityChecks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAA0B,MAAM,sBAAsB,CAAC;AAChF,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACd,gBAAgB,GACjB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,yBAAyB,EACzB,4BAA4B,GAE7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CA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A6F;QAC7F,2FAA2F;QAC3F,6FAA6F;QAC7F,+FAA+F;QAC/F,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACpD,+FAA+F;QAC/F,4EAA4E;QAC5E,8FAA8F;QAC9F,6CAA6C;QAC7C,sHAAsH;QACtH,gGAAgG;QAChG,6EAA6E;QAC7E,YAAY,EAAE,iBAAiB,CAC7B,IAAI,CAAC,OAAO,CACb;QACD,mBAAmB,EAAE,wBAAwB,CAAC,IAAI,EAAE,IAAI,CAAC;QACzD,sFAAsF;QACtF,8FAA8F;QAC9F,0GAA0G;QAC1G,4FAA4F;QAC5F,wBAAwB;QACxB,YAAY,EAAE,qBAAqB;QACnC,oBAAoB,EAAE,qBAAqB;KAC5C,CAAC,CAAC;AACL,CAAC;AAED,wEAAwE;AACxE,8FAA8F;AAC9F,gGAAgG;AAChG,+FAA+F;AAC/F,oGAAoG;AACpG,yFAAyF"}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* and reads each file's header code into DiscoveredFeature records (split out of the old
|
|
4
4
|
* spec/featureCodes.ts). The pure header parser (extractFeatureCode) lives here with its sole
|
|
5
5
|
* consumer; the `scnId → feature-code` grammar helper is engine-side (packages/core/src/lib/
|
|
6
|
-
* featureCode.ts); the duplicate-code lint is engine-side too
|
|
6
|
+
* featureCode.ts); the duplicate-code lint is engine-side too, in
|
|
7
7
|
* parse/scenarioCodeErrors.ts, and no longer a private check under tests/checks/.
|
|
8
8
|
*
|
|
9
|
-
* NO PER-FILE LIST OF SCENARIO CODES
|
|
9
|
+
* NO PER-FILE LIST OF SCENARIO CODES. One used to ride here, read by a copy of the
|
|
10
10
|
* @SCN grammar of its own, and nothing but its own test read it; a scenario's code is read by the
|
|
11
11
|
* engine's scenario walk, which is the reading the ledger's accounts are minted from.
|
|
12
12
|
*
|
|
@@ -28,7 +28,7 @@ export interface DiscoveredFeature {
|
|
|
28
28
|
export declare function extractFeatureCode(source: string): string | null;
|
|
29
29
|
/**
|
|
30
30
|
* Discover every feature file on disk and its header code — REFUSING a corpus the Gherkin
|
|
31
|
-
* parser rejects
|
|
31
|
+
* parser rejects.
|
|
32
32
|
*
|
|
33
33
|
* The refusal lives HERE, in the one reader every corpus consumer already goes through, so a
|
|
34
34
|
* consumer INHERITS it rather than restating it. It is not a second parser: it is the existing
|
|
@@ -36,7 +36,7 @@ export declare function extractFeatureCode(source: string): string | null;
|
|
|
36
36
|
* balance CLI's edge. One answer to "what is a feature file".
|
|
37
37
|
*
|
|
38
38
|
* WHY THE WHOLE CORPUS, NOT THE FIRST BAD FILE. `featureCorpusParseErrors` reports every
|
|
39
|
-
* unreadable file and the balance CLI prints them all
|
|
39
|
+
* unreadable file and the balance CLI prints them all. Refusing at the first
|
|
40
40
|
* failure would silently narrow that message, so every file is parsed and the refusal is raised
|
|
41
41
|
* once, carrying the lot in discovery order.
|
|
42
42
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ingestScenarios.d.ts","sourceRoot":"","sources":["../../src/ingest/ingestScenarios.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAeH,iFAAiF;AACjF,MAAM,WAAW,iBAAiB;IAChC,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKhE;
|
|
1
|
+
{"version":3,"file":"ingestScenarios.d.ts","sourceRoot":"","sources":["../../src/ingest/ingestScenarios.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAeH,iFAAiF;AACjF,MAAM,WAAW,iBAAiB;IAChC,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKhE;AA2ED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,MAAsB,GAAG,iBAAiB,EAAE,CAiBjF"}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* and reads each file's header code into DiscoveredFeature records (split out of the old
|
|
4
4
|
* spec/featureCodes.ts). The pure header parser (extractFeatureCode) lives here with its sole
|
|
5
5
|
* consumer; the `scnId → feature-code` grammar helper is engine-side (packages/core/src/lib/
|
|
6
|
-
* featureCode.ts); the duplicate-code lint is engine-side too
|
|
6
|
+
* featureCode.ts); the duplicate-code lint is engine-side too, in
|
|
7
7
|
* parse/scenarioCodeErrors.ts, and no longer a private check under tests/checks/.
|
|
8
8
|
*
|
|
9
|
-
* NO PER-FILE LIST OF SCENARIO CODES
|
|
9
|
+
* NO PER-FILE LIST OF SCENARIO CODES. One used to ride here, read by a copy of the
|
|
10
10
|
* @SCN grammar of its own, and nothing but its own test read it; a scenario's code is read by the
|
|
11
11
|
* engine's scenario walk, which is the reading the ledger's accounts are minted from.
|
|
12
12
|
*
|
|
@@ -62,8 +62,7 @@ function featuresDir() {
|
|
|
62
62
|
return join(process.cwd(), "features");
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
|
-
* List the corpus directory, REFUSING an absent one by name rather than by `ENOENT
|
|
66
|
-
* 3F-3345).
|
|
65
|
+
* List the corpus directory, REFUSING an absent one by name rather than by `ENOENT`.
|
|
67
66
|
*
|
|
68
67
|
* Absence stays a REFUSAL AT THE READER — what changed is that it is typed, so a caller can decide.
|
|
69
68
|
* `balance` opts in to reporting on a target that has no corpus (most targets have no `features/`
|
|
@@ -75,7 +74,7 @@ function featuresDir() {
|
|
|
75
74
|
* a different fault and is not ours to reinterpret — it rethrows.
|
|
76
75
|
*
|
|
77
76
|
* A SUPPLIED `--features` never reaches here absent: `checkInputsExist` refuses it at the CLI edge
|
|
78
|
-
* with exit 2
|
|
77
|
+
* with exit 2. Supplied-but-absent is the operator mistyping; absent-by-default is
|
|
79
78
|
* the target's honest shape.
|
|
80
79
|
*/
|
|
81
80
|
function corpusFileNames(dir) {
|
|
@@ -88,9 +87,23 @@ function corpusFileNames(dir) {
|
|
|
88
87
|
throw err;
|
|
89
88
|
}
|
|
90
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* A feature file's text. A read the operating system refuses keeps its error, and gains the file's
|
|
92
|
+
* path when it has none: reading a directory fails with no path at all.
|
|
93
|
+
*/
|
|
94
|
+
function readFeatureSource(path) {
|
|
95
|
+
try {
|
|
96
|
+
return readFileSync(path, "utf8");
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
const errno = err;
|
|
100
|
+
errno.path ??= path;
|
|
101
|
+
throw err;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
91
104
|
/**
|
|
92
105
|
* Discover every feature file on disk and its header code — REFUSING a corpus the Gherkin
|
|
93
|
-
* parser rejects
|
|
106
|
+
* parser rejects.
|
|
94
107
|
*
|
|
95
108
|
* The refusal lives HERE, in the one reader every corpus consumer already goes through, so a
|
|
96
109
|
* consumer INHERITS it rather than restating it. It is not a second parser: it is the existing
|
|
@@ -98,7 +111,7 @@ function corpusFileNames(dir) {
|
|
|
98
111
|
* balance CLI's edge. One answer to "what is a feature file".
|
|
99
112
|
*
|
|
100
113
|
* WHY THE WHOLE CORPUS, NOT THE FIRST BAD FILE. `featureCorpusParseErrors` reports every
|
|
101
|
-
* unreadable file and the balance CLI prints them all
|
|
114
|
+
* unreadable file and the balance CLI prints them all. Refusing at the first
|
|
102
115
|
* failure would silently narrow that message, so every file is parsed and the refusal is raised
|
|
103
116
|
* once, carrying the lot in discovery order.
|
|
104
117
|
*
|
|
@@ -111,7 +124,7 @@ export function discoverFeatures(dir = featuresDir()) {
|
|
|
111
124
|
.sort()
|
|
112
125
|
.map((name) => {
|
|
113
126
|
const path = join(dir, name);
|
|
114
|
-
return { name, path, source:
|
|
127
|
+
return { name, path, source: readFeatureSource(path) };
|
|
115
128
|
});
|
|
116
129
|
const parseErrors = files.flatMap(({ path, source }) => parseErrorsIn(path, source));
|
|
117
130
|
if (parseErrors.length > 0)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ingestScenarios.js","sourceRoot":"","sources":["../../src/ingest/ingestScenarios.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEpD,OAAO,EAAW,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EACL,yBAAyB,EACzB,4BAA4B,EAC5B,aAAa,GACd,MAAM,wBAAwB,CAAC;AAEhC,8DAA8D;AAC9D,MAAM,YAAY,GAAG,iBAAiB,CAAC;AAWvC;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACpC,MAAM,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;IAClF,IAAI,WAAW,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACjC,OAAO,eAAe,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC;AACxE,CAAC;AAED,qFAAqF;AACrF,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;AAE7E,iGAAiG;AACjG,SAAS,YAAY,CAAC,IAAY;IAChC,OAAO,CAAC,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I,EAAE;SACN,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC7B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC;IACzD,CAAC,CAAC,CAAC;IAEL,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IACrF,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,IAAI,4BAA4B,CAAC,WAAW,CAAC,CAAC;IAEhF,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;QAC5C,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;QACpC,IAAI;QACJ,WAAW,EAAE,kBAAkB,CAAC,MAAM,CAAC;KACxC,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shape each JSON input `balance` reads must have before its reader is handed it: the fields
|
|
3
|
+
* that reader goes on to read, and nothing more. A report is its producer's document, so a field
|
|
4
|
+
* the reader never touches is never checked, and a well-formed empty report is still a report.
|
|
5
|
+
*
|
|
6
|
+
* A document that is not this shape is an input the tool cannot read. Read anyway, it either
|
|
7
|
+
* throws part-way or is read as nothing and reaches a verdict about evidence it discarded, and
|
|
8
|
+
* both of those end on the out-of-balance code.
|
|
9
|
+
*/
|
|
10
|
+
/** A leaf kind, a list of one shape, a record of named fields, or a map whose entries share one. */
|
|
11
|
+
export type Shape = "string" | "number" | "boolean" | "anything" | {
|
|
12
|
+
readonly list: Shape;
|
|
13
|
+
} | {
|
|
14
|
+
readonly fields: Readonly<Record<string, Shape>>;
|
|
15
|
+
readonly required?: readonly string[];
|
|
16
|
+
} | {
|
|
17
|
+
readonly entries: Shape;
|
|
18
|
+
readonly keys?: RegExp;
|
|
19
|
+
};
|
|
20
|
+
/** What the Vitest JSON reporter writes, as far as the Vitest reader reads it. */
|
|
21
|
+
export declare const VITEST_REPORT: Shape;
|
|
22
|
+
/** What the Cucumber JSON formatter writes, as far as the Cucumber reader reads it. */
|
|
23
|
+
export declare const CUCUMBER_REPORT: Shape;
|
|
24
|
+
/**
|
|
25
|
+
* A CI run's step record, as far as the step-record reader reads it: an object of steps keyed by
|
|
26
|
+
* step id, of which it credits only those keyed by a scenario code, reading each one's `outcome`.
|
|
27
|
+
* The key grammar is the reader's own, so a step it never credits is never checked.
|
|
28
|
+
*/
|
|
29
|
+
export declare const CI_STEP_RECORD: Shape;
|
|
30
|
+
/**
|
|
31
|
+
* A package.json, as far as the run reads it outside the `specController` block: an object whose
|
|
32
|
+
* `scripts` are a map of commands. The `specController` block is left to its own resolvers, which
|
|
33
|
+
* read a value they cannot use as absent rather than refuse the run over it.
|
|
34
|
+
*/
|
|
35
|
+
export declare const PACKAGE_MANIFEST: Shape;
|
|
36
|
+
/**
|
|
37
|
+
* A reconciliation this tool saved, at its top: the sections every one carries, and the optional
|
|
38
|
+
* ones in their kind. Below the top the renderer is the reader, and a document it cannot render
|
|
39
|
+
* is refused where it renders.
|
|
40
|
+
*/
|
|
41
|
+
export declare const SAVED_RECONCILIATION: Shape;
|
|
42
|
+
/**
|
|
43
|
+
* The first place `value` is not `shape`, said as the path to it and what was found there, or null
|
|
44
|
+
* when the whole value is that shape. `where` is the path so far; the top level has none.
|
|
45
|
+
*/
|
|
46
|
+
export declare function shapeFaultIn(value: unknown, shape: Shape, where?: string): string | null;
|
|
47
|
+
//# sourceMappingURL=inputShapes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputShapes.d.ts","sourceRoot":"","sources":["../../src/ingest/inputShapes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,oGAAoG;AACpG,MAAM,MAAM,KAAK,GACb,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,UAAU,GACV;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;CAAE,GACxB;IAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAC3F;IAAE,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAKxD,kFAAkF;AAClF,eAAO,MAAM,aAAa,EAAE,KAc3B,CAAC;AAEF,uFAAuF;AACvF,eAAO,MAAM,eAAe,EAAE,KAe7B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,KAG5B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAsD,CAAC;AAEtF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAWlC,CAAC;AAkBF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,SAAK,GAAG,MAAM,GAAG,IAAI,CASpF"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shape each JSON input `balance` reads must have before its reader is handed it: the fields
|
|
3
|
+
* that reader goes on to read, and nothing more. A report is its producer's document, so a field
|
|
4
|
+
* the reader never touches is never checked, and a well-formed empty report is still a report.
|
|
5
|
+
*
|
|
6
|
+
* A document that is not this shape is an input the tool cannot read. Read anyway, it either
|
|
7
|
+
* throws part-way or is read as nothing and reaches a verdict about evidence it discarded, and
|
|
8
|
+
* both of those end on the out-of-balance code.
|
|
9
|
+
*/
|
|
10
|
+
/** What the Vitest JSON reporter writes, as far as the Vitest reader reads it. */
|
|
11
|
+
export const VITEST_REPORT = {
|
|
12
|
+
fields: {
|
|
13
|
+
testResults: {
|
|
14
|
+
list: {
|
|
15
|
+
fields: {
|
|
16
|
+
name: "string",
|
|
17
|
+
status: "string",
|
|
18
|
+
message: "string",
|
|
19
|
+
assertionResults: { list: { fields: { fullName: "string", title: "string", status: "string" } } },
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
required: ["testResults"],
|
|
25
|
+
};
|
|
26
|
+
/** What the Cucumber JSON formatter writes, as far as the Cucumber reader reads it. */
|
|
27
|
+
export const CUCUMBER_REPORT = {
|
|
28
|
+
list: {
|
|
29
|
+
fields: {
|
|
30
|
+
uri: "string",
|
|
31
|
+
name: "string",
|
|
32
|
+
elements: {
|
|
33
|
+
list: {
|
|
34
|
+
fields: {
|
|
35
|
+
tags: { list: { fields: { name: "string" } } },
|
|
36
|
+
steps: { list: { fields: { keyword: "string", name: "string", result: { fields: { status: "string" } } } } },
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* A CI run's step record, as far as the step-record reader reads it: an object of steps keyed by
|
|
45
|
+
* step id, of which it credits only those keyed by a scenario code, reading each one's `outcome`.
|
|
46
|
+
* The key grammar is the reader's own, so a step it never credits is never checked.
|
|
47
|
+
*/
|
|
48
|
+
export const CI_STEP_RECORD = {
|
|
49
|
+
entries: { fields: { outcome: "string" } },
|
|
50
|
+
keys: /^SCN-[A-Z0-9]{2,5}-\d+$/,
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* A package.json, as far as the run reads it outside the `specController` block: an object whose
|
|
54
|
+
* `scripts` are a map of commands. The `specController` block is left to its own resolvers, which
|
|
55
|
+
* read a value they cannot use as absent rather than refuse the run over it.
|
|
56
|
+
*/
|
|
57
|
+
export const PACKAGE_MANIFEST = { fields: { scripts: { entries: "string" } } };
|
|
58
|
+
/**
|
|
59
|
+
* A reconciliation this tool saved, at its top: the sections every one carries, and the optional
|
|
60
|
+
* ones in their kind. Below the top the renderer is the reader, and a document it cannot render
|
|
61
|
+
* is refused where it renders.
|
|
62
|
+
*/
|
|
63
|
+
export const SAVED_RECONCILIATION = {
|
|
64
|
+
fields: {
|
|
65
|
+
runProvenance: { fields: {} },
|
|
66
|
+
summary: { fields: {} },
|
|
67
|
+
ledger: { fields: { scenarioReconciliations: { list: "anything" } }, required: ["scenarioReconciliations"] },
|
|
68
|
+
scenarioCodeErrors: { list: "anything" },
|
|
69
|
+
scenarioCodePopulation: { fields: {} },
|
|
70
|
+
evidenceObligations: { fields: {} },
|
|
71
|
+
metadata: { fields: {} },
|
|
72
|
+
},
|
|
73
|
+
required: ["runProvenance", "summary", "ledger"],
|
|
74
|
+
};
|
|
75
|
+
function kindOf(value) {
|
|
76
|
+
if (value === null)
|
|
77
|
+
return "null";
|
|
78
|
+
if (Array.isArray(value))
|
|
79
|
+
return "a list";
|
|
80
|
+
if (typeof value === "object")
|
|
81
|
+
return "an object";
|
|
82
|
+
return `a ${typeof value}`;
|
|
83
|
+
}
|
|
84
|
+
function expectedKindOf(shape) {
|
|
85
|
+
if (typeof shape === "string")
|
|
86
|
+
return `a ${shape}`;
|
|
87
|
+
return "list" in shape ? "a list" : "an object";
|
|
88
|
+
}
|
|
89
|
+
function pathOf(where, key) {
|
|
90
|
+
return where === "" ? key : `${where}.${key}`;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The first place `value` is not `shape`, said as the path to it and what was found there, or null
|
|
94
|
+
* when the whole value is that shape. `where` is the path so far; the top level has none.
|
|
95
|
+
*/
|
|
96
|
+
export function shapeFaultIn(value, shape, where = "") {
|
|
97
|
+
if (shape === "anything")
|
|
98
|
+
return null;
|
|
99
|
+
const found = kindOf(value);
|
|
100
|
+
const expected = expectedKindOf(shape);
|
|
101
|
+
if (found !== expected)
|
|
102
|
+
return `${where === "" ? "the top level" : where} is ${found}, not ${expected}`;
|
|
103
|
+
if (typeof shape === "string")
|
|
104
|
+
return null;
|
|
105
|
+
if ("list" in shape)
|
|
106
|
+
return listFault(value, shape.list, where);
|
|
107
|
+
if ("entries" in shape)
|
|
108
|
+
return entriesFault(value, shape, where);
|
|
109
|
+
return fieldsFault(value, shape, where);
|
|
110
|
+
}
|
|
111
|
+
function listFault(items, item, where) {
|
|
112
|
+
for (const [index, value] of items.entries()) {
|
|
113
|
+
const fault = shapeFaultIn(value, item, `${where}[${index}]`);
|
|
114
|
+
if (fault !== null)
|
|
115
|
+
return fault;
|
|
116
|
+
}
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
function fieldsFault(record, shape, where) {
|
|
120
|
+
for (const [key, field] of Object.entries(shape.fields)) {
|
|
121
|
+
const path = pathOf(where, key);
|
|
122
|
+
if (record[key] === undefined) {
|
|
123
|
+
if (shape.required?.includes(key) === true)
|
|
124
|
+
return `${path} is missing`;
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
const fault = shapeFaultIn(record[key], field, path);
|
|
128
|
+
if (fault !== null)
|
|
129
|
+
return fault;
|
|
130
|
+
}
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
function entriesFault(record, shape, where) {
|
|
134
|
+
for (const [key, value] of Object.entries(record)) {
|
|
135
|
+
if (shape.keys !== undefined && !shape.keys.test(key))
|
|
136
|
+
continue;
|
|
137
|
+
const fault = shapeFaultIn(value, shape.entries, pathOf(where, key));
|
|
138
|
+
if (fault !== null)
|
|
139
|
+
return fault;
|
|
140
|
+
}
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=inputShapes.js.map
|