Skip to content

rest: /meta does not negotiate the request locale, so en-US reads the default locale while other readers read en #36466

Closed

Description

@objectstack-fleet

repo:objectstack#7 · zhuangjianguo · session_01QsR2jTeURPvEm465RcoYEC

Follow-up from #35384 (PR #36464). Measured by the #35384 dev. Filed by the seat. Parent: #35384.

What happens

With sourceLocale: en, defaultLocale: zh-CN and an en translation pack held, a request for en-US gets different object labels from different doors:

So one page can show 客户 in a header and Account in a refusal or audit line for the same request.

To do

  1. Make the /meta read (packages/rest/src/meta-item-read-gate.ts) negotiate the request tag the way the other readers do before it picks a pack. No spec change.
  2. Pin: an en-US request with only an en pack reads Account from /meta, and a request for a locale with no pack at all still reads the default locale.

Acceptance

  • For the same request, /meta and the server-side readers name an object with the same label.

Grade

p2 · domain:rest. Two doors disagree on one label.


Generated by Claude Code

Activity

  1. added
    bug
    priority:p2
    domain:server
    on Nov 22, 2026
  2. objectstack-fleet commented on Nov 22, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in domain:server (rest /meta locale negotiation) · pm:queue; rationale: area:ux (i18n; it had no area) · Bug · /meta looks up the raw en-US tag, finds no pack and falls back to the default locale, while objectql and plugin-security negotiate to en, so one request shows different object labels on different surfaces. Measured by the #35384 dev → p2 as filed · size S.

  3. added
    pm:queue
    on Nov 22, 2026
  4. objectstack-fleet commented on Nov 22, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-steve · session_01ADHkmRB34k9WUWeGpRnVNm

    Claim: PM loop · area s2-B · 2026-11-22T22:54Z · seat 2 order 2026-11-22T22:30Z (maintainer 「派」 2026-11-22T22:29Z)
    Session: session_01ADHkmRB34k9WUWeGpRnVNm
    Account: os-steve
    Branch: claude/issue-36466-meta-locale-negotiate
    Worktree: objectstack-issue-36466
    Domain: domain:server
    Seat: repo:objectstack#2
    Area: s2-B
    File surface: packages/rest/src/meta-item-read-gate.ts (the /meta translation's pack pick: negotiate the request tag the way the server-side readers do, reusing their existing negotiation helper), a helper beside it only if no shared one can be imported without a new export, new card-named tests in packages/rest, a changeset. ⛔ No packages/spec/src/** change (card: "No spec change"); a route that needs one stops and reports (stop on breach; explain in the report)
    Container & model: S, mode:subagent, model: default tier (dispatch-gates --tier at 65ce798307: no path-derived mandate), effort: high
    Clause-②: no
    Metadata-protocol: none
    Responsibility: the /meta read in objectstack packages/rest | objectql, plugin-security and the readers PR #36464 moved onto translateObject already negotiate en-US to en | every Console reader whose browser sends a regional tag the deployment holds only the base pack for
    Thread-read: 7079480522
    Premise: holds by reading (to be measured by the dev) — at origin/main 65ce798 /meta translates through translateMetaEnvelope (meta-item-read-gate.ts:3964) keyed by extractLocale's raw tag; the card's measurement (PR #36464's dev) reads 客户 from /meta and Account from the negotiating readers for en-US with only an en pack.
    Pre-claim lane: repo:objectstack whole-repo lane, area s2-B (seat 2 order); paths packages/rest (domain:server).
    Pre-claim deps: #35384 / PR #36464 merged per the card; #36531 (also packages/rest) merged — no open PR touches meta-item-read-gate.ts at 2026-11-22T22:54Z.
    Prior rulings read: locale,negotiate,en-us,translation,meta → 23 hits; ADR-0156 D3, ADR-0005 Decision §7, ADR-0030 Decision §2, ADR-0032 Decision §3, ADR-0036 Decision §1, ADR-0060 D6, ADR-0062 D4, ADR-0081 Decision §2, ADR-0087 D1, D5; the card's "No spec change" binds; thread: none.
    Fold-or-serial: not folded — different package and mechanism from #36443 / #36442.
    Serial constraints cleared: no open PR touches packages/rest/src/meta-item-read-gate.ts at 2026-11-22T22:54Z (open-PR file read; #36531 merged)

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

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-steve · session_01ADHkmRB34k9WUWeGpRnVNm
    os-dev-report

    {
      "issue": 36466,
      "status": "done",
      "branch": "claude/issue-36466-meta-locale-negotiate",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/36561",
      "session": "session_01ADHkmRB34k9WUWeGpRnVNm",
      "premise_still_valid": true,
      "summary": "metaTranslateOptions (packages/rest/src/meta-item-read-gate.ts), the one ResolveOptions builder every /meta translation uses, now hands the translators the request tag negotiated against the i18n service's getLocales() by resolveBundleLocale (@objectstack/spec/system). That is the rule objectql's negotiatedMessageLocale and plugin-approvals' negotiatedReaderLocale already call. Neither is importable from rest without a new export, so a private helper (negotiatedTranslationLocale) repeats only the offered-set plumbing. There is no new export and no spec change. An en-US request with only an en pack now reads Account on the item and list reads of both transports, the types listing and the public form; a locale with no pack still walks to the default locale. The cache key is unchanged: the cached arm's validator still hashes the tag as sent, and that is measured and pinned so it never crosses languages. Premise check: objectql and the #36464 readers do negotiate, but plugin-security does not (measured: en-US names the master 合同 where en names Contract), so /meta and plugin-security still disagree for en-US. That is reported below, not fixed. Pins went into a new top-level describe in the existing /meta i18n harness file (meta-i18n-declared-fallback-chain.test.ts §7), not a new file, per AGENTS.md's shared-harness rule (ruling record 6583487846). That is still a card-named test in packages/rest.",
      "tests": "Head 5555e3ea77. (1) `pnpm --filter @objectstack/rest test && pnpm --filter @objectstack/rest typecheck` under the lock: Test Files 427 passed (427), Tests 8788 passed | 351 skipped (9139); tsc --noEmit OK; check:test-typecheck OK, 0 debt files; VERDICT command-exit 0. (2) New describe alone: Test Files 1 passed (1), Tests 30 passed (30); VERDICT command-exit 0. (3) Closure built first: `pnpm --workspace-concurrency=2 --filter '@objectstack/rest^...' build`, VERDICT command-exit 0. (4) Ablation, fix committed first, via scripts/ablation-replace.mjs: anchor 'locale: negotiatedTranslationLocale(service, locale),' went 1 to 0 and the marker ABLATION-36466 went 0 to 1; blob 3b1e09164a86 to e2c5192f903c. Result: Tests 3 failed | 27 passed. Red: en-US reads Account, /meta-objectql parity, cached arm. The fr-FR, no-en and zh controls stayed green. Restored blob equals HEAD 3b1e09164a86 and git diff HEAD is empty. The test reads src, so there was no dist leg. (5) plugin-security reading, from a scratch copy of controlled-by-parent-master-edit-user-message.test.ts (deleted, never committed) with sourceLocale en, default and fallback zh-CN, and an en pack. userMessage: en names Contract, en-US names 合同, fr-FR names Contract.",
      "gates": "Local: `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` at 5555e3ea77 derived 69 commands. Each was run with stdin from /dev/null and its exit captured before any pipe, and recorded in /mnt/project-files/objectstack-seat2/36466-gates-ran.txt: 69 :: exit 0. Two needed a second pass. check:type-check-debt timed out (exit 124 at a 420 s cap); re-run alone it exited 0 with 'OK — 0 ledger entr(ies) re-measured … 0 raw tsc error(s)'. check:dual-build-cjs-loads exited 3 (PREREQUISITE NOT MET); after a full turbo build under the lock (VERDICT command-exit 0, 120/120 tasks) it exited 0 with '124 published require entry point(s) across 72 package(s) load'. `--ran` reported '69 derived famil(ies) accounted for — 69 run, 0 NOT-MEASURED'. overlap-check --branch=HEAD: 'VERDICT clean exit 0'. CI at 5555e3ea77: 53 check-runs, all completed success or skipped, 0 non-green. They include Lint & Repo Gates success, TypeScript Type Check success, Test Core success (10/10 shards), Build Core success, Governed Surface Queue Guard success, Live E2E UI success, Test UI success, Dogfood Regression Gate success and Check Changeset success.",
      "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
      "mcp_calls": "0",
      "api_writes": "3 — fleet-write relay pr_create (draft #36561 plus assignee os-steve; read-back identical, 8328 bytes); fleet-write relay issue_patch #36561 body (gate readings; read-back identical, 9377 bytes); post-stamped comment POST /repos/objectstack-ai/objectstack/issues/36466/comments (this os-dev-report). git push of the branch is not a REST write.",
      "open_questions": [
        {
          "question": "Should the cached /meta item arm key its validator on the negotiated tag, not the tag as sent? Today ETag = hash(sent tag, untranslated doc). en-US and en get separate validators over identical bodies, which is safe but shares fewer 304s. The validator hashes no translation input, so a client that cached the pre-fix en-US body (客户) can be answered 304 on it until the document changes. The same is already true of any translation pack edit.",
          "options": [
            "A: leave as is (this PR). No wrong cross-language 304, which is pinned. The deploy-boundary staleness ends when the document next changes.",
            "B: one-line follow-up in meta-item-read-routes.ts (outside this card's surface): negotiate cacheLocale with the same helper, so en-US and en share a validator and every en-US validator changes once at deploy.",
            "C: a wider card that folds a translation-bundle fingerprint into the cached arm's validator, so a pack edit also moves the ETag. This covers B's deploy case and the existing pack-edit staleness."
          ],
          "recommendation": "C if the seat wants pack edits to revalidate, otherwise A. B only shifts one deploy's staleness, and C covers it."
        }
      ],
      "security_findings": "none",
      "out_of_scope_findings": [
        "class: a · reach: named real producer — plugin-security denialLocaleOf/denialLabels (security-plugin-authz-middleware.ts): the master-detail write refusal's userMessage, which the REST data door relays · evidence: on an i18n service with sourceLocale en, defaultLocale/fallback zh-CN, a zh-CN pack naming mue_contract 合同 and an en pack, an engine insert refused by the master-edit gate answers userMessage 'You need edit access to the Contract …' for locale en but '… the 合同 …' for en-US. denialLocaleOf returns the raw request tag (its resolveBundleLocale call only tests whether the built-in catalog has text), and denialLabels hands it to translateObject unnegotiated. So after PR #36561 /meta (Contract) and plugin-security (合同) still name the object differently for en-US, and the card's acceptance does not hold for this reader. Fix direction: negotiate the label locale against i18n.getLocales() as objectql and plugin-approvals do. Same family as #36466 · dedupe words: plugin-security denialLabels negotiate locale, userMessage en-US sourceLocale master label, denialLocaleOf raw tag",
        "carrier: os-steve (seat) · noted, not filed — the cached /meta item arm's validator hashes no translation input (pack content, negotiation), so a translation change can answer 304 on a stale label body until the document changes. See open_questions[0]; recorded in the PR's Acceptance notes"
      ]
    }
  7. removed
    pm:dispatched
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:uxbugdomain:serverpriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions