Skip to content

fix(mobile): localize agent mode badges on profile agent rows - #8168

Merged
iscekic merged 3 commits into
mainfrom
drain/localize-agent-mode-badges
Oct 22, 2026
Merged

iscekic merged 3 commits into
mainfrom
drain/localize-agent-mode-badges

Conversation

@iscekic

@iscekic iscekic commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

What changed

ProfileAgentsScreen rendered the raw config value as the mode badge, so a translated screen read PRIMARY / SUBAGENT / ALL in English next to Hindi row copy.

  • profile-agents-model.ts now exports AGENT_VISIBILITY_LABEL_KEYS, typed satisfies Record<AgentVisibility, string> so a future mode fails the typecheck instead of falling back to the raw enum.
  • The badge renders t(AGENT_VISIBILITY_LABEL_KEYS[visibility]), keeping the existing uppercase tracking-wide styling.
  • New catalog keys profiles.agents.modePrimary / modeSubagent / modeAll ("Primary only" / "Subagent only" / "All modes") in en.json and all 86 locale catalogs. Short labels, not the add-sheet picker copy, which carries an explanatory suffix and would be too long for the row badge; the picker is unchanged.
  • AgentRowViewProps.visibility tightened from string to AgentVisibility.

Branch state: main is merged into the branch as a merge commit. The only conflict was in four locale catalogs whose visibility* copy main retranslated; those files take main's strings and keep the three new mode* keys (the modeSubagent values were aligned with main's newly chosen term for "subagent" in Finnish, Hungarian and Thai).

Verification

  • node tools/i18n/check-catalogs.mjs → check-catalogs: 87 languages, every catalog matches en.json

  • pnpm --filter kilo-app run check:i18n, run typecheck, run lint → clean

  • vitest run (both mobile projects) on the merged head → 1246 files, 18491 tests passed

  • New profile-agents-screen.mounted.test.tsx mounts the screen with the hi catalog and three agents (primary / subagent / all), asserting the badge text is the Hindi label and never the raw mode. It fails on the pre-change screen and passes after. main moved this screen onto TabScreenScrollView, so the suite mocks that wrapper the way the other screen suites do; without it the real react-native module graph is parsed and the suite cannot load.

  • Android emulator, local dev stack, fake account (kilo-drain-badge-*@example.com), profile seeded with one agent per mode, app language हिन्दी, run on the merged head:

    Before: PRIMARY ONLY / SUBAGENT ONLY / ALL MODES
    After: केवल प्राथमिक / केवल सबएजेंट / सभी

    Screenshot attached in the next comment.

The change touches no iOS-specific code (Platform, safe areas, keyboard, native modules), so the Android emulator is the required proof; the rendering path is shared Text. The iOS lane gate refuses a lease for this branch for the same reason, so the emulator run is the end-to-end proof for the badge.

Proxy answers

The owner's proxy gave these answers in the owner's place.

  1. Question: Badge copy: The picker labels carry explanatory suffixes ("Primary — shown in the picker" / "प्राथमिक - पिकर में दिखाया गया है"). The work-item brief says to map each mode to 'the same localized labels the add sheet uses'. Reusing those verbatim would make each badge very long. Which copy should the badge use?
    Answer: Short keys, no suffix
    Confidence: 0.80 · Precedent: UX and design quality: remove redundant copy and keep badges right-sized; session a247f3c19b1e asked to remove the redundant "context" copy. Localize every string: session dcb3f9170164 "the mobile app always must respect i18n"
  2. Question: Uppercase: The badge currently applies uppercase CSS. Keep it for the localized labels?
    Answer: Keep styling (Recommended)
    Confidence: 0.75 · Precedent: Keep similar elements consistent across surfaces; session a247f3c19b1e asked that the thought row match the tool call row
  3. Question: Copy: Badge copy for the three visibility modes. The picker keeps its long explanatory labels ("Primary — shown in the picker"); the badge needs the short form. The i18n checker forbids two keys holding identical English, and "All"/"Subagent" already exist elsewhere.
    Answer: Primary only / Subagent only / All modes
    Confidence: 0.55 · Precedent: Engineering conventions: prefer existing tooling over workarounds. Precision and consistency come from UX rules: 'Keep similar elements consistent across surfaces' (session a247f3c19b1e). This option keeps the i18n checker strict and needs no registry exemptions.
  4. Question: Default badge: Should the default primary mode still render a badge?
    Answer: Show on every row
    Confidence: 0.70 · Precedent: UX: 'Keep similar elements consistent across surfaces' (session a247f3c19b1e). The brief expects a localized badge on every agent row.
  5. Question: Test depth: Regression coverage for this copy fix?
    Answer: Mapping test + mounted Hindi test
    Confidence: 0.55 · Precedent: Proof: 'we want to catch errors in PRs, as early as possible' (session 99e88001c4b4). Run only the targeted tests locally, and still verify on iOS in Hindi end to end with screenshots uploaded to the PR.

The row rendered the raw config value, so a translated screen showed PRIMARY or SUBAGENT in English. Map each mode to a short catalog label, with the key table typed against the mode union so a new mode cannot fall back to English.
@iscekic iscekic added drain Work item from the findings drain explorer:ios Finding surfaced by the iOS explorer labels Oct 19, 2026
@iscekic

iscekic commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator Author

bot: Android emulator, local dev stack, fake account, profile with one agent per mode. Badges before and after switching the app to हिन्दी.

  • English, after the change: ALL MODES / SUBAGENT ONLY / PRIMARY ONLY
  • हिन्दी, after the change: सभी / केवल सबएजेंट / केवल प्राथमिक — the rows no longer render the raw all / subagent / primary config values.

Profile agent rows in English showing localized mode badges

Profile agent rows in Hindi showing localized mode badges

@kilo-code-bot

kilo-code-bot Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

The only change since the last review adds the @/components/tab-screen mock to the agent badge suite, matching the pattern used by the other mounted screen suites; no defects found.

Assumptions: none.

Files Reviewed (4 files)
  • apps/mobile/src/components/profiles/profile-agents-screen.mounted.test.tsx - incremental change: added TabScreenScrollView mock (line 38) required after main moved the screen to TabScreenScrollView; assertions still select the badge by its uppercase class
  • apps/mobile/src/components/profiles/profile-agents-screen.tsx - carried forward, unchanged since last review (current version uses TabScreenScrollView from base branch)
  • apps/mobile/src/components/profiles/profile-agents-model.ts - carried forward, unchanged since last review
  • apps/mobile/src/i18n/locales/{en,hi}.json - spot-checked profiles.agents.modePrimary / modeSubagent / modeAll present and localized
Previous Review Summary (commit 82cec83)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 82cec83)

Status: No Issues Found | Recommendation: Merge

Executive Summary

The badge now resolves a typed, exhaustive mode key map through t(), all 87 catalogs carry the three new keys, and the mounted Hindi test exercises the rendered badge; no functional defects found.

Files Reviewed (90 files)
  • apps/mobile/src/components/profiles/profile-agents-model.ts
  • apps/mobile/src/components/profiles/profile-agents-screen.tsx
  • apps/mobile/src/components/profiles/profile-agents-screen.mounted.test.tsx
  • apps/mobile/src/i18n/locales/*.json - 87 locale catalogs (en + 86), each verified to contain modePrimary, modeSubagent, modeAll inside profiles.agents with valid JSON formatting

Reviewed by deepseek-flash-latest · Input: 71.6K · Output: 3.9K · Cached: 518.9K

Review guidance: REVIEW.md from base branch main

@iscekic iscekic added merge:human Substantive functional risk requires human review. merge:bot Bot-owned review; merge when ready once readiness passes and a review approves. and removed merge:human Substantive functional risk requires human review. labels Oct 19, 2026
@iscekic
iscekic added this pull request to the merge queue Oct 21, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 21, 2026
…mode-badges

# Conflicts:
#	apps/mobile/src/i18n/locales/fi.json
#	apps/mobile/src/i18n/locales/hu.json
#	apps/mobile/src/i18n/locales/sv.json
#	apps/mobile/src/i18n/locales/th.json
@iscekic iscekic added merge:bot Bot-owned review; merge when ready once readiness passes and a review approves. and removed merge:bot Bot-owned review; merge when ready once readiness passes and a review approves. labels Oct 22, 2026
main moved ProfileAgentsScreen onto TabScreenScrollView, which pulls the real
react-native module graph into the mounted test. Mock the wrapper the way the
other screen suites do, so the badge assertions run again.
@iscekic iscekic removed the merge:bot Bot-owned review; merge when ready once readiness passes and a review approves. label Oct 22, 2026
@iscekic

iscekic commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator Author

bot: Android emulator on the merged head, local dev stack, owned fake account, app language हिन्दी, profile seeded with one agent per mode. Each row shows the localized short mode label instead of the raw config value; the row name, slug and model are shown for scale.

Agent rows showing Hindi mode badges केवल प्राथमिक, केवल सबएजेंट and सभी

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

drain Work item from the findings drain explorer:ios Finding surfaced by the iOS explorer merge:bot Bot-owned review; merge when ready once readiness passes and a review approves.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants