Skip to content

console Settings pages fetch /api/settings with no session locale, so server-composed copy (the Localization page's currency-lock banner, write refusals, action copy) comes back in the browser's language on a zh-CN session #33857

Closed

Description

@objectstack-fleet

qa#3 · os-tesla · session_01L9qibzj9DrVWXkq7joYHGB

Kind: product defect (off-clause probe, rule 8) — severity guess P2 (mixed-language page on a switched session; no data effect)

Repro (main a557fa3, stock showcase)

  1. Boot: pnpm -C examples/app-showcase exec objectstack dev --ui --seed-admin --no-compile --no-watch -p PORT -d file:/tmp/x.db.
  2. In a browser whose own language is English (Accept-Language en-US), sign in at http://localhost:PORT/_console/ as admin@objectos.ai / admin123.
  3. Avatar menu → Language → 中文 (writes sys_user.locale; the shell turns Chinese).
  4. Open Setup → 设置 → 本地化 (/_console/apps/setup/system/settings/localization).
  • Expected: the info banner at the top reads 默认币种已锁定:USD with its zh-CN text (the zh-CN entry of CURRENCY_LOCK_COPY, lockedLabel / lockedText).
  • Actual: the banner reads Default currency locked: USD / In use by 1 object (Invoice) and 4 exchange rates. Converted amounts are stored in this currency, so it can no longer be changed., while every other string on the page (title 本地化, groups 区域 / 财务, key labels 默认时区, source badges) is Chinese.
  • Network: the page's GET /api/settings/localization carries accept-language: en-US (the browser default), while the same page's GET /api/v1/meta/object carries accept-language: zh-Hans.
  • Server control: curl -H 'Accept-Language: zh-CN' /api/settings/localization and -H 'Accept-Language: zh-Hans' both answer 默认币种已锁定:USD — the server copy and its locale pick are correct.

Mechanism

  • ui/apps/console/src/pages/settings/api.ts:102 jsonHeaders() sends only Content-Type and Accept; getSettingsNamespace / listSettingsManifests / the PUT and action POSTs (lines 137-184) use it with raw fetch, so no session locale reaches the server and the browser's own Accept-Language is what arrives.
  • packages/services/service-settings/src/settings-routes.ts:216-222 requestLocaleOf reads the top Accept-Language tag, else ?locale — so it picks the browser's language, and liveStatementOf (line 316), getNamespace (304) and the action route (385) hand that to currencyLockCopy() (packages/services/service-settings/src/localization-currency-lock.ts:330) and the other per-request copy tables (settings-action-copy.ts, localization-locale-options.ts NOT_OFFERED_COPY).
  • The console's own metadata client sends the session language (zh-Hans), which is why the rest of the page is Chinese.
  • Not new in 18.5: neither file changed since 18.4.0 (git log 181ad7d4..HEAD empty for both).

Fix direction

Send the session language from the settings API client (the same header the metadata client sends), or pass ?locale=.

Duplicates searched (open issues, objectstack-ai/objectstack)

QA-source: #33853 · i18n.surface-matrix · observed beside the clauses

Activity

  1. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Path: none

    Triage: first touch → domain:ui · p3 · 2026-11-15T12:56Z

    ⛔ Not a claim.

    From sweep #33761. The Settings pages fetch /api/settings with no session locale, so server-composed copy comes back in the wrong language. Mixed-language page with no data effect, so p3.

  2. added
    domain:ui
    pm:queue
    on Nov 15, 2026
  3. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:ui#2 · os-steve · session_01ADHkmSzhXR4yUAgwq1bQRi

    Claim: PM loop round 1 · 2026-11-15T14:16Z
    Session: session_01ADHkmSexsZNR6rXJkqTHS2 (card thread, dev) · seat session_01ADHkmSzhXR4yUAgwq1bQRi
    Account: os-steve (the seat's linked user as GET /user answers it; the card's assignee)
    Branch: claude/project-thread-tp6zjw
    Worktree: objectstack-issue-33857
    Domain: domain:ui
    Seat: domain:ui#2
    File surface: ui/apps/console/src/pages/settings/api.ts and its tests (an existing shared locale helper in ui/ may be imported, not edited); no server change (stop on breach; explain in the report)
    Container & model: S, mode:thread, model: default judgement tier (dispatch-gates --tier: "no path-derived mandate: the surface hits none of the 4 declared glob(s)"), effort: medium
    Clause-②: no
    Metadata-protocol: none
    Responsibility: ui/apps/console settings api.ts (objectstack) | none | every admin on a session whose language differs from the browser's
    Thread-read: 6894649332
    Premise: holds
    Serial constraints cleared: no open PR touches this surface (read 14:15Z); seat 1's p1/p2 cards and seat 2's other in-flight cards (#33863, #33858, #33857, #33856, #33723) have disjoint files

  4. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 15, 2026
  5. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:ui#2 · os-steve · session_01ADHkmSzhXR4yUAgwq1bQRi

    Release: 2026-11-15T14:19Z — the domain:ui#2 claim 6895863887 ends before any work. Back to pm:queue, assignee cleared.

    • Why: the maintainer, in this account's fleet project chat: 「尽快把 p1 p2 卡处理完」 and 「应该是优先 p1 p2 ,为什么会派 p3」 (2026-11-15T14:16:27Z). This shift works p1/p2 only; this card is p3.
    • State: the card thread stopped with zero edits, zero commits, nothing pushed, no PR, no GitHub writes. Branch claude/project-thread-tp6zjw carries nothing. Resume-from: none (start from main).
    • Reading kept for the next dev (data, not a ruling): an unpushed draft (jsonHeaders in settings/api.ts sends Accept-Language from the html lang, the same source createAuthenticatedFetch reads; no tests yet) is parked in this project's files as ui-seat2/33857-wip.patch.
  6. added
    pm:queue
    and removed
    pm:dispatched
    on Nov 15, 2026
  7. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:ui#2 · os-steve · session_01ADHkmSzhXR4yUAgwq1bQRi

    Claim: PM loop round 2 · 2026-11-15T17:15Z
    Session: session_01ADHkmTMJ1tS7fhvnNnQSxg (card thread, dev) · seat session_01ADHkmSzhXR4yUAgwq1bQRi
    Account: os-steve (the seat's linked user as GET /user answers it; the card's assignee)
    Branch: claude/project-thread-5plpus
    Worktree: objectstack-issue-33857
    Domain: domain:ui
    Seat: domain:ui#2
    File surface: ui/apps/console/src/pages/settings/api.ts and its tests (an existing shared locale helper in ui/ may be imported, not edited); ⛔ no server change; ⛔ not languageSeed.ts / LocalizationFetchProvider.tsx (held for #33985) (stop on breach; explain in the report)
    Container & model: S, mode:thread, model: default judgement tier (dispatch-gates --tier: "no path-derived mandate: the surface hits none of the 4 declared glob(s)"), effort: medium
    Clause-②: no
    Metadata-protocol: none
    Responsibility: ui/apps/console settings api.ts (objectstack) | none | every admin on a session whose language differs from the browser's
    Thread-read: 6895926978
    Premise: holds
    Serial constraints cleared: no open PR touches settings/api.ts (read 17:15Z); prior claim 6895863887 released 6895926978 with no pushed work; #33985 files held; seat 1 p3 split agreed 17:14Z

  8. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 15, 2026
  9. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:ui#2 · os-steve · session_01ADHkmTMJ1tS7fhvnNnQSxg
    os-dev-report

    {
     "issue": 33857,
     "status": "done",
     "branch": "claude/project-thread-5plpus",
     "pr": "https://github.com/objectstack-ai/objectstack/pull/34072",
     "session": "session_01ADHkmTMJ1tS7fhvnNnQSxg",
     "premise_still_valid": true,
     "summary": "Premise holds on main e71ecc1b: settings/api.ts jsonHeaders() sent only Content-Type and Accept, and the four /api/settings calls (list, namespace GET, PUT save, action POST) used it with raw fetch. jsonHeaders() now adds Accept-Language from document.documentElement.lang when non-empty, the same source createAuthenticatedFetch stamps on metadata/data calls (the i18n provider keeps it in step with the switcher); empty lang leaves the header to the browser as before. No server change, no languageSeed.ts / LocalizationFetchProvider.tsx edit. The parked WIP patch was re-checked against today's main and reused, docblock reworded to state the invariant.",
     "tests": "new top-level describe in the module's existing harness api.envelope.test.ts (9 tests: each of the 4 calls sends Accept-Language zh-Hans and keeps the JSON headers; CONTROL each of the 4 with empty html lang sends no Accept-Language; a language switch reaches the next call ['en','zh-Hans']): file 28/28 pass. Settings folder under lock: Test Files 40 passed (40), Tests 387 passed (387). Ablation (fix committed first; ui vitest aliases src, no build leg): ablation-replace deleted the Accept-Language line (anchor 1->0, blob 55abaf1f->4caa2363) -> 5 failed | 23 passed, the 4 CONTROLs green; restored blob == HEAD 55abaf1f, git diff HEAD empty.",
     "gates": "local at d41fbf12 (rebased on main e71ecc1b): dispatch-gates --commands 36 derived families, each run, all exit 0 (ui scripts/ vitest 171 files passed 2 skipped, 5065 tests passed 2 skipped); --ran reconciliation: 36 derived, 36 run, 0 NOT-MEASURED, 0 UNRUN. pnpm --filter @object-ui/console run type-check exit 0 after turbo build --filter='@object-ui/console^...' (74 tasks), lock VERDICT command-exit 0. CI families: in_progress at report time (not waited, per order).",
     "line_budget": "106 changed lines (+102/-4) over 3 files vs 3000 human-merge threshold: under",
     "files_changed": [
      ".changeset/33857-settings-session-language.md",
      "ui/apps/console/src/pages/settings/api.envelope.test.ts",
      "ui/apps/console/src/pages/settings/api.ts"
     ],
     "deviations": [
      "Card acceptance (Localization banner reads the zh-CN currency-lock copy on a zh-CN session) pinned at the request layer only; NOT MEASURED in a browser against a live server. The card's own curl control covers the server half.",
      "PR body footer uses the AGENTS.md session-URL form, not the harness emoji footer; PR body spells the html lang attribute in words (no tag-shaped fragment) for the sanitizer."
     ],
     "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm",
     "mcp_calls": "5 — issue_read get_comments #33857 x2, issue_read get #33857, pull_request_read get #34035 (body shape precedent), issue_read get_comments #33987 (report shape precedent); no write tools",
     "api_writes": "2 — relay pr_create (objectstack-ai/objectstack#34072, read-back 5238 bytes sent == stored, assignees os-steve, no labels), post-stamped os-dev-report comment on #33857",
     "open_questions": [
      {
       "question": "Route the four settings calls through createAuthenticatedFetch itself (the move services/approvalsApi.ts made) instead of stamping Accept-Language in jsonHeaders()?",
       "options": [
        "A keep this PR's header stamp: one line in jsonHeaders(), same html-lang source, no auth or transport change, no forced test edits",
        "B switch to createAuthenticatedFetch: one transport for all console calls (also adds bearer, X-Tenant-ID, session-rotation adoption, 401/403 session events to settings), but about 14 settings test files' fetch doubles lack response.headers and would each need a forced edit"
       ],
       "recommendation": "A for this card, because B is a transport change the card does not ask for and widens the diff across ~14 test files; B, if wanted, is its own card"
      }
     ],
     "security_findings": "none",
     "out_of_scope_findings": []
    }
  10. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:ui#2 · os-steve · session_01ADHkmSzhXR4yUAgwq1bQRi

    ACCEPT → PR #34072 comment (seat record) · 2026-11-15T18:03Z · ready and auto-merge armed.

  11. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:ui#2 · os-steve · session_01ADHkmSzhXR4yUAgwq1bQRi

    Landed · 2026-11-15T20:59Z

    reading value
    PR #34072 MERGED as b29f2dd1 on main (Fixes #33857)
    card closed

    State: pm:dispatched removed, assignee cleared.

  12. removed
    pm:dispatched
    on Nov 15, 2026
  13. added a commit that references this issue on Nov 16, 2026
    b29f2dd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    domain:uipriority:p3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions