Repository navigation
fix(plugin-grid): a multi-field row conflict lists each field, and a summary column's footer total is formatted as its cells - #33728
Conversation
…at a summary column's footer total as its cell A grid row save that changed several fields and met a 409 now fills the conflict dialog's per-field list (column header, your edit, current value) instead of handing it the draft map, which printed as raw JSON. The footer total of a roll-up (summary) column now takes the arm the list cell draws the same field with: money when the summary declares its currency, else a number at its declared scale. @object-ui/fields exports summaryDeclaresCurrency, the cell's own test, for the footer to reuse. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5mDVzZmSX2UmJXU7sH
…the fix Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5mDVzZmSX2UmJXU7sH
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5mDVzZmSX2UmJXU7sH
|
domain:ui#2 · os-project-manager · session_01FEkQ5oF8GgTHN2jBZoDwz8 Contract reviewServed-tier: Inputs: #33557 (body and 3 comments), #33542 (body and 4 comments, including claim amendment 04:25Z), the PR #33728 body, its 6-file list and net diff against ① Derived judgmentsJ1 ·
J2 ·
J3 ·
Pins: the two new tests run against the rendered grid, and each has a CONTROL. The ablations quoted in the PR body (fields ablated: 1 red / 1 green; summary routing switched off: 4 red / 1 green) are the dev's report. This review did not re-run them. ② Semver levelRight.
③ Boundary flags
Implemented-by: VERDICT: PASS |
|
domain:ui#2 · os-project-manager · session_01FEkQ5oF8GgTHN2jBZoDwz8 席位核对Verdict: ACCEPT · head
|
Requested by Leehom · project thread
domain:ui#2 · os-project-manager · session_01FEkQ5mDVzZmSX2UmJXU7sH
Fixes #33557
Fixes #33542
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
Field.summary)的合计按它在单元格里的画法格式化:声明了币种(currencyConfig)就按货币,否则按声明的scale位小数;都没声明的保持原样。HotCRM 发票列表的「Paid 230,000」因此读作「230,000.00」,与该列单元格一致。{"estimate_hours":61,...};fix(ui): console v18.4.0 sweep — connector input reset, per-field conflict list, share page fields, Studio error box wrap #33547 已给对话框加了逐字段列表,表格这条路径还没填。② 合计行的格式化按列类型分支,summary类型落到兜底分支,从不读scale;实测 showcase 服务端返回的汇总字段带scale: 2,缺口在 ui。@object-ui/plugin-grid内部和@object-ui/fields新增一个导出summaryDeclaresCurrency(单元格本就用它判断汇总字段是否为货币,现在合计行复用同一个判断,不另写格式化器)。货币与否按汇总字段自己的currencyConfig,不看被汇总的源字段类型,这是 spec 的规定,席位已认可。回滚即 revert 本 PR。ui/packages/plugin-grid/src/useColumnSummary.ts的summaryValueType及formatSummaryLabel里改为调用它的那一行;ui/packages/plugin-grid/src/ObjectGrid.tsx的buildRowConflict新增的fields。pnpm --dir ui exec vitest run packages/plugin-grid/src/__tests__/footerSummaryFieldScale-33542.test.tsx packages/plugin-grid/src/__tests__/inlineEditConflictFields-33557.test.tsx,预期 7 个用例全绿。What changes
#33557, a multi-field grid row conflict lists each field.
buildRowConflictinObjectGrid.tsxnow fills the conflict'sfieldslist (#33547'sConcurrentUpdateFieldConflict: field, label, your edit, current value) when a row save changed more than one field, labelled by the column header (columnHeaderOf, the label the one-field conflict already uses). The dialog then draws one row per field instead of the two whole-map previews. A one-field conflict is built exactly as before.#33542, a summary column's footer total is formatted as its cell. The footer formatter (
formatSummaryLabelinuseColumnSummary.ts) chooses its arm by the column type, and asummarycolumn fell to the plain default, which never readsscale. A newsummaryValueTyperoutes a summary into the arm the list cell draws the same field with (FormulaCellRenderer):currencywhen the summary declares its currency (summaryDeclaresCurrency, the cell's own predicate, now exported from@object-ui/fields), elsenumberwhenresolveFieldScaleanswers a width, else the plain default as today. No second formatter: the existing currency arm (formatCurrency) and number arm (resolveFieldScale) do the formatting.Measured first, as the triage asked. On a live showcase (
origin/maind95ddeb,objectstack dev),GET /api/v1/meta/object/showcase_expense_reportserves the summary fields with their scale, e.g.total_amount:{"type":"summary","scale":2,"summaryOperations":{"object":"showcase_expense_line","field":"amount","function":"sum"}}, nocurrencyConfig. The sourceshowcase_expense_line.amountis served astype: currencyon its own object. So the scale reaches the console and the gap was the footer.Tests
ui/packages/plugin-grid/src/__tests__/inlineEditConflictFields-33557.test.tsx, new. The realObjectGrid,data-tableandConcurrentUpdateDialog; writes go through the real@object-ui/data-objectstackadapter and@objectstack/client, with onlyfetchstubbed by a server answering a staleIf-Matchwith the 409CONCURRENT_UPDATEenvelope. Cells are edited by click, typing and Enter, then the row's Save is clicked.estimate_hoursunder "Estimate" (61 / 77) andowner_noteunder "Owner note" (shipped / blocked), and its text holds no{or}.ui/packages/plugin-grid/src/__tests__/footerSummaryFieldScale-33542.test.tsx, new. The realObjectGridfooter, its field catalogue read from the data source's object schema, under a realI18nProvider.scale: 2totals toSum: 230,000.00; zh-CN:合计:230,000.00.fixedCNY currency totals exactly as a plain currency column with the same config does (money, not a bare number).Sum: 7).Ablations at head
eed5643b(scripts/ablation-replace.mjs; the tests import plugin-grid and@object-ui/fieldsfromsrc/through the ui vitest alias, so no dist is in the path):#33557: buildRowConflict without the fields list → the multi-field case red, the control green; restored
#33542: the summary routing switched off → the four scale and currency cases red, the control green; restored
Acceptance notes
currencyConfig, not its source field's type (seat accepted this reading). The card asks for the currency format "when its source field is currency". The spec'scurrencyConfigdescribe says "Absent: dynamic mode, and no currency on a summary", and the list cell (FormulaCellRenderer) draws a summary as money only whensummaryDeclaresCurrencyholds. The footer follows the same rule, so footer and cell agree. HotCRM's All Invoicespaid_amount(Field.summary,scale: 2, nocurrencyConfig, summing currencycrm_payment.amount) therefore totals as230,000.00, matching its cells; a HotCRM author who wants it drawn as money declarescurrencyConfig: { currencyMode: 'fixed', ... }on the summary. The HotCRM result is read from a fixture of the same shape in the pin above, not from a live HotCRM run.formulacolumn's footer total also falls to the plain default arm (the cell draws it byreturnType). Not measured on a real producer here; noted only.Verification
Local, at head
eed5643b(rebased onorigin/main5604aeb), each exit code captured before any pipe:pnpm --dir ui exec vitest run packages/plugin-grid/ --maxWorkers=2under the verify lock: Test Files 283 passed (283), Tests 2443 passed (2443), the two new files included.pnpm --filter @object-ui/fields run type-checkandpnpm --filter @object-ui/plugin-grid run type-check(eachtsc --noEmit && tsc -p tsconfig.test.json, so the new tests are type-checked): exit 0, after building the@object-ui/plugin-grid^...closure.pnpm check:new-line-citations(ui, run by hand perui/AGENTS.mdMigrate documentation site to Fumadocs with monorepo structure and shared content #11): 0 new citations.node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack): 39 derived, 39 run, all exit 0;--ranreconciles: "39 derived famil(ies) accounted for — 39 run, 0 NOT-MEASURED".the 39 derived families, each COMMAND :: exit N
The repo-wide scans, the
test:repoproject and every family CI runs beyond the derived list are CI's (Test UI, Type Check UI and the lint farm).Generated by Claude Code