Test: prove merge_strings crash on nested-dict .strings (stacked on #741)#750
Draft
mokagio wants to merge 1 commit into
Draft
Test: prove merge_strings crash on nested-dict .strings (stacked on #741)#750mokagio wants to merge 1 commit into
mokagio wants to merge 1 commit into
Conversation
`L10nHelper.merge_strings` bookkeeps keys via `plutil` (which parses a
nested-dictionary value fine) but re-tokenizes the raw lines through
`prefix_keys`, which raises `Invalid character` on the `{`.
Such a file is a valid property list, still detected as `:text`, so it
passes the format gate and reaches `prefix_keys` — a public
`ios_merge_strings_files` run that previously copied the line through now
aborts.
This stacks a regression test on top of #741 and is intentionally left
red so the reviewer can decide how to make the path fail-soft (e.g.
rescue and copy the line verbatim, matching the scanner path).
---
Generated with the help of Claude Code, https://claude.com/claude-code
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
Generated by 🚫 Danger |
4 tasks
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.
Stacked on #741 (base =
foundation), intentionally left failing — this is a review artifact, not a fix. It's here so the change tomerge_stringsprefixing is decided with the regression in front of us.The bug it proves
L10nHelper.merge_stringsnow books keys viaplutil(which parses a nested-dictionary value fine) but re-tokenizes the raw lines throughStringsFileValidationHelper.prefix_keys, which raises on the{:A file like
"k" = { a = b; };is a valid property list, soplutil -lintpasses andfilereportsASCII text→strings_file_typereturns:text. It clears the format gate inmerge_strings, reachesprefix_keys, and aborts. Before this PR the line-basedgsubnever raised — it copied such a line through unprefixed. So a publicios_merge_strings_filesrun that used to complete now crashes.This mirrors the fail-soft decision already made on the scanner path (
scan_for_duplicate_keysrescues rather than crash the lane);merge_stringsdidn't get the same treatment.Suggested resolution (reviewer's call)
Rescue the tokenizer in
merge_stringsand copy the line verbatim when it can't be prefixed (nested dicts aren'tkey = valueso there's nothing to prefix anyway), or otherwise skip prefixing that file. Then flip this test's assertion to also check the line survives.Verification
bundle exec rspec spec/ios_l10n_helper_spec.rb -e "nested dictionary"→ 1 example, 1 failure (thenot_to raise_errorabove). The rest of the suite is unaffected by this commit.Opened by Claude (Opus 4.8) on behalf of @mokagio with approval.