Skip to content

fix: follow the language switch in pop-out and history-entry labels - #47878

Open
winnythedev wants to merge 1 commit into
mainfrom
fix/47843-popout-history-follow-language
Open

winnythedev wants to merge 1 commit into
mainfrom
fix/47843-popout-history-follow-language

Conversation

@winnythedev

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: After a dashboard language switch, a core page's pop-out window title and the label on the current history entry always show the new language.

AppPopoutFrame (shownLabel) and ShellTabTitle in appShell.tsx (historyLabel, and the tab title next to it) read a translated label with i18nT(), which subscribes to nothing, and hand it to a useEffect through its dependency list. They rely on LanguageProvider's cloneElement repaint to render them again. When a store-driven re-render of the same component lands between the switch and that repaint and changes nothing React tracks, React bails out of it: the render's hook state, with the effect's new dependency values, is kept, but the effect is dropped. The repaint then finds the dependencies unchanged, so the window title and the history entry stay in the old language until something else renders them. It is rare in a browser, because it needs a pending re-render at the moment of the switch.

Why it matters

A person who switches language sees the pop-out window's title (taskbar and window switcher) and the Back/Forward history menu entry still in the language they left, with nothing they can do to fix it short of navigating or reloading.

Not a goal

What changed (motivation → approach → change)

Symptom: the window title and history label keep the old language after a switch. Root cause: the owning components do not subscribe to the switch, so a bailed-out re-render can swallow the effect that hands the new label on (#47843; #47814 is the same case in the Files tree). Change: AppPopoutFrame and ShellTabTitle each call useLanguageGeneration() once, with a short comment on why, the same as #47852 does for the tree. The switch itself now renders each component, and that render cannot bail out because the hook's snapshot changed, so its effects run with the new strings. In appShell.tsx the change is only the import, the hook call and its comment.

Backwards compatibility

Compatible: two components subscribe to one more external store; nothing they accept or render changes.

Removes nothing: the diff only adds a hook call in two components and two tests.

Tests

  • website/src/test/AppPopoutFrame.test.tsx: "re-titles a core page’s window on the language switch itself, with no repaint from above". Renders the /channels core page pop-out with no LanguageProvider, switches to Japanese, and expects the window title and the title bar to show nav.channels in Japanese. Language is restored in finally. Adds a ChannelPage module stub so the lazy core page does not load the real page.
  • website/src/test/App.tabTitle.test.tsx: "names the tab and the history entry in the new language on the switch itself, with no repaint from above". Renders App at /chat with no LanguageProvider, waits for the shell to settle, switches to Japanese, and expects the tab title and the last labelCurrentRouteEntry call to carry app.tab_title_chat in Japanese. labelCurrentRouteEntry is wrapped in a vi.fn around the real function, so the other tests in the file see the same behaviour.

Both tests fail on main and pass with the fix (output under Real-machine verification).

Proof: not provable -- frontend test (prove.py runs Python only)

Nearby inputs tested: a core page (/channels) whose label is a catalog key; the chat route with no active session, whose tab and history label are both the chat panel label; the existing cases in both files (installed and built-in app titles, session titles, attention count, remote crew, labelled gateway, pop-out windows) still pass. Both files were run five times in shuffled order: 68/68 each time.

Other checks: the 25 test files that reference either component (435 tests), CarriedMockAnswerRatchet, chatSlice.ownership, memoBailout, renderSwitch and LanguageProvider tests, eslint on the four files, tsc -p tsconfig.app.json --noEmit, test/test_flake_pattern_ratchet.py, the comment-history, brand-name, agent-SDK-boundary and file-line-cap checks, and scripts/local-gate.py --base upstream/main --tree-scans.

Review (multi-model interrogate)

Independent reviewers read the full diff against the CI review lanes' own briefs. Two reviews counted; two more were set aside because their read of the repo rules came back short.

  • Found: the commit body cited the Files tree fix as if it were already on main. Acted on: the body now names open PR fix: re-plan the tree's state rows on the language switch itself #47852.
  • Dismissed: a concern that the new module-level mocks change other tests in the two files. The ChannelPage stub is reached only by the new /channels case, and labelCurrentRouteEntry is wrapped around the real function, so every other test sees the same behaviour.
  • No correctness, security or test-determinism findings. One final re-check of the diff ran before the push and left two open nits: the pre-switch toHaveBeenLastCalledWith('Chat') could be met by a call from an earlier test (the post-switch assertion, which carries the proof, is unaffected), and the tests remove the repaint rather than staging the exact re-render race.

Manual verification

N/A -- unit coverage sufficient: the bug needs a re-render to land between the switch and the repaint, which the tests force by removing the repaint. No live dashboard run was done: no gateway was started and no dashboard token was minted.

Real-machine verification

Machine: own computer, Linux x86_64. vitest on the real components; no browser run, no gateway and no dashboard token.
Before (main dcc6fd1): npx vitest run src/test/AppPopoutFrame.test.tsx src/test/App.tabTitle.test.tsx -> 2 failed: expected 'Channels — Kiro Crew' to be 'チャネル — Kiro Crew' and expected 'Chat — Kiro Crew' to be 'チャット — Kiro Crew'
After (head 26a6045): same command -> 68 passed (68), five shuffled repeats green.
Cleanup: own computer, nothing to remove.

Screenshots / video

Why no screenshot: the change is in the OS window title and the browser history menu entry, which a page screenshot does not show, and the page itself renders the same.

Related Issues

Fixes #47843

Follow-up to #47814 (fixed in open PR #47852, which edits PierreWorkspaceTreeImpl.tsx and the header of useLanguageGeneration.ts; this PR touches neither, so the two land in any order). #47852's header rewrite also describes the non-memoized case this PR adds.

Other open PRs that touch the same files: #45436 (AppPopoutFrame.tsx), #47827, #41145, #41140, #31967, #31959 and #16349 (appShell.tsx). This PR's appShell.tsx change is three lines in ShellTabTitle plus one import line.

Sibling sweep

Swept: git grep -l 'i18nT(' -- website/src filtered to files without useLanguageGeneration() that name an i18nT-derived const in a useEffect/useLayoutEffect dependency list (the scan #47843 describes)
Sibling: website/src/pages/AppPopoutFrame.tsx -- changed here
Sibling: website/src/shell/appShell.tsx -- changed here
Sibling: website/src/pierre/PierreWorkspaceTreeImpl.tsx -- tracked in #47814
Sibling: website/src/pages/chat/page/transcriptPins.ts -- not affected -- pinStatus only re-arms a timer, nothing visible stays stale
Sibling: website/src/pages/settings/useChatPanelTypedFields.ts -- not affected -- the selector is compared again whenever the deep link changes

Pattern harvest

Rule candidate: review-prompt
Pattern: an i18nT() string passed to an effect through its dependency list in a component that does not call useLanguageGeneration()

Checklist

  • A Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...); PR Hygiene does not count commits
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

A core page's pop-out window title and the label on the current history
entry are read with i18nT(), which subscribes to nothing, and handed to
an effect through its dependency list. A store-driven re-render that
lands between the language switch and LanguageProvider's repaint bails
out: it keeps the new dependency values but drops the effect, so the
repaint finds nothing changed and the old language stays.

AppPopoutFrame and ShellTabTitle now call useLanguageGeneration(), as
open PR #47852 does for the Files tree, so the switch itself re-renders
them. A test for each switches the language with no repaint and expects
the new label.

Fixes #47843
@winnythedev
winnythedev requested review from a team and KiroCrewCaptain as code owners December 5, 2026 19:00
@winnythedev
winnythedev requested a review from CrysisDeu December 5, 2026 19:00
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Dec 5, 2026
@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 26a60456b6f0406e6fcb023cd85098ee2cfe6f44 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: both components now subscribe to the language switch, the same per-component pattern as #47852, and no rendered surface or contract changes.

[DESIGN-REVIEWED] 26a6045

Description read

[DESCRIPTION-READ] fb7c7d4077dc23adefa8831b9b3e1a68a036b017f5a32ed66659eb6f6a3befc0

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 26a60456b6f0406e6fcb023cd85098ee2cfe6f44 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing to check. The diff adds no control, string or layout. It only adds a hook call so the existing window title and history-entry label update when the language changes. There is no new surface to screenshot.

[UX-REVIEWED] 26a6045

Description read

[DESCRIPTION-READ] 8108075dddd5d3a360dabc5b3a8d4ac854c58871caee19fe379f2822872ea75c

That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 26a60456b6f0406e6fcb023cd85098ee2cfe6f44 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

This reuses the existing useLanguageGeneration() subscription, which 112 non-test files already call. It adds nothing new, and the sibling sweep is spelled out.

Notes

What this change ships

Inventory (3 items) — 2 justified

Intent: after a language switch, the pop-out window title and the current history entry label show the new language. This is a FIX.

  1. Pop-out window and taskbar title for a core page now follows a language switch — inherited: relies on a header rewrite in another PR (fix: re-plan the tree's state rows on the language switch itself #47852)
  2. Main-window tab title and Back/Forward history entry label now follow a language switch — justified
  3. Two regression tests that fail on main — justified

[FIRST-PRINCIPLES-REVIEWED] 26a6045

Description read

[DESCRIPTION-READ] 9bc4289f2858a40c089b3b0b55b9ba8f89c8fea8e312a0d42e99d3abaf39b0de

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 26a60456b6f0406e6fcb023cd85098ee2cfe6f44 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 26a6045

Verdict parsed from the review's SHA-scoped output markers for commit 26a60456b6f0406e6fcb023cd85098ee2cfe6f44.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 26a60456b6f0406e6fcb023cd85098ee2cfe6f44 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 26a60456b6f0406e6fcb023cd85098ee2cfe6f44 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 26a6045

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 26a60456b6f0406e6fcb023cd85098ee2cfe6f44 false-positive: <reason, 20 to 500 characters>

This branch has not been deployed

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

Labels

readiness: checking Automated validation is still running

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pop-out window title and history label can keep the old language after a language switch

1 participant