YAML I/O: quote with double quotes, matching Prettier's default - #710
Merged
Conversation
writeYAMLmodel emitted single quotes when a scalar needed quoting (matching ruamel's own default, which raven_toolbox's writer was built against). Switched to double quotes to match Prettier's YAML default instead, since there's no reason to defer to ruamel's choice over a more common convention now that byte-parity with either isn't the constraint --- only staying importable across both toolboxes is. readYAMLmodel stripped a wrapping quote pair but never undid the escaping either style uses inside it (doubled '' for a literal apostrophe in single quotes, backslash escapes for \ and \" in double quotes) --- a latent gap that switching the active quote character exercises for real. Fixed: undo whichever style's escaping was used, with a sentinel-based two-pass unescape for the double-quote case so an escaped backslash immediately followed by an escaped quote (\\\" in the file) round-trips correctly. Verified against a value containing both a literal apostrophe and a literal double quote, wrapped to force quoting: reads back exactly, and survives a further MATLAB read-write-read cycle unchanged.
Merged
5 tasks
Function test results304 tests 277 ✅ 59s ⏱️ Results for commit fc50417. |
This was referenced Aug 28, 2026
edkerk
added a commit
that referenced
this pull request
Aug 28, 2026
…lt" (#713) Reverts the quote-character choice from #710 back to single quotes. writeYAMLmodel emits single quotes when a scalar needs quoting again, exactly as before #710 (verified: byte-identical output to the pre-#710 writer on tutorial/smallYeast.yml, same SHA256). readYAMLmodel's unescaping keeps handling both quote styles (it already did, to read files written either way) and #712's list-item quote-marker-stripping fix is untouched --- that bug affected quoted list items under either quote convention and isn't specific to which character is used, so there's no reason to revert it.
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.
Summary
writeYAMLmodelnow double-quotes a scalar when quoting is required, instead of single-quoting (which matched ruamel's own default, not a deliberate choice). Matches Prettier's YAML default instead — see raven-gecko-parity discussion; byte-parity with any particular tool's default isn't the actual constraint, only staying importable across RAVEN and raven-toolbox is.readYAMLmodelstripped a wrapping quote pair but never undid the escaping either quote style uses inside it — a latent gap (doubled''for single-quoted, backslash\/\"for double-quoted) that switching the writer's active quote character exercises for real. Fixed with a proper unescape pass, including a sentinel-based two-step unescape for double quotes so\\\"in the file (an escaped backslash immediately followed by an escaped quote) round-trips correctly rather than being misread.Test plan
tSyntax,tIO— 15 passed, 0 failed, 1 filtered (unrelated missing dependency)write_yaml_model(paired PR) for the same model: identical SHA256read_yaml_modelon the same probe value recovers the identical text