Repository navigation
Commit 28749e3
fix(plugin-detail): summary chip honours percentDisplay plain (#36279)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XTRdLmK9YYgMSCJ7NH2PuUY)_
Fixes #36078
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 看记录页的用户:标题旁的摘要小标签里,百分比字段设成「只显示数字」时,以前仍画进度条,改后只显示百分数;其他情况不变。
- 为什么做:让记录页和列表对同一个百分比字段显示一致,解决胜率、利润率这类比率被误读成进度的问题。
- 出错会怎样:最坏是摘要小标签多画或少画一条进度条,数值文字不受影响,可直接撤回本次改动。
- 要你做什么:无。
## What changes
The record header's `summaryFields` chip now honours a percent field's
`percentDisplay` (the `percentDisplay` describe in
`packages/spec/src/data/field.zod.ts`: `plain` = "the percentage as text
alone, with no bar"). In `DetailView`'s chip percent arm, the bar's fill
value is computed only when the merged field bag (view entry over object
schema, the same `percentField` bag the arm already reads `scale` and
`max` from) does not say `plain`; with `plain`, the chip falls through
to the plain Badge branch, so the text (`formatPercent`, unchanged) and
the accessible name (`Label: 40%`, unchanged) stay and only the bar
goes. Because the arm is chosen by `armType`, a `formula` whose
`returnType` is `percent` takes the same path and its own
`percentDisplay` counts too.
The bar-or-not rule is the literal `percentDisplay === 'plain'` test,
inline in `PercentCellRenderer` (`@object-ui/fields`) and not exported,
so this is a local read of the one key, not a second copy of an exported
helper and not a published-export change.
No `packages/spec` change. Changeset: `@object-ui/plugin-detail` patch.
Read first (by risk):
1. `ui/packages/plugin-detail/src/DetailView.tsx`, the hunk guarding
`summaryChipPercentPoints` with `percentField.percentDisplay !==
'plain'`.
2.
`ui/packages/plugin-detail/src/__tests__/summaryChip.percentPlain-36078.test.tsx`.
Two-minute check: `pnpm --dir ui exec vitest run
packages/plugin-detail/src/__tests__/summaryChip.percentPlain-36078.test.tsx`
(spec, formula and client built) prints 7 passed.
## Tests
New `summaryChip.percentPlain-36078.test.tsx` (7 cases), stored value
`0.4`:
- percent field `plain` reads `40%`, accessible name `Probability: 40%`,
no bar track;
- percent formula (`returnType: 'percent'`) `plain`: same;
- `plain` declared on the object schema only (no view entry), judged
after an arrival probe: same;
- CONTROL: percent field with no `percentDisplay`, and with `bar`, draws
the bar filled to `40%`;
- CONTROL: percent formula with no `percentDisplay`, and with `bar`,
draws the bar;
- CONTROL: a view entry `bar` over an object schema `plain` draws the
bar (precedence).
## Acceptance notes
- Directions on the base tree were predicted before the first run and
the ablation matched them: the three `plain` cases red, the four
controls green.
- Overlap: `overlap-check.mjs` names open PR #36234 as sharing
`DetailView.tsx`; it merges cleanly with this branch.
- No out-of-scope findings.
## Verification
All readings at head `4bf99c41`.
<details><summary>Targeted tests (under the shared verify
lock)</summary>
- `pnpm --dir ui exec vitest run --maxWorkers=2
packages/plugin-detail/src/__tests__/summaryChip`: Test Files 10 passed,
1 skipped (11); Tests 106 passed, 8 skipped. The existing `summaryChip*`
pins stay green.
- `pnpm --dir ui exec vitest run --maxWorkers=2
packages/plugin-detail/src/__tests__/percentDisplayRelay-28255.test.tsx
packages/plugin-grid/src/__tests__/percentAbsentScale.fiveFaces-9843.test.tsx
packages/plugin-detail/src/__tests__/DetailView`: Test Files 25 passed
(25); Tests 170 passed (170).
- `pnpm --filter @object-ui/plugin-detail run type-check`: exit 0 (after
building the `@object-ui/plugin-detail^...` closure);
`tsconfig.test.json --listFilesOnly` includes the new test file.
- The full `@object-ui/plugin-detail` suite (405 test files) is declared
to CI's `Test UI`, not run locally.
</details>
<details><summary>Ablation (one, on the committed fix)</summary>
`node scripts/ablation-replace.mjs` replaced the guard `if
(percentField.percentDisplay !== 'plain') {` with an always-true guard:
anchor 1 to 0, blob `c62b65de4f71` to `915375fad2c8`. The new file then
read 3 failed, 4 passed: exactly the three `plain` cases red, all four
controls green. Restore: blob after restore equals HEAD
(`c62b65de4f71`), `git diff HEAD` empty, marker count 0. The test
imports `../DetailView` from source, so no build sits between the
mutation and the run.
</details>
<details><summary>Derived gates</summary>
`node scripts/pm/dispatch-gates.mjs --commands` derived 38 commands for
this diff; 37 ran locally with exit 0; `pnpm check:type-check-debt` is
NOT MEASURED (its closure build never acquired the shared verify lock,
exit 3 PREREQUISITE NOT MET) and is CI's `Lint & Repo Gates`. `--ran`
reconciliation: 38 derived, 37 run, 1 NOT-MEASURED, 0 UNRUN. Also `pnpm
--dir ui run check:new-line-citations`: 0 new citations.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01FEkQ5oLLK7uoxp33riiBJL)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 8925d5b commit 28749e3
3 files changed
Lines changed: 179 additions & 2 deletions
File tree
- .changeset
- ui/packages/plugin-detail/src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1457 | 1457 | | |
1458 | 1458 | | |
1459 | 1459 | | |
1460 | | - | |
1461 | | - | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
1462 | 1471 | | |
1463 | 1472 | | |
1464 | 1473 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
0 commit comments