Skip to content

Add failing specs for inter-token comments in merge_strings#742

Draft
mokagio wants to merge 2 commits into
foundationfrom
mokagio/merge-strings-inline-comment-tests
Draft

Add failing specs for inter-token comments in merge_strings#742
mokagio wants to merge 2 commits into
foundationfrom
mokagio/merge-strings-inline-comment-tests

Conversation

@mokagio

@mokagio mokagio commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

What does it do?

Adds two failing specs that pin a gap in #741, on which this branch is stacked.

AI-generated details

The duplicate-key scanner and plutil-based bookkeeping both accept .strings comments between a statement's tokens (e.g. CFBundleName /* c */ = WordPress;), but merge_strings' line-based key rewrite only prefixes when = and the value are adjacent. A key behind such a comment is written unprefixed while still bookkept with the prefix — resurfacing the key collisions the prefix exists to prevent. The second spec makes the harm concrete: merging two files that each hide the same key behind a comment collapses to a single key instead of two distinctly-prefixed ones.

The specs are red on purpose — they're the regression net for the fix (tokenizer-unification, or an interim comment-aware rewrite), which is intentionally not in this branch yet.

Heads-up for reviewers

How to test

bundle exec rspec spec/ios_l10n_helper_spec.rb — the two new #merge_strings examples fail; the rest pass.

These specs fail against the current `merge_strings`, pinning a gap left by
PR #741: the duplicate-key scanner and `plutil`-based bookkeeping both accept
`.strings` comments *between* a statement's tokens
(e.g. `CFBundleName /* c */ = WordPress;`), but the line-based key rewrite only
prefixes when `=` and the value are adjacent.
A key behind such a comment is written unprefixed while bookkept *with* the
prefix — resurfacing the very key collisions the prefix exists to prevent, as
the second spec demonstrates by merging two files into a single collapsed key.

---

Generated with the help of Claude Code, https://claude.com/claude-code

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mokagio mokagio self-assigned this Jun 25, 2026
@dangermattic

Copy link
Copy Markdown
Collaborator
1 Warning
⚠️ Please add an entry in the CHANGELOG.md file to describe the changes made by this PR
1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

Assert parsed keys so the regression captures the merge contract without depending on raw output formatting.

---

Generated with the help of Codex, https://openai.com/codex

Co-Authored-By: Codex GPT-5 <noreply@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants