ADR 0045: Reject duplicate YAML mapping keys
- Status: Accepted
- Date: 2026-11-29
Context
Section titled “Context”Marshal only deserializes YAML, but its previous parser depended on the unmaintained
unsafe-libyaml crate. A replacement must preserve the meaning of policy values, including
untyped values used in MCP argument constraints.
Decision
Section titled “Decision”Use the deserialization-only build of serde-saphyr through a shared marshal-config
entry point, including the early env_file read. Use compatibility settings for scalar
inference and leave << literal. Reject duplicate mapping keys rather than silently keeping
one value in an arbitrary map. Report parse locations without retaining input text in errors.
Alternatives considered
Section titled “Alternatives considered”noyalib-serde-yaml matched the old duplicate-key behavior in the comparison corpus.
yaml_serde did too, but retains a backend transpiled from C with unsafe Rust. Preserving
last-value-wins would make migration easier for some files but leaves ambiguous policy input.
Consequences
Section titled “Consequences”Existing files that use duplicate mapping keys must be corrected. Parse diagnostics omit rejected values and may be less specific, but cannot echo configuration values through the underlying parser error. Compatibility tests cover policy-sensitive scalars, not every YAML construct.