Repository navigation
fix(i18n): stop parallel native PRs from conflicting in the string inventory - #163330
Conversation
…ventory
The generated native inventory stored one line per string with every
extraction site inline, sorted alphabetically. Two PRs reusing a string
("Retry") both rewrote its line, and a feature's new strings ("Group by",
"Group chat") landed in the same insertion gap, so parallel native PRs
conflicted in apps/.i18n/native-source.json and needed a rebase plus a
full CI rerun.
Inventory v3 writes one line per extraction site, clustered by source
file, with clusters ordered by a hash of the path so new sibling files do
not share a gap. Each row's position depends only on its own content, so
independent edits merge cleanly (including GitHub's server-side merge)
and the merged text equals a fresh baseline. The new
scripts/native-i18n-inventory.ts owns serialization and parsing; the
generator, Android/Gradle and Apple readers migrate to it together and
receive the same entries in the same order as before.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 2, 2026, 11:39 AM ET / 15:39 UTC (Revision 3). ClawSweeper reviewWhat this changesThe PR stores native translation strings by extraction site and updates Android, Apple, build inputs, and CI routing to reduce conflicts between independent native changes. Merge readiness✅ Ready for maintainer review The PR remains useful: current main still uses the conflict-prone v2 inventory. The coordinated reader cutover preserves existing inventory contents, and the supplied real-generator merge evidence supports the improvement. No actionable correctness or security findings remain. Priority: P2 Review scores
Verification
How this fits togetherNative localization tooling extracts strings from app source into a committed inventory. Android and Apple readers combine that inventory with translations to produce platform resources, while CI checks inventory consistency. flowchart TD
A[Native app source] --> B[String extraction]
B --> C[Site-based inventory]
C --> D[Git merge and CI verification]
C --> E[Platform localization readers]
F[Existing translations] --> E
E --> G[Android and Apple resources]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +84, Config +2, Other +1252. Total +1338 across 13 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Use one site-based inventory owner while preserving stable translation IDs, platform projections, and baseline regeneration. Do we have a high-confidence way to reproduce the issue? Yes: the supplied real-generator two-branch replay establishes the v2 conflict and clean v3 result, and the inspected regression captures that trigger. This reviewer did not execute target code. Is this the best way to solve the issue? Yes: the shared format owner preserves existing entries and migrates every discovered reader together, avoiding a GitHub-incompatible custom merge driver or hundreds of inventory files. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 93e27de58fb2. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
…ring-5d45d6 # Conflicts: # apps/.i18n/native-source.json
|
Merged via squash auto-merge.
|
…ventory (openclaw#163330) The generated native inventory stored one line per string with every extraction site inline, sorted alphabetically. Two PRs reusing a string ("Retry") both rewrote its line, and a feature's new strings ("Group by", "Group chat") landed in the same insertion gap, so parallel native PRs conflicted in apps/.i18n/native-source.json and needed a rebase plus a full CI rerun. Inventory v3 writes one line per extraction site, clustered by source file, with clusters ordered by a hash of the path so new sibling files do not share a gap. Each row's position depends only on its own content, so independent edits merge cleanly (including GitHub's server-side merge) and the merged text equals a fresh baseline. The new scripts/native-i18n-inventory.ts owns serialization and parsing; the generator, Android/Gradle and Apple readers migrate to it together and receive the same entries in the same order as before.
What Problem This Solves
Fixes: native app PRs that land in parallel conflict in the generated string inventory
apps/.i18n/native-source.json, even when they touch different source files.On 2026-10-01 four native macOS sidebar PRs landed in parallel. #163165, #163164 and #163193 each hit a real conflict in that file after the previous one landed, which forced a rebase plus a full CI rerun of 25–34 minutes each. #163164 needed two extra runs.
User Impact
No user-visible change. Native developers can land independent PRs that add or reuse strings without inventory conflicts. CI still requires the committed inventory to equal a fresh
pnpm native:i18n:baseline.One-time cost: open PRs that already changed the v2 inventory will conflict once after this lands. To resolve, take either side and rerun
pnpm native:i18n:baseline, which now overwrites any older or conflicted file instead of refusing to read it.Why This Change Was Made
The v2 inventory stored one line per string, with every extraction site inline, sorted alphabetically. That line depends on every file that uses the string, so two PRs reusing "Retry" both rewrote it. Alphabetical order also put a feature's new strings ("Group by", "Group chat") into the same insertion gap. Replaying the sidebar PRs showed exactly these shapes, plus both PRs adding the same new string ("Project") with different sites.
Inventory v3 writes one line per extraction site, clustered by source file. The clusters are ordered by sha256(path), so new sibling files in the same directory don't share a gap. Each row's position depends only on its own content. Git, including GitHub's server-side merge-ort, therefore merges independent edits cleanly, and the merged text is byte-identical to a fresh baseline. The new
scripts/native-i18n-inventory.tsowns serialization and parsing. The generator, the Android/Gradle reader and the Apple reader all move to it in this PR. The parser returns the same entries, in the same order, as v2 did, so Android and Apple projections are unchanged by construction.Options considered:
.gitattributes. A custom driver needsmerge.<name>.driverin Git config, which GitHub's server-side merge does not run, so PRs would still show as conflicting. It would only help local rebases. The built-inmerge=uniondriver on the v2 layout produced output that differs from a fresh baseline in all three conflicting sidebar pairs: lines out of order, and a duplicate "Project" id. That turns conflicts intoverifyfailures.resource-string-only entries. Apple selects iOS vs macOS catalog entries by site path prefix and kind, and maps InfoPlist ids throughplist-stringsites.Evidence
Scripted two-branch merge with the real generator. Each branch adds a new macOS view that reuses "Retry", adds an alphabetically adjacent new label, and adds the same new shared label. Each branch runs
baseline --writeand commits. Thengit merge-tree --write-tree(GitHub's merge-ort) and a realgit merge:merge-treegit mergeHistory replay through the shipped serializer. Every commit's inventory delta is re-applied to the prior commit's parent, then merged with
git merge-file --diff-algorithm=histogram:14 of the 21 remaining v3 conflicts are pairs where both commits changed strings in the same source file. The other 7 are new or edited files landing in the same hash gap. The replay also reported 4 clean merges that differed from the expected result; these are dependent commit pairs where the later commit removed a row the earlier one added, not independent PRs.
Checks:
node --import ./scripts/tsx.mjs scripts/native-app-i18n.ts verify: pass.Parsing the v3 file gives 4,443 entries that are deep-equal to the v2 entries, in the same order.
serialize(parse(file))round-trips byte-for-byte. Plainnodeloads the module, which is how Gradle runsandroid-app-i18n.ts.native:i18n:checkfails identically on main and on this branch: 1,554 missing translations (74 strings × 21 locales) from the sidebar PRs, waiting for the locale refresh workflow. CI runs this strict check only when generated artifacts change; this PR changes none.Each touched test file passed with
node scripts/run-vitest.mjs run <file> --maxWorkers=1:test/scripts/native-app-i18n.test.tstest/scripts/android-app-i18n.test.tstest/scripts/apple-app-i18n.test.tstest/scripts/ci-workflow-native-generated.test.tssrc/scripts/ci-changed-scope.native-i18n.test.tsThe new merge regression test fails against a temporary v2 serializer, with the Group by/Group chat, Project and Retry conflict, and passes on v3. It spawns one
git merge-file, no timers.oxfmt, scoped oxlint,
check-script-erasabilityandcheck-coercion-helpers: pass.node scripts/check-changed.mjs --base origin/mainon Blacksmith Testboxtbx_01m3xm1hsg7sk3k52eh952wmvk(Actions run): exit 0 in 34m45s. Every lane passed: typecheck (core tests, scripts, test root), lint (core, scripts, test root, Android ktlint), ratchets, format, dead-export scan and plugin boundaries.Codex autoreview: scoped-clean, no findings.
Measured cost: inventory size 1,047,724 → 1,094,389 bytes (+4.5%), 4,448 → 5,632 lines.
baseline --writetakes 1.7 s andverify2.3–3.1 s, unchanged.Release-note context: internal native i18n tooling. No user-visible behavior change and no changelog entry.