@descryy/runtime-controller 0.2.0 → 0.3.0
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/LICENSE +6 -0
- package/dist/capability-registry.d.ts +0 -15
- package/dist/capability-registry.d.ts.map +1 -1
- package/dist/capability-registry.js +9 -19
- package/dist/capability-registry.js.map +1 -1
- package/dist/collector-version.d.ts +1 -8
- package/dist/collector-version.d.ts.map +1 -1
- package/dist/collector-version.js +1 -8
- package/dist/collector-version.js.map +1 -1
- package/dist/container-sandbox.d.ts +66 -150
- package/dist/container-sandbox.d.ts.map +1 -1
- package/dist/container-sandbox.js +62 -143
- package/dist/container-sandbox.js.map +1 -1
- package/dist/controller.d.ts +54 -87
- package/dist/controller.d.ts.map +1 -1
- package/dist/controller.js +77 -104
- package/dist/controller.js.map +1 -1
- package/dist/dependency-version-check.d.ts +19 -73
- package/dist/dependency-version-check.d.ts.map +1 -1
- package/dist/dependency-version-check.js +18 -67
- package/dist/dependency-version-check.js.map +1 -1
- package/dist/env.d.ts +4 -10
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +4 -10
- package/dist/env.js.map +1 -1
- package/dist/environment-metadata.d.ts +9 -17
- package/dist/environment-metadata.d.ts.map +1 -1
- package/dist/environment-metadata.js +12 -29
- package/dist/environment-metadata.js.map +1 -1
- package/dist/environment-version-check.d.ts +22 -65
- package/dist/environment-version-check.d.ts.map +1 -1
- package/dist/environment-version-check.js +24 -66
- package/dist/environment-version-check.js.map +1 -1
- package/dist/execution-safety.d.ts +54 -112
- package/dist/execution-safety.d.ts.map +1 -1
- package/dist/execution-safety.js +48 -102
- package/dist/execution-safety.js.map +1 -1
- package/dist/index.d.ts +0 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/orchestration.d.ts +24 -39
- package/dist/orchestration.d.ts.map +1 -1
- package/dist/orchestration.js +39 -75
- package/dist/orchestration.js.map +1 -1
- package/dist/process-collector.d.ts +8 -22
- package/dist/process-collector.d.ts.map +1 -1
- package/dist/process-collector.js +23 -55
- package/dist/process-collector.js.map +1 -1
- package/dist/process-manager.d.ts +45 -80
- package/dist/process-manager.d.ts.map +1 -1
- package/dist/process-manager.js +51 -101
- package/dist/process-manager.js.map +1 -1
- package/dist/readiness.d.ts +28 -70
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +73 -95
- package/dist/readiness.js.map +1 -1
- package/dist/sandbox.d.ts +60 -105
- package/dist/sandbox.d.ts.map +1 -1
- package/dist/sandbox.js +78 -121
- package/dist/sandbox.js.map +1 -1
- package/package.json +7 -2
package/dist/env.js
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Default environment applied to every spawned process, on top of
|
|
3
|
-
* the caller passes explicitly.
|
|
2
|
+
* Default environment applied to every spawned process, on top of the caller's own.
|
|
4
3
|
*
|
|
5
|
-
* RUST_BACKTRACE
|
|
6
|
-
*
|
|
7
|
-
* RUST_BACKTRACE=1" without it. That is a collector-absence-masquerading-
|
|
8
|
-
* as-application-success case — the process didn't fail to crash, the
|
|
9
|
-
* runtime just failed to *see* how — so it belongs here rather than being
|
|
10
|
-
* left to each caller to remember.
|
|
4
|
+
* RUST_BACKTRACE=1 (§17): without it a Rust panic prints only a message, hiding the
|
|
5
|
+
* trace — a collector-absence-masquerading-as-success case, not a caller-remembers-it case.
|
|
11
6
|
*
|
|
12
|
-
*
|
|
13
|
-
* overrides a deliberate choice.
|
|
7
|
+
* Never overrides a key the caller already set.
|
|
14
8
|
*/
|
|
15
9
|
export function withDefaultProcessEnv(env) {
|
|
16
10
|
return { RUST_BACKTRACE: "1", ...env };
|
package/dist/env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACnC,GAAiD;IAEjD,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,CAAC;AACzC,CAAC"}
|
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* §2
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* `captureEnvironmentMetadata` fills the missing half from the real host:
|
|
7
|
-
* OS platform, this controller process's own Node version (`process.version`
|
|
8
|
-
* -- always known, never probed), and the version of every distinct
|
|
9
|
-
* executable `configuration.services` actually invokes.
|
|
2
|
+
* §2/RT-193: `Execution.commit` alone can't reproduce a run — same commit, different
|
|
3
|
+
* Node/OS/toolchain can behave differently. Fills the gap from the real host: OS
|
|
4
|
+
* platform, this process's own `process.version`, and the version of every distinct
|
|
5
|
+
* executable `configuration.services` invokes.
|
|
10
6
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* `interpreters()` checks a fixed, hardcoded list of dev-environment
|
|
17
|
-
* toolchains against a specific expected-version regex per tool; this
|
|
18
|
-
* checks whatever `services[*].command` actually names, for any command,
|
|
19
|
-
* with no expected version to compare against -- a report, not a gate.
|
|
7
|
+
* Toolchain probe mirrors `scripts/preflight.mjs`'s `interpreters()` (version flag,
|
|
8
|
+
* read stdout+stderr combined since some tools like `java -version` write to stderr
|
|
9
|
+
* only, keep first line) but isn't the same function: that one checks a fixed tool
|
|
10
|
+
* list against expected versions (a gate); this reports whatever `services[*].command`
|
|
11
|
+
* names, no expected version to compare against.
|
|
20
12
|
*/
|
|
21
13
|
import type { EnvironmentMetadata, ServiceConfiguration } from "@descryy/runtime-contracts";
|
|
22
14
|
export declare function captureEnvironmentMetadata(services: Readonly<Record<string, ServiceConfiguration>>): Promise<EnvironmentMetadata>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment-metadata.d.ts","sourceRoot":"","sources":["../src/environment-metadata.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"environment-metadata.d.ts","sourceRoot":"","sources":["../src/environment-metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAM5F,wBAAsB,0BAA0B,CAC9C,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,GACvD,OAAO,CAAC,mBAAmB,CAAC,CAmB9B"}
|
|
@@ -1,34 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* §2
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* `captureEnvironmentMetadata` fills the missing half from the real host:
|
|
7
|
-
* OS platform, this controller process's own Node version (`process.version`
|
|
8
|
-
* -- always known, never probed), and the version of every distinct
|
|
9
|
-
* executable `configuration.services` actually invokes.
|
|
2
|
+
* §2/RT-193: `Execution.commit` alone can't reproduce a run — same commit, different
|
|
3
|
+
* Node/OS/toolchain can behave differently. Fills the gap from the real host: OS
|
|
4
|
+
* platform, this process's own `process.version`, and the version of every distinct
|
|
5
|
+
* executable `configuration.services` invokes.
|
|
10
6
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* `interpreters()` checks a fixed, hardcoded list of dev-environment
|
|
17
|
-
* toolchains against a specific expected-version regex per tool; this
|
|
18
|
-
* checks whatever `services[*].command` actually names, for any command,
|
|
19
|
-
* with no expected version to compare against -- a report, not a gate.
|
|
7
|
+
* Toolchain probe mirrors `scripts/preflight.mjs`'s `interpreters()` (version flag,
|
|
8
|
+
* read stdout+stderr combined since some tools like `java -version` write to stderr
|
|
9
|
+
* only, keep first line) but isn't the same function: that one checks a fixed tool
|
|
10
|
+
* list against expected versions (a gate); this reports whatever `services[*].command`
|
|
11
|
+
* names, no expected version to compare against.
|
|
20
12
|
*/
|
|
21
13
|
import { execFile } from "node:child_process";
|
|
22
14
|
import { platform } from "node:os";
|
|
23
15
|
import { tokenizeCommand } from "./orchestration.js";
|
|
24
|
-
/** Bounds a
|
|
16
|
+
/** Bounds a version probe so a hung command can't stall run() — same discipline as RT-030's readiness probes. */
|
|
25
17
|
const VERSION_PROBE_TIMEOUT_MS = 3000;
|
|
26
18
|
export async function captureEnvironmentMetadata(services) {
|
|
27
19
|
const commands = new Set();
|
|
28
20
|
for (const service of Object.values(services)) {
|
|
29
|
-
// Attach-mode services
|
|
30
|
-
// was launched by this runtime for it, so there is no toolchain to
|
|
31
|
-
// probe on its behalf.
|
|
21
|
+
// Attach-mode services have no `command` -- nothing to probe.
|
|
32
22
|
if (service.command === undefined)
|
|
33
23
|
continue;
|
|
34
24
|
const tokenized = tokenizeCommand(service.command);
|
|
@@ -45,14 +35,7 @@ export async function captureEnvironmentMetadata(services) {
|
|
|
45
35
|
toolchainVersions,
|
|
46
36
|
};
|
|
47
37
|
}
|
|
48
|
-
/**
|
|
49
|
-
* Tries `--version` then `-version` then `-v` -- the three flags
|
|
50
|
-
* `scripts/preflight.mjs`'s `interpreters()` needed across the toolchains
|
|
51
|
-
* this repo already runs (`java -version`, `mvn -v`). Returns the first
|
|
52
|
-
* line of whichever attempt exits 0, or `null` if none does -- an absent
|
|
53
|
-
* or non-version-reporting command is a disclosed gap in the map, not a
|
|
54
|
-
* thrown error and not an omitted key.
|
|
55
|
-
*/
|
|
38
|
+
/** Tries `--version`, `-version`, `-v` in order (covers `java -version`, `mvn -v`, etc). Returns the first line of whichever exits 0, or `null` — an unprobeable command is a disclosed gap, never a thrown error. */
|
|
56
39
|
function probeVersion(command) {
|
|
57
40
|
return tryFlags(command, ["--version", "-version", "-v"]);
|
|
58
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment-metadata.js","sourceRoot":"","sources":["../src/environment-metadata.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"environment-metadata.js","sourceRoot":"","sources":["../src/environment-metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,iHAAiH;AACjH,MAAM,wBAAwB,GAAG,IAAI,CAAC;AAEtC,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,QAAwD;IAExD,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC9C,8DAA8D;QAC9D,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS;YAAE,SAAS;QAC5C,MAAM,SAAS,GAAG,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACnD,IAAI,SAAS,CAAC,EAAE;YAAE,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACpD,CAAC;IAED,MAAM,iBAAiB,GAAkC,EAAE,CAAC;IAC5D,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,iBAAiB,CAAC,OAAO,CAAC,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,QAAQ,EAAE;QACpB,WAAW,EAAE,OAAO,CAAC,OAAO;QAC5B,iBAAiB;KAClB,CAAC;AACJ,CAAC;AAED,sNAAsN;AACtN,SAAS,YAAY,CAAC,OAAe;IACnC,OAAO,QAAQ,CAAC,OAAO,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;AAC5D,CAAC;AAED,KAAK,UAAU,QAAQ,CAAC,OAAe,EAAE,KAAwB;IAC/D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACnD,IAAI,MAAM,KAAK,IAAI;YAAE,OAAO,MAAM,CAAC;IACrC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,cAAc,CAAC,OAAe,EAAE,IAAY;IACnD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACzF,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;gBACnB,OAAO,CAAC,IAAI,CAAC,CAAC;gBACd,OAAO;YACT,CAAC;YACD,MAAM,QAAQ,GAAG,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;YAC7C,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAC1C,OAAO,CAAC,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,54 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `DEC-NEXT-fault-layer-empirical-confirmation.md`'s `environment`
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* comparison -- cheap, always available, no rerun needed.
|
|
2
|
+
* `DEC-NEXT-fault-layer-empirical-confirmation.md`'s `environment` mechanism:
|
|
3
|
+
* declared/expected runner version vs observed, at execution. Same shape as
|
|
4
|
+
* `dependency-version-check.ts` -- cheap, always available, no rerun needed.
|
|
6
5
|
*
|
|
7
|
-
*
|
|
8
|
-
* CI-
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* YAML parser (or a regex sketch of one) for a signal that is, in every
|
|
18
|
-
* real Node project, already restated in `package.json` -- `.nvmrc` and
|
|
19
|
-
* `engines.node` are the actual, load-bearing declarations `nvm`/`npm`
|
|
20
|
-
* themselves read, checked directly against this repo's own root
|
|
21
|
-
* `package.json` (`engines: { node: ">=22.5" }`) and every fixture app
|
|
22
|
-
* under `fixture-apps/`, which all carry the same field. A future CI-file
|
|
23
|
-
* reader is a real, disclosed extension point, not a silent omission --
|
|
24
|
-
* this function's `declaredSource` is a closed union specifically so a
|
|
25
|
-
* third source can be added later without changing the shape callers
|
|
26
|
-
* already read.
|
|
27
|
-
*
|
|
28
|
-
* ## `satisfiesDeclaredNodeVersion`'s grammar is a real, narrower subset
|
|
29
|
-
*
|
|
30
|
-
* Supports `^x.y.z`, `~x.y.z`, `>=`/`<=`/`>`/`<` clauses, a bare version at
|
|
31
|
-
* any precision (`"20"`, `"20.11"`, `"20.11.5"`, each an x-range at that
|
|
32
|
-
* precision -- `"20"` means "any 20.x.y", matching what `actions/setup-node`
|
|
33
|
-
* itself does for a bare major), and space-separated AND clauses
|
|
34
|
-
* (`">=20.0.0 <21.0.0"`), npm's own shape for a bounded range. Does **not**
|
|
35
|
-
* support `||` (OR), hyphen ranges (`"1.2.3 - 2.3.4"`), prerelease/build
|
|
36
|
-
* tags, or the `x`/`*` wildcard tokens (`"20.x"`) -- an input using any of
|
|
37
|
-
* those parses to `null` ("cannot say") rather than a silently wrong
|
|
38
|
-
* true/false, the same "disclosed narrower scope, not a guess" pattern this
|
|
39
|
-
* repo already applies to `EnvironmentMetadata.toolchainVersions`' `null`
|
|
40
|
-
* entries.
|
|
6
|
+
* - "Declared" reads `.nvmrc`/`package.json engines.node`, not a CI-workflow parser
|
|
7
|
+
* -- nothing here already parses CI YAML, and these are the load-bearing
|
|
8
|
+
* declarations `nvm`/`npm` themselves read. A future CI-file reader is a
|
|
9
|
+
* disclosed extension point: `declaredSource` is a closed union so a third source
|
|
10
|
+
* can be added without changing callers' shape.
|
|
11
|
+
* - `satisfiesDeclaredNodeVersion`'s grammar supports `^x.y.z`, `~x.y.z`,
|
|
12
|
+
* `>=`/`<=`/`>`/`<`, a bare version at any precision (x-range at that precision,
|
|
13
|
+
* matching `actions/setup-node`), and space-separated AND clauses. Does NOT
|
|
14
|
+
* support `||`, hyphen ranges, prerelease/build tags, or `x`/`*` wildcards --
|
|
15
|
+
* those parse to `null` ("cannot say"), never a guessed true/false.
|
|
41
16
|
*/
|
|
42
17
|
export declare const DECLARED_VERSION_SOURCES: readonly ["nvmrc", "package.json engines.node"];
|
|
43
18
|
export type DeclaredVersionSource = (typeof DECLARED_VERSION_SOURCES)[number];
|
|
44
19
|
export interface EnvironmentVersionCheckResult {
|
|
45
|
-
/**
|
|
46
|
-
* `false` when no declared version could be found at all (neither
|
|
47
|
-
* `.nvmrc` nor `package.json engines.node` present), or when the declared
|
|
48
|
-
* or observed value could not be parsed as a version -- "not applicable,"
|
|
49
|
-
* never a guessed clean result. `mismatch` is always `false` when this is
|
|
50
|
-
* `false`.
|
|
51
|
-
*/
|
|
20
|
+
/** `false` when no declared version was found, or declared/observed didn't parse -- "not applicable," never a guessed clean result. `mismatch` is `false` when this is. */
|
|
52
21
|
readonly applicable: boolean;
|
|
53
22
|
readonly mismatch: boolean;
|
|
54
23
|
readonly declaredVersion: string | null;
|
|
@@ -56,28 +25,16 @@ export interface EnvironmentVersionCheckResult {
|
|
|
56
25
|
readonly observedVersion: string;
|
|
57
26
|
}
|
|
58
27
|
/**
|
|
59
|
-
* Reads the declared Node version for the project
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* "always known, never probed" value this repo already captures elsewhere;
|
|
63
|
-
* this function never probes for it itself).
|
|
28
|
+
* Reads the declared Node version for the project at `cwd`, compares against
|
|
29
|
+
* `observedVersion` (`process.version`/`EnvironmentMetadata.nodeVersion` -- never
|
|
30
|
+
* probed here).
|
|
64
31
|
*
|
|
65
|
-
* `.nvmrc` takes precedence over `
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* more specific declaration wins, the same precedence
|
|
70
|
-
* `classifyFaultLayer` (`descry-core`) already applies between `dependency`
|
|
71
|
-
* and `environment` themselves ("the narrower, more specific structural
|
|
72
|
-
* fact... is checked first").
|
|
32
|
+
* `.nvmrc` takes precedence over `engines.node` when both exist -- it names one
|
|
33
|
+
* exact version a developer runs locally, vs. a more often permissive compatibility
|
|
34
|
+
* range. Narrower/more specific wins, same precedence `classifyFaultLayer`
|
|
35
|
+
* (`descry-core`) applies between `dependency` and `environment`.
|
|
73
36
|
*/
|
|
74
37
|
export declare function checkEnvironmentVersion(cwd: string, observedVersion: string): EnvironmentVersionCheckResult;
|
|
75
|
-
/**
|
|
76
|
-
* Whether `observedVersion` satisfies `declaredRange` under the grammar
|
|
77
|
-
* documented in this module's header. `null` means the comparison could not
|
|
78
|
-
* be made at all (either string used a construct this reader does not
|
|
79
|
-
* cover) -- distinct from `false`, which is a real, positive "does not
|
|
80
|
-
* satisfy" answer.
|
|
81
|
-
*/
|
|
38
|
+
/** Whether `observedVersion` satisfies `declaredRange` under the grammar above. `null` means the comparison couldn't be made -- distinct from `false`, a real "does not satisfy" answer. */
|
|
82
39
|
export declare function satisfiesDeclaredNodeVersion(declaredRange: string, observedVersion: string): boolean | null;
|
|
83
40
|
//# sourceMappingURL=environment-version-check.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment-version-check.d.ts","sourceRoot":"","sources":["../src/environment-version-check.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"environment-version-check.d.ts","sourceRoot":"","sources":["../src/environment-version-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,eAAO,MAAM,wBAAwB,iDAAkD,CAAC;AACxF,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9E,MAAM,WAAW,6BAA6B;IAC5C,2KAA2K;IAC3K,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,QAAQ,CAAC,cAAc,EAAE,qBAAqB,GAAG,IAAI,CAAC;IACtD,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAMD;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,6BAA6B,CAgD3G;AAmGD,4LAA4L;AAC5L,wBAAgB,4BAA4B,CAAC,aAAa,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAU3G"}
|
|
@@ -1,62 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `DEC-NEXT-fault-layer-empirical-confirmation.md`'s `environment`
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* comparison -- cheap, always available, no rerun needed.
|
|
2
|
+
* `DEC-NEXT-fault-layer-empirical-confirmation.md`'s `environment` mechanism:
|
|
3
|
+
* declared/expected runner version vs observed, at execution. Same shape as
|
|
4
|
+
* `dependency-version-check.ts` -- cheap, always available, no rerun needed.
|
|
6
5
|
*
|
|
7
|
-
*
|
|
8
|
-
* CI-
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* YAML parser (or a regex sketch of one) for a signal that is, in every
|
|
18
|
-
* real Node project, already restated in `package.json` -- `.nvmrc` and
|
|
19
|
-
* `engines.node` are the actual, load-bearing declarations `nvm`/`npm`
|
|
20
|
-
* themselves read, checked directly against this repo's own root
|
|
21
|
-
* `package.json` (`engines: { node: ">=22.5" }`) and every fixture app
|
|
22
|
-
* under `fixture-apps/`, which all carry the same field. A future CI-file
|
|
23
|
-
* reader is a real, disclosed extension point, not a silent omission --
|
|
24
|
-
* this function's `declaredSource` is a closed union specifically so a
|
|
25
|
-
* third source can be added later without changing the shape callers
|
|
26
|
-
* already read.
|
|
27
|
-
*
|
|
28
|
-
* ## `satisfiesDeclaredNodeVersion`'s grammar is a real, narrower subset
|
|
29
|
-
*
|
|
30
|
-
* Supports `^x.y.z`, `~x.y.z`, `>=`/`<=`/`>`/`<` clauses, a bare version at
|
|
31
|
-
* any precision (`"20"`, `"20.11"`, `"20.11.5"`, each an x-range at that
|
|
32
|
-
* precision -- `"20"` means "any 20.x.y", matching what `actions/setup-node`
|
|
33
|
-
* itself does for a bare major), and space-separated AND clauses
|
|
34
|
-
* (`">=20.0.0 <21.0.0"`), npm's own shape for a bounded range. Does **not**
|
|
35
|
-
* support `||` (OR), hyphen ranges (`"1.2.3 - 2.3.4"`), prerelease/build
|
|
36
|
-
* tags, or the `x`/`*` wildcard tokens (`"20.x"`) -- an input using any of
|
|
37
|
-
* those parses to `null` ("cannot say") rather than a silently wrong
|
|
38
|
-
* true/false, the same "disclosed narrower scope, not a guess" pattern this
|
|
39
|
-
* repo already applies to `EnvironmentMetadata.toolchainVersions`' `null`
|
|
40
|
-
* entries.
|
|
6
|
+
* - "Declared" reads `.nvmrc`/`package.json engines.node`, not a CI-workflow parser
|
|
7
|
+
* -- nothing here already parses CI YAML, and these are the load-bearing
|
|
8
|
+
* declarations `nvm`/`npm` themselves read. A future CI-file reader is a
|
|
9
|
+
* disclosed extension point: `declaredSource` is a closed union so a third source
|
|
10
|
+
* can be added without changing callers' shape.
|
|
11
|
+
* - `satisfiesDeclaredNodeVersion`'s grammar supports `^x.y.z`, `~x.y.z`,
|
|
12
|
+
* `>=`/`<=`/`>`/`<`, a bare version at any precision (x-range at that precision,
|
|
13
|
+
* matching `actions/setup-node`), and space-separated AND clauses. Does NOT
|
|
14
|
+
* support `||`, hyphen ranges, prerelease/build tags, or `x`/`*` wildcards --
|
|
15
|
+
* those parse to `null` ("cannot say"), never a guessed true/false.
|
|
41
16
|
*/
|
|
42
17
|
import { existsSync, readFileSync } from "node:fs";
|
|
43
18
|
import { join } from "node:path";
|
|
44
19
|
export const DECLARED_VERSION_SOURCES = ["nvmrc", "package.json engines.node"];
|
|
45
20
|
/**
|
|
46
|
-
* Reads the declared Node version for the project
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* "always known, never probed" value this repo already captures elsewhere;
|
|
50
|
-
* this function never probes for it itself).
|
|
21
|
+
* Reads the declared Node version for the project at `cwd`, compares against
|
|
22
|
+
* `observedVersion` (`process.version`/`EnvironmentMetadata.nodeVersion` -- never
|
|
23
|
+
* probed here).
|
|
51
24
|
*
|
|
52
|
-
* `.nvmrc` takes precedence over `
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* more specific declaration wins, the same precedence
|
|
57
|
-
* `classifyFaultLayer` (`descry-core`) already applies between `dependency`
|
|
58
|
-
* and `environment` themselves ("the narrower, more specific structural
|
|
59
|
-
* fact... is checked first").
|
|
25
|
+
* `.nvmrc` takes precedence over `engines.node` when both exist -- it names one
|
|
26
|
+
* exact version a developer runs locally, vs. a more often permissive compatibility
|
|
27
|
+
* range. Narrower/more specific wins, same precedence `classifyFaultLayer`
|
|
28
|
+
* (`descry-core`) applies between `dependency` and `environment`.
|
|
60
29
|
*/
|
|
61
30
|
export function checkEnvironmentVersion(cwd, observedVersion) {
|
|
62
31
|
const notApplicable = {
|
|
@@ -98,9 +67,8 @@ export function checkEnvironmentVersion(cwd, observedVersion) {
|
|
|
98
67
|
}
|
|
99
68
|
const satisfies = satisfiesDeclaredNodeVersion(declaredVersion, observedVersion);
|
|
100
69
|
if (satisfies === null) {
|
|
101
|
-
//
|
|
102
|
-
//
|
|
103
|
-
// implying a comparison was actually made -- see this module's header.
|
|
70
|
+
// Grammar not covered (or observed string unparseable) -- "not applicable",
|
|
71
|
+
// not a comparison that was actually made.
|
|
104
72
|
return { applicable: false, mismatch: false, declaredVersion, declaredSource, observedVersion };
|
|
105
73
|
}
|
|
106
74
|
return { applicable: true, mismatch: !satisfies, declaredVersion, declaredSource, observedVersion };
|
|
@@ -132,11 +100,7 @@ function compareVersions(a, b) {
|
|
|
132
100
|
const CARET_PATTERN = /^\^(\d+)(?:\.(\d+))?(?:\.(\d+))?$/;
|
|
133
101
|
const TILDE_PATTERN = /^~(\d+)(?:\.(\d+))?(?:\.(\d+))?$/;
|
|
134
102
|
const COMPARATOR_PATTERN = /^(>=|<=|>|<|=)?(\d+)(?:\.(\d+))?(?:\.(\d+))?$/;
|
|
135
|
-
/**
|
|
136
|
-
* `null` means "this clause's grammar is not one of the ones documented in
|
|
137
|
-
* this module's header" -- propagated up as `null`, never coerced to a
|
|
138
|
-
* guessed `true`/`false`.
|
|
139
|
-
*/
|
|
103
|
+
/** `null` means the clause's grammar isn't covered -- propagated up, never coerced to a guessed true/false. */
|
|
140
104
|
function satisfiesClause(clause, observed) {
|
|
141
105
|
const trimmed = clause.trim();
|
|
142
106
|
if (trimmed.length === 0)
|
|
@@ -196,13 +160,7 @@ function satisfiesClause(clause, observed) {
|
|
|
196
160
|
return null;
|
|
197
161
|
}
|
|
198
162
|
}
|
|
199
|
-
/**
|
|
200
|
-
* Whether `observedVersion` satisfies `declaredRange` under the grammar
|
|
201
|
-
* documented in this module's header. `null` means the comparison could not
|
|
202
|
-
* be made at all (either string used a construct this reader does not
|
|
203
|
-
* cover) -- distinct from `false`, which is a real, positive "does not
|
|
204
|
-
* satisfy" answer.
|
|
205
|
-
*/
|
|
163
|
+
/** Whether `observedVersion` satisfies `declaredRange` under the grammar above. `null` means the comparison couldn't be made -- distinct from `false`, a real "does not satisfy" answer. */
|
|
206
164
|
export function satisfiesDeclaredNodeVersion(declaredRange, observedVersion) {
|
|
207
165
|
const observed = parseVersion(observedVersion);
|
|
208
166
|
if (observed === null)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment-version-check.js","sourceRoot":"","sources":["../src/environment-version-check.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"environment-version-check.js","sourceRoot":"","sources":["../src/environment-version-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,OAAO,EAAE,2BAA2B,CAAU,CAAC;AAgBxF;;;;;;;;;GASG;AACH,MAAM,UAAU,uBAAuB,CAAC,GAAW,EAAE,eAAuB;IAC1E,MAAM,aAAa,GAAkC;QACnD,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,KAAK;QACf,eAAe,EAAE,IAAI;QACrB,cAAc,EAAE,IAAI;QACpB,eAAe;KAChB,CAAC;IAEF,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IACtC,IAAI,eAAe,GAAkB,IAAI,CAAC;IAC1C,IAAI,cAAc,GAAiC,IAAI,CAAC;IAExD,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC1B,MAAM,GAAG,GAAG,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;QACnD,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnB,eAAe,GAAG,GAAG,CAAC;YACtB,cAAc,GAAG,OAAO,CAAC;QAC3B,CAAC;IACH,CAAC;SAAM,CAAC;QACN,MAAM,eAAe,GAAG,IAAI,CAAC,GAAG,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