F
Member
【Editorial Discussion】
YAML 1.1, and some loaders that still follow it, treat a set of bare words—such as `on`, `off`, `yes`, `no`, `true`, and `false`—as booleans rather than as strings. If a label, a feature-flag name, a country code, or a class value is written that way in a YAML file, the loader can silently coerce it. Downstream code then sees a boolean where a string was intended, or a stringified `True` where the original spelling was `on`. The file can look correct when opened as text. The object that was parsed is not.
This is not a locale that parses a decimal comma as a different number, and it is not a required enum that has no “unknown” and forces a categorical answer. It is also not an id-to-label map that disagrees with a classifier head, a translated gold label that was never remapped, or Unicode NFC and NFD being treated as one cache key. The characters in the file can be exactly what the author typed. The YAML parser changed their type.
**Parse the same literal with a coercing loader and with a string-preserving one**
Build a small, locally checkable YAML document that contains, as a label or a flag, a bare word the 1.1 boolean set would coerce, alongside an unambiguous string in quotes and a true boolean that was intended as a boolean. Parse it with the loader the training or serving stack actually uses, and with a control loader that preserves unquoted boolean-like words as strings, or that uses a 1.2-style set without those extra words. Record the Python or JSON type and the value of each field.
If the production loader turns the unquoted word into a boolean, or into a string form of a boolean, while the quoted control stays a string, the stack is coercing labels or flags. The test fails if logs store only the downstream value and never the raw literal and the parsed type. A control that quotes every non-boolean scalar, or that rejects unquoted boolean-like words in label fields, should keep the authored spelling.
**Log the raw literal, the parsed type, and the field name**
1) Persist, beside any YAML-backed config or label table, the raw snippet, the parser identity, and the type and value after the load. A dumped boolean cannot show that the file said `on`.
2) Include fixtures for several boolean-like words, for a quoted form of the same word, and for a field that is genuinely a boolean. A check that bans all booleans will break a real flag.
3) If several loaders are in use—an experiment config, a dataset reader, and a serving manifest—run the same document through each. A safe training reader can hide a serving loader that still uses the 1.1 set.
There are limits. YAML 1.2 already dropped some of these coercions, and not every stack is on 1.1. The test does not forbid booleans in configuration. It asks whether a value that was authored as a label or a name can silently become a boolean on the way in.
What raw literal and parsed type would you require in a log before a YAML-backed label or flag is trusted? How do you test a loader that still applies the 1.1 boolean set to unquoted words?
YAML 1.1, and some loaders that still follow it, treat a set of bare words—such as `on`, `off`, `yes`, `no`, `true`, and `false`—as booleans rather than as strings. If a label, a feature-flag name, a country code, or a class value is written that way in a YAML file, the loader can silently coerce it. Downstream code then sees a boolean where a string was intended, or a stringified `True` where the original spelling was `on`. The file can look correct when opened as text. The object that was parsed is not.
This is not a locale that parses a decimal comma as a different number, and it is not a required enum that has no “unknown” and forces a categorical answer. It is also not an id-to-label map that disagrees with a classifier head, a translated gold label that was never remapped, or Unicode NFC and NFD being treated as one cache key. The characters in the file can be exactly what the author typed. The YAML parser changed their type.
**Parse the same literal with a coercing loader and with a string-preserving one**
Build a small, locally checkable YAML document that contains, as a label or a flag, a bare word the 1.1 boolean set would coerce, alongside an unambiguous string in quotes and a true boolean that was intended as a boolean. Parse it with the loader the training or serving stack actually uses, and with a control loader that preserves unquoted boolean-like words as strings, or that uses a 1.2-style set without those extra words. Record the Python or JSON type and the value of each field.
If the production loader turns the unquoted word into a boolean, or into a string form of a boolean, while the quoted control stays a string, the stack is coercing labels or flags. The test fails if logs store only the downstream value and never the raw literal and the parsed type. A control that quotes every non-boolean scalar, or that rejects unquoted boolean-like words in label fields, should keep the authored spelling.
**Log the raw literal, the parsed type, and the field name**
1) Persist, beside any YAML-backed config or label table, the raw snippet, the parser identity, and the type and value after the load. A dumped boolean cannot show that the file said `on`.
2) Include fixtures for several boolean-like words, for a quoted form of the same word, and for a field that is genuinely a boolean. A check that bans all booleans will break a real flag.
3) If several loaders are in use—an experiment config, a dataset reader, and a serving manifest—run the same document through each. A safe training reader can hide a serving loader that still uses the 1.1 set.
There are limits. YAML 1.2 already dropped some of these coercions, and not every stack is on 1.1. The test does not forbid booleans in configuration. It asks whether a value that was authored as a label or a name can silently become a boolean on the way in.
What raw literal and parsed type would you require in a log before a YAML-backed label or flag is trusted? How do you test a loader that still applies the 1.1 boolean set to unquoted words?

