spec-controller 0.1.0-alpha.45 → 0.1.0-alpha.46
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/dist/cli-allocate/cli.d.ts.map +1 -1
- package/dist/cli-allocate/cli.js +0 -5
- package/dist/cli-allocate/cli.js.map +1 -1
- package/dist/cli-allocate/readHistory.d.ts +0 -13
- package/dist/cli-allocate/readHistory.d.ts.map +1 -1
- package/dist/cli-allocate/readHistory.js +0 -33
- package/dist/cli-allocate/readHistory.js.map +1 -1
- package/dist/cli-allocate/readParts.d.ts +0 -1
- package/dist/cli-allocate/readParts.d.ts.map +1 -1
- package/dist/cli-allocate/readParts.js +0 -6
- package/dist/cli-allocate/readParts.js.map +1 -1
- package/dist/cli-allocate/readTree.d.ts +0 -11
- package/dist/cli-allocate/readTree.d.ts.map +1 -1
- package/dist/cli-allocate/readTree.js +0 -32
- package/dist/cli-allocate/readTree.js.map +1 -1
- package/dist/cli-allocate/refStore.d.ts +0 -1
- package/dist/cli-allocate/refStore.d.ts.map +1 -1
- package/dist/cli-allocate/refStore.js +0 -13
- package/dist/cli-allocate/refStore.js.map +1 -1
- package/dist/cli-allocate/request.d.ts +0 -2
- package/dist/cli-allocate/request.d.ts.map +1 -1
- package/dist/cli-allocate/request.js +0 -7
- package/dist/cli-allocate/request.js.map +1 -1
- package/dist/cli-allocate/stderr.d.ts +0 -7
- package/dist/cli-allocate/stderr.d.ts.map +1 -1
- package/dist/cli-allocate/stderr.js +0 -7
- package/dist/cli-allocate/stderr.js.map +1 -1
- package/dist/cli-allocate/unreadable.d.ts +0 -13
- package/dist/cli-allocate/unreadable.d.ts.map +1 -1
- package/dist/cli-allocate/unreadable.js +0 -13
- package/dist/cli-allocate/unreadable.js.map +1 -1
- package/dist/cli-args.d.ts +0 -113
- package/dist/cli-args.d.ts.map +1 -1
- package/dist/cli-args.js +0 -145
- package/dist/cli-args.js.map +1 -1
- package/dist/cli-balance/cli.d.ts +0 -85
- package/dist/cli-balance/cli.d.ts.map +1 -1
- package/dist/cli-balance/cli.js +0 -230
- package/dist/cli-balance/cli.js.map +1 -1
- package/dist/cli-balance/emit/format.d.ts +0 -52
- package/dist/cli-balance/emit/format.d.ts.map +1 -1
- package/dist/cli-balance/emit/format.js +0 -70
- package/dist/cli-balance/emit/format.js.map +1 -1
- package/dist/cli-balance/emit/writer.d.ts +0 -17
- package/dist/cli-balance/emit/writer.d.ts.map +1 -1
- package/dist/cli-balance/emit/writer.js +0 -13
- package/dist/cli-balance/emit/writer.js.map +1 -1
- package/dist/cli-balance/exitStatus.d.ts +0 -1
- package/dist/cli-balance/exitStatus.d.ts.map +1 -1
- package/dist/cli-balance/exitStatus.js +0 -7
- package/dist/cli-balance/exitStatus.js.map +1 -1
- package/dist/cli-balance/inputsRead.d.ts +0 -12
- package/dist/cli-balance/inputsRead.d.ts.map +1 -1
- package/dist/cli-balance/inputsRead.js +0 -12
- package/dist/cli-balance/inputsRead.js.map +1 -1
- package/dist/cli-balance/reRender.d.ts +0 -14
- package/dist/cli-balance/reRender.d.ts.map +1 -1
- package/dist/cli-balance/reRender.js +0 -15
- package/dist/cli-balance/reRender.js.map +1 -1
- package/dist/cli-balance/unreadableInputs.d.ts +0 -21
- package/dist/cli-balance/unreadableInputs.d.ts.map +1 -1
- package/dist/cli-balance/unreadableInputs.js +0 -21
- package/dist/cli-balance/unreadableInputs.js.map +1 -1
- package/dist/cli-registry.d.ts +0 -86
- package/dist/cli-registry.d.ts.map +1 -1
- package/dist/cli-registry.js +0 -70
- package/dist/cli-registry.js.map +1 -1
- package/dist/cli.d.ts +0 -20
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +0 -21
- package/dist/cli.js.map +1 -1
- package/dist/deferralTags.d.ts +0 -14
- package/dist/deferralTags.d.ts.map +1 -1
- package/dist/deferralTags.js +0 -14
- package/dist/deferralTags.js.map +1 -1
- package/dist/host.d.ts +0 -61
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +1 -84
- package/dist/host.js.map +1 -1
- package/dist/ingest/ciSourcePaths.d.ts +0 -38
- package/dist/ingest/ciSourcePaths.d.ts.map +1 -1
- package/dist/ingest/ciSourcePaths.js +0 -38
- package/dist/ingest/ciSourcePaths.js.map +1 -1
- package/dist/ingest/gherkinValidation.d.ts +0 -76
- package/dist/ingest/gherkinValidation.d.ts.map +1 -1
- package/dist/ingest/gherkinValidation.js +0 -76
- package/dist/ingest/gherkinValidation.js.map +1 -1
- package/dist/ingest/ingestQualityChecks.d.ts +0 -81
- package/dist/ingest/ingestQualityChecks.d.ts.map +1 -1
- package/dist/ingest/ingestQualityChecks.js +0 -194
- package/dist/ingest/ingestQualityChecks.js.map +1 -1
- package/dist/ingest/ingestScenarios.d.ts +0 -39
- package/dist/ingest/ingestScenarios.d.ts.map +1 -1
- package/dist/ingest/ingestScenarios.js +0 -70
- package/dist/ingest/ingestScenarios.js.map +1 -1
- package/dist/ingest/inputShapes.d.ts +0 -31
- package/dist/ingest/inputShapes.d.ts.map +1 -1
- package/dist/ingest/inputShapes.js +0 -30
- package/dist/ingest/inputShapes.js.map +1 -1
- package/dist/outputLocation.d.ts +0 -48
- package/dist/outputLocation.d.ts.map +1 -1
- package/dist/outputLocation.js +0 -48
- package/dist/outputLocation.js.map +1 -1
- package/dist/run-management/keptRun.d.ts +0 -107
- package/dist/run-management/keptRun.d.ts.map +1 -1
- package/dist/run-management/keptRun.js +0 -75
- package/dist/run-management/keptRun.js.map +1 -1
- package/dist/run-management/resolveRunInputs.d.ts +0 -67
- package/dist/run-management/resolveRunInputs.d.ts.map +1 -1
- package/dist/run-management/resolveRunInputs.js +0 -88
- package/dist/run-management/resolveRunInputs.js.map +1 -1
- package/dist/storedRun.d.ts +0 -21
- package/dist/storedRun.d.ts.map +1 -1
- package/dist/storedRun.js +0 -21
- package/dist/storedRun.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,49 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resolve a CI input to the workflow files it names (@SCN-USG-006, 3F-2497).
|
|
3
|
-
*
|
|
4
|
-
* A target's pipeline is routinely split across files — a nightly sweep, a security
|
|
5
|
-
* scan — and reading one of them scores the rest against the target twice over: a
|
|
6
|
-
* NAMED check enforced elsewhere is called a watermelon it is not, an UNNAMED one
|
|
7
|
-
* never reaches the books at all (3F-2238).
|
|
8
|
-
*
|
|
9
|
-
* THIS IS THE ONLY PLACE THAT KNOWS A CI INPUT CAN BE A DIRECTORY. The core takes
|
|
10
|
-
* anonymous source strings so a second ecosystem can supply its own; teaching it to
|
|
11
|
-
* walk a folder would import a filesystem and one provider's layout into a pure
|
|
12
|
-
* parser and close that seam for good. So the walk lives here, at the edge that
|
|
13
|
-
* already resolved `.github/workflows/ci.yml`, and the edge knows exactly as much
|
|
14
|
-
* about GitHub after this slice as it did before.
|
|
15
|
-
*
|
|
16
|
-
* Pure, with the filesystem injected — the resolution rules are the part worth
|
|
17
|
-
* asserting directly, and a fixture tree can only show one of them going wrong at a
|
|
18
|
-
* time.
|
|
19
|
-
*/
|
|
20
1
|
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
21
2
|
import { join } from "node:path";
|
|
22
|
-
/** The real filesystem, for the CLI edge. */
|
|
23
3
|
export const NODE_CI_PATH_READER = {
|
|
24
4
|
exists: existsSync,
|
|
25
5
|
isDirectory: (path) => statSync(path).isDirectory(),
|
|
26
6
|
readDir: readdirSync,
|
|
27
7
|
};
|
|
28
|
-
/** Both YAML spellings: a target picks one, and the tool does not get to mind which. */
|
|
29
8
|
const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
|
|
30
|
-
/**
|
|
31
|
-
* The workflow files a CI input names: every workflow in a directory, or the single
|
|
32
|
-
* file itself.
|
|
33
|
-
*
|
|
34
|
-
* Sorted, so two runs over one tree cannot differ and a diff of two reports never
|
|
35
|
-
* turns on `readdir` ordering.
|
|
36
|
-
*
|
|
37
|
-
* A FILE RESOLVES TO ITSELF ALONE. Sweeping its parent directory would silently widen
|
|
38
|
-
* a caller's deliberate scope, which is the promise @SCN-USG-008 pins at the report level.
|
|
39
|
-
*
|
|
40
|
-
* An absent path resolves to nothing — no sources, no commands, every static check
|
|
41
|
-
* read as unenforced. That over-reports gaps and hides none, the same fail-safe
|
|
42
|
-
* direction `ciRunCommands` takes on a document it cannot parse. The HARD error for a
|
|
43
|
-
* path the caller SUPPLIED and that does not exist is @SCN-CLI-002's, raised upstream;
|
|
44
|
-
* reaching here with nothing means the DEFAULT found no workflows, which is a fact
|
|
45
|
-
* about the target rather than a mistake by its author.
|
|
46
|
-
*/
|
|
47
9
|
export function ciSourcePathsOf(ciPath, reader = NODE_CI_PATH_READER) {
|
|
48
10
|
if (!reader.exists(ciPath))
|
|
49
11
|
return [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ciSourcePaths.js","sourceRoot":"","sources":["../../src/ingest/ciSourcePaths.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ciSourcePaths.js","sourceRoot":"","sources":["../../src/ingest/ciSourcePaths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAQjC,MAAM,CAAC,MAAM,mBAAmB,GAAiB;IAC/C,MAAM,EAAE,UAAU;IAClB,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE;IACnD,OAAO,EAAE,WAAW;CACrB,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE9C,MAAM,UAAU,eAAe,CAC7B,MAAc,EACd,SAAuB,mBAAmB;IAE1C,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;QAAE,OAAO,EAAE,CAAC;IACtC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC;QAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACjD,OAAO,MAAM;SACV,OAAO,CAAC,MAAM,CAAC;SACf,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;SACvE,IAAI,EAAE;SACN,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -1,89 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The Gherkin VALIDATOR — the feature corpus's integrity checkpoint (@SCN-CLI-016, 3F-1767).
|
|
3
|
-
*
|
|
4
|
-
* WHY THIS EXISTS. The feature corpus is the ledger's DEBIT side, and it was read by a
|
|
5
|
-
* hand-rolled TAG-LINE SCAN (`parseScenarios`) that never looked for a `Scenario:` header at
|
|
6
|
-
* all: a scenario EXISTED purely because an `@SCN-FFF-NNN` tag line did. So a
|
|
7
|
-
* malformed tag line simply STOPPED BEING A TAG LINE, and its scenario ceased to exist —
|
|
8
|
-
* silently. One stray character, in a file cucumber itself rejects, deleted a failing row and
|
|
9
|
-
* turned an out-of-balance run (exit 1) into a clean BALANCED (exit 0). A dropped scenario
|
|
10
|
-
* cannot even reconcile `missing`, because it was never raised to be missing: the run reads
|
|
11
|
-
* CLEANER THAN REALITY. That is the false-green this tool exists to prevent, aimed at itself.
|
|
12
|
-
*
|
|
13
|
-
* THE FIX (this slice). VALIDATE every feature file with the REAL Gherkin parser — the same one
|
|
14
|
-
* cucumber uses. A file the parser rejects is an input the tool CANNOT READ, and the CLI refuses
|
|
15
|
-
* it: exit 2, halting before reconciling (@SCN-CLI-014/015's Rule — "an input the tool cannot read
|
|
16
|
-
* is a usage error, never a verdict" — extended from the OBSERVATION side to the OBLIGATION side).
|
|
17
|
-
*
|
|
18
|
-
* VALIDATION IS HALF THE STORY. This decides whether a feature file can be READ at all; the corpus
|
|
19
|
-
* is then EXTRACTED from the same real AST by `parseScenarios` (@SCN-LDG-020, 3F-1775), so the
|
|
20
|
-
* scenarios spec-controller reconciles carry exactly the tags cucumber gives them — Feature/Rule
|
|
21
|
-
* tag inheritance included. One reading of the file, not two.
|
|
22
|
-
*
|
|
23
|
-
* PURE: `string → parse errors`. No fs, no process — the file READ lives beside it at the ingest
|
|
24
|
-
* edge, as it does for every other input.
|
|
25
|
-
*
|
|
26
|
-
* WHY IT LIVES IN THE APP, NOT CORE. Core's barrel is the v1 contract surface downstream consumers
|
|
27
|
-
* build on. Since 3F-3449 nothing reds when a symbol is added there — the guard that reconciled it
|
|
28
|
-
* both directions is gone — so keeping it narrow is a discipline rather than a gate. This validator
|
|
29
|
-
* is an INGEST concern (it decides whether an input can be read at all), not part of the
|
|
30
|
-
* reconciliation contract, so it belongs with the other readers at the app edge and the v1 surface
|
|
31
|
-
* stays untouched.
|
|
32
|
-
*/
|
|
33
|
-
/** A Gherkin parse failure: the file could not be read as Gherkin at all. */
|
|
34
1
|
export interface GherkinParseError {
|
|
35
|
-
/** The offending file, as supplied (the operator's locator — what to go and fix). */
|
|
36
2
|
file: string;
|
|
37
|
-
/** The parser's own message, verbatim — WHAT broke, in the parser's words. */
|
|
38
3
|
message: string;
|
|
39
4
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Validate one `.feature` source with the real Gherkin parser. Returns the parse errors it
|
|
42
|
-
* reports — empty when the file is well-formed Gherkin.
|
|
43
|
-
*
|
|
44
|
-
* The parser is authoritative BY CONSTRUCTION: it is cucumber's own. A file it rejects is one
|
|
45
|
-
* cucumber would refuse to RUN, so a scenario corpus built from it would be a FICTION — which is
|
|
46
|
-
* precisely how a corrupt spec used to read balanced.
|
|
47
|
-
*
|
|
48
|
-
* A parse failure is reported, never thrown: the CLI edge routes it to stderr + exit 2 (the
|
|
49
|
-
* shared typed-error surface), so it can never reach Node's default exit 1 and masquerade as an
|
|
50
|
-
* out-of-balance verdict (@SCN-CLI-014's collision, on the obligation side).
|
|
51
|
-
*
|
|
52
|
-
* @SCN-CLI-016 (3F-1773).
|
|
53
|
-
*/
|
|
54
5
|
export declare function parseErrorsIn(file: string, source: string): GherkinParseError[];
|
|
55
|
-
/**
|
|
56
|
-
* The corpus-level REFUSAL (@SCN-GPG-001, 3F-2817). A parse failure is reported per file by
|
|
57
|
-
* `parseErrorsIn` above; this is how a reader of the WHOLE corpus says no.
|
|
58
|
-
*
|
|
59
|
-
* WHY IT CARRIES EVERY FILE. The balance CLI already names every unparseable file it found
|
|
60
|
-
* (@SCN-CLI-016), and a refusal raised at the first bad one would silently narrow that message —
|
|
61
|
-
* a behaviour change dressed as an implementation detail. So the discovery collects the corpus
|
|
62
|
-
* and refuses ONCE, carrying the lot in discovery order.
|
|
63
|
-
*
|
|
64
|
-
* The rendered message is the parser's words, per file, verbatim: a reader must be told WHAT
|
|
65
|
-
* broke by the parser rather than by our paraphrase of it.
|
|
66
|
-
*/
|
|
67
6
|
export declare class UnreadableFeatureCorpusError extends Error {
|
|
68
7
|
readonly errors: readonly GherkinParseError[];
|
|
69
8
|
constructor(errors: readonly GherkinParseError[]);
|
|
70
9
|
}
|
|
71
|
-
/**
|
|
72
|
-
* The corpus-level ABSENCE refusal (@SCN-CLI-017, 3F-3345) — sibling to the parse refusal above,
|
|
73
|
-
* and deliberately the same shape: the reader refuses ONCE, and each command decides what the
|
|
74
|
-
* refusal means for it.
|
|
75
|
-
*
|
|
76
|
-
* WHY A TYPED ERROR RATHER THAN AN EMPTY CORPUS. The obvious fix is for `discoverFeatures` to hand
|
|
77
|
-
* back `[]` when the directory is not there, and that would decide for every reader that absence
|
|
78
|
-
* is empty. Typed, each caller decides: `balance` reads it as no corpus (@SCN-CLI-017), and any
|
|
79
|
-
* other reader still meets a refusal. (The second command this guarded, `tags`, left at 3F-3635.)
|
|
80
|
-
*
|
|
81
|
-
* IT CARRIES THE DIRECTORY because the report is owed the name of what it examined — "I found no
|
|
82
|
-
* record" and "I found no regression" must never wear one word (3F-2947), and a consumer told
|
|
83
|
-
* their corpus is empty deserves to know which directory was read to reach that.
|
|
84
|
-
*/
|
|
85
10
|
export declare class MissingFeatureCorpusError extends Error {
|
|
86
|
-
/** The directory that is not there — as resolved, so a reader can print the path examined. */
|
|
87
11
|
readonly directory: string;
|
|
88
12
|
constructor(directory: string);
|
|
89
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gherkinValidation.d.ts","sourceRoot":"","sources":["../../src/ingest/gherkinValidation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gherkinValidation.d.ts","sourceRoot":"","sources":["../../src/ingest/gherkinValidation.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAU/E;AAED,qBAAa,4BAA6B,SAAQ,KAAK;IACrD,QAAQ,CAAC,MAAM,EAAE,SAAS,iBAAiB,EAAE,CAAC;gBAElC,MAAM,EAAE,SAAS,iBAAiB,EAAE;CAUjD;AAED,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBAEf,SAAS,EAAE,MAAM;CAK9B"}
|
|
@@ -1,51 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The Gherkin VALIDATOR — the feature corpus's integrity checkpoint (@SCN-CLI-016, 3F-1767).
|
|
3
|
-
*
|
|
4
|
-
* WHY THIS EXISTS. The feature corpus is the ledger's DEBIT side, and it was read by a
|
|
5
|
-
* hand-rolled TAG-LINE SCAN (`parseScenarios`) that never looked for a `Scenario:` header at
|
|
6
|
-
* all: a scenario EXISTED purely because an `@SCN-FFF-NNN` tag line did. So a
|
|
7
|
-
* malformed tag line simply STOPPED BEING A TAG LINE, and its scenario ceased to exist —
|
|
8
|
-
* silently. One stray character, in a file cucumber itself rejects, deleted a failing row and
|
|
9
|
-
* turned an out-of-balance run (exit 1) into a clean BALANCED (exit 0). A dropped scenario
|
|
10
|
-
* cannot even reconcile `missing`, because it was never raised to be missing: the run reads
|
|
11
|
-
* CLEANER THAN REALITY. That is the false-green this tool exists to prevent, aimed at itself.
|
|
12
|
-
*
|
|
13
|
-
* THE FIX (this slice). VALIDATE every feature file with the REAL Gherkin parser — the same one
|
|
14
|
-
* cucumber uses. A file the parser rejects is an input the tool CANNOT READ, and the CLI refuses
|
|
15
|
-
* it: exit 2, halting before reconciling (@SCN-CLI-014/015's Rule — "an input the tool cannot read
|
|
16
|
-
* is a usage error, never a verdict" — extended from the OBSERVATION side to the OBLIGATION side).
|
|
17
|
-
*
|
|
18
|
-
* VALIDATION IS HALF THE STORY. This decides whether a feature file can be READ at all; the corpus
|
|
19
|
-
* is then EXTRACTED from the same real AST by `parseScenarios` (@SCN-LDG-020, 3F-1775), so the
|
|
20
|
-
* scenarios spec-controller reconciles carry exactly the tags cucumber gives them — Feature/Rule
|
|
21
|
-
* tag inheritance included. One reading of the file, not two.
|
|
22
|
-
*
|
|
23
|
-
* PURE: `string → parse errors`. No fs, no process — the file READ lives beside it at the ingest
|
|
24
|
-
* edge, as it does for every other input.
|
|
25
|
-
*
|
|
26
|
-
* WHY IT LIVES IN THE APP, NOT CORE. Core's barrel is the v1 contract surface downstream consumers
|
|
27
|
-
* build on. Since 3F-3449 nothing reds when a symbol is added there — the guard that reconciled it
|
|
28
|
-
* both directions is gone — so keeping it narrow is a discipline rather than a gate. This validator
|
|
29
|
-
* is an INGEST concern (it decides whether an input can be read at all), not part of the
|
|
30
|
-
* reconciliation contract, so it belongs with the other readers at the app edge and the v1 surface
|
|
31
|
-
* stays untouched.
|
|
32
|
-
*/
|
|
33
1
|
import { AstBuilder, GherkinClassicTokenMatcher, Parser } from "@cucumber/gherkin";
|
|
34
2
|
import { IdGenerator } from "@cucumber/messages";
|
|
35
|
-
/**
|
|
36
|
-
* Validate one `.feature` source with the real Gherkin parser. Returns the parse errors it
|
|
37
|
-
* reports — empty when the file is well-formed Gherkin.
|
|
38
|
-
*
|
|
39
|
-
* The parser is authoritative BY CONSTRUCTION: it is cucumber's own. A file it rejects is one
|
|
40
|
-
* cucumber would refuse to RUN, so a scenario corpus built from it would be a FICTION — which is
|
|
41
|
-
* precisely how a corrupt spec used to read balanced.
|
|
42
|
-
*
|
|
43
|
-
* A parse failure is reported, never thrown: the CLI edge routes it to stderr + exit 2 (the
|
|
44
|
-
* shared typed-error surface), so it can never reach Node's default exit 1 and masquerade as an
|
|
45
|
-
* out-of-balance verdict (@SCN-CLI-014's collision, on the obligation side).
|
|
46
|
-
*
|
|
47
|
-
* @SCN-CLI-016 (3F-1773).
|
|
48
|
-
*/
|
|
49
3
|
export function parseErrorsIn(file, source) {
|
|
50
4
|
const parser = new Parser(new AstBuilder(IdGenerator.uuid()), new GherkinClassicTokenMatcher());
|
|
51
5
|
try {
|
|
@@ -53,25 +7,10 @@ export function parseErrorsIn(file, source) {
|
|
|
53
7
|
return [];
|
|
54
8
|
}
|
|
55
9
|
catch (err) {
|
|
56
|
-
// The parser raises a CompositeParserException carrying every error it found; its message
|
|
57
|
-
// is the operator's actionable payload (line, column, and what it expected). Reported
|
|
58
|
-
// verbatim — the tool must not paraphrase the parser and risk describing a fault wrongly.
|
|
59
10
|
const message = err instanceof Error ? err.message : String(err);
|
|
60
11
|
return [{ file, message }];
|
|
61
12
|
}
|
|
62
13
|
}
|
|
63
|
-
/**
|
|
64
|
-
* The corpus-level REFUSAL (@SCN-GPG-001, 3F-2817). A parse failure is reported per file by
|
|
65
|
-
* `parseErrorsIn` above; this is how a reader of the WHOLE corpus says no.
|
|
66
|
-
*
|
|
67
|
-
* WHY IT CARRIES EVERY FILE. The balance CLI already names every unparseable file it found
|
|
68
|
-
* (@SCN-CLI-016), and a refusal raised at the first bad one would silently narrow that message —
|
|
69
|
-
* a behaviour change dressed as an implementation detail. So the discovery collects the corpus
|
|
70
|
-
* and refuses ONCE, carrying the lot in discovery order.
|
|
71
|
-
*
|
|
72
|
-
* The rendered message is the parser's words, per file, verbatim: a reader must be told WHAT
|
|
73
|
-
* broke by the parser rather than by our paraphrase of it.
|
|
74
|
-
*/
|
|
75
14
|
export class UnreadableFeatureCorpusError extends Error {
|
|
76
15
|
errors;
|
|
77
16
|
constructor(errors) {
|
|
@@ -83,22 +22,7 @@ export class UnreadableFeatureCorpusError extends Error {
|
|
|
83
22
|
this.errors = errors;
|
|
84
23
|
}
|
|
85
24
|
}
|
|
86
|
-
/**
|
|
87
|
-
* The corpus-level ABSENCE refusal (@SCN-CLI-017, 3F-3345) — sibling to the parse refusal above,
|
|
88
|
-
* and deliberately the same shape: the reader refuses ONCE, and each command decides what the
|
|
89
|
-
* refusal means for it.
|
|
90
|
-
*
|
|
91
|
-
* WHY A TYPED ERROR RATHER THAN AN EMPTY CORPUS. The obvious fix is for `discoverFeatures` to hand
|
|
92
|
-
* back `[]` when the directory is not there, and that would decide for every reader that absence
|
|
93
|
-
* is empty. Typed, each caller decides: `balance` reads it as no corpus (@SCN-CLI-017), and any
|
|
94
|
-
* other reader still meets a refusal. (The second command this guarded, `tags`, left at 3F-3635.)
|
|
95
|
-
*
|
|
96
|
-
* IT CARRIES THE DIRECTORY because the report is owed the name of what it examined — "I found no
|
|
97
|
-
* record" and "I found no regression" must never wear one word (3F-2947), and a consumer told
|
|
98
|
-
* their corpus is empty deserves to know which directory was read to reach that.
|
|
99
|
-
*/
|
|
100
25
|
export class MissingFeatureCorpusError extends Error {
|
|
101
|
-
/** The directory that is not there — as resolved, so a reader can print the path examined. */
|
|
102
26
|
directory;
|
|
103
27
|
constructor(directory) {
|
|
104
28
|
super(`The feature corpus directory does not exist: ${directory}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gherkinValidation.js","sourceRoot":"","sources":["../../src/ingest/gherkinValidation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"gherkinValidation.js","sourceRoot":"","sources":["../../src/ingest/gherkinValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,0BAA0B,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAOjD,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,MAAc;IACxD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,UAAU,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,0BAA0B,EAAE,CAAC,CAAC;IAEhG,IAAI,CAAC;QACH,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACrB,OAAO,EAAE,CAAC;IACZ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjE,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC;AAED,MAAM,OAAO,4BAA6B,SAAQ,KAAK;IAC5C,MAAM,CAA+B;IAE9C,YAAY,MAAoC;QAC9C,KAAK,CACH;YACE,yEAAyE;YACzE,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC;SAC5D,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,8BAA8B,CAAC;QAC3C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IACzC,SAAS,CAAS;IAE3B,YAAY,SAAiB;QAC3B,KAAK,CAAC,gDAAgD,SAAS,EAAE,CAAC,CAAC;QACnE,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;QACxC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF"}
|
|
@@ -1,105 +1,24 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ingest the target's quality-check inputs — the IMPURE reads behind the balance
|
|
3
|
-
* command (split out of the old cli.ts). Reads evidence
|
|
4
|
-
* obligations from the repo's feature files, observed evidence from the Vitest +
|
|
5
|
-
* Cucumber result JSON, and the static-check evidence from the CI config + package.json,
|
|
6
|
-
* turning each into the engine's in-memory model. The orchestration (arg parsing, the
|
|
7
|
-
* output plan/write, main) stays in cli-balance/cli.ts; these are the file reads it calls.
|
|
8
|
-
*
|
|
9
|
-
* Configurable input paths (no adapter registry in v1 — the readers are named, not
|
|
10
|
-
* registered). Missing result files are tolerated: their evidence is simply absent
|
|
11
|
-
* (the scenario reconciles as missing for that level). The static check kind reads
|
|
12
|
-
* `--ci` (a workflow file or a directory of them, default `.github/workflows`) +
|
|
13
|
-
* `package.json` to observe each fitness check the corpus cites.
|
|
14
|
-
*/
|
|
15
1
|
import { type GherkinParseError } from "./gherkinValidation.js";
|
|
16
2
|
import { type EvidenceObligations } from "@3f-consulting/spec-controller-core";
|
|
17
3
|
import type { EvidenceReconciliation } from "@3f-consulting/spec-controller-core";
|
|
18
|
-
/**
|
|
19
|
-
* The reconciler's resolved input paths — the CLI options threaded to the readers.
|
|
20
|
-
* Every path is optional; a missing result file is tolerated (its evidence is
|
|
21
|
-
* simply absent). `packageJson` is the EXTERNALLY-SPECIFIED package.json the static
|
|
22
|
-
* static-check reader reads `exists` from (the --package-json seam):
|
|
23
|
-
* default the tool's own cwd `package.json`; set it to reconcile ANOTHER repo's
|
|
24
|
-
* static checks — required to render the historical watermelon correctly.
|
|
25
|
-
*/
|
|
26
4
|
export interface ReconcileOptions {
|
|
27
5
|
features?: string;
|
|
28
6
|
vitest?: string;
|
|
29
7
|
cucumber?: string;
|
|
30
8
|
ci?: string;
|
|
31
9
|
packageJson?: string;
|
|
32
|
-
/**
|
|
33
|
-
* The CI RUN'S OWN RECORD of what each of its steps did — the credit
|
|
34
|
-
* side of every CONVERTED fitness check, written by the consumer's own pipeline and by neither
|
|
35
|
-
* party to this reconciliation.
|
|
36
|
-
*
|
|
37
|
-
* KEPT APART FROM `ci` BECAUSE THE TWO DOCUMENTS ANSWER DIFFERENT QUESTIONS. The workflow FILE
|
|
38
|
-
* says a check is wired into this pipeline and which row its step cites — a fact about a
|
|
39
|
-
* repository, true between runs. This is one RUN's record: did it run this time, and what did it
|
|
40
|
-
* find. Optional like the other result files: a consumer whose pipeline dumps no record, or a
|
|
41
|
-
* local run with no pipeline at all, hands none, and the converted rows it would have answered
|
|
42
|
-
* read `missing`.
|
|
43
|
-
*/
|
|
44
10
|
ciSteps?: string;
|
|
45
11
|
}
|
|
46
|
-
/** Where the CI workflows are read from when `--ci` is not given. */
|
|
47
12
|
export declare const DEFAULT_CI_PATH = ".github/workflows";
|
|
48
|
-
/** The target's manifest when `--package-json` is not given: the one in the directory the run is in. */
|
|
49
13
|
export declare const DEFAULT_PACKAGE_JSON = "package.json";
|
|
50
|
-
/**
|
|
51
|
-
* The feature corpus's INTEGRITY CHECKPOINT — validate every discovered
|
|
52
|
-
* `.feature` with the REAL Gherkin parser and report the files it cannot read.
|
|
53
|
-
*
|
|
54
|
-
* The feature corpus is the ledger's DEBIT side, and it used to be read by a tag-line scan that
|
|
55
|
-
* never consulted a parser — so a malformed tag line silently deleted its scenario, and a corrupt
|
|
56
|
-
* spec could read BALANCED. A file the parser rejects is one cucumber would refuse to run: the
|
|
57
|
-
* CLI halts on it (exit 2) rather than reconciling a corpus that is a fiction.
|
|
58
|
-
*
|
|
59
|
-
* THIS IS NOW THE CATCH SITE, NOT THE CALL SITE. The validation moved
|
|
60
|
-
* into `discoverFeatures`, which REFUSES an unreadable corpus rather than returning one, so every
|
|
61
|
-
* corpus reader inherits the refusal instead of each restating it. What is left here is the
|
|
62
|
-
* translation back into the list this CLI edge already prints — same files, same order, same
|
|
63
|
-
* verbatim parser messages, so `balance`'s behaviour is unchanged. Anything that is not a corpus
|
|
64
|
-
* refusal is not ours to interpret and rethrows.
|
|
65
|
-
*/
|
|
66
14
|
export declare function featureCorpusParseErrors(featuresDir: string | undefined): GherkinParseError[];
|
|
67
|
-
/** A read of the feature corpus or the CI workflows that the operating system refused. */
|
|
68
15
|
export interface InputReadFault {
|
|
69
16
|
readonly path: string;
|
|
70
17
|
readonly reason: string;
|
|
71
18
|
}
|
|
72
|
-
/**
|
|
73
|
-
* The read of the feature corpus that failed, taken by the same discovery the reconcile uses, or
|
|
74
|
-
* null when it reads. A file the Gherkin parser rejects is not this fault: it is reported by
|
|
75
|
-
* `featureCorpusParseErrors`, after this.
|
|
76
|
-
*/
|
|
77
19
|
export declare function corpusReadFault(featuresDir: string | undefined): InputReadFault | null;
|
|
78
|
-
/** The read of a CI workflow that failed, over the same files the reconcile reads, or null when they all read. */
|
|
79
20
|
export declare function ciReadFault(ciPath: string | undefined): InputReadFault | null;
|
|
80
|
-
/**
|
|
81
|
-
* Read the target's `feature-code → slug` map over the same `discoverFeatures` corpus
|
|
82
|
-
* — each coded feature file's `@<FFF>` header (`featureCode`)
|
|
83
|
-
* mapped to its filename `slug`, the full feature name. This is the mapping
|
|
84
|
-
* `scenariosFromFeatures` discards (it keeps only the parsed scenarios). A sibling read to
|
|
85
|
-
* the balance, threaded to `renderMarkdown` (via `writeOutputs`) as the 5th sibling arg
|
|
86
|
-
* (markdown-only — the by-feature cut is markdown-only, so it is NOT serialised to JSON).
|
|
87
|
-
* Uncoded files (`featureCode === null`) are omitted, so the by-feature emitter falls
|
|
88
|
-
* back to the bare `FFF` for any id whose code no file registers. When two files carry one
|
|
89
|
-
* code the map keeps the last, and that run lists `duplicate-feature-code` under Scenario code
|
|
90
|
-
* errors and fails, so a report whose map is ambiguous never passes.
|
|
91
|
-
*/
|
|
92
21
|
export declare function readFeatureNames(featuresDir?: string): Map<string, string>;
|
|
93
|
-
/**
|
|
94
|
-
* Read the scenario-corpus census over the discovered feature files (the same
|
|
95
|
-
* `discoverFeatures` corpus `scenariosFromFeatures` reads): sum the raw @SCN
|
|
96
|
-
* occurrences (`countScnOccurrences`) and the scenario count
|
|
97
|
-
* (`parseScenarios(...).length`) across every file, and build the `EvidenceObligations`
|
|
98
|
-
* sibling. Also collects the UNTAGGED scenarios
|
|
99
|
-
* — `parseUntaggedScenarios` per file, each paired with its feature-file
|
|
100
|
-
* locator, sorted by (feature, scenario). Read alongside the balance in `main()` and
|
|
101
|
-
* threaded to the renderers via `writeOutputs`; `runReconcile` stays unchanged.
|
|
102
|
-
*/
|
|
103
22
|
export declare function readEvidenceObligations(features?: string): EvidenceObligations;
|
|
104
23
|
export declare function runReconcile(opts: ReconcileOptions): EvidenceReconciliation;
|
|
105
24
|
//# sourceMappingURL=ingestQualityChecks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ingestQualityChecks.d.ts","sourceRoot":"","sources":["../../src/ingest/ingestQualityChecks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ingestQualityChecks.d.ts","sourceRoot":"","sources":["../../src/ingest/ingestQualityChecks.ts"],"names":[],"mappings":"AAWA,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAEL,KAAK,mBAAmB,EAEzB,MAAM,qCAAqC,CAAC;AAY7C,OAAO,KAAK,EAIV,sBAAsB,EACvB,MAAM,qCAAqC,CAAC;AAO7C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,eAAe,sBAAsB,CAAC;AAEnD,eAAO,MAAM,oBAAoB,iBAAiB,CAAC;AAkCnD,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,iBAAiB,EAAE,CAQ7F;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAQD,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,cAAc,GAAG,IAAI,CAUtF;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,cAAc,GAAG,IAAI,CAU7E;AAYD,wBAAgB,gBAAgB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAM1E;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAqB9E;AAmBD,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,sBAAsB,CA2B3E"}
|