@telorun/kernel 0.73.0 → 0.74.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.
@@ -1,4 +1,4 @@
1
- import { type ContractDirection, type DefResolver } from "@telorun/analyzer";
1
+ import { type ContractDirection, type DeclaredScalarPath, type DefResolver } from "@telorun/analyzer";
2
2
  import type { ResourceDefinition, ResourceInstance, ResourceManifest } from "@telorun/sdk";
3
3
  /**
4
4
  * Binds a resource's resolved invocation contract to its dispatch entry points,
@@ -52,6 +52,10 @@ export interface BoundContract {
52
52
  /** Paths a default can be written to — how far the caller's value must be
53
53
  * copied before validation runs. Empty when the contract declares none. */
54
54
  defaultPaths(): string[][];
55
+ /** Paths whose declared type fixes a scalar representation — the leaves a
56
+ * value is normalized at, in either direction. Empty when the contract
57
+ * declares none. */
58
+ scalarPaths(): DeclaredScalarPath[];
55
59
  }
56
60
  export declare function resolveBoundContract(direction: ContractDirection, manifest: ResourceManifest, definition: ResourceDefinition | undefined, resolveDef: DefResolver, factory: ContractValidatorFactory): BoundContract | undefined;
57
61
  /**
@@ -64,6 +68,38 @@ export declare function resolveBoundContract(direction: ContractDirection, manif
64
68
  * payload — a contract declaring no defaults copies one level and nothing more.
65
69
  */
66
70
  export declare function copyForDefaults(value: unknown, paths: readonly string[][]): unknown;
71
+ /**
72
+ * `value` with every leaf normalized to the representation its declaration
73
+ * names, copied along the containers above each one so the producer's own object
74
+ * is not rewritten under it.
75
+ *
76
+ * A declared shape says what the value IS, not only what it must pass — the same
77
+ * service a JSON Schema gives an HTTP response serializer. Telo's CEL layer
78
+ * takes the declaration literally: `integer` types as CEL `int` and a CEL int is
79
+ * a BigInt, so a controller handing back a plain JS number at an `integer` slot
80
+ * makes the contract a lie that surfaces nowhere until an expression composes it
81
+ * — `result.n + 1` type-checking statically and then dying at dispatch with
82
+ * `no such overload: dyn<double> + int`. Normalizing at the boundary that
83
+ * already knows the declared shape closes it for every kind at once, instead of
84
+ * once per module after each report.
85
+ *
86
+ * BOTH DIRECTIONS, deliberately. A controller cannot be written correctly
87
+ * against a slot that hands it a JS number when the manifest wrote a literal and
88
+ * a BigInt when CEL computed the same value — it would have to accept either at
89
+ * every declared-integer field, which is what `typeof x === "number"` guards
90
+ * around the standard library were quietly relying on. One representation per
91
+ * declaration is what makes the declared type something a controller can read.
92
+ *
93
+ * Only an EXACT conversion is performed: an integral number becomes an int64,
94
+ * and a BigInt becomes a double only when the round-trip is lossless. A
95
+ * fractional number at an integer slot, a string, a null, a magnitude no double
96
+ * can hold — all are left exactly as they arrived, so a value that genuinely
97
+ * violates the contract is still rejected rather than quietly repaired into
98
+ * something that passes, and a 64-bit integer is never truncated to reach a
99
+ * `number` slot (which is the `double(...)` defect this whole line of work
100
+ * exists to retire).
101
+ */
102
+ export declare function normalizeDeclaredScalars(value: unknown, paths: readonly DeclaredScalarPath[]): unknown;
67
103
  /**
68
104
  * Raise a contract violation as a structured {@link InvokeError}.
69
105
  *
@@ -1 +1 @@
1
- {"version":3,"file":"invocation-contract-binding.d.ts","sourceRoot":"","sources":["../src/invocation-contract-binding.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EAGtB,KAAK,WAAW,EAEjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAQ3F;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;sEACsE;AACtE,MAAM,WAAW,wBAAwB;IACvC,CAAC,OAAO,EAAE,OAAO,GAAG;QAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAA;KAAE,CAAC;IACvD;8EAC0E;IAC1E,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;IAC5D;kFAC8E;IAC9E,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MA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ChC,aAAa,GAAG,SAAS,CAqD3B;AAUD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,OAAO,CAWnF;AAwBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,SAAS,kBAAkB,EAAE,GACnC,OAAO,CAKT;AA8CD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,iBAAiB,EAC5B,cAAc,EAAE,MAAM,MAAM,EAC5B,KAAK,EAAE,OAAO,GACb,KAAK,CAuBP;AAeD,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB;iEAC6D;IAC7D,cAAc,IAAI,MAAM,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,eAAe,GAAG,IAAI,CAqEvF"}
@@ -1,4 +1,4 @@
1
- import { defaultBearingPaths, effectiveContractField, withLiveValuesSkipped, } from "@telorun/analyzer";
1
+ import { declaredScalarPaths, defaultBearingPaths, effectiveContractField, withLiveValuesSkipped, } from "@telorun/analyzer";
2
2
  import { ERR_CONTRACT_UNRESOLVABLE, ERR_INPUT_INVALID, ERR_OUTPUT_INVALID, InvokeError, } from "@telorun/sdk";
3
3
  const CONTRACT_ERROR = {
4
4
  inputType: ERR_INPUT_INVALID,
@@ -51,6 +51,7 @@ export function resolveBoundContract(direction, manifest, definition, resolveDef
51
51
  return undefined;
52
52
  let compiled;
53
53
  let paths;
54
+ let scalars;
54
55
  const resolve = () => {
55
56
  if (compiled !== undefined)
56
57
  return compiled;
@@ -65,6 +66,7 @@ export function resolveBoundContract(direction, manifest, definition, resolveDef
65
66
  }
66
67
  const stripped = withLiveValuesSkipped(schema, factory.resolveRef);
67
68
  paths = defaultBearingPaths(stripped, factory.resolveRef);
69
+ scalars = declaredScalarPaths(stripped, factory.resolveRef);
68
70
  // Compile by NAME whenever the declaration is one, so the type's CEL
69
71
  // `rules:` are composed in — including when a stream had to be stripped, in
70
72
  // which case the stream-bearing properties are dropped from the schema the
@@ -83,6 +85,10 @@ export function resolveBoundContract(direction, manifest, definition, resolveDef
83
85
  resolve();
84
86
  return paths ?? [];
85
87
  },
88
+ scalarPaths: () => {
89
+ resolve();
90
+ return scalars ?? [];
91
+ },
86
92
  };
87
93
  }
88
94
  const nameOf = (declared) => typeof declared === "string"
@@ -130,6 +136,87 @@ function copyAlong(node, segments) {
130
136
  container[head] = copyAlong(shallowCopy(child), rest);
131
137
  return node;
132
138
  }
139
+ /**
140
+ * `value` with every leaf normalized to the representation its declaration
141
+ * names, copied along the containers above each one so the producer's own object
142
+ * is not rewritten under it.
143
+ *
144
+ * A declared shape says what the value IS, not only what it must pass — the same
145
+ * service a JSON Schema gives an HTTP response serializer. Telo's CEL layer
146
+ * takes the declaration literally: `integer` types as CEL `int` and a CEL int is
147
+ * a BigInt, so a controller handing back a plain JS number at an `integer` slot
148
+ * makes the contract a lie that surfaces nowhere until an expression composes it
149
+ * — `result.n + 1` type-checking statically and then dying at dispatch with
150
+ * `no such overload: dyn<double> + int`. Normalizing at the boundary that
151
+ * already knows the declared shape closes it for every kind at once, instead of
152
+ * once per module after each report.
153
+ *
154
+ * BOTH DIRECTIONS, deliberately. A controller cannot be written correctly
155
+ * against a slot that hands it a JS number when the manifest wrote a literal and
156
+ * a BigInt when CEL computed the same value — it would have to accept either at
157
+ * every declared-integer field, which is what `typeof x === "number"` guards
158
+ * around the standard library were quietly relying on. One representation per
159
+ * declaration is what makes the declared type something a controller can read.
160
+ *
161
+ * Only an EXACT conversion is performed: an integral number becomes an int64,
162
+ * and a BigInt becomes a double only when the round-trip is lossless. A
163
+ * fractional number at an integer slot, a string, a null, a magnitude no double
164
+ * can hold — all are left exactly as they arrived, so a value that genuinely
165
+ * violates the contract is still rejected rather than quietly repaired into
166
+ * something that passes, and a 64-bit integer is never truncated to reach a
167
+ * `number` slot (which is the `double(...)` defect this whole line of work
168
+ * exists to retire).
169
+ */
170
+ export function normalizeDeclaredScalars(value, paths) {
171
+ if (paths.length === 0 || !value || typeof value !== "object")
172
+ return value;
173
+ let out = value;
174
+ for (const { path, form } of paths)
175
+ out = normalizeAlong(out, path, form);
176
+ return out;
177
+ }
178
+ function normalizeAlong(node, segments, form) {
179
+ if (!node || typeof node !== "object")
180
+ return node;
181
+ const [head, ...rest] = segments;
182
+ if (head === "[]") {
183
+ if (!Array.isArray(node))
184
+ return node;
185
+ let changed = false;
186
+ const next = node.map((item) => {
187
+ const value = rest.length === 0 ? asForm(item, form) : normalizeAlong(item, rest, form);
188
+ if (value !== item)
189
+ changed = true;
190
+ return value;
191
+ });
192
+ return changed ? next : node;
193
+ }
194
+ const container = node;
195
+ if (!(head in container))
196
+ return node;
197
+ const child = container[head];
198
+ const next = rest.length === 0 ? asForm(child, form) : normalizeAlong(child, rest, form);
199
+ if (next === child)
200
+ return node;
201
+ // Copy-on-write, and only once a leaf actually moved: a producer may hand back
202
+ // an object it retains (a cached record, a live config), and rewriting it in
203
+ // place would change what it holds.
204
+ const copy = shallowCopy(container);
205
+ copy[head] = next;
206
+ return copy;
207
+ }
208
+ function asForm(value, form) {
209
+ if (form === "int64") {
210
+ return typeof value === "number" && Number.isInteger(value) ? BigInt(value) : value;
211
+ }
212
+ if (typeof value !== "bigint")
213
+ return value;
214
+ const asNumber = Number(value);
215
+ // Lossless only. Past the safe range a double cannot hold the integer, and
216
+ // handing back a silently-rounded one is the precision loss the int64 work
217
+ // exists to remove.
218
+ return BigInt(asNumber) === value ? asNumber : value;
219
+ }
133
220
  /**
134
221
  * Raise a contract violation as a structured {@link InvokeError}.
135
222
  *
@@ -199,11 +286,19 @@ export function bindContract(instance, binding) {
199
286
  let effective = inputs;
200
287
  if (input) {
201
288
  // Copied only so the validator's default-fill cannot mutate what the
202
- // caller still holds. The BigInt normalization a JSON Schema validator
203
- // needs (CEL evaluates an integer to one, which AJV does not recognise
204
- // as `integer`) belongs to the validator and is applied there — see
205
- // `bigint-schema-view.ts`. Doing it here as well would walk every input
206
- // tree twice per dispatch, and split one concern across two layers.
289
+ // caller still holds. Making the value READABLE to a JSON Schema
290
+ // validator regardless of representation is the validator's own concern
291
+ // and is applied there (`bigint-schema-view.ts`).
292
+ //
293
+ // Deliberately NOT normalized on this side. Normalization states what a
294
+ // value IS to whoever reads it next, and on the way in that reader is a
295
+ // controller written in the host language — a declared `integer` reaching
296
+ // one as an int64 is a change to the authoring surface of every module,
297
+ // not a repair to a lie. On the way OUT the reader is CEL, which already
298
+ // types the declaration as `int`, so there the declaration and the value
299
+ // genuinely disagree. The asymmetry is the point: a controller still sees
300
+ // whatever the call site produced and must accept both, which is what
301
+ // `bigint-schema-view.ts` documents.
207
302
  effective = copyForDefaults(inputs, input.defaultPaths());
208
303
  try {
209
304
  input.validate(effective);
@@ -220,6 +315,12 @@ export function bindContract(instance, binding) {
220
315
  catch (error) {
221
316
  throw contractViolation("outputType", describeTarget, error);
222
317
  }
318
+ // AFTER validation, not before: the validator fills declared defaults,
319
+ // and a default written as a plain YAML number is exactly the leaf that
320
+ // has to come out normalized too. Validation itself is indifferent to
321
+ // which representation arrives (`bigint-schema-view.ts`), so ordering
322
+ // costs nothing there.
323
+ return normalizeDeclaredScalars(result, output.scalarPaths());
223
324
  }
224
325
  return result;
225
326
  };
@@ -234,7 +335,7 @@ export function bindContract(instance, binding) {
234
335
  catch (error) {
235
336
  throw contractViolation("outputType", describeTarget, error);
236
337
  }
237
- return result;
338
+ return normalizeDeclaredScalars(result, output.scalarPaths());
238
339
  };
239
340
  }
240
341
  }
@@ -1 +1 @@
1
- {"version":3,"file":"invocation-contract-binding.js","sourceRoot":"","sources":["../src/invocation-contract-binding.ts"],"names":[],"mappings":"AAAA,OA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EAAE;YAC9C,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC;YACvC,IAAI,CAAC;gBACH,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAC1B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,iBAAiB,CAAC,YAAY,EAAE,cAAc,EAAE,KAAK,CAAC,CAAC;YAC/D,CAAC;YACD,OAAO,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;QAChE,CAAC,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"schema-compiled-values.d.ts","sourceRoot":"","sources":["../src/schema-compiled-values.ts"],"names":[],"mappings":"AA4FA;;;;;;;;;;;;kFAYkF;AAClF,wBAAgB,mBAAmB,CACjC,CAAC,EAAE,OAAO,EACV,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACpC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,OAAO,CAqDT"}
1
+ {"version":3,"file":"schema-compiled-values.d.ts","sourceRoot":"","sources":["../src/schema-compiled-values.ts"],"names":[],"mappings":"AA0GA;;;;;;;;;;;;kFAYkF;AAClF,wBAAgB,mBAAmB,CACjC,CAAC,EAAE,OAAO,EACV,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACpC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,OAAO,CAkET"}
@@ -1,4 +1,5 @@
1
1
  import { isCompiledValue } from "@telorun/sdk";
2
+ import { selectUnionBranch } from "@telorun/analyzer";
2
3
  /** Returns a schema-appropriate placeholder value for a CompiledValue field. */
3
4
  function placeholderForSchema(schema) {
4
5
  if (schema.default !== undefined)
@@ -10,6 +11,20 @@ function placeholderForSchema(schema) {
10
11
  // performs the same substitution for the static half.
11
12
  if (Array.isArray(schema.enum) && schema.enum.length > 0)
12
13
  return schema.enum[0];
14
+ // A union with no `type` of its own: take the first branch that yields a
15
+ // placeholder, so a whole-field CEL leaf at an `anyOf` slot is not handed the
16
+ // `""` fallback that only a string branch would accept. Mirrors the analyzer's
17
+ // `celPlaceholderForSchema`, which makes the same substitution for the static
18
+ // half — the two must agree or one rejects what the other passes.
19
+ if (schema.type === undefined) {
20
+ const branches = (schema.anyOf ?? schema.oneOf);
21
+ if (Array.isArray(branches)) {
22
+ for (const branch of branches) {
23
+ if (branch && typeof branch === "object")
24
+ return placeholderForSchema(branch);
25
+ }
26
+ }
27
+ }
13
28
  switch (schema.type) {
14
29
  case "integer":
15
30
  case "number":
@@ -102,7 +117,16 @@ export function stripCompiledValues(v, schema = {}, rootSchema) {
102
117
  // Ancestors on the current path, so a genuine cycle stops while a sub-object
103
118
  // that merely appears twice is still stripped both times.
104
119
  const ancestors = new Set();
105
- const walk = (value, nodeSchema) => {
120
+ const walk = (value, rawNodeSchema) => {
121
+ // A UNION carries no `type` / `items` / `properties` of its own, so descending
122
+ // through one hands every CEL leaf underneath the schema-unaware `""`
123
+ // placeholder — which the branches then reject, reporting violations against
124
+ // a value the author never wrote (`/success/1 must be integer` for a `!cel`
125
+ // inside a list). Resolving the branch first is what lets the leaves be
126
+ // placed. Shared with the analyzer rather than reimplemented: the static and
127
+ // dispatch halves must choose the same branch, or one reports what the other
128
+ // accepts.
129
+ const nodeSchema = selectUnionBranch(resolveSchemaRef(rawNodeSchema, root), value, root);
106
130
  const resolved = resolveSchemaRef(nodeSchema, root);
107
131
  if (isCompiledValue(value))
108
132
  return placeholderForSchema(resolved);
@@ -1 +1 @@
1
- {"version":3,"file":"schema-compiled-values.js","sourceRoot":"","sources":["../src/schema-compiled-values.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,gFAAgF;AAChF,SAAS,oBAAoB,CAAC,MAA+B;IAC3D,IAAI,MAAM,CAAC,OAAO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AC,CAAC,EAAE,MAAM,CAAC,CAAC;AACzB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telorun/kernel",
3
- "version": "0.73.0",
3
+ "version": "0.74.0",
4
4
  "description": "Telo Runtime - A lightweight, polyglot execution host.",
5
5
  "keywords": [
6
6
  "telo",
@@ -61,9 +61,9 @@
61
61
  "dependencies": {
62
62
  "@marcbachmann/cel-js": "^7.6.1",
63
63
  "@sinclair/typebox": "^0.34.48",
64
- "@telorun/analyzer": "0.58.0",
64
+ "@telorun/analyzer": "0.59.0",
65
65
  "@telorun/glob": "0.2.0",
66
- "@telorun/templating": "0.14.0",
66
+ "@telorun/templating": "0.15.0",
67
67
  "ajv": "^8.17.1",
68
68
  "ajv-formats": "^3.0.1",
69
69
  "packageurl-js": "^2.0.1",
@@ -75,7 +75,7 @@
75
75
  "@types/tar-stream": "^3.1.3",
76
76
  "typescript": "^5.0.0",
77
77
  "vitest": "^2.1.8",
78
- "@telorun/sdk": "0.73.0"
78
+ "@telorun/sdk": "0.74.0"
79
79
  },
80
80
  "optionalDependencies": {
81
81
  "esbuild": "^0.25.12"
@@ -1,5 +1,8 @@
1
1
  import {
2
2
  type ContractDirection,
3
+ declaredScalarPaths,
4
+ type DeclaredScalarForm,
5
+ type DeclaredScalarPath,
3
6
  defaultBearingPaths,
4
7
  effectiveContractField,
5
8
  type DefResolver,
@@ -63,6 +66,10 @@ export interface BoundContract {
63
66
  /** Paths a default can be written to — how far the caller's value must be
64
67
  * copied before validation runs. Empty when the contract declares none. */
65
68
  defaultPaths(): string[][];
69
+ /** Paths whose declared type fixes a scalar representation — the leaves a
70
+ * value is normalized at, in either direction. Empty when the contract
71
+ * declares none. */
72
+ scalarPaths(): DeclaredScalarPath[];
66
73
  }
67
74
 
68
75
  const CONTRACT_ERROR: Record<ContractDirection, string> = {
@@ -123,6 +130,7 @@ export function resolveBoundContract(
123
130
 
124
131
  let compiled: { validate(value: unknown): void } | undefined;
125
132
  let paths: string[][] | undefined;
133
+ let scalars: DeclaredScalarPath[] | undefined;
126
134
 
127
135
  const resolve = (): { validate(value: unknown): void } => {
128
136
  if (compiled !== undefined) return compiled;
@@ -140,6 +148,7 @@ export function resolveBoundContract(
140
148
  }
141
149
  const stripped = withLiveValuesSkipped(schema, factory.resolveRef);
142
150
  paths = defaultBearingPaths(stripped, factory.resolveRef);
151
+ scalars = declaredScalarPaths(stripped, factory.resolveRef);
143
152
  // Compile by NAME whenever the declaration is one, so the type's CEL
144
153
  // `rules:` are composed in — including when a stream had to be stripped, in
145
154
  // which case the stream-bearing properties are dropped from the schema the
@@ -159,6 +168,10 @@ export function resolveBoundContract(
159
168
  resolve();
160
169
  return paths ?? [];
161
170
  },
171
+ scalarPaths: () => {
172
+ resolve();
173
+ return scalars ?? [];
174
+ },
162
175
  };
163
176
  }
164
177
 
@@ -214,6 +227,91 @@ function copyAlong(node: unknown, segments: readonly string[]): unknown {
214
227
  return node;
215
228
  }
216
229
 
230
+ /**
231
+ * `value` with every leaf normalized to the representation its declaration
232
+ * names, copied along the containers above each one so the producer's own object
233
+ * is not rewritten under it.
234
+ *
235
+ * A declared shape says what the value IS, not only what it must pass — the same
236
+ * service a JSON Schema gives an HTTP response serializer. Telo's CEL layer
237
+ * takes the declaration literally: `integer` types as CEL `int` and a CEL int is
238
+ * a BigInt, so a controller handing back a plain JS number at an `integer` slot
239
+ * makes the contract a lie that surfaces nowhere until an expression composes it
240
+ * — `result.n + 1` type-checking statically and then dying at dispatch with
241
+ * `no such overload: dyn<double> + int`. Normalizing at the boundary that
242
+ * already knows the declared shape closes it for every kind at once, instead of
243
+ * once per module after each report.
244
+ *
245
+ * BOTH DIRECTIONS, deliberately. A controller cannot be written correctly
246
+ * against a slot that hands it a JS number when the manifest wrote a literal and
247
+ * a BigInt when CEL computed the same value — it would have to accept either at
248
+ * every declared-integer field, which is what `typeof x === "number"` guards
249
+ * around the standard library were quietly relying on. One representation per
250
+ * declaration is what makes the declared type something a controller can read.
251
+ *
252
+ * Only an EXACT conversion is performed: an integral number becomes an int64,
253
+ * and a BigInt becomes a double only when the round-trip is lossless. A
254
+ * fractional number at an integer slot, a string, a null, a magnitude no double
255
+ * can hold — all are left exactly as they arrived, so a value that genuinely
256
+ * violates the contract is still rejected rather than quietly repaired into
257
+ * something that passes, and a 64-bit integer is never truncated to reach a
258
+ * `number` slot (which is the `double(...)` defect this whole line of work
259
+ * exists to retire).
260
+ */
261
+ export function normalizeDeclaredScalars(
262
+ value: unknown,
263
+ paths: readonly DeclaredScalarPath[],
264
+ ): unknown {
265
+ if (paths.length === 0 || !value || typeof value !== "object") return value;
266
+ let out: unknown = value;
267
+ for (const { path, form } of paths) out = normalizeAlong(out, path, form);
268
+ return out;
269
+ }
270
+
271
+ function normalizeAlong(
272
+ node: unknown,
273
+ segments: readonly string[],
274
+ form: DeclaredScalarForm,
275
+ ): unknown {
276
+ if (!node || typeof node !== "object") return node;
277
+ const [head, ...rest] = segments;
278
+
279
+ if (head === "[]") {
280
+ if (!Array.isArray(node)) return node;
281
+ let changed = false;
282
+ const next = node.map((item) => {
283
+ const value = rest.length === 0 ? asForm(item, form) : normalizeAlong(item, rest, form);
284
+ if (value !== item) changed = true;
285
+ return value;
286
+ });
287
+ return changed ? next : node;
288
+ }
289
+
290
+ const container = node as Record<string, unknown>;
291
+ if (!(head! in container)) return node;
292
+ const child = container[head!];
293
+ const next = rest.length === 0 ? asForm(child, form) : normalizeAlong(child, rest, form);
294
+ if (next === child) return node;
295
+ // Copy-on-write, and only once a leaf actually moved: a producer may hand back
296
+ // an object it retains (a cached record, a live config), and rewriting it in
297
+ // place would change what it holds.
298
+ const copy = shallowCopy(container);
299
+ copy[head!] = next;
300
+ return copy;
301
+ }
302
+
303
+ function asForm(value: unknown, form: DeclaredScalarForm): unknown {
304
+ if (form === "int64") {
305
+ return typeof value === "number" && Number.isInteger(value) ? BigInt(value) : value;
306
+ }
307
+ if (typeof value !== "bigint") return value;
308
+ const asNumber = Number(value);
309
+ // Lossless only. Past the safe range a double cannot hold the integer, and
310
+ // handing back a silently-rounded one is the precision loss the int64 work
311
+ // exists to remove.
312
+ return BigInt(asNumber) === value ? asNumber : value;
313
+ }
314
+
217
315
  /**
218
316
  * Raise a contract violation as a structured {@link InvokeError}.
219
317
  *
@@ -306,11 +404,19 @@ export function bindContract(instance: ResourceInstance, binding: ContractBindin
306
404
  let effective = inputs;
307
405
  if (input) {
308
406
  // Copied only so the validator's default-fill cannot mutate what the
309
- // caller still holds. The BigInt normalization a JSON Schema validator
310
- // needs (CEL evaluates an integer to one, which AJV does not recognise
311
- // as `integer`) belongs to the validator and is applied there — see
312
- // `bigint-schema-view.ts`. Doing it here as well would walk every input
313
- // tree twice per dispatch, and split one concern across two layers.
407
+ // caller still holds. Making the value READABLE to a JSON Schema
408
+ // validator regardless of representation is the validator's own concern
409
+ // and is applied there (`bigint-schema-view.ts`).
410
+ //
411
+ // Deliberately NOT normalized on this side. Normalization states what a
412
+ // value IS to whoever reads it next, and on the way in that reader is a
413
+ // controller written in the host language — a declared `integer` reaching
414
+ // one as an int64 is a change to the authoring surface of every module,
415
+ // not a repair to a lie. On the way OUT the reader is CEL, which already
416
+ // types the declaration as `int`, so there the declaration and the value
417
+ // genuinely disagree. The asymmetry is the point: a controller still sees
418
+ // whatever the call site produced and must accept both, which is what
419
+ // `bigint-schema-view.ts` documents.
314
420
  effective = copyForDefaults(inputs, input.defaultPaths());
315
421
  try {
316
422
  input.validate(effective);
@@ -325,6 +431,12 @@ export function bindContract(instance: ResourceInstance, binding: ContractBindin
325
431
  } catch (error) {
326
432
  throw contractViolation("outputType", describeTarget, error);
327
433
  }
434
+ // AFTER validation, not before: the validator fills declared defaults,
435
+ // and a default written as a plain YAML number is exactly the leaf that
436
+ // has to come out normalized too. Validation itself is indifferent to
437
+ // which representation arrives (`bigint-schema-view.ts`), so ordering
438
+ // costs nothing there.
439
+ return normalizeDeclaredScalars(result, output.scalarPaths());
328
440
  }
329
441
  return result;
330
442
  };
@@ -339,7 +451,7 @@ export function bindContract(instance: ResourceInstance, binding: ContractBindin
339
451
  } catch (error) {
340
452
  throw contractViolation("outputType", describeTarget, error);
341
453
  }
342
- return result;
454
+ return normalizeDeclaredScalars(result, output.scalarPaths());
343
455
  };
344
456
  }
345
457
  }
@@ -1,4 +1,5 @@
1
1
  import { isCompiledValue } from "@telorun/sdk";
2
+ import { selectUnionBranch } from "@telorun/analyzer";
2
3
 
3
4
  /** Returns a schema-appropriate placeholder value for a CompiledValue field. */
4
5
  function placeholderForSchema(schema: Record<string, unknown>): unknown {
@@ -9,6 +10,19 @@ function placeholderForSchema(schema: Record<string, unknown>): unknown {
9
10
  // author never wrote. Mirrors `celPlaceholderForSchema` in the analyzer, which
10
11
  // performs the same substitution for the static half.
11
12
  if (Array.isArray(schema.enum) && schema.enum.length > 0) return schema.enum[0];
13
+ // A union with no `type` of its own: take the first branch that yields a
14
+ // placeholder, so a whole-field CEL leaf at an `anyOf` slot is not handed the
15
+ // `""` fallback that only a string branch would accept. Mirrors the analyzer's
16
+ // `celPlaceholderForSchema`, which makes the same substitution for the static
17
+ // half — the two must agree or one rejects what the other passes.
18
+ if (schema.type === undefined) {
19
+ const branches = (schema.anyOf ?? schema.oneOf) as Record<string, unknown>[] | undefined;
20
+ if (Array.isArray(branches)) {
21
+ for (const branch of branches) {
22
+ if (branch && typeof branch === "object") return placeholderForSchema(branch);
23
+ }
24
+ }
25
+ }
12
26
  switch (schema.type) {
13
27
  case "integer":
14
28
  case "number":
@@ -113,7 +127,20 @@ export function stripCompiledValues(
113
127
  // that merely appears twice is still stripped both times.
114
128
  const ancestors = new Set<object>();
115
129
 
116
- const walk = (value: unknown, nodeSchema: Record<string, unknown>): unknown => {
130
+ const walk = (value: unknown, rawNodeSchema: Record<string, unknown>): unknown => {
131
+ // A UNION carries no `type` / `items` / `properties` of its own, so descending
132
+ // through one hands every CEL leaf underneath the schema-unaware `""`
133
+ // placeholder — which the branches then reject, reporting violations against
134
+ // a value the author never wrote (`/success/1 must be integer` for a `!cel`
135
+ // inside a list). Resolving the branch first is what lets the leaves be
136
+ // placed. Shared with the analyzer rather than reimplemented: the static and
137
+ // dispatch halves must choose the same branch, or one reports what the other
138
+ // accepts.
139
+ const nodeSchema = selectUnionBranch(
140
+ resolveSchemaRef(rawNodeSchema, root),
141
+ value,
142
+ root as Record<string, any>,
143
+ ) as Record<string, unknown>;
117
144
  const resolved = resolveSchemaRef(nodeSchema, root);
118
145
 
119
146
  if (isCompiledValue(value)) return placeholderForSchema(resolved);