JSON bigint serialization cannot roundtrip through from_string/from_json
On 0.18.1-nightly.20260909.a, the JSON encoder accepts a class with a bigint field, but the strict decoder cannot read its own output. This blocks persistence/reload of timestamped workflow results.
Minimal Linux x86_64 reproduction, no model or network needed:
class Record { elapsed_ms: bigint }
function main() -> Record {
let value = Record { elapsed_ms: 12n };
let encoded = baml.json.to_string(value);
baml.json.from_string<Record>(encoded)
}Save as repro.baml and run:
BAML_VERSION=0.18.1-nightly.20260909.a baml run --file repro.baml --output-format jsonExpected: roundtrip Record { elapsed_ms: 12n }. Actual:
uncaught throw: baml.json.DecodeError {
message: "bigint JSON decoding not yet implemented",
path: ".elapsed_ms"
}baml.sap.parse<Record>(encoded) succeeds, but SAP is permissive and should not silently coerce persisted telemetry. Our temporary application workaround uses SAP, then refuses the reload unless serializing the decoded class exactly equals the canonical input JSON. We verified that an added unknown field is rejected by that guard.
The standard time APIs return bigint millisecond values, making this a natural workflow persistence shape. Please support the encoder's bigint representation in strict from_string/from_json, or document the unsupported roundtrip explicitly. This is separate from arithmetic runtime issues #4813/#4814.
Source: BoundaryML/baml