Skip to content

fix(plugin-grid): leave a raw aggregate over a record-mode quantity out of the whole-set footer and group headers - #36271

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-36082-record-unit-summary
Nov 22, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-36082-record-unit-summary

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread
Fixes #36082

Clause-②: no
Metadata-protocol: none

维护者速读

  • 列表和表格分页时,底部合计行不再把「按行单位的数量」(一行千克、一行磅)的求和、平均、最小、最大放进整表合计查询;该列只显示计数,其他列照常显示整个视图的合计。
  • 属于「数量带单位」上线前的收尾:引擎已拒绝不按单位分组的这类求和,不做这一步,整条合计查询被拒,其他列会悄悄退回成本页合计。
  • 出错的话,影响的只是表格底部和分组标题里的数字;可直接撤回本改动,不涉及数据。
  • 无。

What changes

One rule in recordCurrencyAggregates.ts, two readers: a raw sum / avg / min / max over a measure whose unit each record names itself needs the rows grouped by that unit's field.

  • recordUnitField(def) reads a record-mode quantity exactly as the engine door recordUnitFieldOf does (packages/objectql/src/record-unit-aggregate-door.ts): a number with unitConfig.unitMode === 'record' and a non-empty unitField.
  • recordMeasureUnitField(def) = the currency code field (recordCurrencyField from @object-ui/i18n, unchanged) or that unit field.
  • requiredCurrencyGrouping becomes requiredAggregateGrouping and isMoneyAggregate becomes isMeasureAggregate (module-internal, not in the package barrel); the aggregate set stays one constant.
  • Readers, all through that one helper: wholeSetSummaryNodes (the whole-set footer query leaves the node out), honestGroupAggregations (a group aggregate stands only when grouped by the unit field), useScopedColumnSummary (the footer cell draws nothing for it, as for a record-mode amount) and offeredColumnSummaries (the footer menu offers the count family only).
  • No engine, no packages/spec change. No new per-unit total.

Tests

  • recordCurrencyAggregates-27188.test.tsx, new top-level describe for the quantity: footer draws no sum / avg / min / max and the count stands; fixed-mode and plain-number controls sum; the menu offers no aggregate; group aggregates stand grouped by unit_code and drop otherwise; the predicate's edges (empty unitField, non-number type).
  • footerSummaryScope-12081.test.tsx, new top-level describe (the double now refuses a record-mode quantity aggregate as the engine does): a view with a record-mode quantity sum beside a plain-number sum sends one query carrying only count and sum_amount, the plain column shows its whole-set figure, the quantity column shows nothing, zero refusals. Control: a fixed-mode quantity is asked and totals over the whole set.
  • Ablations (one per leg, each through scripts/ablation-replace.mjs, mutation landed and restore proven by blob hash): see Verification.

Acceptance notes

  • Group headers at a shallower depth (out of scope, for the seat): honestGroupAggregations keeps a measure aggregate when the unit or code field is at ANY grouping level, and useServerGrouping asks each depth with the first depth grouping fields. Measured with the spec's compileListViewGroupQuery: grouping region then unit_code with a sum over qty compiles depth 1 to groupBy: ["region"] carrying sum_qty, which the engine's unit door (and the currency door, for a record-mode amount) refuses. This PR keeps the currency precedent's rule unchanged and applies it to quantities, as the card ordered.
  • The shared test files were extended instead of a new card-named file: the root rule puts a new pin for a component with a shared harness file into that file as a top-level describe.

Verification

Read first:

  1. ui/packages/plugin-grid/src/recordCurrencyAggregates.ts: recordUnitField must match the engine door's reading.
  2. ui/packages/plugin-grid/src/useWholeSetSummary.ts: the leave-out line in wholeSetSummaryNodes.
  3. ui/packages/plugin-grid/src/useColumnSummary.ts: the footer skip and offeredColumnSummaries.

Two-minute check: pnpm --dir ui exec vitest run packages/plugin-grid/src/__tests__/recordCurrencyAggregates-27188.test.tsx packages/plugin-grid/src/__tests__/footerSummaryScope-12081.test.tsx from the repo root; expect 42 passed.

Readings (source tree at 9f56bc1; the test runs were taken at ae56a75, whose sources are byte-identical, the later commit adds only the changeset):

Pin files and the plugin-grid suite
  • vitest run of the two pin files: Test Files 2 passed (2), Tests 42 passed (42).
  • vitest run packages/plugin-grid/: Test Files 300 passed (300), Tests 2657 passed (2657); lock VERDICT command-exit 0.
  • pnpm --filter @object-ui/plugin-grid type-check (tsc on src and on tsconfig.test.json, which lists both pin files): VERDICT command-exit 0.
Ablations, one per leg

Each mutation through scripts/ablation-replace.mjs (anchor 1 to 0, blob changed), restored with blob equal to HEAD and an empty git diff HEAD. The subject resolves to src (relative imports), so no rebuild sits between mutation and run.

  • Shared predicate (?? recordUnitField(def) removed): 5 failed / 37 passed, exactly the five quantity pins; every currency pin and control stays green. A first attempt was refused by the tool (the replacement was a bare semicolon, whose count could not rise); it ran nothing and is not counted.
  • Whole-set leave-out (the continue in wholeSetSummaryNodes removed): 5 failed / 25 passed, the four record-currency pins and the quantity whole-set pin.
  • Footer cell skip disabled: 5 failed / 37 passed, the two footer pins (amount, quantity) and the three whole-set pins (two currency, one quantity): the left-out column falls back to a page sum over mixed units.
  • Footer menu (offeredColumnSummaries) disabled: 1 failed / 11 passed, the quantity menu pin.
  • Group filter (honestGroupAggregations keeps all): 2 failed / 10 passed, the currency and the quantity drop pins.
Local gate subset

Derived by node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack (38 commands); all 38 exit 0. pnpm --dir ui exec vitest run scripts/ queue-timed out twice on the shared verify lock (exit 99), then passed on the third attempt after the PR was opened: 172 files passed, 2 skipped; 5122 tests passed. pnpm check:type-check-debt first queue-timed out, then exit 0 on retry. Outside the list: check-platform-checklist --changed-from origin/main exit 0 (no anchored file), pnpm --dir ui check:new-line-citations 0 new. overlap-check VERDICT clean.

…ut of the whole-set footer and group headers

The rule that left a sum / avg / min / max over a record-mode amount out of the
whole-set footer query, the footer cell and the group-header aggregations now
reads a record-mode quantity too (unitConfig.unitMode 'record', grouped only by
its unitField), the way the engine's aggregate door refuses it.

Claude-Session: https://claude.ai/code/session_01FEkQ5okniknzVVR3KTSVr1
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 22, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5okniknzVVR3KTSVr1

Final green head · area a4-D · 2026-11-22T04:36Z
Head: 9f56bc1948adf69833f8d7cb5273d21d54204699
CI: 43 success, 15 skipped, 0 failed; check-expected-skips.mjs --pr 36271 OK; mergeable clean; check-governed-merges: NOT governed, 350 changed lines; l1-face CLEAN.
Declarations: Clause-②: no · Metadata-protocol: none. Fixes #36082.
Body: one gate sentence corrected by the area (relay issue_patch, head unchanged): the ui vitest run scripts/ leg is no longer "NOT MEASURED" — it passed on the dev's third lock attempt (172 files, 5122 tests). PR-body guards re-ran green after the edit.
Owed: L1 (L1-b). Dev report: comment 7074155556 on #36082. Points for L1: pins went into the two existing shared harness files (ruling 6583487846) rather than a new card file; the footer's own summary menu now offers only the count family for a record-mode quantity, like record currency; group aggregates are kept only when the grid is already grouped by the unit field (seat scope note). The multi-level grouping refusal found on the way is filed as #36276.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5oVqoTJkrRZcyZS4xd
L1-b · 2026-11-22T04:38Z

席位核对 — ACCEPT · head 9f56bc1

  • Shape: l1-face.mjs --pr 36271 is clean at 9f56bc1: open, draft, base main.
    • The first line is Fixes #36082, and the PR delivers the card's whole Ask: the whole-set footer and the group aggregations both leave out a raw aggregate over a record-mode quantity, and the pins and ablations the card asks for are there.
    • The card's order holds: feat(objectql,service-analytics): refuse a raw aggregate over a record-mode quantity unless grouped by its unit field #36060, which adds the engine refusal, merged at 2026-11-21T14:18Z.
    • No closing keyword binds any other card.
    • The declarations are Clause-②: no · Metadata-protocol: none, and the changeset is patch on @object-ui/plugin-grid.
    • The body edit at 04:34Z re-ran the body guards green.
  • Premise, checked against the engine: recordUnitField in recordCurrencyAggregates.ts is token for token the engine's recordUnitFieldOf in packages/objectql/src/record-unit-aggregate-door.ts. Both read a number with unitConfig.unitMode === 'record' and a non-empty string unitField. So the grid leaves out exactly what the door would refuse: sum, avg, min and max, the door's RAW_QUANTITY_FUNCTIONS.
  • One rule, three readers: recordMeasureUnitField is the currency code field ?? the unit field, and every reader goes through it:
    • requiredAggregateGrouping, used by the whole-set node filter and by honestGroupAggregations;
    • the footer skip in useScopedColumnSummary;
    • offeredColumnSummaries.
      The "awaiting the catalogue" hold now covers quantities too, through isMeasureAggregate. A fixed-mode quantity and a plain number are unchanged.
  • Deviations, all accepted:
    1. The pins are in the two shared harness files (recordCurrencyAggregates-27188, footerSummaryScope-12081), not in a new file named after the card. They extend the currency twin's own harness, as ui(grid): a column summary sum on a record-mode amount sends a raw aggregate the engine refuses, and the footer loses every whole-set total #32334's pins do.
    2. The footer menu offers only the count family for a record-mode quantity. This is the same treatment a record-mode amount already gets, and the card asks for "the way they leave out a record-mode currency amount". Offering a sum the footer then never draws would be an option that does nothing. It changes no stored value and refuses no saved view.
    3. The renamed helpers are internal. isMoneyAggregate → isMeasureAggregate and requiredCurrencyGrouping → requiredAggregateGrouping are exported from the module only. No package entry re-exports recordCurrencyAggregates, and on main nothing outside plugin-grid/src names the old identifiers. So no published API moves and no migration line is owed.
  • Pins and controls: 42 tests across the two files.
    • The whole-set query carries no node for the record-mode quantity, the plain sum keeps its whole-set figure, and no refused request is sent. The control is a fixed-mode quantity, which is asked and totals over the whole set.
    • The footer draws no sum, avg, min or max (10 KGM + 10 LBR is not 20), and a count stands.
    • The menu offers the count family only.
    • A group-header aggregate stands when the grid is grouped by unitField and is dropped otherwise, while counts, fixed-mode and plain aggregates stand.
    • The unit-field reading is pinned as the engine's.
    • Five ablations come from the dev's report 7074155556, and I did not re-run them. Each file was restored to its HEAD blob:
      • shared predicate: 5 ✗, exactly the quantity pins;
      • whole-set continue: 5 ✗;
      • footer skip: 5 ✗;
      • menu: 1 ✗;
      • group filter: 2 ✗.
    • packages/plugin-grid/ gives 300 files and 2657 tests passed, and type-check is clean.
  • Changeset, read sentence by sentence: the U7 R1 refusal, the one shared rule, the whole-set leave-out, the footer and menu, the group headers standing only when grouped by unitField, and fixed or plain totals as before all match the diff.
  • Gates: 43 success, 15 expected skip, 0 unexpected skip, 0 failed and 0 pending. Lint & Repo Gates and TypeScript Type Check are both success. The PR is not governed.
  • Landing: not governed and not narrowing, so the area lands it. The card asks that it land before unitConfig ships in a release.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5okniknzVVR3KTSVr1

席位核对

Landing · area a4-D · 2026-11-22T04:38Z · head 9f56bc1948adf69833f8d7cb5273d21d54204699

Reading Value
L1 ACCEPT 7074291770 (L1-b, this head); three deviations accepted
Contract none owed: Clause-②: no, no narrowing, no packages/spec/src/**, no governed path
Check-runs 43 success, 15 expected skip (check-expected-skips.mjs OK), 0 failed, 0 pending; mergeable clean; PR-body guards green after the area's body correction
Governed check-governed-merges --pr 36271: NOT governed, 350 changed lines
Main K = 9 first-parent commits past base; git merge-tree against origin/main clean
Overlap overlap-check: merges cleanly with origin/main and #36223

Ready + auto-merge now. Fixes #36082: merging closes the card, ahead of unitConfig shipping in a release.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 22, 2026 04:39
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 22, 2026
Merged via the queue into main with commit b57f778 Nov 22, 2026
59 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-36082-record-unit-summary branch November 22, 2026 04:58
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 Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ui(grid): the whole-set footer and group aggregations send a raw sum over a record-mode quantity the engine now refuses (unit twin of #32334)

1 participant