Repository navigation
fix(studio): the dataset inspector stores no guessed measure currency - #27208
Conversation
Picking the Currency display format with no code no longer stores currency: 'USD'; the picker defaults to inherit over a currency field and the measure carries no currency key, so it inherits the field's fixed currency and then the tenant default. Claude-Session: https://claude.ai/code/session_01JQwxbakr3SQTyXX1NuZkt3 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbakr3SQTyXX1NuZkt3 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbakr3SQTyXX1NuZkt3 Co-authored-by: Claude <noreply@anthropic.com>
席位核对ACCEPT · seat 席位意见:Studio 数据集检查器不再替作者猜币种:选「货币」格式但不选币种时,度量不写
Generated by Claude Code |
…-0rmmxq # Conflicts: # ui/packages/app-shell/src/views/metadata-admin/inspectors/DatasetDefaultInspector.tsx
席位核对 · addendumACCEPT stands · seat The merge queue removed this PR for the conflict the ACCEPT foresaw: #27163 landed as Generated by Claude Code |
Requested by Warren · project thread
Fixes #27156
Clause-②: no
Metadata-protocol: none
维护者速读
currency: 'USD';货币字段上的度量默认「继承」,保存的度量没有currency键。currency优先于字段固定币种和组织默认币种,猜出来的 USD 让人民币组织的仪表盘显示$(裁决 6464202770,Q2 = X:任何地方都不猜币种)。currency: 'USD'原样保留、不迁移。回滚 = revert 本 PR。DatasetDefaultInspector.tsx的buildMeasureFormat与MeasureFormatField;新测试DatasetDefaultInspector.currencyNoGuess-27156.test.tsx。currency键,币种框显示「继承 —— 字段或组织的默认币种」。What changes
buildMeasureFormat('currency', …)with an empty currency returnscurrency: undefinedinstead of'USD', and the currency picker no longer pre-selects USD (it readmeasure.currency || 'USD').writeMeasureFormatrebuilds the measure withoutformat/currencywhen the picker leaves them unset (thewriteRowFieldrule), so the held draft and the saved body both carry nocurrencykey, rather thancurrency: undefined.currency-type source field the picker gains an "Inherit — field or organization default" row (''), which is the default. Over any other field it offers no inherit row and shows the placeholder "Choose a currency".parseMeasureFormattakes amonetaryFieldflag: a code-less, non-percent numeral format over acurrencyfield reads back as Currency · inherit.@object-ui/i18nstudio namespace:engine.inspector.dataset.currencyInheritandengine.inspector.dataset.currencyChoose(en, zh). Patch changeset for@object-ui/i18n.Why
Maintainer ruling 6464202770 on #27119 (Q2 = X): no surface guesses a currency. The analytics chain resolves a monetary measure's currency as explicit measure
currency, then the source field's fixed currency, then the tenant default; a stored guess outranks both.Tests
New
DatasetDefaultInspector.currencyNoGuess-27156.test.tsx(6 cases, the inspector mounted with a stateful draft holder):currencyfield: the measure has nocurrencyproperty (not.toHaveProperty, socurrency: undefinedwould fail too),format: '0,0', the picker reads inherit;currency: 'CNY';currency: 'USD'measure: no patch on mount, the picker shows USD, a decimals change keepscurrency: 'USD';currencykey, kind stays Currency, the picker shows "Choose a currency" and offers no inherit row;currencyfield reads Currency · inherit; CONTROL: the same format over a number field reads Number.Ablation (committed fix,
node scripts/ablation-replace.mjswith anchorcurrency: currency || undefined };replaced bycurrency: currency || 'USD' };): 2 failed / 4 passed — "stores no currency key when Currency is picked with no code" and the number-field case go red; restore verified (blob10ecdd83equals HEAD,git diff HEADempty).Acceptance notes
currency: 'USD'(including one this inspector wrote earlier) is explicit on the wire: no migration, no rewrite on load, and it round-trips through edits unchanged (pinned above).currency-type field; any other measure never receives a code. So "inherit" is offered only over acurrencyfield; over other fields the empty state asks for a code, following the ruling's intent (no guess) rather than offering an inherit that resolves to nothing.currencyfields. A code-less numeral format over acurrencyfield used to read back as "Number"; it now reads as Currency · inherit. The runtime already rendered those measures with a currency, so the new reading matches what dashboards show. A consequence: choosing "Number" over acurrencyfield reads back as Currency after a reload, because the runtime attaches a currency to it either way.'USD'left inviews/metadata-admin(non-test) is theCURRENCY_OPTIONSrow itself. TheformatKind.currencylabel still shows$1,234.50as an example; it is display text and writes nothing.buildMeasureFormat;origin/mainwas merged before the gates.Verification
Final head
77475026. The last commit only drops anexportkeyword; the derived gates, the ui scripts suite and the two inspector test files were re-run on it, the wider suites ran ondcfac927.Local runs
77475026:node scripts/pm/dispatch-gates.mjs --commands(list unchanged), all 34 families exit 0,--ranreconciliation 34 derived, 34 run, 0 NOT-MEASURED;pnpm --dir ui exec vitest run scripts/plusDatasetDefaultInspector.currencyNoGuess-27156.test.tsxandDatasetDefaultInspector.test.tsx(verify lock): 177 files passed, 2 skipped; 5040 tests passed, 2 skipped.dcfac927:pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/inspectors/ packages/i18n/(verify lock): 286 files passed, 4116 tests passed, 14 skipped.pnpm --filter @object-ui/app-shell --filter @object-ui/i18n run type-check: bothtype-check: Done, exit 0.pnpm --dir ui run check:new-line-citations: 0 new citations, exit 0.eslint --no-inline-configon the four changed files: 0 errors (pre-existing warnings only).dispatch-gates --tier: no path-derived mandate; 233 changed lines.Human Minimum
packages/specholds no runtime logic. (not touched)pnpm lintpasses. (changed files linted locally; repo-wide run is CI's)main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (not touched)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code