Repository navigation
refactor(i18n): re-key native i18n artifacts to content-hash identity (v2) - #123347
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 13, 2026, 9:07 PM ET / August 14, 2026, 01:07 UTC. ClawSweeper reviewWhat this changesThis PR replaces native localization inventory and translation artifacts with content-hash keyed records, regenerates mobile resources, and permits the one-time mixed source/generated migration in CI. Merge readinessKeep open for maintainer review. The review environment could not execute even read-only repository commands ( Priority: P2 Review scores
Verification
How this fits togetherNative source scanners produce a shared inventory and locale artifacts consumed by Android and Apple resource generators. The changed-scope CI guard normally keeps generated locale updates separate from source edits. flowchart LR
A[Native app source] --> B[Localization scanner]
B --> C[Shared inventory]
C --> D[Translation artifacts]
D --> E[Android generator]
D --> F[Apple generator]
E --> G[Android and Wear resources]
F --> H[iOS and macOS catalogs]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +18, Other -470564. Total -470546 across 72 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Complete an exact-head read-only review of extraction, Android generation, Apple generation, CI scope enforcement, and their focused tests, then land only if every consumer accepts the v2 formats and the exception remains owner-complete. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR is a localization-artifact refactor, not a report of an end-user bug. Its claimed no-drift probe could not be independently checked because read-only commands fail in this environment. Is this the best way to solve the issue? Unclear: a canonical content-addressed inventory and translation map is plausible, but source inspection could not verify every generator and CI consumer against the exact PR head. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against e43015146eb4. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
5ef4425 to
b557599
Compare
|
Addressing the ClawSweeper rank-up move ("owner verification of the exact-head generator/artifact-consumer contract after platform checks"):
Maintainer-authorized landing (operator instruction), proceeding with the repo-native land workflow. |
… (v2)
The native inventory stored a write-only 'line' field per entry, so any
unrelated edit above a string rewrote apps/.i18n/native-source.json
(~half of all commits touching it were pure line-number churn). Identity
was (surface, path, source), duplicating the same string per file
(5385 entries for 4187 unique pairs) and churning IDs on file moves.
Locale artifacts were positional arrays repeating full English source
text, so one inserted string rewrote diff spans in all 21 files.
v2 artifacts: inventory entries keyed by (surface, source) with merged
per-site {path, kind} lists and pure sha256 content-hash IDs; locale
files become id-keyed sorted translation maps. Existing translations
carry over by source match with a deterministic duplicate pick; the
sticky-ID reuse machinery and positional validation are deleted.
Everything under apps/.i18n plus generated platform locale artifacts is
marked linguist-generated. ci-changed-scope gains a one-time
owner-complete migration escape mirroring the control-ui precedent.
CLI surface (baseline/check/sync/verify) and the locale-refresh
workflow are unchanged.
Commit e04dfd2 added extensions/codex/src/app-server/run-attempt-state.test.ts without a lane owner, so the full-suite ownership audit (test/vitest-projects-config.test.ts) fails on main. Register it in the attempt-light shard alongside its run-attempt siblings.
b557599 to
1f6c476
Compare
|
Merged via squash.
|
The non-isolated |ui| lane resets the module graph per test file while the jsdom document and customElements registry persist for the whole worker. Three producers leaked across that lifetime mismatch: - github-link-hovercard-registration.ts: each file's module instance adds document-level bootstrap listeners; on the first real focusin every stale instance raced customElements.define -> unhandled NotSupportedError. Guard the define inside the single-flight loader. - app-host.test.ts locale retry asserted through createElement, which serves a sibling graph's shell class bound to a different i18n singleton; construct ShellGatewayOwner directly so spy and callee share one graph. - route-transition.test.ts assigned updateComplete over the real Lit outlet's getter-only accessor when a sibling had registered it; define an own data property instead (byte-identical to the hunk in PR #123347). Adds a boundary regression test reproducing the duplicate-module-instance order; it failed pre-fix with 2 registry defines and the NotSupportedError.
… (v2) (openclaw#123347) * refactor(i18n): re-key native i18n artifacts to content-hash identity (v2) The native inventory stored a write-only 'line' field per entry, so any unrelated edit above a string rewrote apps/.i18n/native-source.json (~half of all commits touching it were pure line-number churn). Identity was (surface, path, source), duplicating the same string per file (5385 entries for 4187 unique pairs) and churning IDs on file moves. Locale artifacts were positional arrays repeating full English source text, so one inserted string rewrote diff spans in all 21 files. v2 artifacts: inventory entries keyed by (surface, source) with merged per-site {path, kind} lists and pure sha256 content-hash IDs; locale files become id-keyed sorted translation maps. Existing translations carry over by source match with a deterministic duplicate pick; the sticky-ID reuse machinery and positional validation are deleted. Everything under apps/.i18n plus generated platform locale artifacts is marked linguist-generated. ci-changed-scope gains a one-time owner-complete migration escape mirroring the control-ui precedent. CLI surface (baseline/check/sync/verify) and the locale-refresh workflow are unchanged. * ci: register run-attempt-state test in its Vitest lane Commit dc41d73 added extensions/codex/src/app-server/run-attempt-state.test.ts without a lane owner, so the full-suite ownership audit (test/vitest-projects-config.test.ts) fails on main. Register it in the attempt-light shard alongside its run-attempt siblings.
The non-isolated |ui| lane resets the module graph per test file while the jsdom document and customElements registry persist for the whole worker. Three producers leaked across that lifetime mismatch: - github-link-hovercard-registration.ts: each file's module instance adds document-level bootstrap listeners; on the first real focusin every stale instance raced customElements.define -> unhandled NotSupportedError. Guard the define inside the single-flight loader. - app-host.test.ts locale retry asserted through createElement, which serves a sibling graph's shell class bound to a different i18n singleton; construct ShellGatewayOwner directly so spy and callee share one graph. - route-transition.test.ts assigned updateComplete over the real Lit outlet's getter-only accessor when a sibling had registered it; define an own data property instead (byte-identical to the hunk in PR openclaw#123347). Adds a boundary regression test reproducing the duplicate-module-instance order; it failed pre-fix with 2 registry defines and the NotSupportedError.
What Problem This Solves
The native app i18n pipeline generates massive PR noise. Over the last 60 days, 1,033 commits touched
apps/.i18n(+838k/−229k lines). Root causes:apps/.i18n/native-source.jsonstored alinefield that nothing consumes — any unrelated edit above a string in a Swift/Kotlin file rewrote the inventory. Classifying the last 40 commits touching it: ~half were pure line-number churn (e.g."line": 102 → 103twice per touched file).(surface, path, source), so the same string in N files produced N entries (5,385 entries for only 4,187 unique surface+source pairs — 1,198 wasted rows duplicated per locale × 21 locales), and file moves churned IDs for zero runtime effect.linguist-generated, so GitHub rendered all of it expanded in review.Why This Change Was Made
The architecture (source-string-as-key extraction, LLM translation, generated platform artifacts) is sound — no off-the-shelf replacement covers Linux-CI extraction for both Apple and Android surfaces. Only the interchange artifact shapes were wrong. This PR re-keys them:
(surface, source)with a pure sha256 content-hash ID and merged, sortedsites: [{path, kind}](preserving the per-site routing the Apple catalog build needs). Nolinefield. The sticky-ID reuse machinery and its suffix-collision loop are deleted — identity is unique by construction.translationsmaps. No repeated source text, no positional coupling. A source edit mints a new ID, so stale translations garbage-collect structurally; the oldexact.source === entry.sourcestaleness check disappears.selectDeterministicTranslation. All 21 locales carried 4,196/4,196 IDs with zero migration fallbacks; no translation API calls needed..gitattributes:apps/.i18n/**and all generated platform locale artifacts (values-* strings.xml, wear, xcstrings, NativeStringResources.kt, InfoPlist.strings) are nowlinguist-generated, collapsing them in PR review.ci-changed-scope.mjsgains a one-time owner-complete migration escape mirroring the existingisControlUiCanonicalMemoryMigrationprecedent, since this PR necessarily mixes source and generated artifacts. Remove after landing.CLI surface (
baseline/check/sync/verify,--locale,--write) is unchanged;native-app-locale-refresh.ymlkeeps working without edits.User Impact
No user-facing behavior change — build tooling and committed artifact shapes only. Developer impact: an unrelated code edit above a string now produces zero i18n diff (verified: inserting a line at the top of
PairingPromptSupport.swift— the exact scenario that motivated this — leavescheckgreen with no drift). Adding one string adds one collapsed inventory block + one line per locale file instead of rewriting spans across 22 files. Interchange artifacts shrink ~60% (source dedup + dropped repeated English text). A side win: previously the per-id positional model let the same source string carry contradictory translations per site; v2 consolidates them deterministically, which zeroed 1,344 iOS / 629 macOS pre-existing translation contradictions reported bycheck.Evidence
node scripts/run-vitest.mjs test/scripts/native-app-i18n.test.ts test/scripts/apple-app-i18n.test.ts test/scripts/android-app-i18n.test.ts src/scripts/ci-changed-scope.native-i18n.test.ts src/scripts/ci-changed-scope.test.ts→ 95 passed. (test/scripts/ci-workflow-guards.test.tshas one pre-existing macOS-only bash-3.2${VAR,,}failure, fails identically on a clean tree.)node --import tsx scripts/native-app-i18n.ts checkandverifygreen on the regenerated artifacts: entries=4196, changed=false, contradictions 0/0.native_*resource names: derived fromsha256(source), not the entry ID — verified zero name churn (1,641 names identical before/after).NativeStringResources.ktbyte-identical.PairingPromptSupport.swift→checkpasses with no inventory drift; string-add probe produces exactly one new entry block.gpt-5.6-sol, high) on the code surface: clean, no actionable findings.Red-main fix carried in this PR
Commit
e04dfd26e23onmainaddedextensions/codex/src/app-server/run-attempt-state.test.tswithout registering it in a Vitest lane, so the full-suite ownership audit (test/vitest-projects-config.test.ts—checks-node-compact-large-4) fails on currentmain. Per repo policy the landing PR fixes the breakage: the test is registered in theattempt-lightshard next to itsrun-attempt-*siblings. Proof: ownership audit missing count 1 → 0 with the one-line lane change.