spec-controller 0.1.0-alpha.5 → 0.1.0-alpha.51
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 +60 -0
- package/dist/cli-allocate/cli.js.map +1 -0
- package/dist/cli-allocate/readHistory.d.ts +15 -0
- package/dist/cli-allocate/readHistory.d.ts.map +1 -0
- package/dist/cli-allocate/readHistory.js +108 -0
- package/dist/cli-allocate/readHistory.js.map +1 -0
- package/dist/cli-allocate/readParts.d.ts +2 -0
- package/dist/cli-allocate/readParts.d.ts.map +1 -0
- package/dist/cli-allocate/readParts.js +22 -0
- package/dist/cli-allocate/readParts.js.map +1 -0
- package/dist/cli-allocate/readTree.d.ts +5 -0
- package/dist/cli-allocate/readTree.d.ts.map +1 -0
- package/dist/cli-allocate/readTree.js +74 -0
- package/dist/cli-allocate/readTree.js.map +1 -0
- package/dist/cli-allocate/refStore.d.ts +2 -0
- package/dist/cli-allocate/refStore.d.ts.map +1 -0
- package/dist/cli-allocate/refStore.js +34 -0
- package/dist/cli-allocate/refStore.js.map +1 -0
- package/dist/cli-allocate/request.d.ts +9 -0
- package/dist/cli-allocate/request.d.ts.map +1 -0
- package/dist/cli-allocate/request.js +22 -0
- package/dist/cli-allocate/request.js.map +1 -0
- package/dist/cli-allocate/stderr.d.ts +7 -0
- package/dist/cli-allocate/stderr.d.ts.map +1 -0
- package/dist/cli-allocate/stderr.js +26 -0
- package/dist/cli-allocate/stderr.js.map +1 -0
- package/dist/cli-allocate/unreadable.d.ts +11 -0
- package/dist/cli-allocate/unreadable.d.ts.map +1 -0
- package/dist/cli-allocate/unreadable.js +30 -0
- package/dist/cli-allocate/unreadable.js.map +1 -0
- package/dist/cli-args.d.ts +12 -70
- package/dist/cli-args.d.ts.map +1 -1
- package/dist/cli-args.js +158 -81
- package/dist/cli-args.js.map +1 -1
- package/dist/cli-balance/cli.d.ts +1 -81
- package/dist/cli-balance/cli.d.ts.map +1 -1
- package/dist/cli-balance/cli.js +71 -357
- package/dist/cli-balance/cli.js.map +1 -1
- package/dist/cli-balance/emit/format.d.ts +16 -38
- package/dist/cli-balance/emit/format.d.ts.map +1 -1
- package/dist/cli-balance/emit/format.js +31 -58
- package/dist/cli-balance/emit/format.js.map +1 -1
- package/dist/cli-balance/emit/writer.d.ts +2 -32
- package/dist/cli-balance/emit/writer.d.ts.map +1 -1
- package/dist/cli-balance/emit/writer.js +50 -37
- package/dist/cli-balance/emit/writer.js.map +1 -1
- package/dist/cli-balance/exitStatus.d.ts +2 -0
- package/dist/cli-balance/exitStatus.d.ts.map +1 -0
- package/dist/cli-balance/exitStatus.js +5 -0
- package/dist/cli-balance/exitStatus.js.map +1 -0
- package/dist/cli-balance/inputsRead.d.ts +11 -0
- package/dist/cli-balance/inputsRead.d.ts.map +1 -0
- package/dist/cli-balance/inputsRead.js +53 -0
- package/dist/cli-balance/inputsRead.js.map +1 -0
- package/dist/cli-balance/reRender.d.ts +8 -0
- package/dist/cli-balance/reRender.d.ts.map +1 -0
- package/dist/cli-balance/reRender.js +21 -0
- package/dist/cli-balance/reRender.js.map +1 -0
- package/dist/cli-balance/unreadableInputs.d.ts +14 -0
- package/dist/cli-balance/unreadableInputs.d.ts.map +1 -0
- package/dist/cli-balance/unreadableInputs.js +80 -0
- package/dist/cli-balance/unreadableInputs.js.map +1 -0
- package/dist/cli-registry.d.ts +12 -70
- package/dist/cli-registry.d.ts.map +1 -1
- package/dist/cli-registry.js +37 -97
- package/dist/cli-registry.js.map +1 -1
- package/dist/cli.d.ts +0 -21
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +62 -55
- 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 +10 -41
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +103 -50
- 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 -80
- package/dist/ingest/gherkinValidation.d.ts.map +1 -1
- package/dist/ingest/gherkinValidation.js +0 -80
- package/dist/ingest/gherkinValidation.js.map +1 -1
- package/dist/ingest/ingestQualityChecks.d.ts +8 -93
- package/dist/ingest/ingestQualityChecks.d.ts.map +1 -1
- package/dist/ingest/ingestQualityChecks.js +57 -214
- package/dist/ingest/ingestQualityChecks.js.map +1 -1
- package/dist/ingest/ingestScenarios.d.ts +0 -45
- package/dist/ingest/ingestScenarios.d.ts.map +1 -1
- package/dist/ingest/ingestScenarios.js +28 -108
- package/dist/ingest/ingestScenarios.js.map +1 -1
- package/dist/ingest/inputShapes.d.ts +16 -0
- package/dist/ingest/inputShapes.d.ts.map +1 -0
- package/dist/ingest/inputShapes.js +113 -0
- package/dist/ingest/inputShapes.js.map +1 -0
- package/dist/outputLocation.d.ts +27 -0
- package/dist/outputLocation.d.ts.map +1 -0
- package/dist/outputLocation.js +135 -0
- package/dist/outputLocation.js.map +1 -0
- package/dist/run-management/keptRun.d.ts +5 -105
- package/dist/run-management/keptRun.d.ts.map +1 -1
- package/dist/run-management/keptRun.js +16 -82
- 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 +6 -0
- package/dist/storedRun.d.ts.map +1 -0
- package/dist/storedRun.js +28 -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 -125
- package/dist/corpus/cli.js.map +0 -1
package/dist/cli-balance/cli.js
CHANGED
|
@@ -1,34 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The balance CLI — thin wiring over the reconciler seams. The orchestration half of
|
|
3
|
-
* the old cli.ts: arg parsing, the render-from-JSON mode, and the reconcile →
|
|
4
|
-
* census → provenance → plan → write sequence. The impure file reads it calls
|
|
5
|
-
* (runReconcile + the read* siblings) live in ingest/ingestQualityChecks.ts; the output
|
|
6
|
-
* plan/write in ./emit; the git-derived run inputs in run-management/resolveRunInputs.ts.
|
|
7
|
-
*
|
|
8
|
-
* Usage:
|
|
9
|
-
* pnpm reconcile [--features <dir>] [--vitest <report.json>]
|
|
10
|
-
* [--cucumber <report.json>] [--ci-steps <record.json>]
|
|
11
|
-
* [--ci <ci.yml>]
|
|
12
|
-
* [--format <fmt>[:<path>]]
|
|
13
|
-
*/
|
|
14
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
15
2
|
import { dirname } from "node:path";
|
|
16
|
-
import { runReconcile, readEvidenceObligations, readFeatureNames, featureCorpusParseErrors,
|
|
3
|
+
import { runReconcile, readEvidenceObligations, readFeatureNames, featureCorpusParseErrors, } from "../ingest/ingestQualityChecks.js";
|
|
17
4
|
import { planOutput } from "./emit/format.js";
|
|
18
5
|
import { writeOutputs } from "./emit/writer.js";
|
|
19
|
-
import {
|
|
6
|
+
import { namesStdout, refuse, settlingRefusal, stdoutIdentity } from "../outputLocation.js";
|
|
7
|
+
import { identifiedInputs, inputsReadBy, NODE_INPUT_READER } from "./inputsRead.js";
|
|
8
|
+
import { checkReRenderFlags } from "./reRender.js";
|
|
9
|
+
import { checkInputPaths, checkInputShapes, checkSavedReconciliation, jsonInputsOf, reRenderOrRefusal, } from "./unreadableInputs.js";
|
|
10
|
+
import { statusFor } from "./exitStatus.js";
|
|
11
|
+
import { verdictCode, } from "@3f-consulting/spec-controller-core";
|
|
20
12
|
import { resolveSourceSha, resolveTargetRoot, resolveToolIdentity } from "../run-management/resolveRunInputs.js";
|
|
21
13
|
import { cliRegistry, renderCommandHelp } from "../cli-registry.js";
|
|
22
|
-
|
|
23
|
-
// lived here while `balance` was the only command; a second command needs them, and a second
|
|
24
|
-
// copy of "what did the operator type" is the one thing this tree least wants two of.
|
|
25
|
-
import { parseArgs, checkUnknownFlags } from "../cli-args.js";
|
|
26
|
-
/**
|
|
27
|
-
* Collect the `--format <spec>` values from argv in order (the flag is REPEATABLE, unlike
|
|
28
|
-
* the single-valued flags `parseArgs` records) — the raw specs `planOutput` parses. Empty
|
|
29
|
-
* when no `--format` was given, which `planOutput` reads as the md→stdout default
|
|
30
|
-
* (@SCN-FMT-001). Later sub-issues (FMT-004) route several specs in one invocation.
|
|
31
|
-
*/
|
|
14
|
+
import { asksForHelp, parseArgs, checkArgvShape, checkUnknownFlags, checkMissingValues, checkMisplacedHostModifiers, } from "../cli-args.js";
|
|
32
15
|
function collectFormatSpecs(argv) {
|
|
33
16
|
const specs = [];
|
|
34
17
|
for (let i = 0; i < argv.length; i++) {
|
|
@@ -42,15 +25,6 @@ function collectFormatSpecs(argv) {
|
|
|
42
25
|
}
|
|
43
26
|
return specs;
|
|
44
27
|
}
|
|
45
|
-
/**
|
|
46
|
-
* The legacy-`--json` guard at the CLI edge (@SCN-FMT-006). The earlier
|
|
47
|
-
* `--json <path>` flag is removed; supplying it must fail fast with a migration hint to
|
|
48
|
-
* `--format json:<path>`, so the removed flag never silently no-ops and drops output. PURE
|
|
49
|
-
* and `@unit`-testable: the removed flag is NOT a `--format` spec (planOutput never sees
|
|
50
|
-
* it), so the guard reads the parsed args directly and returns the typed migration-hint
|
|
51
|
-
* error message when `--json` is present — routed to stderr + a non-zero exit by main(),
|
|
52
|
-
* the same handling planOutput's typed error gets (the shared error surface) — else null.
|
|
53
|
-
*/
|
|
54
28
|
export function checkLegacyJson(args) {
|
|
55
29
|
if (args["json"] !== undefined) {
|
|
56
30
|
return ("The --json <path> flag has been removed. " +
|
|
@@ -59,27 +33,9 @@ export function checkLegacyJson(args) {
|
|
|
59
33
|
}
|
|
60
34
|
return null;
|
|
61
35
|
}
|
|
62
|
-
/**
|
|
63
|
-
* Source the provenance "Target repo:" name for a run (@SCN-RPT-001 Update —
|
|
64
|
-
* Fork A). The operator's `--target` is recorded VERBATIM — no resolution — defaulting to
|
|
65
|
-
* `"unknown-target"` when omitted (parallel to `sourceSha`'s `"unknown"`; the facts
|
|
66
|
-
* artefact is self-describing, so the line always renders). PURE and `@unit`-testable at
|
|
67
|
-
* the CLI edge, like `checkLegacyJson`. It never inspects `--features`: the prior
|
|
68
|
-
* `basename(dirname(--features))` resolution (the deleted `resolveTarget`) and its
|
|
69
|
-
* degenerate `.` are impossible now — the target is only ever the given value or the
|
|
70
|
-
* explicit default.
|
|
71
|
-
*/
|
|
72
36
|
export function sourceTarget(args) {
|
|
73
37
|
return args["target"] ?? "unknown-target";
|
|
74
38
|
}
|
|
75
|
-
/**
|
|
76
|
-
* The parsed args, as the reconciler's input paths — the one place a `--flag` name becomes a
|
|
77
|
-
* `ReconcileOptions` key.
|
|
78
|
-
*
|
|
79
|
-
* Its own function rather than an object literal inside `runBalance`, which sits at the
|
|
80
|
-
* `max-lines-per-function` standard: a flag is added here, not by growing the orchestration. The
|
|
81
|
-
* mapping is also the only thing in that function with nothing to do with orchestration.
|
|
82
|
-
*/
|
|
83
39
|
function reconcileInputsOf(args) {
|
|
84
40
|
return {
|
|
85
41
|
features: args["features"],
|
|
@@ -90,27 +46,7 @@ function reconcileInputsOf(args) {
|
|
|
90
46
|
ciSteps: args["ci-steps"],
|
|
91
47
|
};
|
|
92
48
|
}
|
|
93
|
-
/**
|
|
94
|
-
* Guard the supplied input-file/dir flags at the CLI edge (@SCN-CLI-002). A
|
|
95
|
-
* mistyped `--vitest` / `--cucumber` / `--features` / `--ci` / `--package-json`
|
|
96
|
-
* pointing at a non-existent path used to reconcile silently against ZERO evidence —
|
|
97
|
-
* a terrifying false all-red report meaning "you forgot the reports", not "your code
|
|
98
|
-
* is broken" (the dogfooding fault). These flags are Examples of ONE boundary
|
|
99
|
-
* rule: a supplied-but-absent input path is a hard error, and a flag added to the set
|
|
100
|
-
* inherits it rather than restating it. Scope is existence only
|
|
101
|
-
* (readability / file-vs-dir type-correctness out of scope; `exists` covers the dir
|
|
102
|
-
* flag and the file flags alike).
|
|
103
|
-
*
|
|
104
|
-
* PURE and `@unit`-testable like `checkLegacyJson` / `sourceTarget`: reads the parsed
|
|
105
|
-
* args + an injected `exists` fn (no fs), returns the FIRST supplied-but-absent
|
|
106
|
-
* `(flag, path)` as a typed error naming both — routed to stderr + a non-zero exit by
|
|
107
|
-
* `refuseUnreadableInputs` (the shared typed-error surface) — else null. An OMITTED flag is not an
|
|
108
|
-
* error (legitimately optional: simply no evidence of that kind).
|
|
109
|
-
*/
|
|
110
49
|
export function checkInputsExist(args, exists) {
|
|
111
|
-
// The input flags in a fixed order — the FIRST supplied-but-absent one is the
|
|
112
|
-
// reported error (deterministic; the operator fixes and re-runs). Keys are the
|
|
113
|
-
// parseArgs form (the `--` stripped); the message names the flag WITH its dashes.
|
|
114
50
|
const flags = [
|
|
115
51
|
"vitest", "cucumber", "features", "ci", "package-json", "ci-steps",
|
|
116
52
|
];
|
|
@@ -122,63 +58,33 @@ export function checkInputsExist(args, exists) {
|
|
|
122
58
|
}
|
|
123
59
|
return null;
|
|
124
60
|
}
|
|
125
|
-
/**
|
|
126
|
-
* The JSON-BEARING input flags — the ones whose content is `JSON.parse`d, and so the only
|
|
127
|
-
* ones whose content can throw. `--features` is Gherkin (parsed tolerantly) and `--ci` is
|
|
128
|
-
* read as raw TEXT and scanned for `run:` steps — neither is JSON, neither can crash the
|
|
129
|
-
* process, and on garbage both reconcile normally (verified, 3F-1742 Discovery).
|
|
130
|
-
*/
|
|
131
61
|
const JSON_INPUT_FLAGS = [
|
|
132
62
|
"vitest", "cucumber", "package-json", "ci-steps",
|
|
133
63
|
];
|
|
134
|
-
/**
|
|
135
|
-
* Guard the READABILITY of the supplied JSON inputs at the CLI edge (@SCN-CLI-014).
|
|
136
|
-
* `checkInputsExist` already guards their PRESENCE — but a path that is present yet
|
|
137
|
-
* UNPARSEABLE fell straight through it: the reader threw mid-parse, nothing caught it, and
|
|
138
|
-
* the process hit Node's default exit 1 — the code reserved for a genuine OUT-OF-BALANCE
|
|
139
|
-
* verdict. A crashed invocation was therefore indistinguishable, by exit code, from an
|
|
140
|
-
* honest disagreement (3F-1742). An input the tool cannot read is a USAGE fault: exit 2,
|
|
141
|
-
* sibling to a missing path (@SCN-CLI-002) and an unrecognised flag (@SCN-CLI-009).
|
|
142
|
-
*
|
|
143
|
-
* PURE and `@unit`-testable like its sibling guards: reads the parsed args + an injected
|
|
144
|
-
* `read` fn (no fs), returns the FIRST supplied-but-unparseable `(flag, path, failure)` as
|
|
145
|
-
* a typed error naming all three — routed to stderr + exit 2 by `refuseUnreadableInputs` — else null.
|
|
146
|
-
* An omitted flag is not an error, and an unreadable file (a race after the existence
|
|
147
|
-
* check) reports as the same input fault rather than escaping as a crash.
|
|
148
|
-
*/
|
|
149
64
|
export function checkInputsParse(args, read) {
|
|
150
65
|
for (const flag of JSON_INPUT_FLAGS) {
|
|
151
66
|
const path = args[flag];
|
|
152
67
|
if (path === undefined)
|
|
153
68
|
continue;
|
|
69
|
+
let text;
|
|
154
70
|
try {
|
|
155
|
-
|
|
71
|
+
text = read(path);
|
|
156
72
|
}
|
|
157
73
|
catch (err) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
74
|
+
return `The --${flag} file could not be read: ${path} (${failureOf(err)})`;
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
JSON.parse(text);
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
return `The --${flag} report is not valid JSON: ${path} (${failureOf(err)})`;
|
|
162
81
|
}
|
|
163
82
|
}
|
|
164
83
|
return null;
|
|
165
84
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
* NEITHER: a missing path crashed to `ENOENT` and a malformed file to `SyntaxError`, both
|
|
170
|
-
* landing on Node's default exit 1 — the out-of-balance code (3F-1764).
|
|
171
|
-
*
|
|
172
|
-
* The missing-path case was a live violation of @SCN-CLI-002's own shipped principle: a
|
|
173
|
-
* supplied input path that does not exist is a hard error at exit 2, enforced for the five
|
|
174
|
-
* evidence flags and not for this one. The CLI shipped a guard that half-honoured its Rule.
|
|
175
|
-
*
|
|
176
|
-
* MISSING and UNPARSEABLE are two Examples of one boundary rule — an input the tool cannot
|
|
177
|
-
* read is a usage error, never a verdict — so one guard covers both. PURE and
|
|
178
|
-
* `@unit`-testable like its siblings: the parsed args + an injected `read` (no fs), which
|
|
179
|
-
* throws for an absent/unreadable path exactly as `readFileSync` does. An OMITTED flag is
|
|
180
|
-
* not an error (the ordinary reconcile path).
|
|
181
|
-
*/
|
|
85
|
+
function failureOf(err) {
|
|
86
|
+
return err instanceof Error ? err.message : String(err);
|
|
87
|
+
}
|
|
182
88
|
export function checkRenderFromJson(args, read) {
|
|
183
89
|
const path = args["render-from-json"];
|
|
184
90
|
if (path === undefined)
|
|
@@ -187,262 +93,101 @@ export function checkRenderFromJson(args, read) {
|
|
|
187
93
|
JSON.parse(read(path));
|
|
188
94
|
}
|
|
189
95
|
catch (err) {
|
|
190
|
-
// MISSING (read throws ENOENT) and UNPARSEABLE (JSON.parse throws) are the same input
|
|
191
|
-
// fault, caught in the same place. Anything escaping here lands on Node's default
|
|
192
|
-
// exit 1 — the out-of-balance code — which is the collision this closes.
|
|
193
96
|
const failure = err instanceof Error ? err.message : String(err);
|
|
194
97
|
return `The --render-from-json saved report could not be read: ${path} (${failure})`;
|
|
195
98
|
}
|
|
196
99
|
return null;
|
|
197
100
|
}
|
|
198
101
|
export function runBalance(argv) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
// while balance runs anyway. The registry is the single source, so a flag that exists is
|
|
204
|
-
// a flag that appears in help — no hand-kept list to drift.
|
|
205
|
-
if (argv.includes("--help") || argv.includes("-h")) {
|
|
102
|
+
return settlingRefusal(() => balance(argv), false);
|
|
103
|
+
}
|
|
104
|
+
function balance(argv) {
|
|
105
|
+
if (asksForHelp(argv)) {
|
|
206
106
|
process.stdout.write(renderCommandHelp(cliRegistry, "balance") + "\n");
|
|
207
|
-
return;
|
|
107
|
+
return false;
|
|
208
108
|
}
|
|
209
|
-
// Capture the run-start instant up front — the run provenance's UTC timestamp,
|
|
210
|
-
// threaded through ctx.runStart to the renderers.
|
|
211
109
|
const runStart = new Date();
|
|
212
110
|
const args = parseArgs(argv);
|
|
213
|
-
// Legacy-`--json` guard (@SCN-FMT-006): the earlier `--json <path>` flag is
|
|
214
|
-
// removed. Reject it fast — before any reconcile or write — with a migration hint to
|
|
215
|
-
// `--format json:<path>`, so the removed flag never silently no-ops and drops output. The
|
|
216
|
-
// guard's typed error is routed to stderr + a non-zero exit, exactly as planOutput's error
|
|
217
|
-
// is below (the shared typed-error surface).
|
|
218
111
|
const legacyJsonError = checkLegacyJson(args);
|
|
219
112
|
if (legacyJsonError)
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
// balance, so they never reach here. This is the structural teeth behind "accepted =
|
|
228
|
-
// registry = help" — a flag can't affect behaviour without a registry entry.
|
|
113
|
+
refuse(legacyJsonError);
|
|
114
|
+
const misplacedModifierError = checkMisplacedHostModifiers(args, cliRegistry, "balance");
|
|
115
|
+
if (misplacedModifierError)
|
|
116
|
+
refuse(misplacedModifierError);
|
|
117
|
+
const shapeError = checkArgvShape(argv, cliRegistry, "balance");
|
|
118
|
+
if (shapeError)
|
|
119
|
+
refuse(shapeError);
|
|
229
120
|
const unknownFlagError = checkUnknownFlags(args, cliRegistry, "balance", resolveToolIdentity().toolVersion);
|
|
230
121
|
if (unknownFlagError) {
|
|
231
122
|
process.stderr.write(unknownFlagError + "\n");
|
|
232
123
|
process.exitCode = 2;
|
|
233
|
-
return;
|
|
124
|
+
return false;
|
|
234
125
|
}
|
|
126
|
+
const missingValueError = checkMissingValues(argv, cliRegistry, "balance");
|
|
127
|
+
if (missingValueError)
|
|
128
|
+
refuse(missingValueError);
|
|
235
129
|
if (renderSavedReport(args))
|
|
236
|
-
return;
|
|
130
|
+
return false;
|
|
237
131
|
refuseUnreadableInputs(args);
|
|
238
132
|
const inputs = reconcileInputsOf(args);
|
|
239
|
-
// Reconcile the obligation-vs-observation evidence into the Ledger. The runtime evidence-observation
|
|
240
|
-
// views (Test volume, the evidence grid) are FOLDS the renderers derive off this Ledger's posted
|
|
241
|
-
// credits (@SCN-RPT-010 / 3F-2103 — the census is retired), so they cannot drift from the
|
|
242
|
-
// reconciler's verdict: they ARE the same rows. `withRuntimeObservations: true` (below) tells the
|
|
243
|
-
// renderers the axis is in play.
|
|
244
133
|
const balance = runReconcile(inputs);
|
|
245
|
-
// Read the scenario-corpus census alongside the balance (@SCN-RPT-008) —
|
|
246
|
-
// the raw-vs-parsed @SCN-occurrence delta over the same discovered feature corpus.
|
|
247
|
-
// A sibling to the balance, threaded to the renderers via writeOutputs like ctx.
|
|
248
134
|
const evidenceObligations = readEvidenceObligations(args["features"]);
|
|
249
|
-
// The static-check kind-counts are a FOLD OVER THE LEDGER (@SCN-USG-001 / 3F-2118) — the
|
|
250
|
-
// renderers count the balance's own posted static-check credits (`staticObservationTally`), so
|
|
251
|
-
// they cannot drift from the reconciler's verdict: they ARE the same rows. The parallel static
|
|
252
|
-
// census is RETIRED; `withStaticChecks: true` (below) tells the renderers the axis is in play.
|
|
253
|
-
// Read the target's feature-code→slug map alongside the balance (@SCN-RPT-006)
|
|
254
|
-
// — the by-feature cut's full-name labels. The 5th sibling, threaded to the MARKDOWN
|
|
255
|
-
// renderer via writeOutputs only (markdown-only; the by-feature cut isn't on JSON).
|
|
256
135
|
const featureNames = readFeatureNames(args["features"]);
|
|
257
136
|
const ctx = runContextOf(args, inputs, runStart);
|
|
258
|
-
|
|
259
|
-
// the writer — the pure plan / impure writer split (@SCN-FMT-001). The plan
|
|
260
|
-
// parse+validate is pure; the writer is the only IO for the emitted report. This is
|
|
261
|
-
// the SOLE output path: the tool emits via --format and holds no storage opinion — the
|
|
262
|
-
// legacy runs/<target>/<ISO>/ auto-archive was removed with @SCN-RUN-001, the
|
|
263
|
-
// caller now routes stored runs (spec-controller's run-management layer).
|
|
264
|
-
const planResult = planOutput(collectFormatSpecs(argv));
|
|
137
|
+
const planResult = planOutput(collectFormatSpecs(argv), namesStdout);
|
|
265
138
|
if (!planResult.ok)
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
// as a no-evidence-obligation static-check watermelon) sets process.exitCode = 1 and RETURNS — set,
|
|
272
|
-
// never `process.exit(1)`, so the buffered report is flushed intact rather than truncated
|
|
273
|
-
// mid-write. It exits EXACTLY 1 so it reds a CI build and can't masquerade as the usage
|
|
274
|
-
// error (2, above). An ENUMERATED status, never a count (8-bit wrap → false pass). A
|
|
275
|
-
// balanced run leaves process.exitCode at its default 0 and returns.
|
|
276
|
-
//
|
|
277
|
-
// The --strict escalation (@SCN-CLI-011): Pending Items are run-neutral by DEFAULT
|
|
278
|
-
// (@SCN-PND-008 — they never red a build), but `--strict` is the OPT-IN that fails an
|
|
279
|
-
// OTHERWISE-BALANCED run carrying them, exiting the DISTINCT code 3 (taxonomy 0 balanced /
|
|
280
|
-
// 1 out-of-balance / 2 usage / 3 pending-under-strict / 4 unsound / 5 nothing to reconcile —
|
|
281
|
-
// a Pending Item is not out-of-balance,
|
|
282
|
-
// so it must NEVER share code 1). Out-of-balance DOMINATES: the escalation is checked ONLY in
|
|
283
|
-
// the `isBalanced` branch, so an out-of-balance run exits 1 regardless of --strict. Like the
|
|
284
|
-
// CLI-004 gate this SETS process.exitCode (never process.exit) AFTER writeOutputs, so the
|
|
285
|
-
// buffered report is flushed intact. `--strict` is a registry-LISTED boolean, recorded by
|
|
286
|
-
// parseArgs as the string "true" — presence is what matters, so `!== undefined` reads it.
|
|
287
|
-
//
|
|
288
|
-
// The UNSOUND pre-emption (@SCN-CLI-012): a run carrying BROKEN evidence — a proving suite
|
|
289
|
-
// that failed to COLLECT, so the behaviour was never exercised — exits the DISTINCT code 4
|
|
290
|
-
// (taxonomy 0 balanced / 1 out-of-balance / 2 usage / 3 pending-under-strict / 4 unsound /
|
|
291
|
-
// 5 nothing to reconcile).
|
|
292
|
-
// Exit 1 says "the ledger disagrees"; exit 4 says "the ledger could not be TRUSTED to
|
|
293
|
-
// disagree" — you cannot trust a reconciliation whose evidence never materialised, so
|
|
294
|
-
// unsound DOMINATES.
|
|
295
|
-
//
|
|
296
|
-
// THE ORDER IS LOAD-BEARING, NOT COSMETIC. A broken run is ALWAYS out-of-balance: its
|
|
297
|
-
// `broken` item sits on the SUSPENSE row, so `isBalanced` is already false. Check it AFTER
|
|
298
|
-
// `isBalanced` and the branch is UNREACHABLE — every broken run would exit 1 and the
|
|
299
|
-
// collection failure would stay masked as an honest disagreement (the AWTY dogfood fault,
|
|
300
|
-
// 3F-1642). So `hasBrokenEvidence` is checked FIRST, PRE-EMPTING the balance verdict it
|
|
301
|
-
// would otherwise be swallowed by. @SCN-CLI-004 is a BYSTANDER, not an Update: its fixture
|
|
302
|
-
// is a SOUND out-of-balance run (no broken item), so it falls through this branch and still
|
|
303
|
-
// exits exactly 1 — the pre-emption fires only when evidence genuinely failed to collect.
|
|
304
|
-
//
|
|
305
|
-
// THE NOTHING-TO-RECONCILE PRE-EMPTION (@SCN-CLI-019): a run whose ledger carries ZERO Scenario
|
|
306
|
-
// Reconciliation rows — a target that declared nothing AND produced nothing — exits the DISTINCT
|
|
307
|
-
// code 5. It is its own state: not balanced (no accounts to agree), not out-of-balance (nothing
|
|
308
|
-
// disagrees), not a usage fault (the invocation was valid and `new-client` is a supported
|
|
309
|
-
// adoption state), not unsound (no proof failed; none was owed).
|
|
310
|
-
//
|
|
311
|
-
// IT IS NOT THE UNSOUND PRE-EMPTION ONE CODE FURTHER ON, THOUGH IT LOOKS LIKE IT — measured,
|
|
312
|
-
// because the ticket predicted it was. An empty ledger is MUTUALLY EXCLUSIVE with all three
|
|
313
|
-
// predicates above: with no rows there is no row to carry a broken item, a reconciling item or a
|
|
314
|
-
// Pending Item, so it fires none of them. Moved below `!isBalanced`, this branch STILL returns 5
|
|
315
|
-
// (the prescribed plant stayed green). Its position among the predicates is free, and it is
|
|
316
|
-
// first only so this ladder and `runVerdictSection` read in the SAME order — the shape
|
|
317
|
-
// @SCN-CLI-013's invariant leans on.
|
|
318
|
-
//
|
|
319
|
-
// WHAT IS LOAD-BEARING is its position against the DEFAULT below. "Balanced" is not a branch
|
|
320
|
-
// here, it is the `return 0` a run reaches by failing every test — so there is no "after the
|
|
321
|
-
// balanced case" to append a fifth code to. Appended after that return the branch is dead code
|
|
322
|
-
// and an empty run exits 0 (measured: the plant that DID red). That is why the fault survived a
|
|
323
|
-
// taxonomy that had already grown twice: a fifth code cannot be ADDED to this chain, it has to
|
|
324
|
-
// DISPLACE the default, and nothing about the other three says so.
|
|
325
|
-
//
|
|
326
|
-
// Keyed on the EMPTY LEDGER, never on the empty corpus: a corpus-less run carrying uncited
|
|
327
|
-
// credits HAS a row — its suspense row — and is an ordinary out-of-balance report at exit 1
|
|
328
|
-
// (@SCN-CLI-020). @SCN-CLI-004/005/010/012 are BYSTANDERS: every one of their fixtures carries
|
|
329
|
-
// rows, so none reaches this branch.
|
|
330
|
-
const code = verdictExitCode(balance.ledger, args["strict"] !== undefined);
|
|
331
|
-
// Assigned only when NON-ZERO, so a balanced run still LEAVES process.exitCode at its default
|
|
332
|
-
// rather than writing a 0 over it — the distinction @SCN-CLI-005 and @SCN-CLI-010 both rest on.
|
|
139
|
+
refuse(planResult.error);
|
|
140
|
+
const payloads = { balance, ctx, evidenceObligations, withRuntimeObservations: true, withStaticChecks: true, featureNames };
|
|
141
|
+
writeOutputs(planResult.plan, payloads, stdoutIdentity, identifiedInputs(inputsReadBy(args, NODE_INPUT_READER)));
|
|
142
|
+
const verdict = verdictCode({ ...balance, strict: ctx.strict === true });
|
|
143
|
+
const code = statusFor(verdict, args["exit-zero"] !== undefined);
|
|
333
144
|
if (code !== 0)
|
|
334
145
|
process.exitCode = code;
|
|
146
|
+
return true;
|
|
335
147
|
}
|
|
336
|
-
/**
|
|
337
|
-
* A usage or input fault: the message on stderr, then exit 2 — the enumerated usage code
|
|
338
|
-
* (@SCN-CLI-002), distinct from the out-of-balance verdict code 1 (@SCN-CLI-004). An
|
|
339
|
-
* out-of-balance run must never masquerade as a usage error, nor the reverse.
|
|
340
|
-
*/
|
|
341
|
-
function exitUsage(message) {
|
|
342
|
-
process.stderr.write(message + "\n");
|
|
343
|
-
process.exit(2);
|
|
344
|
-
}
|
|
345
|
-
/**
|
|
346
|
-
* Render-from-saved-JSON mode (@SCN-RMD-007): regenerate the human markdown from a
|
|
347
|
-
* banked spec-reconciliation.json ALONE — no reconcile, no live inputs, no RunContext. Reads
|
|
348
|
-
* the file, JSON.parses it back into the whole-document report model, renders the markdown via
|
|
349
|
-
* renderReport, and writes it to stdout (the same trailing-newline convention as the writer's
|
|
350
|
-
* stdout path). The load-bearing proof that the JSON IS the model — true when it answered the
|
|
351
|
-
* run, so `runBalance` returns before any reconcile.
|
|
352
|
-
*/
|
|
353
148
|
function renderSavedReport(args) {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
// — the out-of-balance code. The missing-path case was a live violation of @SCN-CLI-002's own
|
|
358
|
-
// shipped principle, which the CLI enforced for the five evidence flags and not for this
|
|
359
|
-
// one. The guard therefore runs INSIDE this mode, ahead of the read (3F-1764).
|
|
149
|
+
const ignoredFlagError = checkReRenderFlags(args);
|
|
150
|
+
if (ignoredFlagError)
|
|
151
|
+
refuse(ignoredFlagError);
|
|
360
152
|
const unreadableSavedReportError = checkRenderFromJson(args, (path) => readFileSync(path, "utf8"));
|
|
361
153
|
if (unreadableSavedReportError)
|
|
362
|
-
|
|
154
|
+
refuse(unreadableSavedReportError);
|
|
363
155
|
const rehydratePath = args["render-from-json"];
|
|
364
156
|
if (rehydratePath === undefined)
|
|
365
157
|
return false;
|
|
366
|
-
const
|
|
367
|
-
|
|
158
|
+
const savedJson = readFileSync(rehydratePath, "utf8");
|
|
159
|
+
const notSavedError = checkSavedReconciliation(rehydratePath, savedJson);
|
|
160
|
+
if (notSavedError)
|
|
161
|
+
refuse(notSavedError);
|
|
162
|
+
const saved = reRenderOrRefusal(rehydratePath, savedJson, args["strict"] !== undefined);
|
|
163
|
+
if (typeof saved === "string")
|
|
164
|
+
refuse(saved);
|
|
165
|
+
process.stdout.write(saved.markdown + "\n");
|
|
166
|
+
const code = statusFor(saved.code, args["exit-zero"] !== undefined);
|
|
167
|
+
if (code !== 0)
|
|
168
|
+
process.exitCode = code;
|
|
368
169
|
return true;
|
|
369
170
|
}
|
|
370
|
-
/**
|
|
371
|
-
* The live-input guards, in the order they run: each halts at exit 2 BEFORE any reconcile,
|
|
372
|
-
* because an input the tool cannot read is a usage error, never a verdict.
|
|
373
|
-
*/
|
|
374
171
|
function refuseUnreadableInputs(args) {
|
|
375
|
-
// Input-existence guard (@SCN-CLI-002): a supplied input-file/dir flag pointing at a
|
|
376
|
-
// non-existent path is a HARD ERROR — halt BEFORE reconciling, with a typed message
|
|
377
|
-
// naming the flag + path, never the silent zero-evidence all-red report a mistyped
|
|
378
|
-
// path used to produce (the dogfooding fault). Routed to stderr + a non-zero exit,
|
|
379
|
-
// exactly as the legacy-`--json` guard (the shared typed-error surface). An
|
|
380
|
-
// omitted flag is legitimately optional and passes through untouched.
|
|
381
172
|
const missingInputError = checkInputsExist(args, existsSync);
|
|
382
173
|
if (missingInputError)
|
|
383
|
-
|
|
384
|
-
// Input-READABILITY guard (@SCN-CLI-014): existence is not enough. A report that is
|
|
385
|
-
// PRESENT but UNPARSEABLE (`--vitest /dev/null`, truncated JSON, non-JSON) used to throw
|
|
386
|
-
// mid-parse inside reconcileWithCensus, uncaught — and Node's default exit code is 1, the
|
|
387
|
-
// code reserved for a genuine OUT-OF-BALANCE verdict (@SCN-CLI-004). So a tool that
|
|
388
|
-
// CRASHED before reconciling was indistinguishable, by exit code, from an honest
|
|
389
|
-
// disagreement (3F-1742). Runs immediately after the existence guard and BEFORE any
|
|
390
|
-
// reconcile, routing to the same stderr + exit 2 lane: an input the tool cannot read is a
|
|
391
|
-
// usage fault, sibling to a missing path and an unrecognised flag — never a verdict.
|
|
174
|
+
refuse(missingInputError);
|
|
392
175
|
const unparseableInputError = checkInputsParse(args, (path) => readFileSync(path, "utf8"));
|
|
393
176
|
if (unparseableInputError)
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
// reality, the exact false-green this tool exists to prevent.
|
|
402
|
-
//
|
|
403
|
-
// Validated with the REAL Gherkin parser (cucumber's own), so a file the tool would reconcile is
|
|
404
|
-
// at least a file cucumber would RUN. A file it rejects is an input we CANNOT READ: exit 2,
|
|
405
|
-
// halting BEFORE any reconcile, naming the file and the parse failure — the same Rule as
|
|
406
|
-
// @SCN-CLI-014 and @SCN-CLI-015 ("an input the tool cannot read is a usage error, never a
|
|
407
|
-
// verdict"), now on the obligation side. Never a verdict, and never a green.
|
|
408
|
-
//
|
|
409
|
-
// The corpus is EXTRACTED from the same real AST (@SCN-LDG-020), so what the tool reconciles is
|
|
410
|
-
// what cucumber runs — Feature/Rule tag inheritance included. This guard decides whether the file
|
|
411
|
-
// can be read at all; parseScenarios then reads it exactly as cucumber would.
|
|
177
|
+
refuse(unparseableInputError);
|
|
178
|
+
const unreadablePathError = checkInputPaths(args);
|
|
179
|
+
if (unreadablePathError)
|
|
180
|
+
refuse(unreadablePathError);
|
|
181
|
+
const misshapenInputError = checkInputShapes(jsonInputsOf(args, existsSync), (path) => readFileSync(path, "utf8"));
|
|
182
|
+
if (misshapenInputError)
|
|
183
|
+
refuse(misshapenInputError);
|
|
412
184
|
const featureParseErrors = featureCorpusParseErrors(args["features"]);
|
|
413
185
|
if (featureParseErrors.length > 0) {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
process.exit(2);
|
|
418
|
-
}
|
|
419
|
-
// AMBIGUOUS-CORPUS guard (@SCN-LDG-020's guardrail, 3F-1775). An @SCN identifies exactly ONE
|
|
420
|
-
// scenario — that is the whole basis of attributing evidence to it. Tag inheritance makes a
|
|
421
|
-
// DUPLICATE reachable: an @SCN hoisted to a Feature:/Rule: is inherited by every scenario
|
|
422
|
-
// beneath it (cucumber does this, so we do). One passing test would then mark EVERY scenario
|
|
423
|
-
// sharing that id `balanced` — including scenarios nothing proves — a BALANCED-WHEN-BROKEN run
|
|
424
|
-
// at exit 0. A new silent false-green, introduced by the very fix that closed the last one.
|
|
425
|
-
//
|
|
426
|
-
// So the corpus is REFUSED, not reconciled: the tool cannot know which scenario a citing test
|
|
427
|
-
// proves, and any verdict over it would be a guess. Same Rule as @SCN-CLI-014/015/016 — an input
|
|
428
|
-
// the tool cannot read is a usage error, never a verdict.
|
|
429
|
-
const duplicateScnIds = featureCorpusDuplicateScnIds(args["features"]);
|
|
430
|
-
if (duplicateScnIds.length > 0) {
|
|
431
|
-
process.stderr.write(`The --features corpus names the same @SCN on more than one scenario: ` +
|
|
432
|
-
`${duplicateScnIds.join(", ")}.\n` +
|
|
433
|
-
`An @SCN identifies exactly one scenario — evidence citing a duplicated id cannot be ` +
|
|
434
|
-
`attributed, so no verdict over this corpus would be trustworthy. (An @SCN on a Feature: ` +
|
|
435
|
-
`or Rule: line is inherited by every scenario beneath it — name it on the scenario.)\n`);
|
|
436
|
-
process.exit(2);
|
|
186
|
+
refuse(featureParseErrors
|
|
187
|
+
.map(({ file, message }) => `The --features corpus contains a feature file that could not be parsed: ${file}\n${message}`)
|
|
188
|
+
.join("\n"));
|
|
437
189
|
}
|
|
438
190
|
}
|
|
439
|
-
/**
|
|
440
|
-
* Build the run provenance ONCE (project design §1) — a sibling RunContext, the
|
|
441
|
-
* Ledger staying pure — reusing the existing runStart. The target is the
|
|
442
|
-
* operator's --target VERBATIM (unknown-target on omit; Fork A — no
|
|
443
|
-
* resolution, no basename guessing). Source SHA via the read-only target read, with
|
|
444
|
-
* --source-sha as the override (resolveSourceSha).
|
|
445
|
-
*/
|
|
446
191
|
function runContextOf(args, inputs, runStart) {
|
|
447
192
|
return {
|
|
448
193
|
target: sourceTarget(args),
|
|
@@ -452,42 +197,11 @@ function runContextOf(args, inputs, runStart) {
|
|
|
452
197
|
sourceSha: args["source-sha"],
|
|
453
198
|
targetDir: args["features"] !== undefined ? dirname(args["features"]) : undefined,
|
|
454
199
|
}),
|
|
455
|
-
// The TARGET repo root the recorded input paths are made portable against (fixed to
|
|
456
|
-
// the target root, not the run cwd, by @SCN-RPT-016) — the SAME
|
|
457
|
-
// root readEvidenceObservations passes to countRuntimeEvidenceObservationKinds, derived from
|
|
458
|
-
// --features, so a cross-repo reconcile records inputs relative (`features`) rather
|
|
459
|
-
// than leaking the target's absolute path.
|
|
460
200
|
root: resolveTargetRoot({ features: inputs.features }),
|
|
461
|
-
// The TOOL's own identity (@SCN-RPT-026, 3F-1916) — which spec-controller produced
|
|
462
|
-
// this run, distinct from the target's sourceSha. Read from the tool's OWN dir, never
|
|
463
|
-
// cwd (which is the target). One call, spread into the ctx; the same identity feeds
|
|
464
|
-
// the run.yaml manifest.
|
|
465
201
|
...resolveToolIdentity(),
|
|
202
|
+
strict: args["strict"] !== undefined,
|
|
466
203
|
};
|
|
467
204
|
}
|
|
468
|
-
/**
|
|
469
|
-
* THE DOMINANCE LADDER — the whole-run verdict as the enumerated status a consumer's CI branches
|
|
470
|
-
* on, and the ONE place the order argued for above is written down. Extracted from `runBalance`
|
|
471
|
-
* (3F-3344) so the ladder is a named thing with its own reading rather than a tail the reader
|
|
472
|
-
* arrives at, and so the pre-emption argument sits ON it.
|
|
473
|
-
*
|
|
474
|
-
* ENUMERATED, NEVER A COUNT — a count would 8-bit `& 0xFF` wrap into a false pass. Returns 0 for a
|
|
475
|
-
* balanced run; the caller leaves the process's default alone rather than writing that 0 back.
|
|
476
|
-
*/
|
|
477
|
-
function verdictExitCode(ledger, strict) {
|
|
478
|
-
if (hasNothingToReconcile(ledger))
|
|
479
|
-
return 5;
|
|
480
|
-
if (hasBrokenEvidence(ledger))
|
|
481
|
-
return 4;
|
|
482
|
-
if (!isBalanced(ledger))
|
|
483
|
-
return 1;
|
|
484
|
-
if (strict && hasPendingItems(ledger))
|
|
485
|
-
return 3;
|
|
486
|
-
return 0;
|
|
487
|
-
}
|
|
488
|
-
// Only run the balance command when this module is executed directly
|
|
489
|
-
// (`tsx cli-balance/cli.ts`), NOT when imported by the top-level `spec-controller`
|
|
490
|
-
// bin dispatcher or by a test that exercises the pure edge guards.
|
|
491
205
|
const invokedDirectly = process.argv[1] !== undefined && import.meta.url === `file://${process.argv[1]}`;
|
|
492
206
|
if (invokedDirectly)
|
|
493
207
|
runBalance(process.argv.slice(2));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli-balance/cli.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli-balance/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,gBAAgB,EAChB,wBAAwB,GAEzB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,eAAe,EAAE,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