Skip to content

fix(app-shell): a dynamic currency change in record History reads in the tenant currency - #27779

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-pwdhvq
Oct 29, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-pwdhvq

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

domain:ui#2 · os-bill · session_01Utp6CY2n1JmZZKrHgtp9jC

Requested by Bill · project thread
Fixes #27640

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:记录页 History 的格式化上下文现在带上租户默认币种(useLocalization().currency),dynamic 币种字段的变更显示为 €1,500.00 → €2,500.00,不再是裸数字。
  • 为什么改:同一字段在记录页显示 $4,321,000.00,History 里却是 4,321,000.00,两处读数不一致;原因是 History 从没拿到租户币种。
  • 风险与回滚:风险低,只是给已有的可选成员传值,record 模式不受影响;回滚即还原本 PR 一个提交。
  • 先看:ui/packages/app-shell/src/views/RecordDetailView.tsx(fmtCtx 一行、hook 读取、effect 依赖),再看新测试 RecordDetailView.auditTenantCurrency-27640.test.tsx。
  • 两分钟验证:pnpm --dir ui exec vitest run packages/app-shell/src/views/RecordDetailView.auditTenantCurrency-27640.test.tsx,预期 3 个测试全绿。
  • 需要你做的:无,席位落地。

What changes

RecordDetailView's History effect built its format context as { t, locale: displayLocale, lookupLabels }, so formatAuditValue → resolveFieldCurrency never reached its last step, the tenant default currency (AuditValueFormatContext.tenantCurrency, ADR-0053). A dynamic-mode currency change therefore read as a plain grouped number next to the record's own currency face.

  • The view reads const { currency: tenantCurrency } = useLocalization(); (from @object-ui/i18n), the same value the record page's cells read: DetailView in @object-ui/plugin-detail takes its tenantCurrency from useLocalization() the same way. The view held no such value before, so this is the one hook read the triage allowed.
  • fmtCtx becomes { t, locale: displayLocale, lookupLabels, tenantCurrency }.
  • tenantCurrency joins the History effect's dependency list beside displayLocale, so the stream re-formats when the tenant's localization arrives or changes, the way it already does for a display-locale switch.
  • record-mode fields are unchanged (out of scope per triage): resolveFieldCurrency answers no code for them without the row, and the tenant default is never their fallback.

Changeset: .changeset/27640-history-dynamic-currency.md, @object-ui/app-shell patch.

Tests

New: ui/packages/app-shell/src/views/RecordDetailView.auditTenantCurrency-27640.test.tsx renders the record page on its History stream (?tab=timeline) under a real I18nProvider and a LocalizationProvider, with one audit entry that moves a dynamic field and a record-mode field from 1500 to 2500:

  • EUR tenant: the dynamic change reads Amount €1,500.00 → €2,500.00 (the pin);
  • EUR tenant: the record-mode change stays List price 1,500.00 → 2,500.00;
  • control, no tenant currency: the dynamic change reads Amount 1,500.00 → 2,500.00.

Ablation (fix committed first, mutation through scripts/ablation-replace.mjs): replacing lookupLabels, tenantCurrency }; with lookupLabels }; landed on disk (anchor 1 → 0, blob ab5f20a6e2c8 → cb4dc3752561); the pin went red (got: Amount 1,500.00 → 2,500.00), the record-mode case and the control stayed green, and the restore matched the HEAD blob ab5f20a6e2c8.

Acceptance notes

  • The spec seat's draft PR feat(rest,console): one request opens a record page #27713 also edits RecordDetailView.tsx; its patch does not touch the hunks here (the import line, the displayLocale hook area, fmtCtx and the History effect's dependency list). Whichever lands second rebases.
  • Local verification was narrowed: the @object-ui/app-shell package holds about 1,900 test files, too many to run on the shared box under the verification lock, so the local run covers every test file that imports RecordDetailView plus the auditHistoryDisplay unit tests. Test UI in CI runs the whole package.

Verification

Local readings, on head 7be9046e (after the one merge of origin/main) unless named otherwise.

Targeted tests
  • New test file: Test Files 1 passed (1), Tests 3 passed (3).
  • History siblings (RecordDetailView.auditDisplayLocale-10442, auditHistoryDisplay.numericAmounts-27486): green.
  • Every test file importing RecordDetailView plus the auditHistoryDisplay unit tests (157 files, the new one included): Test Files 156 passed | 1 skipped (157), Tests 1079 passed | 8 skipped (1087), lock VERDICT command-exit 0.
Typecheck and lint
  • pnpm --filter @object-ui/app-shell run type-check (both tsc --noEmit and tsconfig.test.json), on f804616f (the merge brought no change to this diff's files): lock VERDICT command-exit 0.
  • eslint on the two touched source files: exit 0, 0 errors (warnings only, the existing no-explicit-any ones and two as any test doubles that mirror the sibling History test).
  • pnpm check:new-line-citations (run by hand per ui/AGENTS.md): 0 new citations.
Derived gates

node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 34 commands over the 3 changed paths; all 34 exited 0 (node scripts/check-sdui-manifest.mjs among them), and --ran reconciled 34 derived / 34 run / 0 NOT-MEASURED. Re-run in full on 7be9046e: 34/34 exit 0, --ran reconciled 34/34/0.


Generated by Claude Code

…the tenant currency

The record page's History format context now carries
`useLocalization().currency` as `tenantCurrency`, the value the page's
currency cells read, so `resolveFieldCurrency` reaches the tenant default
for a `dynamic`-mode field. `record`-mode fields stay a plain number.

Claude-Session: https://claude.ai/code/session_01Utp6CY2n1JmZZKrHgtp9jC
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling labels Oct 29, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#2 · os-bill · session_01Utp6CY2n1JmZZKrHgtp9jC

席位核对

ACCEPT · head 7be9046e251bb915602b55b537fc69f3a18b15f1 · 2026-10-29T23:18Z

  1. Shape: draft → main, Fixes #27640, attribution block on top. Three files: app-shell/src/views/RecordDetailView.tsx (+6 / −3), one new test and one changeset (@object-ui/app-shell patch). No assignee, no reviewer. Implemented by the seat's in-seat subagent on the seat's branch.
  2. Premise and diff (seat read):
    • The History format context is now { t, locale: displayLocale, lookupLabels, tenantCurrency }.
    • The value is useLocalization().currency, the same read plugin-detail's DetailView uses for its cells. Triage asked for "the same value its cells read", and the page did not hold it before, so this is the one hook read the order allowed.
    • tenantCurrency joins the History effect's dependency list beside displayLocale, so a localization that loads after the first read re-formats.
    • record mode is unchanged.
  3. Gates (check-runs on this head): 44 success, 11 skipped, 0 red.
    • Named runs: Lint & Repo Gates 123787201673, TypeScript Type Check 123786458156, Test UI 123788448082, Lint · PM dispatch-gates 123784418424.
    • The dev's derived gates: 34/34 run, 0 NOT-MEASURED.
    • The test pins three cases: dynamic + EUR reads €1,500.00 → €2,500.00; record mode stays plain; no tenant currency stays plain (control).
    • The ablation turned the EUR case red and was restored.
    • 157 RecordDetailView-importing files: 156 passed, 1 skipped.
  4. Contract review: not owed. Clause-②: no: app-shell is private, and the context member tenantCurrency was already declared by fix(app-shell): format currency, number and percent values in the record history Changes entry #27638. Metadata-protocol: none.
  5. Accepted deviations / out of scope:
  6. Landing: not governed (check-governed-merges --pr 27779: NOT governed), +238 / −3 < 3000. The seat lands it: ready + auto-merge now.

Generated by Claude Code

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 29, 2026 23:19
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge October 29, 2026 23:19
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 29, 2026
Merged via the queue into main with commit 561b764 Oct 29, 2026
56 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-pwdhvq branch October 29, 2026 23:45
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/m tooling

Projects

None yet

1 participant