@intentius/chant 0.25.0 → 0.26.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/dist/build.d.ts.map +1 -1
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/discovery/entity-wire-codec.d.ts +14 -9
- package/dist/discovery/entity-wire-codec.d.ts.map +1 -1
- package/dist/discovery/graph.d.ts.map +1 -1
- package/dist/discovery/sandbox/config-wire.d.ts +16 -0
- package/dist/discovery/sandbox/config-wire.d.ts.map +1 -1
- package/dist/discovery/sandbox/driver.d.ts +29 -0
- package/dist/discovery/sandbox/driver.d.ts.map +1 -1
- package/dist/discovery/sandbox/fork.d.ts +18 -0
- package/dist/discovery/sandbox/fork.d.ts.map +1 -1
- package/dist/discovery/sandbox/policy-run.d.ts +33 -0
- package/dist/discovery/sandbox/policy-run.d.ts.map +1 -0
- package/dist/discovery/sandbox/policy-wire.d.ts +177 -0
- package/dist/discovery/sandbox/policy-wire.d.ts.map +1 -0
- package/dist/intrinsic-interpolation.d.ts.map +1 -1
- package/dist/lexicon-output.d.ts.map +1 -1
- package/dist/lint/policy-import.d.ts +50 -0
- package/dist/lint/policy-import.d.ts.map +1 -0
- package/dist/lint/policy-sandbox.d.ts +89 -0
- package/dist/lint/policy-sandbox.d.ts.map +1 -0
- package/dist/lint/policy.d.ts +12 -1
- package/dist/lint/policy.d.ts.map +1 -1
- package/dist/stack-output.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/build.test.ts +77 -1
- package/src/build.ts +15 -2
- package/src/cli/commands/build.ts +33 -5
- package/src/cli/main.test.ts +93 -17
- package/src/cli/main.ts +101 -11
- package/src/discovery/entity-wire-codec.ts +14 -9
- package/src/discovery/graph.test.ts +40 -1
- package/src/discovery/graph.ts +8 -2
- package/src/discovery/sandbox/config-wire.ts +21 -0
- package/src/discovery/sandbox/driver.ts +132 -0
- package/src/discovery/sandbox/fork.ts +39 -1
- package/src/discovery/sandbox/policy-boundary.test.ts +325 -0
- package/src/discovery/sandbox/policy-run.ts +180 -0
- package/src/discovery/sandbox/policy-wire.test.ts +310 -0
- package/src/discovery/sandbox/policy-wire.ts +277 -0
- package/src/intrinsic-interpolation.test.ts +27 -1
- package/src/intrinsic-interpolation.ts +10 -2
- package/src/lexicon-output.test.ts +36 -0
- package/src/lexicon-output.ts +12 -2
- package/src/lint/policy-import.ts +70 -0
- package/src/lint/policy-sandbox.ts +123 -0
- package/src/lint/policy.ts +20 -2
- package/src/stack-output.test.ts +118 -0
- package/src/stack-output.ts +21 -5
package/dist/build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAsB,MAAM,UAAU,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,cAAc,EAAiC,MAAM,UAAU,CAAC;AACzE,OAAO,EAAE,aAAa,EAAmB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAsB,MAAM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ACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,GAChC,aAAa,EAAE,CAuEjB;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,GAChC,aAAa,EAAE,CA+FjB;AA6ED;;;;;;;GAOG;AACH,wBAAsB,KAAK,CACzB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,UAAU,EAAE,EACzB,gBAAgB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EAC9B,OAAO,CAAC,EAAE,YAAY,GACrB,OAAO,CAAC,WAAW,CAAC,CAWtB;AA0KD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,sBAAsB,EAC5B,WAAW,EAAE,UAAU,EAAE,EACzB,KAAK,SAAsB,EAC3B,gBAAgB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EAC9B,OAAO,CAAC,EAAE,YAAY,GACrB,OAAO,CAAC,WAAW,CAAC,CAgBtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/build.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAoB,MAAM,kBAAkB,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/build.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAoB,MAAM,kBAAkB,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAUnD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,MAAM,CAAC,EAAE,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,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAIlD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAItD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,YAAY,EACrB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,GACxC,MAAM,IAAI,CAmCZ"}
|
package/dist/cli/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AAMA,OAAO,EAAmC,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AAMA,OAAO,EAAmC,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAoE9E;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAoQpD;AA2aD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAuB5E"}
|
|
@@ -23,20 +23,25 @@
|
|
|
23
23
|
* value) becomes a name-keyed marker instead. {@link decodeEntitySet} is the
|
|
24
24
|
* inverse — it rebuilds a live `Map<string, Declarable>` whose entities are
|
|
25
25
|
* BEHAVIORALLY indistinguishable from what `discover()` would have produced
|
|
26
|
-
* in-process: real `AttrRef` instances
|
|
27
|
-
* `
|
|
26
|
+
* in-process: real `AttrRef` instances, not a duck-typed `{__attrRef}`
|
|
27
|
+
* envelope alone. `new AttrRef(...)` here is plain, direct construction from
|
|
28
|
+
* this module's own class — this codec runs inside the same module graph as
|
|
29
|
+
* every downstream reader (`intrinsic-interpolation.ts`'s
|
|
28
30
|
* `defaultInterpolationSerializer`, `discovery/graph.ts`'s
|
|
29
31
|
* `buildDependencyGraph`, `build.ts`'s `detectCrossLexiconRefs`/
|
|
30
|
-
* `computeStackGraph
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
32
|
+
* `computeStackGraph`, all converted to `isAttrRefLike` duck-typing by chant
|
|
33
|
+
* #1137 for the OTHER hazard, a separately-loaded lexicon copy) — so there is
|
|
34
|
+
* no dual-package boundary to duck-type across here, and building the real
|
|
35
|
+
* class is simply less code than hand-assembling a shape-alike stand-in with
|
|
36
|
+
* matching methods, and whole-entity embeds restored to the SAME object
|
|
37
|
+
* reference (not a structurally-equal clone), so `entityNames.get(decl)`
|
|
38
|
+
* keeps working by identity exactly as it does today.
|
|
34
39
|
*
|
|
35
40
|
* `serializer-walker.ts`'s `walkValue` needs NO changes for this: it already
|
|
36
41
|
* falls back to reading a plain `{__attrRef}` envelope (added for intrinsics
|
|
37
42
|
* whose own `toJSON()` embeds one). `decodeEntitySet` goes further and
|
|
38
|
-
* reconstructs the real class
|
|
39
|
-
*
|
|
43
|
+
* reconstructs the real class, both simpler here and a belt-and-suspenders
|
|
44
|
+
* match for any call site that still checks `instanceof AttrRef` directly.
|
|
40
45
|
*
|
|
41
46
|
* Naming happens exactly once, inside the boundary — `resolveAttrRefs`
|
|
42
47
|
* (./resolve.ts) runs as part of `discover()`, before `encodeEntitySet` is
|
|
@@ -78,7 +83,7 @@ import { type Declarable } from "../declarable.js";
|
|
|
78
83
|
* form. `refs` additionally captures any `AttrRef`/whole-entity reference
|
|
79
84
|
* found while walking the intrinsic's OWN fields (not through `toJSON()`)
|
|
80
85
|
* — `buildDependencyGraph` and `detectCrossLexiconRefs`/`computeStackGraph`
|
|
81
|
-
* walk raw entity property trees looking for `
|
|
86
|
+
* walk raw entity property trees looking for an `AttrRef`-like value/a
|
|
82
87
|
* tracked `Declarable`, not through `toJSON()`, so a ref nested inside e.g.
|
|
83
88
|
* a `Sub` template needs to still be discoverable post-decode for
|
|
84
89
|
* cross-lexicon output auto-detection and dependency ordering to keep
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-wire-codec.d.ts","sourceRoot":"","sources":["../../src/discovery/entity-wire-codec.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"entity-wire-codec.d.ts","sourceRoot":"","sources":["../../src/discovery/entity-wire-codec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AAEH,OAAO,EAA2C,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAOzF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,MAAM,SAAS,GACjB,IAAI,GACJ,MAAM,GACN,MAAM,GACN,OAAO,GACP,SAAS,EAAE,GACX;IAAE,SAAS,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GACpD;IAAE,WAAW,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GACnC;IAAE,UAAU,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,SAAS,CAAA;KAAE,CAAA;CAAE,GAC1E;IAAE,WAAW,EAAE;QAAE,KAAK,EAAE,SAAS,CAAC;QAAC,IAAI,CAAC,EAAE,SAAS,CAAC;QAAC,IAAI,EAAE,SAAS,EAAE,CAAA;KAAE,CAAA;CAAE,GAC1E;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAEjC,kIAAkI;AAClI,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC1C,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;;;;;;OAOG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACnC;AAED,iKAAiK;AACjK,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,+KAA+K;IAC/K,GAAG,EAAE,SAAS,CAAC;CAChB;AAED,MAAM,MAAM,UAAU,GAAG,oBAAoB,GAAG,uBAAuB,CAAC;AAExE,kEAAkE;AAClE,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,UAAU,EAAE,CAAC;CACxB;AA0KD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,aAAa,CAoBhF;AAuGD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CA0C5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/discovery/graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/discovery/graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAKhD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,GAChC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAuB1B"}
|
|
@@ -18,6 +18,12 @@
|
|
|
18
18
|
* the project code it is inspecting — so it must not import anything, and must
|
|
19
19
|
* not touch the filesystem, the environment or the process.
|
|
20
20
|
*
|
|
21
|
+
* chant #1131 reuses the same walk for the OTHER direction: a `lint.policies`
|
|
22
|
+
* check runs inside a sandboxed child and its `PostSynthDiagnostic[]` has to
|
|
23
|
+
* come back as data (`./policy-wire.ts`). That is the same "JSON is lossy
|
|
24
|
+
* without complaining" problem with a different root value, so the walk is
|
|
25
|
+
* exported as {@link scanValueWireSafety} rather than copied.
|
|
26
|
+
*
|
|
21
27
|
* ## What `ChantConfig` legally holds
|
|
22
28
|
*
|
|
23
29
|
* Every field of `ChantConfig` (`../../config.ts`) is JSON data: string arrays
|
|
@@ -52,6 +58,16 @@ export interface ConfigWireOffender {
|
|
|
52
58
|
/** What was found there, phrased for an error message (e.g. `a function`, `a Date`). */
|
|
53
59
|
found: string;
|
|
54
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* chant #1131 — report every value ANYWHERE in `value` that cannot cross the
|
|
63
|
+
* sandbox boundary as JSON, with paths rooted at `rootPath`.
|
|
64
|
+
*
|
|
65
|
+
* {@link scanConfigWireSafety} is the config-shaped entry point (it tolerates a
|
|
66
|
+
* module namespace object at the root); this one takes the value as given, so
|
|
67
|
+
* an array root (`diagnostics`) or a plain object root both work. Same rules,
|
|
68
|
+
* same `undefined`-object-property allowance — see the module doc.
|
|
69
|
+
*/
|
|
70
|
+
export declare function scanValueWireSafety(value: unknown, rootPath?: string): ConfigWireOffender[];
|
|
55
71
|
/**
|
|
56
72
|
* Report every value in `config` that cannot cross the sandbox boundary as
|
|
57
73
|
* JSON. An empty array means a `JSON.parse(JSON.stringify(config))` round-trip
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-wire.d.ts","sourceRoot":"","sources":["../../../src/discovery/sandbox/config-wire.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"config-wire.d.ts","sourceRoot":"","sources":["../../../src/discovery/sandbox/config-wire.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,8EAA8E;AAC9E,MAAM,WAAW,kBAAkB;IACjC,6FAA6F;IAC7F,IAAI,EAAE,MAAM,CAAC;IACb,wFAAwF;IACxF,KAAK,EAAE,MAAM,CAAC;CACf;AAiFD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,SAAK,GAAG,kBAAkB,EAAE,CAIvF;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,kBAAkB,EAAE,CAe1E;AAED,2IAA2I;AAC3I,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,SAAS,kBAAkB,EAAE,GACvC,MAAM,CAOR"}
|
|
@@ -30,4 +30,33 @@ export declare function generateDriverSource(options: GenerateDriverOptions): st
|
|
|
30
30
|
* interpreted.
|
|
31
31
|
*/
|
|
32
32
|
export declare function generateConfigDriverSource(configPath: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* chant #1131 — generate the driver module that imports a project's
|
|
35
|
+
* `lint.policies` modules INSIDE the sandboxed child, runs their checks over
|
|
36
|
+
* the build result the parent hands it, and sends back plain
|
|
37
|
+
* `PostSynthDiagnostic`s.
|
|
38
|
+
*
|
|
39
|
+
* Same machinery again: literal-specifier dynamic `import()`s esbuild can trace
|
|
40
|
+
* and inline, `./child-errors.ts` for classification so a permission denial
|
|
41
|
+
* names the policy file, one IPC message back. Two things are specific to this
|
|
42
|
+
* one:
|
|
43
|
+
*
|
|
44
|
+
* - **It receives before it sends.** The run and config drivers are fully
|
|
45
|
+
* parameterized by their generated source; a policy check needs the finished
|
|
46
|
+
* build result, which is neither known at bundle time nor something to bake
|
|
47
|
+
* into a source literal. It arrives as one IPC message (see `./fork.ts`'s
|
|
48
|
+
* `send`). The `process.on("message", …)` registration is top-level and
|
|
49
|
+
* synchronous, so it is in place before the event loop can deliver anything
|
|
50
|
+
* — a message the parent sent before the child finished booting is queued on
|
|
51
|
+
* the channel, not lost.
|
|
52
|
+
* - **Checks run wrapped, not raw.** `runPostSynthChecks` (chant's own, from
|
|
53
|
+
* `../../lint/post-synth.ts`) is invoked ONCE over every check from every
|
|
54
|
+
* policy module, exactly as `cli/commands/build.ts` invokes it in-process —
|
|
55
|
+
* so the checks share one `PostSynthContext` and run in one order, and the
|
|
56
|
+
* diagnostics come back in the same sequence. The wrapper around each check
|
|
57
|
+
* is what makes a bad return value attributable: it scans that check's own
|
|
58
|
+
* output and throws a `PolicyWireError` naming the module the check was
|
|
59
|
+
* loaded from, rather than reporting an offending index in a merged array.
|
|
60
|
+
*/
|
|
61
|
+
export declare function generatePolicyDriverSource(policyPaths: readonly string[]): string;
|
|
33
62
|
//# sourceMappingURL=driver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../../src/discovery/sandbox/driver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../../src/discovery/sandbox/driver.ts"],"names":[],"mappings":"AAiDA,MAAM,WAAW,qBAAqB;IACpC,qIAAqI;IACrI,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,oNAAoN;IACpN,SAAS,EAAE,MAAM,CAAC;CACnB;AAOD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,MAAM,CAqF3E;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CA6CrE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAmGjF"}
|
|
@@ -42,6 +42,24 @@ export interface SandboxForkOptions {
|
|
|
42
42
|
timeoutMs: number;
|
|
43
43
|
/** What timed out / exited early, for the error message (e.g. `"sandboxed run"`). */
|
|
44
44
|
label: string;
|
|
45
|
+
/**
|
|
46
|
+
* chant #1131 — an optional payload sent to the child over the SAME IPC
|
|
47
|
+
* channel its response comes back on, immediately after the fork.
|
|
48
|
+
*
|
|
49
|
+
* The run and config children are fully described by their generated driver
|
|
50
|
+
* source, so they need nothing inbound. The policy child does: its input is
|
|
51
|
+
* the finished build result, which exists only after the parent has merged
|
|
52
|
+
* and serialized, long after the bundle was built. Sending it rather than
|
|
53
|
+
* baking it into a source literal keeps the bundle small (esbuild would
|
|
54
|
+
* otherwise parse a multi-megabyte literal) and keeps it off disk.
|
|
55
|
+
*
|
|
56
|
+
* Safe to send before the child has booted: `child.send` writes to the IPC
|
|
57
|
+
* pipe and Node queues the message until the child's channel is read, and
|
|
58
|
+
* the driver registers its `process.on("message", …)` synchronously at module
|
|
59
|
+
* top level — before the event loop can deliver anything. This is NOT a
|
|
60
|
+
* second protocol: same channel, same JSON, same one-message-back response.
|
|
61
|
+
*/
|
|
62
|
+
send?: Record<string, unknown>;
|
|
45
63
|
}
|
|
46
64
|
/**
|
|
47
65
|
* Fork `bundlePath` under `--permission` with a scrubbed environment, and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fork.d.ts","sourceRoot":"","sources":["../../../src/discovery/sandbox/fork.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,WAAW,kBAAkB;IACjC,sEAAsE;IACtE,UAAU,EAAE,MAAM,CAAC;IACnB,6FAA6F;IAC7F,SAAS,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,eAAe,EAAE,MAAM,CAAC;IACxB,6IAA6I;IAC7I,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;;;OAKG;IACH,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,0EAA0E;IAC1E,SAAS,EAAE,MAAM,CAAC;IAClB,qFAAqF;IACrF,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"fork.d.ts","sourceRoot":"","sources":["../../../src/discovery/sandbox/fork.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,WAAW,kBAAkB;IACjC,sEAAsE;IACtE,UAAU,EAAE,MAAM,CAAC;IACnB,6FAA6F;IAC7F,SAAS,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,eAAe,EAAE,MAAM,CAAC;IACxB,6IAA6I;IAC7I,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;;;OAKG;IACH,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,0EAA0E;IAC1E,SAAS,EAAE,MAAM,CAAC;IAClB,qFAAqF;IACrF,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;;;;;;;;;;OAgBG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,OAAO,EAAE,kBAAkB,EAC3B,UAAU,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,CAAC,GACzC,OAAO,CAAC,CAAC,CAAC,CAwEZ"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { PostSynthDiagnostic } from "../../lint/post-synth.js";
|
|
2
|
+
import { type EncodablePolicyBuildResult } from "./policy-wire.js";
|
|
3
|
+
export interface SandboxPolicyResult {
|
|
4
|
+
/** What the policy pack reported — plain data, validated inside the child before it crossed (see `./policy-wire.ts`'s `scanPolicyDiagnostics`). */
|
|
5
|
+
diagnostics: PostSynthDiagnostic[];
|
|
6
|
+
/** esbuild bundling wall-clock time. */
|
|
7
|
+
bundleMs: number;
|
|
8
|
+
/** Bundle size in bytes. */
|
|
9
|
+
bundleBytes: number;
|
|
10
|
+
/** Encoded build-result payload size in bytes — what crossed the IPC channel. */
|
|
11
|
+
payloadBytes: number;
|
|
12
|
+
}
|
|
13
|
+
export interface SandboxPolicyOptions {
|
|
14
|
+
/** Absolute paths to the project's `lint.policies` modules, in declaration order. */
|
|
15
|
+
policyPaths: readonly string[];
|
|
16
|
+
/** The merged, serialized build result the checks run over. */
|
|
17
|
+
buildResult: EncodablePolicyBuildResult;
|
|
18
|
+
/** The environment/stack this build was evaluated for (`--env`, else `ownership.env`) — becomes `ctx.env`. */
|
|
19
|
+
env?: string;
|
|
20
|
+
/** Directory the child is granted `--allow-fs-read` for: the project root (the `chant.config.*` directory, which `lint.policies` paths are resolved against). */
|
|
21
|
+
projectRoot: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Evaluate `policyPaths` against `buildResult` inside a sandboxed child.
|
|
25
|
+
*
|
|
26
|
+
* Throws — rather than degrading to an in-process run — when the policies
|
|
27
|
+
* cannot be evaluated inside the boundary or their diagnostics cannot cross it
|
|
28
|
+
* as JSON. Under `--sandbox` a policy pack that "almost" ran is not a safe
|
|
29
|
+
* thing to proceed with, and quietly falling back would give away the property
|
|
30
|
+
* the flag exists to provide.
|
|
31
|
+
*/
|
|
32
|
+
export declare function runPoliciesSandboxed(options: SandboxPolicyOptions): Promise<SandboxPolicyResult>;
|
|
33
|
+
//# sourceMappingURL=policy-run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy-run.d.ts","sourceRoot":"","sources":["../../../src/discovery/sandbox/policy-run.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAIjE,OAAO,EAGL,KAAK,0BAA0B,EAEhC,MAAM,eAAe,CAAC;AA+EvB,MAAM,WAAW,mBAAmB;IAClC,mJAAmJ;IACnJ,WAAW,EAAE,mBAAmB,EAAE,CAAC;IACnC,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,iFAAiF;IACjF,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,qFAAqF;IACrF,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,+DAA+D;IAC/D,WAAW,EAAE,0BAA0B,CAAC;IACxC,8GAA8G;IAC9G,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iKAAiK;IACjK,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CA0DtG"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import type { Declarable } from "../../declarable.js";
|
|
2
|
+
import type { SerializerResult } from "../../serializer.js";
|
|
3
|
+
import type { PostSynthContext } from "../../lint/post-synth.js";
|
|
4
|
+
import { type EntitySetWire } from "../entity-wire-codec.js";
|
|
5
|
+
import { type ConfigWireOffender } from "./config-wire.js";
|
|
6
|
+
/**
|
|
7
|
+
* chant #1131 — what a build result looks like on its way INTO the sandboxed
|
|
8
|
+
* policy child, and what a `PostSynthDiagnostic` must look like on its way back
|
|
9
|
+
* out.
|
|
10
|
+
*
|
|
11
|
+
* A project's `lint.policies` checks are project-authored functions chant calls
|
|
12
|
+
* over the finished build. #1113 put `chant.config.ts` behind the `--sandbox`
|
|
13
|
+
* boundary but could not take the policies with it, because the config declares
|
|
14
|
+
* them as *paths*: the modules were still imported and their `check` functions
|
|
15
|
+
* still invoked in the CLI's own process, with the CLI's filesystem, network,
|
|
16
|
+
* environment and process-spawn access, after discovery was over.
|
|
17
|
+
*
|
|
18
|
+
* The shape of the fix is forced by what a policy is. It is not data that can
|
|
19
|
+
* be evaluated somewhere and carried back — it is a callback over the resolved
|
|
20
|
+
* resources, so it has to run somewhere it can see them. It also cannot run in
|
|
21
|
+
* the #1045 discovery child, because that child only ever sees the run-fallback
|
|
22
|
+
* *subset*: folded files are collected in the parent, and serialization happens
|
|
23
|
+
* in the parent, so no complete view of the build exists on that side. What
|
|
24
|
+
* does exist, after the parent has merged and serialized, is a build result
|
|
25
|
+
* that is *nearly* data already — which is what this module makes explicit.
|
|
26
|
+
*
|
|
27
|
+
* So: one more child, after the merge, handed the encoded build result,
|
|
28
|
+
* importing the policy modules inside the boundary and returning plain
|
|
29
|
+
* diagnostics. Same bundling (`./bundle.ts`), same spawn and `--permission`
|
|
30
|
+
* profile (`./fork.ts`), same error classification (`./child-errors.ts`), same
|
|
31
|
+
* "only JSON crosses, and anything else is named, never dropped" contract
|
|
32
|
+
* (`./config-wire.ts`, whose walk is reused directly).
|
|
33
|
+
*
|
|
34
|
+
* ## What crosses, and what that costs
|
|
35
|
+
*
|
|
36
|
+
* `PostSynthContext` gives a check five things. Four of them are already data:
|
|
37
|
+
* `outputs` (each lexicon's serialized text), `warnings`, `errors`,
|
|
38
|
+
* `sourceFileCount`. The fifth, `entities`, is a live `Map<string, Declarable>`
|
|
39
|
+
* whose cross-entity references are object identity and `WeakRef`s — the exact
|
|
40
|
+
* problem chant #1045 Phase 1 solved for discovery, so this reuses that codec
|
|
41
|
+
* (`../entity-wire-codec.ts`) rather than inventing a second one.
|
|
42
|
+
*
|
|
43
|
+
* That reuse is what makes the round trip cheap AND what defines its limits.
|
|
44
|
+
* `encodeEntitySet`/`decodeEntitySet` is documented as producing entities
|
|
45
|
+
* "behaviorally indistinguishable" from the in-process ones for chant's own
|
|
46
|
+
* consumers (serializers, the dependency graph, cross-lexicon detection), and
|
|
47
|
+
* a policy is a consumer of the same shape. Where it is NOT identical is
|
|
48
|
+
* written down in `docs/.../architecture/sandbox.mdx` and pinned by
|
|
49
|
+
* `./policy-wire.test.ts`:
|
|
50
|
+
*
|
|
51
|
+
* - An intrinsic (`Sub`, `Ref`, gitlab's `!reference`, …) decodes to a
|
|
52
|
+
* marker-bearing wrapper exposing `toJSON()`/`toYAML()`, not to an instance
|
|
53
|
+
* of the lexicon's own intrinsic class.
|
|
54
|
+
* - A decoded entity is a plain marker-bearing object, not an instance of the
|
|
55
|
+
* lexicon's resource class, and its `lexicon`/`entityType`/`kind`/`props`/
|
|
56
|
+
* `attributes` are non-enumerable (so `Object.keys(entity)` sees only the
|
|
57
|
+
* per-attribute/extra fields). Reads — `entity.props`, `entity.entityType`,
|
|
58
|
+
* `isDeclarable(entity)`, `instanceof AttrRef` — all still work.
|
|
59
|
+
* - A `ChildProjectInstance` (`nestedStack()`) has no wire form at all;
|
|
60
|
+
* `encodeEntitySet` throws rather than mis-encoding it, so a `--sandbox`
|
|
61
|
+
* build that both uses `nestedStack()` and declares `lint.policies` fails
|
|
62
|
+
* loudly. (No corpus entry uses `nestedStack()`.)
|
|
63
|
+
* - `errors` cross as the plain objects `DiscoveryError`/`BuildError`'s own
|
|
64
|
+
* `toJSON()` produces, not as `Error` instances. In practice this is never
|
|
65
|
+
* observable: `chant build` runs policies only when the build produced no
|
|
66
|
+
* errors at all, so the array is always empty at that point.
|
|
67
|
+
*
|
|
68
|
+
* Crucially, the first two are NOT new under `--sandbox`: a sandboxed build
|
|
69
|
+
* already merges decoded entities for every run-fallback file (`./run.ts`), so
|
|
70
|
+
* a policy running in-process on a `--sandbox` build is already looking at
|
|
71
|
+
* decoded entities for part of the set. Encoding is idempotent over a decoded
|
|
72
|
+
* entity (verified in `./policy-wire.test.ts`), so this child widens that from
|
|
73
|
+
* "the run-fallback subset" to "all of them" and changes nothing else.
|
|
74
|
+
*/
|
|
75
|
+
/** Wire form of one lexicon's serialized output — already data on both sides; carried as-is. */
|
|
76
|
+
export type PolicyOutputWire = string | {
|
|
77
|
+
primary: string;
|
|
78
|
+
files?: Record<string, string>;
|
|
79
|
+
warnings?: string[];
|
|
80
|
+
};
|
|
81
|
+
/** A build result as pure JSON, for the sandboxed policy child. */
|
|
82
|
+
export interface PolicyBuildResultWire {
|
|
83
|
+
/** `../entity-wire-codec.ts`'s format — the same one the #1045 discovery child returns. */
|
|
84
|
+
entities: EntitySetWire;
|
|
85
|
+
/** `Map` entries as pairs; a `Map` itself JSON-stringifies to `{}`. */
|
|
86
|
+
outputs: Array<[string, PolicyOutputWire]>;
|
|
87
|
+
warnings: string[];
|
|
88
|
+
/** `DiscoveryError`/`BuildError`'s own `toJSON()` output. Always empty in practice — see the module doc. */
|
|
89
|
+
errors: Array<Record<string, unknown>>;
|
|
90
|
+
sourceFileCount: number;
|
|
91
|
+
/** `BuildResult.dependencies` (`Map<string, Set<string>>`) as pairs of arrays. Not part of `PostSynthContext`'s declared surface; carried so `ctx.buildResult` is not silently narrower than the object the in-process path passes. */
|
|
92
|
+
dependencies: Array<[string, string[]]>;
|
|
93
|
+
/** `BuildResult.manifest` — plain data (lexicons, cross-lexicon outputs, deploy order, stack graph). Same "not declared, still carried" reasoning as {@link dependencies}. */
|
|
94
|
+
manifest?: unknown;
|
|
95
|
+
/** `BuildResult.foldDecisions` — plain data. */
|
|
96
|
+
foldDecisions?: unknown[];
|
|
97
|
+
/** `BuildResult.buildParams` — plain data (#1064 provenance records). */
|
|
98
|
+
buildParams?: unknown[];
|
|
99
|
+
}
|
|
100
|
+
/** The subset of `BuildResult` this module knows how to carry. Structurally satisfied by `../../build.ts`'s `BuildResult`. */
|
|
101
|
+
export interface EncodablePolicyBuildResult {
|
|
102
|
+
outputs: Map<string, string | SerializerResult>;
|
|
103
|
+
entities: Map<string, Declarable>;
|
|
104
|
+
warnings: string[];
|
|
105
|
+
errors: ReadonlyArray<{
|
|
106
|
+
name: string;
|
|
107
|
+
message: string;
|
|
108
|
+
toJSON?: () => unknown;
|
|
109
|
+
}>;
|
|
110
|
+
sourceFileCount: number;
|
|
111
|
+
dependencies?: Map<string, Set<string>>;
|
|
112
|
+
manifest?: unknown;
|
|
113
|
+
foldDecisions?: unknown[];
|
|
114
|
+
buildParams?: unknown[];
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Encode a merged, serialized build result for the policy child.
|
|
118
|
+
*
|
|
119
|
+
* Runs in the PARENT. Throws — never drops — when the result holds something
|
|
120
|
+
* the wire cannot represent: `encodeEntitySet`'s own refusals (a `nestedStack()`
|
|
121
|
+
* child project, an `AttrRef` that never got a logical name) propagate, and the
|
|
122
|
+
* finished payload is walked by `./config-wire.ts`'s scan so a serializer that
|
|
123
|
+
* somehow produced a non-data output is named by key path rather than silently
|
|
124
|
+
* mangled by `JSON.stringify`.
|
|
125
|
+
*/
|
|
126
|
+
export declare function encodePolicyBuildResult(result: EncodablePolicyBuildResult): PolicyBuildResultWire;
|
|
127
|
+
/**
|
|
128
|
+
* Rebuild the `PostSynthContext["buildResult"]` a check expects, from the wire.
|
|
129
|
+
*
|
|
130
|
+
* Runs INSIDE the child. The maps and the live entity graph are reconstructed
|
|
131
|
+
* here (`decodeEntitySet`), so a check sees the same kind of object it sees
|
|
132
|
+
* in-process — `ctx.entities` is a real `Map`, its values are real
|
|
133
|
+
* `Declarable`s, and an `AttrRef` between two of them is a real `AttrRef`
|
|
134
|
+
* carrying its resolved logical name.
|
|
135
|
+
*/
|
|
136
|
+
export declare function decodePolicyBuildResult(wire: PolicyBuildResultWire): PostSynthContext["buildResult"];
|
|
137
|
+
/** One thing a policy returned that cannot cross back, with the policy module it came from. */
|
|
138
|
+
export interface PolicyDiagnosticOffender extends ConfigWireOffender {
|
|
139
|
+
/** Absolute path of the `lint.policies` module whose check returned it. */
|
|
140
|
+
policy: string;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Validate what one policy module's checks returned, INSIDE the child, before
|
|
144
|
+
* it goes anywhere near the IPC channel.
|
|
145
|
+
*
|
|
146
|
+
* Two separate questions, both answered here rather than by hoping
|
|
147
|
+
* `JSON.stringify` behaves:
|
|
148
|
+
*
|
|
149
|
+
* 1. Is it data? A `PostSynthDiagnostic` is declared as five plain fields, but
|
|
150
|
+
* a check is arbitrary project code and can return anything. A function, a
|
|
151
|
+
* `Date`, a class instance, a circular reference — `JSON.stringify` would
|
|
152
|
+
* drop or rewrite each of them without a word, and the CLI would print a
|
|
153
|
+
* diagnostic that is not the one the policy produced.
|
|
154
|
+
* 2. Is it a diagnostic? A missing `checkId`, or a `severity` outside
|
|
155
|
+
* `error`/`warning`/`info`, is reported here instead of turning into an
|
|
156
|
+
* undefined-shaped line in the build's error list.
|
|
157
|
+
*/
|
|
158
|
+
export declare function scanPolicyDiagnostics(diagnostics: unknown, policyPath: string): PolicyDiagnosticOffender[];
|
|
159
|
+
/**
|
|
160
|
+
* Thrown INSIDE the child by the per-check wrapper `./driver.ts` generates,
|
|
161
|
+
* when a check returns something that cannot cross back. Carries the offenders
|
|
162
|
+
* so the driver can report them as data rather than as a message string it
|
|
163
|
+
* would then have to parse.
|
|
164
|
+
*
|
|
165
|
+
* A class rather than a tagged object because the driver tests it with
|
|
166
|
+
* `instanceof`: both halves come from this one module, bundled once, so there
|
|
167
|
+
* is exactly one class identity inside the child.
|
|
168
|
+
*/
|
|
169
|
+
export declare class PolicyWireError extends Error {
|
|
170
|
+
readonly offenders: PolicyDiagnosticOffender[];
|
|
171
|
+
constructor(offenders: PolicyDiagnosticOffender[]);
|
|
172
|
+
}
|
|
173
|
+
/** Render offenders as the body of a build error — one line each, naming the policy module. */
|
|
174
|
+
export declare function formatPolicyWireOffenders(subject: string, offenders: ReadonlyArray<ConfigWireOffender & {
|
|
175
|
+
policy?: string;
|
|
176
|
+
}>): string;
|
|
177
|
+
//# sourceMappingURL=policy-wire.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy-wire.d.ts","sourceRoot":"","sources":["../../../src/discovery/sandbox/policy-wire.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intrinsic-interpolation.d.ts","sourceRoot":"","sources":["../src/intrinsic-interpolation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"intrinsic-interpolation.d.ts","sourceRoot":"","sources":["../src/intrinsic-interpolation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,MAAM,MAAM,4BAA4B,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAC;AAEtE;;;;;;;;GAQG;AACH,wBAAgB,8BAA8B,CAC5C,gBAAgB,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,EACpE,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GACxC,4BAA4B,CAkD9B;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,aAAa,EAAE,SAAS,MAAM,EAAE,EAChC,MAAM,EAAE,SAAS,OAAO,EAAE,EAC1B,cAAc,EAAE,4BAA4B,GAC3C,MAAM,CASR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexicon-output.d.ts","sourceRoot":"","sources":["../src/lexicon-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAe,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"lexicon-output.d.ts","sourceRoot":"","sources":["../src/lexicon-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAe,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC;;0CAE0C;AAC1C,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE7D;;;;;;;;;;;;;;;;;;GAkBG;AACH,e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GAAG,aAAa,CAEnG;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAOtE"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single place chant imports a project's `lint.policies` module **in the
|
|
3
|
+
* CLI's own process** — and the flag that says it may not.
|
|
4
|
+
*
|
|
5
|
+
* The third member of the same family as `../discovery/import.ts`'s
|
|
6
|
+
* `importModule` (project source) and `../config-import.ts`'s
|
|
7
|
+
* `importConfigModule` (`chant.config.ts`): one narrow module whose only job is
|
|
8
|
+
* "execute project-authored code here", so that "did any project code run in
|
|
9
|
+
* this process?" has one place to look and one place to instrument — see
|
|
10
|
+
* `examples/sandbox-execution-boundary.test.ts`, which spies on all three.
|
|
11
|
+
*
|
|
12
|
+
* Before chant #1131 `./policy.ts` called `await import(resolved)` inline,
|
|
13
|
+
* which is why the corpus boundary gate could not see it even after #1113 put
|
|
14
|
+
* the config behind the boundary: there was nothing named to wrap.
|
|
15
|
+
*
|
|
16
|
+
* The armed flag lives here rather than in `./policy-sandbox.ts` (which owns
|
|
17
|
+
* the *decision* and documents the reasoning, and re-exports these three
|
|
18
|
+
* functions as its public surface) for one structural reason: `./policy.ts`
|
|
19
|
+
* needs to consult it, `./policy-sandbox.ts` needs to call `./policy.ts`, and a
|
|
20
|
+
* flag on a leaf module with no imports of its own breaks what would otherwise
|
|
21
|
+
* be an import cycle. It also puts the check on the narrowest possible thing —
|
|
22
|
+
* the function that actually executes project code — rather than on a caller
|
|
23
|
+
* that might forget to ask.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Arm sandboxed policy execution for the rest of this process. See
|
|
27
|
+
* `./policy-sandbox.ts` for what arms it and why it is a process mode rather
|
|
28
|
+
* than a threaded option. Idempotent; there is deliberately no disarm.
|
|
29
|
+
*/
|
|
30
|
+
export declare function armSandboxPolicyExecution(): void;
|
|
31
|
+
/** Whether {@link armSandboxPolicyExecution} has been called. */
|
|
32
|
+
export declare function isSandboxPolicyExecutionArmed(): boolean;
|
|
33
|
+
/** Test-only reset — vitest gives each test file its own module registry, so this exists for suites that arm and disarm within one file. */
|
|
34
|
+
export declare function resetSandboxPolicyExecutionForTests(): void;
|
|
35
|
+
/** The shape a policy module evaluates to — chant reads its exported values and keeps the `PostSynthCheck`-shaped ones. */
|
|
36
|
+
export type PolicyModuleNamespace = Record<string, unknown>;
|
|
37
|
+
/**
|
|
38
|
+
* Import a policy module into THIS process and return its module namespace.
|
|
39
|
+
* Node's ESM registry caches it, so repeated loads within one CLI invocation
|
|
40
|
+
* evaluate the file once.
|
|
41
|
+
*
|
|
42
|
+
* Refuses while armed. Under `--sandbox` the policy modules are imported inside
|
|
43
|
+
* a child process (`../discovery/sandbox/policy-run.ts`); arriving here anyway
|
|
44
|
+
* means something is about to execute project-authored code in the CLI's own
|
|
45
|
+
* process, which is exactly what the flag promises does not happen. Falling
|
|
46
|
+
* through would make `--sandbox` mean less than it says with nothing visible to
|
|
47
|
+
* notice, so this throws instead.
|
|
48
|
+
*/
|
|
49
|
+
export declare function importPolicyModule(policyPath: string): Promise<PolicyModuleNamespace>;
|
|
50
|
+
//# sourceMappingURL=policy-import.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy-import.d.ts","sourceRoot":"","sources":["../../src/lint/policy-import.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAKH;;;;GAIG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAEhD;AAED,iEAAiE;AACjE,wBAAgB,6BAA6B,IAAI,OAAO,CAEvD;AAED,4IAA4I;AAC5I,wBAAgB,mCAAmC,IAAI,IAAI,CAE1D;AAED,2HAA2H;AAC3H,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5D;;;;;;;;;;;GAWG;AACH,wBAAsB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAO3F"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { type PostSynthCheck, type PostSynthContext, type PostSynthDiagnostic } from "./post-synth.js";
|
|
2
|
+
import { armSandboxPolicyExecution, isSandboxPolicyExecutionArmed, resetSandboxPolicyExecutionForTests } from "./policy-import.js";
|
|
3
|
+
import type { EncodablePolicyBuildResult } from "../discovery/sandbox/policy-wire.js";
|
|
4
|
+
/**
|
|
5
|
+
* chant #1131 — decides WHERE a project's `lint.policies` checks run.
|
|
6
|
+
*
|
|
7
|
+
* A policy is project-authored code. Every other piece of project code moved
|
|
8
|
+
* behind the `--sandbox` boundary in chant #1045 (run-fallback source), #1093
|
|
9
|
+
* (composite factories, constructors, intrinsic tags) and #1113
|
|
10
|
+
* (`chant.config.ts`), and all three had to leave this one out: the config
|
|
11
|
+
* declares its policies as *paths*, so putting the config behind the boundary
|
|
12
|
+
* did not put them there with it. `chant build` imported each policy module and
|
|
13
|
+
* called its `check` function in the CLI's own process, after discovery was
|
|
14
|
+
* over, with the CLI's filesystem, network, environment and process-spawn
|
|
15
|
+
* access. This module closes it.
|
|
16
|
+
*
|
|
17
|
+
* ## Why an armed process mode rather than a threaded option
|
|
18
|
+
*
|
|
19
|
+
* The same reason `../config-sandbox.ts` gives. `./policy.ts`'s
|
|
20
|
+
* `loadPolicyChecks` is exported from chant-core's public surface and called
|
|
21
|
+
* from more than one place (`../cli/commands/build.ts` for a build, and
|
|
22
|
+
* `evaluateProjectPolicies` for the `policyGate` Op step). Threading a
|
|
23
|
+
* `sandbox` flag to each is fail-OPEN: miss one and project code executes in
|
|
24
|
+
* the CLI process with nothing to notice. Arming the process once, before any
|
|
25
|
+
* policy is loaded, is fail-CLOSED — `loadPolicyChecks` REFUSES while armed, so
|
|
26
|
+
* a call site nobody remembered gets a loud error rather than a silent
|
|
27
|
+
* execution.
|
|
28
|
+
*
|
|
29
|
+
* ## What arms it
|
|
30
|
+
*
|
|
31
|
+
* Both ways of turning sandboxing on, unlike `../config-sandbox.ts`. That
|
|
32
|
+
* asymmetry is not an oversight: the config has a bootstrap limit (reading
|
|
33
|
+
* `build.sandbox` out of `chant.config.ts` means running it, so only the CLI
|
|
34
|
+
* flag, known before any config is touched, can cover the config's own
|
|
35
|
+
* evaluation). Policies have no such limit — they are loaded long after the
|
|
36
|
+
* config is known — so `build.sandbox: true` in a project's config sandboxes
|
|
37
|
+
* them just as `--sandbox` does, and `../cli/commands/build.ts` arms this from
|
|
38
|
+
* the RESOLVED value.
|
|
39
|
+
*
|
|
40
|
+
* There is deliberately no disarm: a security mode that can be turned off
|
|
41
|
+
* partway through a process is not one.
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* The mode itself lives on `./policy-import.ts` — the leaf module that actually
|
|
45
|
+
* performs an in-process policy import, so the refusal sits on the narrowest
|
|
46
|
+
* possible thing and `./policy.ts` can consult it without importing this file
|
|
47
|
+
* (which imports `./policy.ts`). Re-exported here because this is where the
|
|
48
|
+
* decision is documented and where callers look.
|
|
49
|
+
*
|
|
50
|
+
* `armSandboxPolicyExecution` is called from `../cli/commands/build.ts` once
|
|
51
|
+
* `build.sandbox`/`--sandbox` has resolved, and from `../cli/main.ts` off the
|
|
52
|
+
* parsed flag.
|
|
53
|
+
*/
|
|
54
|
+
export { armSandboxPolicyExecution, isSandboxPolicyExecutionArmed, resetSandboxPolicyExecutionForTests };
|
|
55
|
+
export interface ProjectPolicyRun {
|
|
56
|
+
/** `lint.policies` as declared in the config — relative paths, resolved against {@link configDir}. */
|
|
57
|
+
policies: readonly string[];
|
|
58
|
+
/** The `chant.config.*` directory (`lint.policies` paths are relative to it), also the child's read allowance. */
|
|
59
|
+
configDir: string;
|
|
60
|
+
/** The merged, serialized build result the checks run over. */
|
|
61
|
+
buildResult: EncodablePolicyBuildResult & PostSynthContext["buildResult"];
|
|
62
|
+
/** `--env`, else `ownership.env`. Becomes `ctx.env`. */
|
|
63
|
+
env?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Checks the caller already loaded into THIS process, before the build ran.
|
|
66
|
+
*
|
|
67
|
+
* `chant build` has always loaded `lint.policies` up front rather than at the
|
|
68
|
+
* point of use, so a policy path that doesn't resolve fails the command
|
|
69
|
+
* immediately — including when the build itself goes on to fail, which is
|
|
70
|
+
* exactly when a typo'd path would otherwise go unnoticed. Preserving that
|
|
71
|
+
* for the unsandboxed path is the whole reason this field exists.
|
|
72
|
+
*
|
|
73
|
+
* Ignored when armed: under `--sandbox` there is nothing loaded here to pass,
|
|
74
|
+
* and `loadPolicyChecks` refuses outright.
|
|
75
|
+
*/
|
|
76
|
+
preloaded?: PostSynthCheck[];
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Run a project's organizational policy checks over a finished build and return
|
|
80
|
+
* their diagnostics. Sandboxed in a post-merge child when armed, in-process
|
|
81
|
+
* otherwise.
|
|
82
|
+
*
|
|
83
|
+
* The unarmed path is byte-for-byte what `chant build` has always done: load
|
|
84
|
+
* the modules, hand every check one `PostSynthContext`, concatenate what they
|
|
85
|
+
* return. The armed path does the same thing on the other side of a process
|
|
86
|
+
* boundary — see `../discovery/sandbox/policy-run.ts`.
|
|
87
|
+
*/
|
|
88
|
+
export declare function runProjectPolicies(run: ProjectPolicyRun): Promise<PostSynthDiagnostic[]>;
|
|
89
|
+
//# sourceMappingURL=policy-sandbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy-sandbox.d.ts","sourceRoot":"","sources":["../../src/lint/policy-sandbox.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACzB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,yBAAyB,EACzB,6BAA6B,EAC7B,mCAAmC,EACpC,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAEnF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH;;;;;;;;;;GAUG;AACH,OAAO,EAAE,yBAAyB,EAAE,6BAA6B,EAAE,mCAAmC,EAAE,CAAC;AAEzG,MAAM,WAAW,gBAAgB;IAC/B,sGAAsG;IACtG,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,kHAAkH;IAClH,SAAS,EAAE,MAAM,CAAC;IAClB,+DAA+D;IAC/D,WAAW,EAAE,0BAA0B,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAC1E,wDAAwD;IACxD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,EAAE,cAAc,EAAE,CAAC;CAC9B;AAED;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAoB9F"}
|
package/dist/lint/policy.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import type { PostSynthCheck, PostSynthDiagnostic } from "./post-synth.js";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Load project policy checks (one or more `PostSynthCheck` exports) from files,
|
|
4
|
+
* **into this process**.
|
|
5
|
+
*
|
|
6
|
+
* chant #1131 — refuses while `./policy-sandbox.ts` is armed. Under `--sandbox`
|
|
7
|
+
* the policy modules are imported and their checks run inside a child process
|
|
8
|
+
* (`runProjectPolicies`); reaching this function anyway means a call site is
|
|
9
|
+
* about to execute project-authored code in the CLI's own process, which is
|
|
10
|
+
* precisely the thing the flag promises does not happen. Failing loudly is the
|
|
11
|
+
* only honest option — falling through would make `--sandbox` mean less than it
|
|
12
|
+
* says without anything visible to notice.
|
|
13
|
+
*/
|
|
3
14
|
export declare function loadPolicyChecks(paths: string[], configDir: string): Promise<PostSynthCheck[]>;
|
|
4
15
|
export interface PolicyEvaluation {
|
|
5
16
|
/** All policy diagnostics (errors + warnings). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/lint/policy.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/lint/policy.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGxE;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAuBpG;AAED,MAAM,WAAW,gBAAgB;IAC/B,kDAAkD;IAClD,WAAW,EAAE,mBAAmB,EAAE,CAAC;IACnC,2EAA2E;IAC3E,UAAU,EAAE,mBAAmB,EAAE,CAAC;IAClC,gEAAgE;IAChE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAAC,IAAI,EAAE;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA8B5B"}
|