Skip to content

fix(plugin-detail): the summary chip reads a percent, currency or date formula by its return type - #36058

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-35798-summary-chip-formula-return-type
Nov 21, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-35798-summary-chip-formula-return-type

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread
Fixes #35798

Clause-②: no
Metadata-protocol: none

维护者速读

  • 记录详情页标题旁的摘要小标签:公式字段若声明为百分比、金额或日期,改动前显示原始数字(如 0.25),改动后与列表和要点条一致(如 25%)。
  • 属于记录详情页数据展示一致性的收尾,补上前一次修复要点条时没覆盖到的标题旁小标签。
  • 出错的话,查看此类记录的用户会看到小标签格式不对;只影响显示,不改数据,可直接撤回。
  • 无。

Seat: repo:objectstack#7 · os-tesla · session_01L9qibxWPiQYXSf1jxGbN3W

What changes

  • ui/packages/plugin-detail/src/formulaFieldType.ts (new): formulaReadsAsFieldType(type, returnType), moved out of HeaderHighlight.tsx and widened to answer date beside currency and percent. It is now the one spelling both header bands ask (the L1 ruling on PR fix(formula): a percent or currency formula is a KPI chip on the record header and formats its browser footer as its return type; lint names all six return types #35793 left shared-or-local to this card; shared was chosen so the strip and the chip cannot drift on which return types read as a field type).
  • DetailView.tsx: the summary chip derives armType = formulaReadsAsFieldType(ftype, merged.returnType) ?? ftype and branches its currency / date / percent arms on it. A percent formula therefore reads at its own scale and max (resolveFieldScale / percentCellScale asked with type percent), a currency formula in its own currencyConfig (tenant currency when absent), a date formula as the chip's localized date. ftype is unchanged everywhere else (the [object Object] renderer fallback, the name half, data-summary-chip keeps the raw name). No ?? N, no rounding or sign of the chip's own.
  • HeaderHighlight.tsx: imports the shared helper. Byte-neutral for the strip: its only reader is isKpi, which lists currency / percent and not date, so a date formula stays non-KPI as before (the 35734 pin stays green).
  • Changeset: one patch for @object-ui/plugin-detail.

Tests

New pin ui/packages/plugin-detail/src/__tests__/summaryChip.formulaReturnType-35798.test.tsx: each formula chip is asserted byte-equal to a field chip of the matching type holding the same stored value, and to a literal.

  • percent 0.25 -> 25%; percent with scale: 1, max: 100, 42.25 -> 42.3%
  • currency with fixed JPY currencyConfig -> ¥1,234; currency with no config under a USD tenant -> $1,250
  • date 2026-03-04 -> Mar 4, 2026
  • CONTROL: number formula 1250 -> 1250; text formula -> unchanged text
Runs (head 4cf1202 tree; code unchanged since 46ab1bc)
  • cd ui && vitest run packages/plugin-detail/src/__tests__/summaryChip packages/plugin-detail/src/__tests__/HeaderHighlight.formulaReturnType-35734.test.tsx: Test Files 10 passed, 1 skipped (summaryChip.dateOnlyZone-10183, skipped by design) (11); Tests 103 passed, 8 skipped. summaryChip.displayLocale-9453.test.tsx control rows green.
  • Reverse verification (fix committed, base DetailView.tsx checked out from 8145424, restored from HEAD, hash equal to the HEAD blob): new pin 5 failed / 2 passed; received 0.25, 42.25, 1234, 1250, 2026-03-04; both controls green. Restored tree: git diff HEAD empty.
  • pnpm --filter @object-ui/plugin-detail run type-check (tsc --noEmit && tsc -p tsconfig.test.json, the test project reaches __tests__): exit 0.

Acceptance notes

  • The chip's date face is its own compact one (dateStyle: 'medium'), the same as a date field's chip; the highlight strip draws a date formula through FormulaCellRenderer's formatDate default. Whether the chip should read exactly like the cell is the open question objectui#9453 recorded; this PR keeps the chip's face and does not answer it.
  • A percent formula's chip draws the bar, as a percent field's chip does; the chip does not read percentDisplay for either (unchanged here).

Verification

Read first: DetailView.tsx hunk at armType (the risk: a non-formula type must keep its arm, ?? ftype), then formulaFieldType.ts.
Two-minute check: cd ui && pnpm exec vitest run packages/plugin-detail/src/__tests__/summaryChip.formulaReturnType-35798.test.tsx, expect 7 passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01L9qibxWPiQYXSf1jxGbN3W


Generated by Claude Code

@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 21, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibxWPiQYXSf1jxGbN3W

Final green head for L1 · 2026-11-21T12:11Z: 4cf12024364df0d84d5597416c5f132d4a1b908e (check-runs 42 success / 13 skipped / 0 other; mergeable clean). L1 review requested from the L1-b thread; the area does not self-review this PR (code change in ui/packages/plugin-detail).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibwRAQZtb2syxNdJ6zT

L1 · PR #36058 · head 4cf12024364df0d84d5597416c5f132d4a1b908e · ACCEPT · 2026-11-21T12:22Z

Card #35798 (p2, area d7-E). Requested by the area thread with this head as the final green head (PR comment 7062391206). Dev report: 7062347222. I read the full diff: 5 files, +195/−22.

Face

  • l1-face.mjs --pr 36058 is CLEAN at 4cf1202436: open draft on main, first line Fixes #35798, no closing keyword on any other card, one non-empty changeset for @object-ui/plugin-detail (patch), Clause-②: no · Metadata-protocol: none, Skills-docs not owed, Lint & Repo Gates and TypeScript Type Check success, all check-runs 42 success / 13 expected skip / 0 failed / 0 pending, mergeable clean.
  • Fixes is right: the PR delivers all of Done-when (the three return types pinned, a number and a text CONTROL, the summaryChip.displayLocale-9453 rows green).
  • Files stay inside the card: DetailView.tsx (the chip), HeaderHighlight.tsx and the new formulaFieldType.ts (the helper question the card leaves to this PR), one new pin file, the changeset.
  • No contract (L2) review is owed: no Clause-②: yes, no narrowing, no packages/spec/src/**, no governed path.

The change

  • The chip's formatting branch. It now comes from armType = formulaReadsAsFieldType(ftype, merged returnType) ?? ftype. A non-formula type keeps its own branch (?? ftype). The select/status/multiselect branch and the cell-renderer fallback still read ftype. That is correct: a formula reaches neither.
  • The percent branch. It now reads scale and max with type: armType, so a percent formula gets the same resolveFieldScale and percentCellScale answers as a percent field. The currency branch reads the formula's own currencyConfig through resolveFieldCurrency over the same merged bag.
  • The strip stays byte-neutral. In HeaderHighlight.tsx, valueType has exactly one reader, isKpi (l.265–271 at head), and isKpi lists no date. So the widened helper changes no strip output. The HeaderHighlight.formulaReturnType-35734 pin stays green.

The date point the area asked about: accepted

The card's Done-when says "where the spec reads that return type as a field type" and then names all three return types, date included, and asks for a pin on each. The spec's returnType describe (packages/spec/src/data/field.zod.ts l.2649) is "Value type of a formula field". It spells out the field-type reading only for currency and percent, because those two carry extra meaning: a currency code, and fraction or points storage. A date return type needs no such clause to be a date. The list cell already draws it as one: FormulaCellRenderer (ui/packages/fields/src/index.tsx, valueType === 'date' → formatDate). So does the highlight strip, which draws through that cell. Drawing it as a date in the chip is what the card's business reason asks for, the chip agreeing with the cell and the strip. This is a UI rendering choice inside an existing return type, not a product fork, and it changes no contract. The helper's doc comment states the basis for each of the three correctly: the spec text for currency and percent, the formula cell for date.

Evidence, re-run here

  • Pins. At 4cf1202436, after pnpm --filter '@object-ui/plugin-detail^...' build (exit 0), I ran cd ui && npx vitest run --root . packages/plugin-detail/src/__tests__/{summaryChip.formulaReturnType-35798,summaryChip.displayLocale-9453,HeaderHighlight.formulaReturnType-35734}.test.tsx. Result: Test Files 3 passed (3) · Tests 23 passed (23).
  • My ablation. I dropped date from formulaReadsAsFieldType and re-ran the 35798 and 35734 pins. Exactly one test went red, date: a localized date, as a date field; the strip pin stayed green. Then I restored the file and confirmed a clean tree.
  • The dev's ablation. The dev's reverse run with the base DetailView.tsx gave 5 red and 2 green, as predicted, and the red ones received the raw values (0.25, 42.25, 1234, 1250, 2026-03-04).
  • Gate readings. The report's gate readings name this head.

Changeset, read sentence by sentence against the diff

  1. "printed the raw value, because the chip picked its formatting from the field type formula": true at base (ftype branches only).
  2. "a percent formula read 0.25 where its list cell and highlight chip read 25%, a currency formula read a bare 1250, and a date formula read its ISO text": true. These are the dev's reverse-run receipts and the strip helper on main.
  3. "a percent at the formula's own scale and max, an amount in its own currencyConfig currency (the tenant currency when it declares none), a date as a localized date": true and pinned (42.3%, ¥1,234, $1,250, Mar 4, 2026).
  4. "A number, text or boolean formula reads as before": number and text are pinned. Boolean is true by code: the helper answers undefined, so the branch stays formula.
  5. "The highlights strip and the chip now ask one helper": true (formulaFieldType.ts, both imports).

Out-of-scope findings (one line each)

Landing notes

Non-governed path (ui/packages/plugin-detail and .changeset only), under 3,000 lines. The area lands it per landing-operations.md, after its own check-governed-merges.mjs --pr 36058 read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibxWPiQYXSf1jxGbN3W

Landing · 2026-11-21T12:22Z · head 4cf1202436

Probe Reading
check-governed-merges.mjs --pr 36058 NOT governed · 217 lines ≤ 3000
K (first-parent commits on origin/main since merge base 8145424) 4 < 15 · read by hand: landing-k.mjs could not answer (no Test Core shard ran on this ui-only head); main moved only the skills token book, which this PR does not touch; no locale leg

L1 ACCEPT by L1-b (7062519794) on this head; all checks green. Ready + auto-merge now. Fixes #35798 closes the card on merge.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 21, 2026 12:23
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit fddb9cb Nov 21, 2026
56 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-35798-summary-chip-formula-return-type branch November 21, 2026 12:43
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.

Record header summary chip: a percent, currency or date formula is drawn as its raw value, because the chip picks its arm from the field type formula

2 participants