@telorun/analyzer 0.69.0 → 0.70.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/canonical-json.d.ts +18 -0
- package/dist/canonical-json.d.ts.map +1 -0
- package/dist/canonical-json.js +26 -0
- package/dist/cel-access-chains.d.ts +14 -0
- package/dist/cel-access-chains.d.ts.map +1 -0
- package/dist/cel-access-chains.js +45 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/manifest-diff.d.ts +111 -0
- package/dist/manifest-diff.d.ts.map +1 -0
- package/dist/manifest-diff.js +130 -0
- package/dist/module-graph.d.ts.map +1 -1
- package/dist/module-graph.js +3 -25
- package/dist/telo-version.d.ts +1 -1
- package/dist/telo-version.js +1 -1
- package/package.json +2 -2
- package/src/canonical-json.ts +24 -0
- package/src/cel-access-chains.ts +47 -0
- package/src/index.ts +8 -0
- package/src/manifest-diff.ts +219 -0
- package/src/module-graph.ts +2 -24
- package/src/telo-version.ts +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical JSON: a rendering under which two structurally equal values produce
|
|
3
|
+
* the same string — object keys sorted, `undefined`-valued entries dropped.
|
|
4
|
+
*
|
|
5
|
+
* Shared rather than duplicated because both readers compare the RESULT for
|
|
6
|
+
* equality: `contentKey` anchors a module-graph row's identity to its content so
|
|
7
|
+
* an inserted sibling does not move it, and `declarationSignature` decides
|
|
8
|
+
* whether a resource has to be rebuilt. Two implementations would eventually
|
|
9
|
+
* disagree about key order or about `undefined`, and the disagreement surfaces
|
|
10
|
+
* as a row that silently changes identity, or as a resource that silently fails
|
|
11
|
+
* to restart.
|
|
12
|
+
*
|
|
13
|
+
* Browser-safe: no hashing, no `node:crypto`. Callers that only need equality
|
|
14
|
+
* compare the strings, which cannot collide; a caller that needs a short key
|
|
15
|
+
* hashes it itself.
|
|
16
|
+
*/
|
|
17
|
+
export declare function canonicalJson(value: unknown): string;
|
|
18
|
+
//# sourceMappingURL=canonical-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical-json.d.ts","sourceRoot":"","sources":["../src/canonical-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAOpD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical JSON: a rendering under which two structurally equal values produce
|
|
3
|
+
* the same string — object keys sorted, `undefined`-valued entries dropped.
|
|
4
|
+
*
|
|
5
|
+
* Shared rather than duplicated because both readers compare the RESULT for
|
|
6
|
+
* equality: `contentKey` anchors a module-graph row's identity to its content so
|
|
7
|
+
* an inserted sibling does not move it, and `declarationSignature` decides
|
|
8
|
+
* whether a resource has to be rebuilt. Two implementations would eventually
|
|
9
|
+
* disagree about key order or about `undefined`, and the disagreement surfaces
|
|
10
|
+
* as a row that silently changes identity, or as a resource that silently fails
|
|
11
|
+
* to restart.
|
|
12
|
+
*
|
|
13
|
+
* Browser-safe: no hashing, no `node:crypto`. Callers that only need equality
|
|
14
|
+
* compare the strings, which cannot collide; a caller that needs a short key
|
|
15
|
+
* hashes it itself.
|
|
16
|
+
*/
|
|
17
|
+
export function canonicalJson(value) {
|
|
18
|
+
if (value === null || typeof value !== "object")
|
|
19
|
+
return JSON.stringify(value) ?? "null";
|
|
20
|
+
if (Array.isArray(value))
|
|
21
|
+
return `[${value.map(canonicalJson).join(",")}]`;
|
|
22
|
+
const entries = Object.entries(value)
|
|
23
|
+
.filter(([, v]) => v !== undefined)
|
|
24
|
+
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
|
|
25
|
+
return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${canonicalJson(v)}`).join(",")}}`;
|
|
26
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ResourceManifest } from "@telorun/sdk";
|
|
2
|
+
/** Access chains an expression reads, or none when it does not parse — a syntax
|
|
3
|
+
* error is the engine pass's to report, not this one's. */
|
|
4
|
+
export declare function accessChains(source: string): string[][];
|
|
5
|
+
/**
|
|
6
|
+
* The bare resource names a manifest's expressions read through
|
|
7
|
+
* `resources.<name>`, deduplicated.
|
|
8
|
+
*
|
|
9
|
+
* Read from the DECLARATION: a compile-eval field is expanded before a
|
|
10
|
+
* controller sees it, so by then `resources.db.dsn` is a literal with nothing
|
|
11
|
+
* left to say where it came from.
|
|
12
|
+
*/
|
|
13
|
+
export declare function celResourceReads(manifest: ResourceManifest): string[];
|
|
14
|
+
//# sourceMappingURL=cel-access-chains.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cel-access-chains.d.ts","sourceRoot":"","sources":["../src/cel-access-chains.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAMrD;4DAC4D;AAC5D,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,CAOvD;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,EAAE,CAQrE"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a manifest's CEL READS, as opposed to what its slots reference.
|
|
3
|
+
*
|
|
4
|
+
* A dependency a manifest states without a slot: `!cel "resources.db.dsn"` makes
|
|
5
|
+
* the reader depend on `db` as surely as a `!ref` would, and no reference walk
|
|
6
|
+
* can see it. Two consumers ask for it — the module graph draws it as a `data`
|
|
7
|
+
* edge, and the kernel needs it to know who becomes invalid when a resource is
|
|
8
|
+
* rebuilt — so the extraction is here rather than in either of them.
|
|
9
|
+
*
|
|
10
|
+
* The expensive half is the CEL environment used to parse, which is built once
|
|
11
|
+
* per process and evaluates nothing.
|
|
12
|
+
*/
|
|
13
|
+
import { extractAccessChains } from "@telorun/templating";
|
|
14
|
+
import { walkCelExpressions } from "@telorun/templating";
|
|
15
|
+
import { buildCelEnvironment } from "./cel-environment.js";
|
|
16
|
+
let parseEnv;
|
|
17
|
+
/** Access chains an expression reads, or none when it does not parse — a syntax
|
|
18
|
+
* error is the engine pass's to report, not this one's. */
|
|
19
|
+
export function accessChains(source) {
|
|
20
|
+
try {
|
|
21
|
+
parseEnv ??= buildCelEnvironment();
|
|
22
|
+
return extractAccessChains(parseEnv.parse(source).ast);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The bare resource names a manifest's expressions read through
|
|
30
|
+
* `resources.<name>`, deduplicated.
|
|
31
|
+
*
|
|
32
|
+
* Read from the DECLARATION: a compile-eval field is expanded before a
|
|
33
|
+
* controller sees it, so by then `resources.db.dsn` is a literal with nothing
|
|
34
|
+
* left to say where it came from.
|
|
35
|
+
*/
|
|
36
|
+
export function celResourceReads(manifest) {
|
|
37
|
+
const names = new Set();
|
|
38
|
+
walkCelExpressions(manifest, "", (source) => {
|
|
39
|
+
for (const chain of accessChains(source)) {
|
|
40
|
+
if (chain[0] === "resources" && chain.length >= 2 && chain[1])
|
|
41
|
+
names.add(chain[1]);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
return [...names];
|
|
45
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,9 @@ export { hasIntermediateWildcard, parseRedactionPath, RedactionPathError, } from
|
|
|
26
26
|
export type { RedactionSegment } from "./redaction-path.js";
|
|
27
27
|
export { buildCallGraph, nodeIdFor, projectToPairs, resolveScopedName, resourceId, } from "./call-graph.js";
|
|
28
28
|
export type { BuildCallGraphOptions, CallGraph, CallGraphEdge, CallGraphNode, ResourceGraphNode, StepGraphNode, } from "./call-graph.js";
|
|
29
|
+
export { celResourceReads } from "./cel-access-chains.js";
|
|
30
|
+
export { declarationSignature, diffManifests } from "./manifest-diff.js";
|
|
31
|
+
export type { DiffEntry, ManifestDiff, ManifestDiffOptions, ResourceChangeKind, } from "./manifest-diff.js";
|
|
29
32
|
export { AMBIENT_CAPABILITIES, buildModuleGraph, contentKey, edgeClassOf, isAmbientCapability, isAmbientHold, isOrderedRow, isUnwired, } from "./module-graph.js";
|
|
30
33
|
export type { BuildModuleGraphOptions, EdgeClass, GraphEdge, GraphKind, GraphNode, GraphPort, GraphRegion, GraphRow, ModuleGraph, ModuleGraphDeps, NodeOwnership, PortSlot, RowKind, } from "./module-graph.js";
|
|
31
34
|
export { buildReferenceFieldMap, isRefEntry, isScopeEntry, satisfiesValueBranch, } from "./reference-field-map.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,YAAY,EACR,cAAc,EACd,UAAU,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,UAAU,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACH,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,gBAAgB,EAChB,wBAAwB,EACxB,oBAAoB,EACpB,gCAAgC,EAChC,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,KAAK,YAAY,GACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,cAAc,EACd,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB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EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC1F,YAAY,EACR,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,QAAQ,EACR,aAAa,EACb,KAAK,EACR,MAAM,YAAY,CAAC;AACpB,cAAc,uBAAuB,CAAC;AAGtC,cAAc,sBAAsB,CAAC;AAIrC,OAAO,EACL,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -13,6 +13,8 @@ export { validateSensitiveSlots } from "./validate-sensitive-slots.js";
|
|
|
13
13
|
export { defaultBearingPaths, declaredScalarPaths, PERMISSIVE_CONTRACT, resolveContract, resolveContractSchema, sensitivePaths, withLiveValuesSkipped, } from "./invocation-contract.js";
|
|
14
14
|
export { hasIntermediateWildcard, parseRedactionPath, RedactionPathError, } from "./redaction-path.js";
|
|
15
15
|
export { buildCallGraph, nodeIdFor, projectToPairs, resolveScopedName, resourceId, } from "./call-graph.js";
|
|
16
|
+
export { celResourceReads } from "./cel-access-chains.js";
|
|
17
|
+
export { declarationSignature, diffManifests } from "./manifest-diff.js";
|
|
16
18
|
export { AMBIENT_CAPABILITIES, buildModuleGraph, contentKey, edgeClassOf, isAmbientCapability, isAmbientHold, isOrderedRow, isUnwired, } from "./module-graph.js";
|
|
17
19
|
export { buildReferenceFieldMap, isRefEntry, isScopeEntry, satisfiesValueBranch, } from "./reference-field-map.js";
|
|
18
20
|
export { hasDeclaredUse, isRefSlot, isRefUse, possibleUses, readRefSlot, REF_USES, refSlotAnnotation, rewriteRefSlotKinds, transfersControl, } from "./ref-slot.js";
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What changed between two loads of one manifest set.
|
|
3
|
+
*
|
|
4
|
+
* The question a reconciling host asks before it touches anything: which
|
|
5
|
+
* resources survive an edit untouched, which have to be rebuilt, which are new,
|
|
6
|
+
* and which are gone. It is here rather than in the kernel because it is pure
|
|
7
|
+
* data in and data out and the editor wants the same answer — to show which
|
|
8
|
+
* resources a save would restart, in a browser, where no kernel runs.
|
|
9
|
+
*
|
|
10
|
+
* **This is the DECLARATION half of the question and only that half.** A field
|
|
11
|
+
* written `!cel "variables.port"` has the same declaration whatever the
|
|
12
|
+
* environment says, so a host that resolves configuration outside the manifest
|
|
13
|
+
* has to supply what moved there (`modulesWithChangedConfig`). Keeping the two
|
|
14
|
+
* apart is what lets this run in a browser at all.
|
|
15
|
+
*/
|
|
16
|
+
import type { ResourceManifest } from "@telorun/sdk";
|
|
17
|
+
/** How one resource differs between the two sets. `unchanged` is reported as a
|
|
18
|
+
* bare id rather than an entry, since there is nothing to say about it. */
|
|
19
|
+
export type ResourceChangeKind = "added" | "removed" | "changed";
|
|
20
|
+
export interface DiffEntry {
|
|
21
|
+
/** {@link nodeIdFor} — module-scoped, so two libraries each declaring a
|
|
22
|
+
* resource named `store` are two entries rather than one. */
|
|
23
|
+
readonly id: string;
|
|
24
|
+
readonly change: ResourceChangeKind;
|
|
25
|
+
/** The declaration as it stood. Absent for an addition. */
|
|
26
|
+
readonly previous?: ResourceManifest;
|
|
27
|
+
/** The declaration as it now stands. Absent for a removal. */
|
|
28
|
+
readonly next?: ResourceManifest;
|
|
29
|
+
}
|
|
30
|
+
export interface ManifestDiff {
|
|
31
|
+
/** Additions, removals and changes. Order follows the next set, then the
|
|
32
|
+
* previous set for removals, so a caller rendering this reads it in
|
|
33
|
+
* declaration order rather than in hash order. */
|
|
34
|
+
readonly entries: readonly DiffEntry[];
|
|
35
|
+
/** Ids present in both sets with an identical declaration. */
|
|
36
|
+
readonly unchanged: readonly string[];
|
|
37
|
+
/** Ids whose current instance is no longer valid: every removal and every
|
|
38
|
+
* change. What a reconciling host unwinds, once it has closed this set under
|
|
39
|
+
* the resources that HOLD them — which is the call graph's answer, not this
|
|
40
|
+
* one's. */
|
|
41
|
+
readonly stale: readonly string[];
|
|
42
|
+
/** Declarations that have to be created: every addition and every change.
|
|
43
|
+
* Named for the kernel's own `pendingResources`, which is where they go. */
|
|
44
|
+
readonly pending: readonly ResourceManifest[];
|
|
45
|
+
}
|
|
46
|
+
export interface ManifestDiffOptions {
|
|
47
|
+
/**
|
|
48
|
+
* Modules whose resolved configuration moved between the two loads, by
|
|
49
|
+
* `metadata.module`.
|
|
50
|
+
*
|
|
51
|
+
* Every resource of such a module is reported `changed` even where its
|
|
52
|
+
* declaration is identical, because a declaration is not the whole of what a
|
|
53
|
+
* resource is built from: `!cel "variables.port"` reads the same and means
|
|
54
|
+
* something else once the environment behind it moves. Only the host that
|
|
55
|
+
* resolved that environment can know, so it is an input rather than something
|
|
56
|
+
* derived here.
|
|
57
|
+
*/
|
|
58
|
+
readonly modulesWithChangedConfig?: ReadonlySet<string>;
|
|
59
|
+
/**
|
|
60
|
+
* Signatures of the previous set, by node id, taken while those manifests
|
|
61
|
+
* were still declarations.
|
|
62
|
+
*
|
|
63
|
+
* A host that INSTALLS manifests does not keep declarations: the kernel
|
|
64
|
+
* registers the very objects it loaded, and resolving references writes live
|
|
65
|
+
* instances into them — a boot target's `!ref`, or a slot nested past the
|
|
66
|
+
* create-time shallow copy. Signing such an object afterwards renders those
|
|
67
|
+
* slots opaque and reports a change that never happened, which on a module
|
|
68
|
+
* document means escalating every reconciliation there is.
|
|
69
|
+
*
|
|
70
|
+
* An id absent from the map is signed from its manifest, so a caller that
|
|
71
|
+
* really is holding declarations passes nothing.
|
|
72
|
+
*/
|
|
73
|
+
readonly previousSignatures?: ReadonlyMap<string, string>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* A resource's declaration, rendered so that two equal declarations render
|
|
77
|
+
* identically.
|
|
78
|
+
*
|
|
79
|
+
* Three things are normalized away, and each would otherwise report a change
|
|
80
|
+
* that is not one:
|
|
81
|
+
*
|
|
82
|
+
* - **Loader stamps** (`DERIVED_METADATA_FIELDS`). `metadata.sourceLine` is the
|
|
83
|
+
* load-bearing one: inserting a line anywhere in a file shifts it for every
|
|
84
|
+
* resource below, so leaving it in would mark a whole file changed on any
|
|
85
|
+
* edit and defeat the mechanism entirely.
|
|
86
|
+
* - **A compiled expression** renders as its source text. What the author wrote
|
|
87
|
+
* is the declaration; what it evaluates to depends on configuration, which
|
|
88
|
+
* `modulesWithChangedConfig` carries instead.
|
|
89
|
+
* - **Anything that is not plain data** renders as a constant. A host that has
|
|
90
|
+
* injected live instances over its reference slots has manifests that are no
|
|
91
|
+
* longer declarations, and walking one reaches a controller's object graph,
|
|
92
|
+
* which is cyclic. Both sides must be declarations as loaded.
|
|
93
|
+
*
|
|
94
|
+
* The result is compared as a string rather than hashed: there is no collision
|
|
95
|
+
* to reason about, and a missed change here is a resource that silently keeps
|
|
96
|
+
* running against a declaration it no longer matches.
|
|
97
|
+
*/
|
|
98
|
+
export declare function declarationSignature(manifest: ResourceManifest): string;
|
|
99
|
+
/**
|
|
100
|
+
* Classify every resource of two loads against each other.
|
|
101
|
+
*
|
|
102
|
+
* **Identity is `nodeIdFor`**, which is module-scoped, so a name is compared
|
|
103
|
+
* only against the same name in the same module. One consequence is worth
|
|
104
|
+
* stating because it is visible: an INLINE resource's name is synthesized from
|
|
105
|
+
* its position (`api_routes_0_handler`), so inserting a route above one renames
|
|
106
|
+
* every inline below it and this reports those as a removal plus an addition.
|
|
107
|
+
* That costs a restart it did not have to cost; it never misses a change, which
|
|
108
|
+
* is the direction that matters.
|
|
109
|
+
*/
|
|
110
|
+
export declare function diffManifests(previous: readonly ResourceManifest[], next: readonly ResourceManifest[], options?: ManifestDiffOptions): ManifestDiff;
|
|
111
|
+
//# sourceMappingURL=manifest-diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"man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AAE,EACrC,IAAI,EAAE,SAAS,gBAAgB,EAAE,EACjC,OAAO,GAAE,mBAAwB,GAChC,YAAY,CA6Cd"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { isCompiledValue } from "@telorun/sdk";
|
|
2
|
+
import { nodeIdFor } from "./call-graph.js";
|
|
3
|
+
import { canonicalJson } from "./canonical-json.js";
|
|
4
|
+
import { DERIVED_METADATA_FIELDS } from "./module-metadata-scope.js";
|
|
5
|
+
/** A value that is not part of the declaration and must not be walked into:
|
|
6
|
+
* a live instance a host injected over a reference slot, a function, a class
|
|
7
|
+
* instance of any kind. Rendering one as a constant keeps the walk finite and
|
|
8
|
+
* acyclic; comparing two sets across the injection boundary is not supported
|
|
9
|
+
* and is what {@link declarationSignature} documents against. */
|
|
10
|
+
const OPAQUE = '"\\u0000opaque"';
|
|
11
|
+
const isPlainObject = (value) => {
|
|
12
|
+
const proto = Object.getPrototypeOf(value);
|
|
13
|
+
return proto === Object.prototype || proto === null;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A resource's declaration, rendered so that two equal declarations render
|
|
17
|
+
* identically.
|
|
18
|
+
*
|
|
19
|
+
* Three things are normalized away, and each would otherwise report a change
|
|
20
|
+
* that is not one:
|
|
21
|
+
*
|
|
22
|
+
* - **Loader stamps** (`DERIVED_METADATA_FIELDS`). `metadata.sourceLine` is the
|
|
23
|
+
* load-bearing one: inserting a line anywhere in a file shifts it for every
|
|
24
|
+
* resource below, so leaving it in would mark a whole file changed on any
|
|
25
|
+
* edit and defeat the mechanism entirely.
|
|
26
|
+
* - **A compiled expression** renders as its source text. What the author wrote
|
|
27
|
+
* is the declaration; what it evaluates to depends on configuration, which
|
|
28
|
+
* `modulesWithChangedConfig` carries instead.
|
|
29
|
+
* - **Anything that is not plain data** renders as a constant. A host that has
|
|
30
|
+
* injected live instances over its reference slots has manifests that are no
|
|
31
|
+
* longer declarations, and walking one reaches a controller's object graph,
|
|
32
|
+
* which is cyclic. Both sides must be declarations as loaded.
|
|
33
|
+
*
|
|
34
|
+
* The result is compared as a string rather than hashed: there is no collision
|
|
35
|
+
* to reason about, and a missed change here is a resource that silently keeps
|
|
36
|
+
* running against a declaration it no longer matches.
|
|
37
|
+
*/
|
|
38
|
+
export function declarationSignature(manifest) {
|
|
39
|
+
const seen = new WeakSet();
|
|
40
|
+
const render = (value) => {
|
|
41
|
+
if (isCompiledValue(value)) {
|
|
42
|
+
const source = value.source;
|
|
43
|
+
return { "\u0000cel": typeof source === "string" ? source : null };
|
|
44
|
+
}
|
|
45
|
+
if (!value || typeof value !== "object")
|
|
46
|
+
return value;
|
|
47
|
+
if (seen.has(value))
|
|
48
|
+
return "\u0000cycle";
|
|
49
|
+
if (Array.isArray(value)) {
|
|
50
|
+
seen.add(value);
|
|
51
|
+
return value.map(render);
|
|
52
|
+
}
|
|
53
|
+
if (!isPlainObject(value))
|
|
54
|
+
return OPAQUE;
|
|
55
|
+
seen.add(value);
|
|
56
|
+
const out = {};
|
|
57
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
58
|
+
out[key] = render(entry);
|
|
59
|
+
}
|
|
60
|
+
return out;
|
|
61
|
+
};
|
|
62
|
+
const authoredMetadata = {};
|
|
63
|
+
const metadata = manifest.metadata;
|
|
64
|
+
for (const [key, value] of Object.entries(metadata ?? {})) {
|
|
65
|
+
if (DERIVED_METADATA_FIELDS.has(key))
|
|
66
|
+
continue;
|
|
67
|
+
authoredMetadata[key] = render(value);
|
|
68
|
+
}
|
|
69
|
+
const body = {};
|
|
70
|
+
for (const [key, value] of Object.entries(manifest)) {
|
|
71
|
+
if (key === "metadata")
|
|
72
|
+
continue;
|
|
73
|
+
body[key] = render(value);
|
|
74
|
+
}
|
|
75
|
+
return canonicalJson({ ...body, metadata: authoredMetadata });
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Classify every resource of two loads against each other.
|
|
79
|
+
*
|
|
80
|
+
* **Identity is `nodeIdFor`**, which is module-scoped, so a name is compared
|
|
81
|
+
* only against the same name in the same module. One consequence is worth
|
|
82
|
+
* stating because it is visible: an INLINE resource's name is synthesized from
|
|
83
|
+
* its position (`api_routes_0_handler`), so inserting a route above one renames
|
|
84
|
+
* every inline below it and this reports those as a removal plus an addition.
|
|
85
|
+
* That costs a restart it did not have to cost; it never misses a change, which
|
|
86
|
+
* is the direction that matters.
|
|
87
|
+
*/
|
|
88
|
+
export function diffManifests(previous, next, options = {}) {
|
|
89
|
+
const before = new Map();
|
|
90
|
+
for (const manifest of previous)
|
|
91
|
+
before.set(nodeIdFor(manifest), manifest);
|
|
92
|
+
const changedConfig = options.modulesWithChangedConfig;
|
|
93
|
+
const configMoved = (manifest) => {
|
|
94
|
+
if (!changedConfig || changedConfig.size === 0)
|
|
95
|
+
return false;
|
|
96
|
+
const module = manifest.metadata?.module;
|
|
97
|
+
return module !== undefined && changedConfig.has(module);
|
|
98
|
+
};
|
|
99
|
+
const entries = [];
|
|
100
|
+
const unchanged = [];
|
|
101
|
+
const stale = [];
|
|
102
|
+
const pending = [];
|
|
103
|
+
const survived = new Set();
|
|
104
|
+
for (const manifest of next) {
|
|
105
|
+
const id = nodeIdFor(manifest);
|
|
106
|
+
const prior = before.get(id);
|
|
107
|
+
if (!prior) {
|
|
108
|
+
entries.push({ id, change: "added", next: manifest });
|
|
109
|
+
pending.push(manifest);
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
survived.add(id);
|
|
113
|
+
const priorSignature = options.previousSignatures?.get(id) ?? declarationSignature(prior);
|
|
114
|
+
const same = !configMoved(manifest) && priorSignature === declarationSignature(manifest);
|
|
115
|
+
if (same) {
|
|
116
|
+
unchanged.push(id);
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
entries.push({ id, change: "changed", previous: prior, next: manifest });
|
|
120
|
+
stale.push(id);
|
|
121
|
+
pending.push(manifest);
|
|
122
|
+
}
|
|
123
|
+
for (const [id, manifest] of before) {
|
|
124
|
+
if (survived.has(id))
|
|
125
|
+
continue;
|
|
126
|
+
entries.push({ id, change: "removed", previous: manifest });
|
|
127
|
+
stale.push(id);
|
|
128
|
+
}
|
|
129
|
+
return { entries, unchanged, stale, pending };
|
|
130
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-graph.d.ts","sourceRoot":"","sources":["../src/module-graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAOzE,OAAO,EAIL,KAAK,SAAS,EAIf,MAAM,iBAAiB,CAAC;AAKzB,OAAO,EAA6B,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"module-graph.d.ts","sourceRoot":"","sources":["../src/module-graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAOzE,OAAO,EAIL,KAAK,SAAS,EAIf,MAAM,iBAAiB,CAAC;AAKzB,OAAO,EAA6B,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAIvE;;qDAEqD;AACrD,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC;AAE7F;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;AAE5D;;;;;;;;;;GAUG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE3E;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAEnD;A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AC;IACxB;uEACmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AA+CD;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAQjD;AAyID;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,gBAAgB,EAAE,EAC7B,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,eAAe,EACrB,OAAO,GAAE,uBAA4B,GACpC,WAAW,CAgbb"}
|
package/dist/module-graph.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isRefSentinel, walkCelExpressions, } from "@telorun/templating";
|
|
2
2
|
import { nodeIdFor, resolveScopedName, resourceId, } from "./call-graph.js";
|
|
3
3
|
import { propertySchemas, resolveLocalRef } from "./manifest-navigation.js";
|
|
4
4
|
import { isStepSlot } from "./step-slot.js";
|
|
5
5
|
import { isInlineResource, resolveFieldEntries } from "./reference-field-map.js";
|
|
6
6
|
import { findZoneProviders } from "./resolve-zone-containment.js";
|
|
7
7
|
import { possibleUses, readRefSlot } from "./ref-slot.js";
|
|
8
|
+
import { canonicalJson } from "./canonical-json.js";
|
|
9
|
+
import { accessChains } from "./cel-access-chains.js";
|
|
8
10
|
/**
|
|
9
11
|
* Rows that are ordered entries of their array.
|
|
10
12
|
*
|
|
@@ -144,16 +146,6 @@ export function contentKey(value) {
|
|
|
144
146
|
}
|
|
145
147
|
return hash.toString(36);
|
|
146
148
|
}
|
|
147
|
-
function canonicalJson(value) {
|
|
148
|
-
if (value === null || typeof value !== "object")
|
|
149
|
-
return JSON.stringify(value) ?? "null";
|
|
150
|
-
if (Array.isArray(value))
|
|
151
|
-
return `[${value.map(canonicalJson).join(",")}]`;
|
|
152
|
-
const entries = Object.entries(value)
|
|
153
|
-
.filter(([, v]) => v !== undefined)
|
|
154
|
-
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
|
|
155
|
-
return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${canonicalJson(v)}`).join(",")}}`;
|
|
156
|
-
}
|
|
157
149
|
/** Mints ids that are unique without being positional: the name where one
|
|
158
150
|
* exists, a content key where none does, and a `~n` suffix only when two
|
|
159
151
|
* siblings are genuinely indistinguishable. */
|
|
@@ -1350,20 +1342,6 @@ function buildKindPlane(resources, nodes, deps, options) {
|
|
|
1350
1342
|
}
|
|
1351
1343
|
return out;
|
|
1352
1344
|
}
|
|
1353
|
-
/** The CEL environment used to PARSE a chain out of an expression. One per
|
|
1354
|
-
* process: building it is the expensive half, and nothing here evaluates. */
|
|
1355
|
-
let parseEnv;
|
|
1356
|
-
/** Access chains an expression reads, or none when it does not parse — a syntax
|
|
1357
|
-
* error is the engine pass's to report, not this one's. */
|
|
1358
|
-
function accessChains(source) {
|
|
1359
|
-
try {
|
|
1360
|
-
parseEnv ??= buildCelEnvironment();
|
|
1361
|
-
return extractAccessChains(parseEnv.parse(source).ast);
|
|
1362
|
-
}
|
|
1363
|
-
catch {
|
|
1364
|
-
return [];
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
1345
|
/**
|
|
1368
1346
|
* Every `resources.<name>…` read in one resource's CEL, as an edge.
|
|
1369
1347
|
*
|
package/dist/telo-version.d.ts
CHANGED
package/dist/telo-version.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
// its release identity, this is the scale a module's `requires.telo` range is
|
|
6
6
|
// written against, and every kernel in every language reports the same scale.
|
|
7
7
|
/** The surface generation this analyzer implements. */
|
|
8
|
-
export const TELO_SURFACE_VERSION = "0.
|
|
8
|
+
export const TELO_SURFACE_VERSION = "0.86.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telorun/analyzer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.70.0",
|
|
4
4
|
"description": "Telo Analyzer - Static manifest validator for Telo manifests.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"telo",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@types/node": "^20.0.0",
|
|
50
50
|
"typescript": "^5.0.0",
|
|
51
51
|
"vitest": "^2.1.8",
|
|
52
|
-
"@telorun/sdk": "0.
|
|
52
|
+
"@telorun/sdk": "0.86.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@telorun/sdk": "*"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical JSON: a rendering under which two structurally equal values produce
|
|
3
|
+
* the same string — object keys sorted, `undefined`-valued entries dropped.
|
|
4
|
+
*
|
|
5
|
+
* Shared rather than duplicated because both readers compare the RESULT for
|
|
6
|
+
* equality: `contentKey` anchors a module-graph row's identity to its content so
|
|
7
|
+
* an inserted sibling does not move it, and `declarationSignature` decides
|
|
8
|
+
* whether a resource has to be rebuilt. Two implementations would eventually
|
|
9
|
+
* disagree about key order or about `undefined`, and the disagreement surfaces
|
|
10
|
+
* as a row that silently changes identity, or as a resource that silently fails
|
|
11
|
+
* to restart.
|
|
12
|
+
*
|
|
13
|
+
* Browser-safe: no hashing, no `node:crypto`. Callers that only need equality
|
|
14
|
+
* compare the strings, which cannot collide; a caller that needs a short key
|
|
15
|
+
* hashes it itself.
|
|
16
|
+
*/
|
|
17
|
+
export function canonicalJson(value: unknown): string {
|
|
18
|
+
if (value === null || typeof value !== "object") return JSON.stringify(value) ?? "null";
|
|
19
|
+
if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`;
|
|
20
|
+
const entries = Object.entries(value as Record<string, unknown>)
|
|
21
|
+
.filter(([, v]) => v !== undefined)
|
|
22
|
+
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
|
|
23
|
+
return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${canonicalJson(v)}`).join(",")}}`;
|
|
24
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a manifest's CEL READS, as opposed to what its slots reference.
|
|
3
|
+
*
|
|
4
|
+
* A dependency a manifest states without a slot: `!cel "resources.db.dsn"` makes
|
|
5
|
+
* the reader depend on `db` as surely as a `!ref` would, and no reference walk
|
|
6
|
+
* can see it. Two consumers ask for it — the module graph draws it as a `data`
|
|
7
|
+
* edge, and the kernel needs it to know who becomes invalid when a resource is
|
|
8
|
+
* rebuilt — so the extraction is here rather than in either of them.
|
|
9
|
+
*
|
|
10
|
+
* The expensive half is the CEL environment used to parse, which is built once
|
|
11
|
+
* per process and evaluates nothing.
|
|
12
|
+
*/
|
|
13
|
+
import { extractAccessChains } from "@telorun/templating";
|
|
14
|
+
import type { ResourceManifest } from "@telorun/sdk";
|
|
15
|
+
import { walkCelExpressions } from "@telorun/templating";
|
|
16
|
+
import { buildCelEnvironment } from "./cel-environment.js";
|
|
17
|
+
|
|
18
|
+
let parseEnv: ReturnType<typeof buildCelEnvironment> | undefined;
|
|
19
|
+
|
|
20
|
+
/** Access chains an expression reads, or none when it does not parse — a syntax
|
|
21
|
+
* error is the engine pass's to report, not this one's. */
|
|
22
|
+
export function accessChains(source: string): string[][] {
|
|
23
|
+
try {
|
|
24
|
+
parseEnv ??= buildCelEnvironment();
|
|
25
|
+
return extractAccessChains(parseEnv.parse(source).ast);
|
|
26
|
+
} catch {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The bare resource names a manifest's expressions read through
|
|
33
|
+
* `resources.<name>`, deduplicated.
|
|
34
|
+
*
|
|
35
|
+
* Read from the DECLARATION: a compile-eval field is expanded before a
|
|
36
|
+
* controller sees it, so by then `resources.db.dsn` is a literal with nothing
|
|
37
|
+
* left to say where it came from.
|
|
38
|
+
*/
|
|
39
|
+
export function celResourceReads(manifest: ResourceManifest): string[] {
|
|
40
|
+
const names = new Set<string>();
|
|
41
|
+
walkCelExpressions(manifest as Record<string, unknown>, "", (source: string) => {
|
|
42
|
+
for (const chain of accessChains(source)) {
|
|
43
|
+
if (chain[0] === "resources" && chain.length >= 2 && chain[1]) names.add(chain[1]);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return [...names];
|
|
47
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -127,6 +127,14 @@ export type {
|
|
|
127
127
|
ResourceGraphNode,
|
|
128
128
|
StepGraphNode,
|
|
129
129
|
} from "./call-graph.js";
|
|
130
|
+
export { celResourceReads } from "./cel-access-chains.js";
|
|
131
|
+
export { declarationSignature, diffManifests } from "./manifest-diff.js";
|
|
132
|
+
export type {
|
|
133
|
+
DiffEntry,
|
|
134
|
+
ManifestDiff,
|
|
135
|
+
ManifestDiffOptions,
|
|
136
|
+
ResourceChangeKind,
|
|
137
|
+
} from "./manifest-diff.js";
|
|
130
138
|
export {
|
|
131
139
|
AMBIENT_CAPABILITIES,
|
|
132
140
|
buildModuleGraph,
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What changed between two loads of one manifest set.
|
|
3
|
+
*
|
|
4
|
+
* The question a reconciling host asks before it touches anything: which
|
|
5
|
+
* resources survive an edit untouched, which have to be rebuilt, which are new,
|
|
6
|
+
* and which are gone. It is here rather than in the kernel because it is pure
|
|
7
|
+
* data in and data out and the editor wants the same answer — to show which
|
|
8
|
+
* resources a save would restart, in a browser, where no kernel runs.
|
|
9
|
+
*
|
|
10
|
+
* **This is the DECLARATION half of the question and only that half.** A field
|
|
11
|
+
* written `!cel "variables.port"` has the same declaration whatever the
|
|
12
|
+
* environment says, so a host that resolves configuration outside the manifest
|
|
13
|
+
* has to supply what moved there (`modulesWithChangedConfig`). Keeping the two
|
|
14
|
+
* apart is what lets this run in a browser at all.
|
|
15
|
+
*/
|
|
16
|
+
import type { ResourceManifest } from "@telorun/sdk";
|
|
17
|
+
import { isCompiledValue } from "@telorun/sdk";
|
|
18
|
+
import { nodeIdFor } from "./call-graph.js";
|
|
19
|
+
import { canonicalJson } from "./canonical-json.js";
|
|
20
|
+
import { DERIVED_METADATA_FIELDS } from "./module-metadata-scope.js";
|
|
21
|
+
|
|
22
|
+
/** How one resource differs between the two sets. `unchanged` is reported as a
|
|
23
|
+
* bare id rather than an entry, since there is nothing to say about it. */
|
|
24
|
+
export type ResourceChangeKind = "added" | "removed" | "changed";
|
|
25
|
+
|
|
26
|
+
export interface DiffEntry {
|
|
27
|
+
/** {@link nodeIdFor} — module-scoped, so two libraries each declaring a
|
|
28
|
+
* resource named `store` are two entries rather than one. */
|
|
29
|
+
readonly id: string;
|
|
30
|
+
readonly change: ResourceChangeKind;
|
|
31
|
+
/** The declaration as it stood. Absent for an addition. */
|
|
32
|
+
readonly previous?: ResourceManifest;
|
|
33
|
+
/** The declaration as it now stands. Absent for a removal. */
|
|
34
|
+
readonly next?: ResourceManifest;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface ManifestDiff {
|
|
38
|
+
/** Additions, removals and changes. Order follows the next set, then the
|
|
39
|
+
* previous set for removals, so a caller rendering this reads it in
|
|
40
|
+
* declaration order rather than in hash order. */
|
|
41
|
+
readonly entries: readonly DiffEntry[];
|
|
42
|
+
/** Ids present in both sets with an identical declaration. */
|
|
43
|
+
readonly unchanged: readonly string[];
|
|
44
|
+
/** Ids whose current instance is no longer valid: every removal and every
|
|
45
|
+
* change. What a reconciling host unwinds, once it has closed this set under
|
|
46
|
+
* the resources that HOLD them — which is the call graph's answer, not this
|
|
47
|
+
* one's. */
|
|
48
|
+
readonly stale: readonly string[];
|
|
49
|
+
/** Declarations that have to be created: every addition and every change.
|
|
50
|
+
* Named for the kernel's own `pendingResources`, which is where they go. */
|
|
51
|
+
readonly pending: readonly ResourceManifest[];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface ManifestDiffOptions {
|
|
55
|
+
/**
|
|
56
|
+
* Modules whose resolved configuration moved between the two loads, by
|
|
57
|
+
* `metadata.module`.
|
|
58
|
+
*
|
|
59
|
+
* Every resource of such a module is reported `changed` even where its
|
|
60
|
+
* declaration is identical, because a declaration is not the whole of what a
|
|
61
|
+
* resource is built from: `!cel "variables.port"` reads the same and means
|
|
62
|
+
* something else once the environment behind it moves. Only the host that
|
|
63
|
+
* resolved that environment can know, so it is an input rather than something
|
|
64
|
+
* derived here.
|
|
65
|
+
*/
|
|
66
|
+
readonly modulesWithChangedConfig?: ReadonlySet<string>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Signatures of the previous set, by node id, taken while those manifests
|
|
70
|
+
* were still declarations.
|
|
71
|
+
*
|
|
72
|
+
* A host that INSTALLS manifests does not keep declarations: the kernel
|
|
73
|
+
* registers the very objects it loaded, and resolving references writes live
|
|
74
|
+
* instances into them — a boot target's `!ref`, or a slot nested past the
|
|
75
|
+
* create-time shallow copy. Signing such an object afterwards renders those
|
|
76
|
+
* slots opaque and reports a change that never happened, which on a module
|
|
77
|
+
* document means escalating every reconciliation there is.
|
|
78
|
+
*
|
|
79
|
+
* An id absent from the map is signed from its manifest, so a caller that
|
|
80
|
+
* really is holding declarations passes nothing.
|
|
81
|
+
*/
|
|
82
|
+
readonly previousSignatures?: ReadonlyMap<string, string>;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** A value that is not part of the declaration and must not be walked into:
|
|
86
|
+
* a live instance a host injected over a reference slot, a function, a class
|
|
87
|
+
* instance of any kind. Rendering one as a constant keeps the walk finite and
|
|
88
|
+
* acyclic; comparing two sets across the injection boundary is not supported
|
|
89
|
+
* and is what {@link declarationSignature} documents against. */
|
|
90
|
+
const OPAQUE = '"\\u0000opaque"';
|
|
91
|
+
|
|
92
|
+
const isPlainObject = (value: object): boolean => {
|
|
93
|
+
const proto = Object.getPrototypeOf(value);
|
|
94
|
+
return proto === Object.prototype || proto === null;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* A resource's declaration, rendered so that two equal declarations render
|
|
99
|
+
* identically.
|
|
100
|
+
*
|
|
101
|
+
* Three things are normalized away, and each would otherwise report a change
|
|
102
|
+
* that is not one:
|
|
103
|
+
*
|
|
104
|
+
* - **Loader stamps** (`DERIVED_METADATA_FIELDS`). `metadata.sourceLine` is the
|
|
105
|
+
* load-bearing one: inserting a line anywhere in a file shifts it for every
|
|
106
|
+
* resource below, so leaving it in would mark a whole file changed on any
|
|
107
|
+
* edit and defeat the mechanism entirely.
|
|
108
|
+
* - **A compiled expression** renders as its source text. What the author wrote
|
|
109
|
+
* is the declaration; what it evaluates to depends on configuration, which
|
|
110
|
+
* `modulesWithChangedConfig` carries instead.
|
|
111
|
+
* - **Anything that is not plain data** renders as a constant. A host that has
|
|
112
|
+
* injected live instances over its reference slots has manifests that are no
|
|
113
|
+
* longer declarations, and walking one reaches a controller's object graph,
|
|
114
|
+
* which is cyclic. Both sides must be declarations as loaded.
|
|
115
|
+
*
|
|
116
|
+
* The result is compared as a string rather than hashed: there is no collision
|
|
117
|
+
* to reason about, and a missed change here is a resource that silently keeps
|
|
118
|
+
* running against a declaration it no longer matches.
|
|
119
|
+
*/
|
|
120
|
+
export function declarationSignature(manifest: ResourceManifest): string {
|
|
121
|
+
const seen = new WeakSet<object>();
|
|
122
|
+
|
|
123
|
+
const render = (value: unknown): unknown => {
|
|
124
|
+
if (isCompiledValue(value)) {
|
|
125
|
+
const source = (value as { source?: unknown }).source;
|
|
126
|
+
return { "\u0000cel": typeof source === "string" ? source : null };
|
|
127
|
+
}
|
|
128
|
+
if (!value || typeof value !== "object") return value;
|
|
129
|
+
if (seen.has(value)) return "\u0000cycle";
|
|
130
|
+
if (Array.isArray(value)) {
|
|
131
|
+
seen.add(value);
|
|
132
|
+
return value.map(render);
|
|
133
|
+
}
|
|
134
|
+
if (!isPlainObject(value)) return OPAQUE;
|
|
135
|
+
seen.add(value);
|
|
136
|
+
const out: Record<string, unknown> = {};
|
|
137
|
+
for (const [key, entry] of Object.entries(value as Record<string, unknown>)) {
|
|
138
|
+
out[key] = render(entry);
|
|
139
|
+
}
|
|
140
|
+
return out;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const authoredMetadata: Record<string, unknown> = {};
|
|
144
|
+
const metadata = manifest.metadata as Record<string, unknown> | undefined;
|
|
145
|
+
for (const [key, value] of Object.entries(metadata ?? {})) {
|
|
146
|
+
if (DERIVED_METADATA_FIELDS.has(key)) continue;
|
|
147
|
+
authoredMetadata[key] = render(value);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const body: Record<string, unknown> = {};
|
|
151
|
+
for (const [key, value] of Object.entries(manifest as Record<string, unknown>)) {
|
|
152
|
+
if (key === "metadata") continue;
|
|
153
|
+
body[key] = render(value);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return canonicalJson({ ...body, metadata: authoredMetadata });
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Classify every resource of two loads against each other.
|
|
161
|
+
*
|
|
162
|
+
* **Identity is `nodeIdFor`**, which is module-scoped, so a name is compared
|
|
163
|
+
* only against the same name in the same module. One consequence is worth
|
|
164
|
+
* stating because it is visible: an INLINE resource's name is synthesized from
|
|
165
|
+
* its position (`api_routes_0_handler`), so inserting a route above one renames
|
|
166
|
+
* every inline below it and this reports those as a removal plus an addition.
|
|
167
|
+
* That costs a restart it did not have to cost; it never misses a change, which
|
|
168
|
+
* is the direction that matters.
|
|
169
|
+
*/
|
|
170
|
+
export function diffManifests(
|
|
171
|
+
previous: readonly ResourceManifest[],
|
|
172
|
+
next: readonly ResourceManifest[],
|
|
173
|
+
options: ManifestDiffOptions = {},
|
|
174
|
+
): ManifestDiff {
|
|
175
|
+
const before = new Map<string, ResourceManifest>();
|
|
176
|
+
for (const manifest of previous) before.set(nodeIdFor(manifest), manifest);
|
|
177
|
+
|
|
178
|
+
const changedConfig = options.modulesWithChangedConfig;
|
|
179
|
+
const configMoved = (manifest: ResourceManifest): boolean => {
|
|
180
|
+
if (!changedConfig || changedConfig.size === 0) return false;
|
|
181
|
+
const module = (manifest.metadata as { module?: string } | undefined)?.module;
|
|
182
|
+
return module !== undefined && changedConfig.has(module);
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
const entries: DiffEntry[] = [];
|
|
186
|
+
const unchanged: string[] = [];
|
|
187
|
+
const stale: string[] = [];
|
|
188
|
+
const pending: ResourceManifest[] = [];
|
|
189
|
+
const survived = new Set<string>();
|
|
190
|
+
|
|
191
|
+
for (const manifest of next) {
|
|
192
|
+
const id = nodeIdFor(manifest);
|
|
193
|
+
const prior = before.get(id);
|
|
194
|
+
if (!prior) {
|
|
195
|
+
entries.push({ id, change: "added", next: manifest });
|
|
196
|
+
pending.push(manifest);
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
survived.add(id);
|
|
200
|
+
const priorSignature =
|
|
201
|
+
options.previousSignatures?.get(id) ?? declarationSignature(prior);
|
|
202
|
+
const same = !configMoved(manifest) && priorSignature === declarationSignature(manifest);
|
|
203
|
+
if (same) {
|
|
204
|
+
unchanged.push(id);
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
entries.push({ id, change: "changed", previous: prior, next: manifest });
|
|
208
|
+
stale.push(id);
|
|
209
|
+
pending.push(manifest);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
for (const [id, manifest] of before) {
|
|
213
|
+
if (survived.has(id)) continue;
|
|
214
|
+
entries.push({ id, change: "removed", previous: manifest });
|
|
215
|
+
stale.push(id);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return { entries, unchanged, stale, pending };
|
|
219
|
+
}
|
package/src/module-graph.ts
CHANGED
|
@@ -65,6 +65,8 @@ import { isStepSlot } from "./step-slot.js";
|
|
|
65
65
|
import { isInlineResource, resolveFieldEntries } from "./reference-field-map.js";
|
|
66
66
|
import { findZoneProviders } from "./resolve-zone-containment.js";
|
|
67
67
|
import { possibleUses, readRefSlot, type RefUse } from "./ref-slot.js";
|
|
68
|
+
import { canonicalJson } from "./canonical-json.js";
|
|
69
|
+
import { accessChains } from "./cel-access-chains.js";
|
|
68
70
|
|
|
69
71
|
/** How a node's declaration reached the module, which is what decides where a
|
|
70
72
|
* view may draw it — an inline child exists nowhere but its parent's YAML, so
|
|
@@ -591,15 +593,6 @@ export function contentKey(value: unknown): string {
|
|
|
591
593
|
return hash.toString(36);
|
|
592
594
|
}
|
|
593
595
|
|
|
594
|
-
function canonicalJson(value: unknown): string {
|
|
595
|
-
if (value === null || typeof value !== "object") return JSON.stringify(value) ?? "null";
|
|
596
|
-
if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`;
|
|
597
|
-
const entries = Object.entries(value as Record<string, unknown>)
|
|
598
|
-
.filter(([, v]) => v !== undefined)
|
|
599
|
-
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
|
|
600
|
-
return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${canonicalJson(v)}`).join(",")}}`;
|
|
601
|
-
}
|
|
602
|
-
|
|
603
596
|
/** Mints ids that are unique without being positional: the name where one
|
|
604
597
|
* exists, a content key where none does, and a `~n` suffix only when two
|
|
605
598
|
* siblings are genuinely indistinguishable. */
|
|
@@ -1940,21 +1933,6 @@ function buildKindPlane(
|
|
|
1940
1933
|
return out;
|
|
1941
1934
|
}
|
|
1942
1935
|
|
|
1943
|
-
/** The CEL environment used to PARSE a chain out of an expression. One per
|
|
1944
|
-
* process: building it is the expensive half, and nothing here evaluates. */
|
|
1945
|
-
let parseEnv: ReturnType<typeof buildCelEnvironment> | undefined;
|
|
1946
|
-
|
|
1947
|
-
/** Access chains an expression reads, or none when it does not parse — a syntax
|
|
1948
|
-
* error is the engine pass's to report, not this one's. */
|
|
1949
|
-
function accessChains(source: string): string[][] {
|
|
1950
|
-
try {
|
|
1951
|
-
parseEnv ??= buildCelEnvironment();
|
|
1952
|
-
return extractAccessChains(parseEnv.parse(source).ast);
|
|
1953
|
-
} catch {
|
|
1954
|
-
return [];
|
|
1955
|
-
}
|
|
1956
|
-
}
|
|
1957
|
-
|
|
1958
1936
|
/**
|
|
1959
1937
|
* Every `resources.<name>…` read in one resource's CEL, as an edge.
|
|
1960
1938
|
*
|
package/src/telo-version.ts
CHANGED