You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
YAML round-trip loses literal data: string "null" becomes '', float/long literals serialize to {} and deserialize to null #83
YamlSerializer (Coder/Serialization/YamlSerializer.cs) loses literal values in two ways.
String literals that look like YAML scalars.SerializeLiteralExpression (~line 842) stores the raw literal.Value and lets the YAML emitter decide whether to quote it. Literal.Text("null") is written as value: null, unquoted, and deserializes as a string literal with value ''. The same risk applies to ~ and to other strings the emitter doesn't quote but the reader interprets as a non-string scalar.
Float and long literals. The serializer's switch (~lines 165-176) only handles LiteralExpression<string|int|bool|double>. Literal.SingleValue(1.5f) and Literal.BigNumberValue(5000000000L) are public helpers (Coder/Ast/LiteralExpression.cs ~100-107), but they serialize as literal<Single>: {} and literal<Int64>: {}. The value is dropped silently, and Deserialize returns null for the node. Every language generator also throws NotSupportedException for these two types, because TryGenerateCommonNode doesn't know about them either.
YAML is the persistence format for ASTs and graphs. Saving and reloading a document silently changes a string constant or deletes a numeric literal, and nothing reports an error.
Suggested fix / acceptance criteria
Always emit string literal values as quoted scalars, or at least quote any value that YAML would parse as null, bool or number.
Either support float/long literals end-to-end (serializer, deserializer, TryGenerateCommonNode), or remove the SingleValue/BigNumberValue helpers so they can't be constructed.
Add round-trip tests for Text("null"), Text("true"), Text("123"), Text("~"), and for float and long literals if they are kept.
Priority: High. YAML is the persistence format for ASTs and graphs. A save and reload silently changes string constants ("null" becomes '') and drops float and long literals, with no error.
Area / suggested owner:Coder/Serialization/YamlSerializer.cs, plus TryGenerateCommonNode if float and long stay supported (maintainer: @matt-edmondson)
Activity
matt-edmondson commentedon Sep 26, 2026
Triage
"null"becomes'') and drops float and long literals, with no error.Coder/Serialization/YamlSerializer.cs, plusTryGenerateCommonNodeif float and long stay supported (maintainer: @matt-edmondson)Generated by Claude Code