fix(bundler): dump_yaml writes literal UTF-8 (allow_unicode=True)#3660
Open
jawwad-ali wants to merge 1 commit into
Open
fix(bundler): dump_yaml writes literal UTF-8 (allow_unicode=True)#3660jawwad-ali wants to merge 1 commit into
jawwad-ali wants to merge 1 commit into
Conversation
dump_yaml called yaml.safe_dump without allow_unicode=True, so non-ASCII content was written as \xNN / \uXXXX escapes instead of literal UTF-8 — a round-trip readability loss for bundle config. The centralized helper _utils.dump_frontmatter and the extensions/presets config writers all pass allow_unicode=True; align dump_yaml with them. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
dump_yaml(bundler/lib/yamlio.py) calledyaml.safe_dumpwithoutallow_unicode=True, so any non-ASCII content was written as\xNN/\uXXXXescape sequences instead of literal UTF-8 — e.g.café-münchenbecame"caf\xE9-m\xFCnchen"in the file. That's a round-trip readability loss for any bundle config carrying accented or non-Latin text.Why it matters
The centralized frontmatter helper
_utils.dump_frontmatterexplicitly passesallow_unicode=Trueand documents it so "no call site can silently drop" unicode, and the extensions/presets config writers (extensions/_commands.py,presets/_commands.py) all do the same.dump_yamlwas the outlier.Fix
Add
allow_unicode=Trueto thesafe_dumpcall, matching the sibling writers.Tests
tests/unit/test_bundler_yamlio.py:test_dump_yaml_preserves_unicode— asserts literalcafé-münchen/例えin the output and no\x/\uescapes (fails before the fix)test_dump_yaml_round_trips_unicode—load_yaml(dump_yaml(...))round-tripsruffclean.AI-assisted: authored with Claude Code. Verified against the
dump_frontmatter/ extensions / presets sibling writers and confirmed fail-before/pass-after.