Skip to content

fix(web): clear this browser's language override when the picker saves - #3908

Merged
Quick104 merged 2 commits into
mainfrom
i18n/web-picker-device-clear
Nov 10, 2026
Merged

Quick104 merged 2 commits into
mainfrom
i18n/web-picker-device-clear

Conversation

@Quick104

@Quick104 Quick104 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: #3188
Validation tasks: none (the picker's saved value and resolution are unchanged; it also clears a per-browser value an administrator set)

Stacked on #3907; the full stack order is in #3723.

The App language picker writes the profile's value, but a value stored for this browser alone still wins, so picking a language seemed to do nothing on that browser. Only an administrator editing this device's preferences creates such a value on the web, but when one exists the picker can't override it. This makes the picker clear it.

Approach

After the profile write succeeds, the picker deletes this browser's profile_device value, as the Android and Apple pickers do. The clear runs with mutateAsync, so it still finishes if the page closes; it is skipped if the profile or session changed during the write; and a failed clear says so instead of reporting the save as failed. A choice made while a save is in flight is ignored, including one made before the pending state renders.

Validation

  • Web tests, typecheck, ESLint, prettier, the size ratchet and the bidi check pass on this branch.
  • On a sandbox with this browser's own value set, picking a language returned PUT 200 then DELETE 204 and the page switched; without one, the DELETE returns 404 silently (see Evidence).

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/pr-3908/

Surface and build: web app Settings → Accessibility, desktop and phone width; English on main and on a build of the whole stack, and Spanish and Arabic on that build, plus the request trail. Phone captures show English (before and after), Spanish and Arabic.

Risks

None identified.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code (in T3 Code)
  • Tool(s): Claude Code; Codex
  • Model(s): claude-opus-5-5; claude-sonnet-5-5; gpt-6.1-sol
  • Involvement: Fully AI-generated; human review pending
  • Adversarial review: code review by Claude (claude-opus-5-5); one adversarial round by Codex (gpt-6.1-sol) on the integration branch (the clear could hit another profile after a switch; fixed). Background review by Codex (gpt-6.1-sol) on 66e8285: F1 (no way to retry a failed clear) fixed in c851c57 with a "Try again" action.

🤖 Generated with Claude Code

Note

Localize the web app with a react-intl catalog, hooks, and per-part message loading

  • Replaces hard-coded English strings across the app, admin, player, settings, and setup-wizard UIs with useT translation lookups and typed MessageKey values; counts, dates, and list separators now follow the app language and locale
  • Adds i18n infrastructure in web/src/i18n/: catalog loaders with lazy English admin messages, shared formatters, useT/useAppLanguage hooks, and an AppIntlProvider; LocaleProvider in App.tsx resolves the locale from profile settings, a signed-out choice, or the appearance cache, and a signed-out language picker appears on auth screens
  • Adds a catalogParts Vite plugin in vite.config.ts that splits locale JSON into part=app (excludes web.admin. keys) and part=admin (includes them), with tests in vite.config.test.ts
  • Parsed V2 problem errors now select display text through a shared problemDisplayText helper (error.<type> and error.field.<code> translations, falling back to server detail); buildApiHeaders sends Accept-Language
  • Per the PR title, saving the auth language picker clears the stored signed-out browser override (selecting the device-match option clears it)
  • Adds scripts/sync-translations to generate or download pinned translation assets with checksum and path-safety checks
  • Behavioral Change: AdminLayout renders nothing until the admin catalog loads (the admin hook throws a recorded load error meanwhile); numbers/dates and generated names (e.g. auto rule names, chart names) use the app locale while some intentionally stay English — check requestRoutingPresets.ts, tmdbSources.chartName, and warningDetailsReport for the English-pinned cases

Macroscope summarized c98de7a.

@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

We couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting @coderabbitai full review.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The app language setting saves the selected profile language asynchronously. After a successful save, it clears this browser’s profile-device language value when the captured request context is current and the profile ID matches.

Changes: App language setting

Layer / File(s) Summary
Save profile language and clear browser value
web/src/pages/settings/AccessibilitySettings.tsx
The setting blocks overlapping saves and saves the selected profile value before clearing the browser-specific value. It skips the clear when the request context is absent or stale, or the profile ID differs. Missing-value errors are ignored; other clear failures show an error with a retry action. Save failures do not trigger the clear.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

Possibly related PRs

Suggested labels: javascript, impact: usability, needs-review

Suggested reviewers: rhainland

Merge Risk: Minimal · previous review 7340f

The language picker saves the profile language and then clears this browser's override. Rapid repeated selections can no longer start overlapping saves. No merge-blocking issues remain.

Security architecture risk: Low · up to 7340f

The change is limited to language preferences and includes ordered writes, overlapping-save protection, and separate cleanup recovery. No security vulnerability was established, but delayed cleanup across identity changes and completion after browser shutdown remain incompletely verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • observed — The inspected picker path fixes the setting key to ui.app_language, writes profile scope, and clears profile_device scope without supplying another profile or device ID. The browser device header identifies the cleanup target; this is not a new generic administrator operation.

Trust Boundaries and Controls

  • observed — The existing server deletion path selects a per-user store, resolves the setting identity, and validates allowed scope before clearing. Explicitly naming another profile invokes household-management authorization and existence checks within that user’s store.
  • observed — After initial request construction, token-refresh retries preserve the original profile and device headers. Refresh processing also rejects a result superseded by an account/server change. These existing controls are counterevidence to a simple profile switch redirecting an already-constructed request.

Resilience and Maintainability Implications

  • observed — Cleanup retries repeat the context preflight but do not use the save lock or a value/version condition. The server clear is transactional and returns 404 for an absent addressed value. Repeated clears converge when no intervening override is written; handling a newer intervening override is not established by the inspected contract.

Hardening Proposals

  • proposed — If cleanup may be queued or deferred, bind or revalidate its captured authority at actual request dispatch rather than relying solely on the preflight guard. Keep captured credentials out of retained mutation variables.
Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title clearly describes the main change: clearing this browser’s language override when the picker saves.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description explains how the language picker clears this browser’s per-device language value after a successful profile save.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 1 files.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6e4a3f0f-5f2f-46bf-b2bc-3f4d14885378
Commits

Reviewing files that changed from the base of the PR and between c851c57 and 7340f6b.

Files selected for processing: 1

  • web/src/pages/settings/AccessibilitySettings.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

@silo-triage silo-triage Bot added the size/M 50–199 added + deleted lines (all files); change volume, not priority. label Nov 9, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T02:13:45.502316Z f8f5944 New commits
🔒 Security Review ✅ Completed 2026-11-10T02:17:40.913346Z f8f5944 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@silo-triage silo-triage Bot added bug Something isn't working evidence-required Needs before-and-after evidence before the Evidence check passes priority: P2 Limited scope, workaround exists, or polish stacked Base is another open PR; merge in stack order named in the body labels Nov 9, 2026
@silo-triage

silo-triage Bot commented Nov 9, 2026

Copy link
Copy Markdown

The Evidence section identifies desktop coverage only. Please add phone-width before-and-after captures of the language picker with a browser override set, or explain why mobile web is unaffected. CONTRIBUTING.md requires both web surfaces when the behavior changes on both.

@Quick104 Quick104 mentioned this pull request Nov 9, 2026
4 tasks done

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adversarial review (gpt-6.1-sol, reviewed 66e8285)

AI disclosure: reviewed by gpt-6.1-sol through the Codex harness in T3 Code.

@Quick104
Quick104 force-pushed the i18n/web-picker-device-clear branch from 66e8285 to c851c57 Compare November 9, 2026 19:01
@coderabbitai coderabbitai Bot added impact: usability Core flow broken or severely blocked javascript Pull requests that update javascript code needs-review Needs maintainer review to resolve uncertain classification, scope, or changed evidence. labels Nov 9, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3a0e9051-8578-41f4-bc8f-41b87c109447
Commits

Reviewing files that changed from the base of the PR and between 569dbaa and c851c57.

Files selected for processing: 1

  • web/src/pages/settings/AccessibilitySettings.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

@Quick104

Quick104 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Added phone-width captures to the evidence page: Settings → Accessibility in English (before and after), Spanish and Arabic, and the open picker in each language (main has no picker to compare).

@Quick104
Quick104 force-pushed the i18n/web-picker-device-clear branch from 550c017 to 7340f6b Compare November 9, 2026 20:08
@Quick104
Quick104 force-pushed the i18n/web-shared-helpers branch from 569dbaa to 603645e Compare November 9, 2026 20:08
@Quick104
Quick104 force-pushed the i18n/web-picker-device-clear branch from 7340f6b to c98de7a Compare November 10, 2026 02:08
@Quick104
Quick104 force-pushed the i18n/web-shared-helpers branch 2 times, most recently from 80b9e1f to 8300e51 Compare November 10, 2026 02:11
@Quick104
Quick104 changed the base branch from i18n/web-shared-helpers to main November 10, 2026 02:11
@silo-triage silo-triage Bot added size/XXXL 3000+ added + deleted lines (all files); change volume, not priority. and removed size/M 50–199 added + deleted lines (all files); change volume, not priority. labels Nov 10, 2026
Quick104 and others added 2 commits November 9, 2026 21:12
The app-language picker writes the profile's value, but a value stored
for this browser alone still wins, so the change seemed to do nothing
here. The picker now deletes this browser's profile_device value after
the profile write, as the Android and Apple pickers do. The clear runs
with mutateAsync so it still finishes if the page closes, says what
failed if it does, and is skipped if the profile or session changed
during the write.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
isPending only changes after a render, so two choices made in that window
could both start a profile write. A ref set synchronously closes it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Quick104
Quick104 force-pushed the i18n/web-picker-device-clear branch from c98de7a to f8f5944 Compare November 10, 2026 02:12
@silo-triage silo-triage Bot added the size/M 50–199 added + deleted lines (all files); change volume, not priority. label Nov 10, 2026
@silo-triage silo-triage Bot removed the size/XXXL 3000+ added + deleted lines (all files); change volume, not priority. label Nov 10, 2026
@Quick104
Quick104 merged commit 26def12 into main Nov 10, 2026
4 checks passed
@Quick104
Quick104 deleted the i18n/web-picker-device-clear branch November 10, 2026 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working evidence-required Needs before-and-after evidence before the Evidence check passes impact: usability Core flow broken or severely blocked javascript Pull requests that update javascript code needs-review Needs maintainer review to resolve uncertain classification, scope, or changed evidence. priority: P2 Limited scope, workaround exists, or polish size/M 50–199 added + deleted lines (all files); change volume, not priority. stacked Base is another open PR; merge in stack order named in the body

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant