Skip to content

refactor(i18n): re-key native i18n artifacts to content-hash identity (v2) - #123347

Merged
steipete merged 2 commits into
mainfrom
steipete/jovial-jemison-cce145
Aug 14, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/jovial-jemison-cce145

Conversation

@steipete

@steipete steipete commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • Every inventory entry in apps/.i18n/native-source.json stored a line field 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 → 103 twice per touched file).
  • Identity was (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.
  • Locale artifacts were positional arrays repeating the full English source per row and order-coupled to the inventory: one inserted string rewrote diff spans in all 21 ~800KB files.
  • None of the generated artifacts were marked 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:

  • Inventory v2: entries keyed by (surface, source) with a pure sha256 content-hash ID and merged, sorted sites: [{path, kind}] (preserving the per-site routing the Apple catalog build needs). No line field. The sticky-ID reuse machinery and its suffix-collision loop are deleted — identity is unique by construction.
  • Locale artifacts v2: id-keyed, key-sorted translations maps. No repeated source text, no positional coupling. A source edit mints a new ID, so stale translations garbage-collect structurally; the old exact.source === entry.source staleness check disappears.
  • Migration: one-time carry-over matches v1 translations by source per surface (v1 IDs encode the surface), with the deterministic duplicate pick reused from 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 now linguist-generated, collapsing them in PR review.
  • CI: ci-changed-scope.mjs gains a one-time owner-complete migration escape mirroring the existing isControlUiCanonicalMemoryMigration precedent, 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.yml keeps 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 — leaves check green 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 by check.

Evidence

  • Focused suites green: 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.ts has one pre-existing macOS-only bash-3.2 ${VAR,,} failure, fails identically on a clean tree.)
  • node --import tsx scripts/native-app-i18n.ts check and verify green on the regenerated artifacts: entries=4196, changed=false, contradictions 0/0.
  • Migration stats: 5,385 → 4,196 entries (1,203 duplicate rows removed); every locale carried all 4,196 IDs; migration source-fallbacks: 0.
  • Android native_* resource names: derived from sha256(source), not the entry ID — verified zero name churn (1,641 names identical before/after). NativeStringResources.kt byte-identical.
  • Production LOC: scripts net +14 (+257/−243; the +28-line one-time CI migration escape is removed after landing, leaving the steady state net-negative). Tests net −445.
  • Line-shift probe: inserted a line at the top of PairingPromptSupport.swift → check passes with no inventory drift; string-add probe produces exactly one new entry block.
  • Codex autoreview (gpt-5.6-sol, high) on the code surface: clean, no actionable findings.

Red-main fix carried in this PR

Commit e04dfd26e23 on main added extensions/codex/src/app-server/run-attempt-state.test.ts without 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 current main. Per repo policy the landing PR fixes the breakage: the test is registered in the attempt-light shard next to its run-attempt-* siblings. Proof: ownership audit missing count 1 → 0 with the one-line lane change.

@clawsweeper

clawsweeper Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review August 13, 2026 22:26
@openclaw-barnacle openclaw-barnacle Bot added app: android App: android app: ios App: ios app: macos App: macos scripts Repository scripts app: wearos App: wearos size: XL maintainer Maintainer-authored PR labels Aug 13, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels Aug 13, 2026
@clawsweeper

clawsweeper Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 13, 2026, 9:07 PM ET / August 14, 2026, 01:07 UTC.

ClawSweeper review

What this changes

This 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 readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for maintainer review. The review environment could not execute even read-only repository commands (bwrap: loopback: Failed RTM_NEWADDR), so the v2 generator/consumer and CI-exception contracts could not be independently verified; likely related person: steipete (low confidence, current migration contributor).

Priority: P2
Reviewed head: 1f6c476b3dad5098f3f823bc3794d51932090fc4

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The supplied validation is substantial, but an environment failure prevented independent exact-head source and test review.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The repository state identifies this as a maintainer-authored PR; the body nevertheless records exact-head generator and artifact-check evidence.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The repository state identifies this as a maintainer-authored PR; the body nevertheless records exact-head generator and artifact-check evidence.
Evidence reviewed 4 items Inspection infrastructure failure: The read-only command intended to inspect the repository policy and source failed before producing repository output: bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted. No source, history, test, or exact-head claim below relies on unperformed local inspection.
Artifact-format boundary: The supplied PR diff changes native inventory entries from per-site records to entries with sites, and locale artifacts from entries arrays to translations maps; Android and Apple generators therefore need exact-head contract verification.
CI migration allowance: The supplied diff adds a one-time native v2 generated-artifact exception to changed-scope enforcement, which is an automation-sensitive behavior change.
Findings None None.
Security None None.

How this fits together

Native 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]
Loading

Before merge

  • Resolve merge risk (P1) - The migration changes checked-in interchange formats and the CI isolation rule, but the exact-head producer/consumer contract and one-time exception boundary were not independently verifiable in this environment.
  • Complete next step (P2) - A functioning exact-head inspection environment is needed to evaluate the compatibility and CI-boundary risks; this protected maintainer item is not a repair-dispatch candidate.
Agent review details

Security

None.

PR surface

Tests +18, Other -470564. Total -470546 across 72 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 5 34 16 +18
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 67 128979 599543 -470564
Total 72 129013 599559 -470546

Review metrics

Metric Value Why it matters
Production versus test delta claimed production +14 after the temporary CI allowance is removed; tests -445 The PR body reports net production growth despite a cleanup goal, so source review should confirm the retained boundary is necessary.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/scripts/ci-changed-scope.native-i18n.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Re-establish exact-head contract evidence (recommended)
    Run the focused generator, artifact check/verify, and changed-scope tests in a functioning review environment before merging this persisted-artifact migration.

Technical review

Best 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.

Labels

Label justifications:

  • P2: This is a broad internal localization-artifact migration with limited direct user impact but meaningful build and maintenance consequences.
  • merge-risk: 🚨 compatibility: The inventory and locale-artifact representations change across extraction and multiple platform generators.
  • merge-risk: 🚨 automation: The PR modifies changed-scope CI enforcement to allow a one-time mixed source/generated migration.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository state identifies this as a maintainer-authored PR; the body nevertheless records exact-head generator and artifact-check evidence.

Evidence

What I checked:

  • Inspection infrastructure failure: The read-only command intended to inspect the repository policy and source failed before producing repository output: bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted. No source, history, test, or exact-head claim below relies on unperformed local inspection.
  • Artifact-format boundary: The supplied PR diff changes native inventory entries from per-site records to entries with sites, and locale artifacts from entries arrays to translations maps; Android and Apple generators therefore need exact-head contract verification. (scripts/native-app-i18n.ts, 1f6c476b3dad)
  • CI migration allowance: The supplied diff adds a one-time native v2 generated-artifact exception to changed-scope enforcement, which is an automation-sensitive behavior change. (scripts/ci-changed-scope.mjs, 1f6c476b3dad)
  • Provided exact-head validation claim: The PR discussion reports exact-head check and verify success plus platform/scope checks, but this review could not independently inspect logs or execute the commands. (1f6c476b3dad)

Likely related people:

  • steipete: The available PR context attributes both current commits to steipete; current-main feature history could not be inspected because repository commands failed. (role: recent area contributor; confidence: low; commits: 5239eccb48a8, 1f6c476b3dad; files: scripts/native-app-i18n.ts, scripts/android-app-i18n.ts, scripts/apple-app-i18n.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Re-run the exact-head generator, artifact check/verify, and changed-scope review in a functioning read-only environment.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-08-13T22:29:46.766Z sha e580229ad9aaa75bc61feebf0e30c7694b01c401 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-13T23:10:24.400Z sha b557599 :: needs maintainer review before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added the app: web-ui App: web-ui label Aug 13, 2026
@steipete
steipete force-pushed the steipete/jovial-jemison-cce145 branch from 5ef4425 to b557599 Compare August 13, 2026 23:05
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels Aug 13, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Addressing the ClawSweeper rank-up move ("owner verification of the exact-head generator/artifact-consumer contract after platform checks"):

  • All platform and scope checks are now green on exact head b5575997fc4 (android, ios-build, macos-swift after an unrelated-flake rerun — the two failing Swift tests are timing-sensitive process/probe tests untouched by this PR, which changes no Swift source).
  • Consumer-contract proof on the exact head: native:i18n:verify + check green (entries=4196, contradictions 0/0); Android native_* resource names byte-stable (1,641 identical — derived from sha256(source), not the re-keyed entry id); NativeStringResources.kt unchanged; wear/thirdParty/InfoPlist artifacts regenerate identically.
  • CI escape narrowness: isNativeCanonicalV2Migration requires all eight owner files present and every generated path inside the fixed migration surface; the new test proves an added out-of-surface generated path (e.g. NativeStringResources.kt) still throws. Marked one-time; removal after landing.

Maintainer-authorized landing (operator instruction), proceeding with the repo-native land workflow.

@steipete steipete self-assigned this Aug 14, 2026
… (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.
@steipete
steipete force-pushed the steipete/jovial-jemison-cce145 branch from b557599 to 1f6c476 Compare August 14, 2026 01:03
@openclaw-barnacle openclaw-barnacle Bot removed the app: web-ui App: web-ui label Aug 14, 2026
@steipete
steipete merged commit edf1777 into main Aug 14, 2026
232 of 234 checks passed
@steipete
steipete deleted the steipete/jovial-jemison-cce145 branch August 14, 2026 02:39
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Aug 14, 2026
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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 14, 2026
… (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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 14, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android app: ios App: ios app: macos App: macos app: wearos App: wearos maintainer Maintainer-authored PR merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant