Skip to content

feat(console): the workspace prompt also asks an administrator for a still-unset default currency - #28953

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/project-thread-64s6kz
Nov 2, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/project-thread-64s6kz

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steedos · project thread

Fixes #28872

Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 改了什么:组织还没有默认货币时,控制台原有的「设置系统时区」一次性提示现在也会问货币,预填浏览器所在地区的货币(如 人民币(CNY));时区和货币都没设时只弹一个对话框、一次保存。区域→货币的 CLDR 表从 plugin-auth 搬进 @objectstack/spec/shared,两边读同一份,控制台不再需要第二份表。
  • 为什么改:裁决 B9 允许设置页有一个向导。今天组织创建时推不出货币(es-419 这类无国家的语言、容器没设 LANG)就什么都不写,所有金额静默显示为裸数字,没人被告知。
  • 风险与回滚:低。只对能写 localization 的管理员、且货币在任何层级都没有值时才问;确认走设置页同一个 PUT /api/settings/localization,拒绝什么都不写;没有新设置键、没有服务端 dismissed 标记、没有门禁。回滚即回退本 PR,表搬回 plugin-auth。
  • 先看:ui/apps/console/src/pages/settings/workspaceTimezonePromptLogic.ts(findWorkspacePromptOffer 与 currencyArm 的判定);ui/apps/console/src/pages/settings/WorkspaceTimezonePrompt.tsx(两个字段合一个对话框、只写有值的键);packages/spec/src/shared/region-currency.ts(原样搬来的表与查找)。
  • 两分钟验证:pnpm --dir ui exec vitest run apps/console/src/pages/settings/__tests__/WorkspaceTimezonePrompt.currency-28872.test.tsx,预期全部通过;其中「both unset」组断言只有一个对话框、一次 PUT 同时带 timezone 与 currency。
  • 需要你做的:无,席位落地。

What changes

The table moves to spec (premise checked first). REGION_CURRENCY and currencyForLocale move unchanged from packages/plugins/plugin-auth/src/organization-default-currency.ts to a new packages/spec/src/shared/region-currency.ts, exported from the @objectstack/spec/shared entry. plugin-auth imports currencyForLocale from there and keeps no copy; neither name was exported from the plugin-auth package entry. The console already imports @objectstack/spec/shared (the prompt logic reads isValueDomainMember from it), so the console reads the same table with no second hand-written copy and no new entry. The module imports nothing.

One prompt for both keys. findWorkspacePromptOffer (replacing findTimezoneOffer) reads the Settings client once and answers either arm, or both, or nothing:

  • timezone: unchanged condition (still the manifest default, unlocked, browser zone admissible);
  • currency: localization.currency resolves from source: 'default' with no value (the key declares no default, so no rung holds one), unlocked, and the browser region's currency is a member of the specifier's value domain. A manifest that declares a default currency has one, so it is not asked about.

The browser region's currency is currencyForLocale of the FIRST browser language only (browserLanguage): a later preference names a language the person reads, not where they are. A tag with no country region (es-419) offers nothing. Both arms need the namespace's writePermission, as before, so a non-admin is never asked and never reads the namespace.

The dialog shows a SettingsField per arm (the Settings page's own control and error slot). Confirm writes the keys whose field holds a value in one saveSettingsNamespace('localization', …) call, the Settings page's write path; clearing the currency field in the combined dialog leaves it unset. Decline ("Not now" when the currency is asked; "Keep the default" when only the timezone is) writes nothing. The prompt's existing per-device record (os:workspace-timezone-prompt:ORG:USER) covers both arms. No settings key, server-side dismissed flag or gate is added.

Copy. Eight console.workspaceTimezonePrompt.* strings in all ten built-in locales: currencyTitle, currencyDescription, currencyConfirm, currencySaved, bothTitle, bothConfirm, bothSaved, notNow. currencyDescription names the offer by the currency's Intl.DisplayNames name in the UI language and its code (name and code placeholders), for example 人民币(CNY) in zh and "Chinese Yuan (CNY)" in en. The timezone-only copy is unchanged.

Tests

  • packages/spec/src/shared/region-currency.test.ts (new): the table and lookup pins moved from plugin-auth, plus a pin that the shared entry re-exports the same bindings.
  • packages/plugins/plugin-auth/src/organization-default-currency.test.ts: the two moved describe blocks are removed; the rest is unchanged. organization-created-default-currency.test.ts (the composed path through the real settings service) is unchanged and green.
  • ui/apps/console/src/pages/settings/__tests__/WorkspaceTimezonePrompt.currency-28872.test.tsx (new): the currency arm alone (en and zh copy, pre-fill, one PUT carrying the currency alone, an edited value, decline and no second ask, a refusal in the field's error slot, asked with no browser zone), the combined case (one dialog, both fields, one read, one PUT with both keys, a cleared currency field written as timezone only, decline), and the no-prompt cases (tenant, global and env currency, a manifest default, a non-admin, an es-419 browser, nothing to offer means no request).
  • WorkspaceTimezonePrompt.test.tsx: one edit. "no browser zone at all → no prompt and no request" now also stubs the browser language to es-419, because a browser with a currency to offer now reads the settings. Every other timezone pin is untouched.

Acceptance notes

  • The record is the existing one, as the card asks ("under the prompt's existing record"). So an administrator who was already shown the timezone prompt on this device before this lands is not asked about the currency there. The Setup → Localization page still shows the unset key.
  • A browser whose first language has no country region (es-419) is not asked, by the card's "offering the browser region's currency"; no guess is made from later preferences.
  • "Amounts then show the symbol" follows from the existing renderer reading localization.currency; this PR writes the key through the Settings page's path and does not change the renderer.

Verification

Branch base 97680bbb; readings on head 93694e2e unless named. origin/main has moved 7 commits since, none touching a file this diff changes.

Tests
  • pnpm --filter @objectstack/spec exec vitest run src/shared/region-currency.test.ts src/shared/value-domain.test.ts: 2 files, 41/41 passed (at 2c068e8f; packages/spec/src unchanged since).
  • pnpm --filter @objectstack/plugin-auth exec vitest run src/organization-default-currency.test.ts src/organization-created-default-currency.test.ts: 2 files, 26/26 passed (at 2c068e8f; plugin-auth unchanged since).
  • pnpm --dir ui exec vitest run on the three WorkspaceTimezonePrompt* files plus packages/i18n/: 97 files, 1477 passed, 13 skipped, 0 failed.
  • pnpm --dir ui exec vitest run scripts/: 169 files passed, 2 skipped; 4900 tests passed.
  • Ablation (one-time, not kept): scripts/ablation-replace.mjs replaced if (currency) offer.currency = currency; in findWorkspacePromptOffer; the currency test file went 11 failed / 9 passed, and the restore leg read blob == HEAD with an empty git diff HEAD.
Type-check, lint, generated artifacts
  • turbo run type-check --filter=@object-ui/console --filter=@object-ui/i18n: 72/72 tasks; turbo run typecheck --filter=@objectstack/spec --filter=@objectstack/plugin-auth: 33/33 tasks.
  • eslint on every changed source and test file: exit 0 (root and ui/).
  • pnpm --filter @objectstack/spec check:generated: two artifacts stale after the export (api-surface/shared.json, export-origins/shared.json), regenerated with gen:api-surface and gen:export-origins, then all gates up to date.
Derived gates

node scripts/pm/dispatch-gates.mjs --ran: 87 derived families accounted for, 86 run, 1 NOT MEASURED. pnpm check:dual-build-cjs-loads answered PREREQUISITE NOT MET (exit 3: it reads every package's dist/, and this worktree did not run a full pnpm build); CI's Lint and Repo Gates runs it. check-plugin-teardown-shape --self-test first exited 3 on the shallow clone's missing fixture commit, then 0 after fetching that commit. The PR-body gates (check-changeset-no-major, check-closing-keyword-parity, check-partof-closing-keyword, check-adr-0087-registration, check-empty-changeset) ran on this body: exit 0. pnpm check:new-line-citations under ui/: 0 new citations.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QsR2jUHdaZrLT9hey9hCyL


Generated by Claude Code

…ack/spec/shared

plugin-auth's REGION_CURRENCY and currencyForLocale move to
packages/spec/src/shared/region-currency.ts, exported from the shared
subpath. plugin-auth reads the lookup from there and keeps no copy, so the
console can read the same table.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jUHdaZrLT9hey9hCyL
…rrency too

While localization.currency has no value on any rung, an administrator who
may write the namespace is asked once, offered the currency of the browser's
region through currencyForLocale from @objectstack/spec/shared. With the
timezone still the default as well it is one dialog with both fields and one
PUT /api/settings/localization. Decline writes nothing; the prompt's existing
per-device record covers both arms.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jUHdaZrLT9hey9hCyL
… region-currency exports

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jUHdaZrLT9hey9hCyL
… separate format string

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jUHdaZrLT9hey9hCyL
@github-actions github-actions Bot added size/xl documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

2 anchor(s) derived from 2 changed package(s); no hand-written page names any of them. ⚠️ 3 changed file(s) yielded no anchor (packages/spec/api-surface/shared.json, packages/spec/export-origins/shared.json, packages/spec/src/shared/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

What this run could not see
  • 3 changed file(s) yielded no anchor (packages/spec/api-surface/shared.json, packages/spec/export-origins/shared.json, packages/spec/src/shared/index.ts) — pages documenting those are invisible to this run
  • the SDK route bridge reached 60 of 216 client-bound route-ledger rows — the other 156 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 156: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 101 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 173 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json ff88105061012c8b14f7ec937d7b3113e404e922 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 9c8b308496832cb5dc9787d73cb75e28d338fbe6 — the merge of head 86224bf08620f187d1a9c17af2bee9e4111824dd into base ff88105061012c8b14f7ec937d7b3113e404e922, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 9c8b308496832cb5dc9787d73cb75e28d338fbe6 && git checkout 9c8b308496832cb5dc9787d73cb75e28d338fbe6
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin ff88105061012c8b14f7ec937d7b3113e404e922 86224bf08620f187d1a9c17af2bee9e4111824dd && git checkout -B drift-repro ff88105061012c8b14f7ec937d7b3113e404e922 && git merge --no-ff 86224bf08620f187d1a9c17af2bee9e4111824dd

node scripts/docs-audit/affected-docs.mjs --json ff88105061012c8b14f7ec937d7b3113e404e922

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

…the currency is unset too

The console now opens the one workspace prompt when localization.currency
has no value, not only when the timezone is the default. global-setup
decided from the timezone alone, so on a backend with a chosen zone and no
currency the prompt stayed open over every spec's page.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jUHdaZrLT9hey9hCyL
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#1 · zhuangjianguo · session_01QsR2jUJ19MstFvFhjgiYTu

席位核对 · ACCEPT · 2026-11-02T05:31Z

Head-sha: 86224bf08620f187d1a9c17af2bee9e4111824dd

  • Shape:
    • The PR is a draft against main. The first card line is Fixes #28872, and no other card sits beside a closing keyword.
    • 23 files, +1000 / −212. No governed path: check-governed-merges --pr 28953 reports NOT governed.
    • Clause-②: yes (widening) and Metadata-protocol: none start their lines in the body and the changeset, as claimed (6568772992, amendment 6569504288). The changeset is patch.
  • Read in the diff:
    • REGION_CURRENCY and currencyForLocale move to packages/spec/src/shared/region-currency.ts and are exported from @objectstack/spec/shared. The seat diffed the table against main's plugin-auth copy and it is byte-identical. plugin-auth now imports currencyForLocale from spec and keeps no copy. Its package index never exported either name, so nothing public narrows.
    • The console prompt adds the currency arm. It asks when localization.currency resolves from the default with no value, is unlocked, and the admin may write. It offers currencyForLocale of the browser's first language. An unset timezone and an unset currency share one dialog, one read and one PUT. Decline writes nothing, and the existing shown-record covers both.
    • There is no new settings key, no server flag and no gate. 8 UI strings are added in each of the 10 packs.
    • ui/e2e/live/global-setup.ts now answers the prompt when the currency is unset too, through the prompt's own buttons (amendment 6569504288). LIVE_TIMEZONE_PROMPT keeps its meaning.
  • Gates (check-runs on this head): 56 success, 8 skipped, 0 failed or pending, Live E2E UI included. mergeable_state is clean. The red Live E2E at 93694e2e was this PR's own prompt over every page, fixed at 86224bf0. The cancelled lanes at 93694e2e were superseded by that push.
  • Tests (dev): spec 41/41 and plugin-auth 26/26 pass. The prompt files plus i18n pass 97 files / 1477 tests, and the ui scripts/ suite passes 169 files. The currency-arm ablation turned 11 pins red and was restored. Live, locally: the control run reproduced CI's red, the fix ran 16 passed, and confirm mode wrote USD.
  • Accepted boundaries:
    • An admin who already saw the timezone prompt on a device is not asked about currency there.
    • A browser whose language maps to no currency (e.g. es-419) gets no offer and so no prompt.
    • Both are by the card's "asked once, under the prompt's existing record" and "no guessed currency".
  • Note: the comment at service-settings localization.manifest.ts:123 still calls plugin-auth's file "the authority". It remains the seeding authority; the table now lives in spec. No edit is owed here.
  • NOT MEASURED: check:dual-build-cjs-loads locally (needs a full build); CI's build covers it. The seat ran no live session.
  • Landing: ordinary queue landing, pr_ready then automerge_enable. Fixes #28872 closes the card on merge.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 2, 2026 05:32
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 2, 2026 05:32
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit 2ac698b Nov 2, 2026
65 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-64s6kz branch November 2, 2026 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

1 participant