@ai-matrx/content-ir 0.10.0 → 0.10.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.2 — 2026-08-30
4
+
5
+ **Bug fix — `nullable` is a FIELD law, not a scalar law.** `validateFinalFieldValue`
6
+ consulted `nullable` only on scalar-shaped fields and `json[]`. Every other branch
7
+ (`object`, `inline_object`, `record`, `array`, `string[]`/`number[]`/`boolean[]`)
8
+ opened with a shape check that reads `null` as a type violation and returned an error
9
+ before `nullable` was ever looked at — so a field a kind legitimately declares
10
+ nullable, whose value is genuinely `null`, failed validation and degraded the WHOLE
11
+ instance to `kindState: "raw"`, rendering through the `generic_structured` fallback.
12
+ Reproduced live on `lulu_print_job` (`costs: null`, `estimated_shipping_dates: null`).
13
+
14
+ `nullable` now short-circuits at the top of `validateFinalFieldValue` for every field
15
+ type, and the same law was applied to the streaming placement path
16
+ (`validateValueAgainstField`), where a `null` arrives as a scalar token and every
17
+ shape check would equally have rejected it — the sibling of the same defect. Messages
18
+ for non-nullable nulls are unchanged. Guard: three cases in
19
+ `__tests__/kind-parser.test.ts` (all five shapes null on a nullable field stays typed;
20
+ chunking-invariant so the streaming path is covered; a null on a NON-nullable field
21
+ still degrades), proven failing on the unfixed parser before the fix landed.
22
+
23
+ ### Consumer action
24
+
25
+ None required — this only widens what validates. Kinds that were declared `json` with
26
+ a comment to work around this bug (matrx-frontend `features/content-ir/kinds/print-kinds.ts`)
27
+ can go back to their true `object` / `inline_object` / `record` type with
28
+ `nullable: true`, and the ~23 existing sites already declaring `nullable: true` on an
29
+ object-shaped field stop being latent bugs.
30
+
3
31
  ## 0.10.0 — 2026-08-30
4
32
 
5
33
  **Non-breaking.** Every existing `@ai-matrx/content-ir` import keeps working
package/dist/core.cjs CHANGED
@@ -1654,9 +1654,10 @@ var KindStreamParser = class {
1654
1654
  }
1655
1655
  validateFinalFieldValue(fieldSchema, value, fieldName, objectKind) {
1656
1656
  if (fieldSchema.type === "json") return null;
1657
+ if (value === null && fieldSchema.nullable === true) return null;
1657
1658
  if (fieldSchema.type === "json[]") {
1658
1659
  if (value === null) {
1659
- return fieldSchema.nullable ? null : `Field "${fieldName}" on kind "${objectKind}" cannot be null.`;
1660
+ return `Field "${fieldName}" on kind "${objectKind}" cannot be null.`;
1660
1661
  }
1661
1662
  if (!Array.isArray(value)) {
1662
1663
  return `Field "${fieldName}" on kind "${objectKind}" must be an array.`;
@@ -1753,6 +1754,7 @@ var KindStreamParser = class {
1753
1754
  if (fieldSchema.type === "json") {
1754
1755
  return null;
1755
1756
  }
1757
+ if (value === null && fieldSchema.nullable === true) return null;
1756
1758
  if (fieldSchema.type === "array" || fieldSchema.type === "json[]") {
1757
1759
  return valueKind === "array" ? null : `Field "${fieldName}" must be an array.`;
1758
1760
  }