Replace discontinued serde_yaml with yaml_serde - #46
Merged
Conversation
serde_yaml was discontinued in March 2024, and its unsafe-libyaml backend has been unreleased since. Swap both for yaml_serde and libyaml-rs, the YAML organization's maintained forks. yaml_serde is an API-compatible fork of serde_yaml 0.9.34 whose only substantive changes are no_std support and lint cleanups, so this is behavior-preserving. Verified by diffing the old and new binaries across all 31 test fixtures: every package.yml and package_todo.yml they write is byte-identical, as are their YAML parse error messages. The two emitter workarounds are still required and unchanged: yaml_serde inherits serde_yaml's emitter, which offers no control over scalar quoting style.
dduugg
commented
Aug 17, 2026
joemsak
approved these changes
Aug 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #15.
Replaces
serde_yaml(discontinued March 2024) withyaml_serde, the YAML organization's maintained fork. This also swaps theunsafe-libyamlbackend forlibyaml-rsfrom the same org, whichyaml_serdepulls in transitively.Why
yaml_serdeThe issue asked whether there's something else to consider, so here's what the field looks like now:
yaml_serde0.10.6serde_yaml_ng0.10.0serde_norway0.9.42serde-saphyr1.1.0Valuetypeserde_yaml20.1.3yaml-rust2binding, undocumentedyaml-rust2(suggested in the issue) has no maintained serde layer of its own; the path to it isserde_yaml2, which is 0.1.x and 0% documented.serde_yaml_ngandserde_norwayare both drop-ins, but both are now going stale themselves, so picking either would trade one unmaintained fork for another.yaml_serdeis the only option that is both actively maintained and byte-compatible. I diffed its source againstserde_yaml0.9.34: the only substantive changes areno_stdsupport (std/core/allocimport shuffling), clippy modernization, and thelibyaml-rsswap.src/ser.rsis functionally untouched, so the emitter behaves identically.Verification
Beyond the existing test suite (253 tests, all passing), I built the binary before and after and compared them directly:
update,validate,check, andlint-package-yml-filesover all 31 fixtures intests/fixtures/, then diffed the resulting trees. Everypackage.ymlandpackage_todo.ymlis byte-identical. (lint-package-yml-filesis the interesting one — it rewrites every pack throughserialize_pack.)add-dependency,create, andupdate-dependencies-for-constantacross five fixtures.!!strtags, multiline literals, unicode, empty collections, and scalars that need each quoting style (#hash,&,*star,a: b,'true','123',.inf). Output identical.did not find expected key at line 11 column 5, while parsing a block mapping at line 9 column 1, socorrupt_todo_testand users' diagnostics are unaffected.The only output differences I found between the two binaries were two pre-existing sources of nondeterminism that reproduce on
mainalone:Pack::client_keysis aHashMap, so arbitrary keys inpackage.ymlcan shuffle between runs, and strict-mode violation messages come out in parallel-execution order.What this does not do
The issue also mentions the workarounds. Those stay, unchanged, because
yaml_serdeinheritsserde_yaml's emitter, which offers no control over scalar quoting style:#…#sentinel inpackage_todo.rsthat produces double-quoted constant keysadd_back_necessary_quotesinpack.rsthat re-adds quotes around::-prefixed constantsWorth recording for a follow-up:
serde-saphyrdoes solve this. It exposesDoubleQuoted/SingleQuotedwrapper types, and with no wrappers at all it already emits"::Bar":as a map key and- "::Necessary"in a sequence, which is exactly what the two workarounds hand-roll today. Two things make it a separate change rather than part of this one:Valuetype, whichPack::client_keys: HashMap<String, Value>needs in order to round-trip user-definedpackage.ymlkeys.ignores: - '**/*'becomes- "**/*". That reformats every affectedpackage.ymlin every consumer repo once, which deserves its own decision rather than riding along here.Happy to open a follow-up issue for that if it's worth pursuing.