Repository navigation
Commit 6206939
fix(console): approvals inbox row figure is the object's declared highlightFields entry, not a name guess (#36698)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBEaJzgBWzjWCNjBjkVoeRto)_
Fixes #36477
repo:objectstack#3 · os-support-ai · session_01WGufzi4PechTRCTBrfxV8W
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
审批人在控制台审批收件箱里,每条申请旁的数字改为该对象「重点字段」里第一个数值字段的值;没声明这类字段的对象不再显示数字,按金额排序也跟着走。
- 属于「审批收尾」专题,替应用作者解决「收件箱按字段名猜金额、可能显示错数字且无法纠正」的问题。
- 出错时审批人看到的行内数字或排序不对,但打开申请页仍能看到全部正确数值;改动可直接撤回。
- 无
## What changes
The figure each approvals-inbox queue row shows after the object name,
and the "Amount (high→low)" sort, now come from the request object's
declared `highlightFields` (ADR-0085: one curated list of the object's
most important fields, every surface; the spec docblock: "first entry
wins where only one fits").
- **Rule:** the figure is the first `highlightFields` entry that names a
numeric field of the object — `number`, `currency`, `percent`,
`summary`, or a `formula` whose `returnType` is `number` / `currency` /
`percent` — and that the object does not declare `hidden: true`. The
value is read from the request's snapshot; `payload_display` formatting
is kept.
- **Removed:** `AMOUNT_KEY_RE` and the name-matching scan
(`decisionAmountEntry` becomes `declaredFigureEntry`). No new key
(`approval.summaryField` / `listFigureField` are not built — seat
route).
- **No declaration, no figure.** An object with no numeric
`highlightFields` entry shows no figure and sinks in the amount sort. ⚠
**Visible change:** objects that show a guessed figure today and declare
no numeric highlight lose it. Also stated in the changeset.
- **Zero-skip dropped:** a declared figure of 0 shows. The skip existed
because a zero from a *guessed* key might not be the request's amount; a
declared field's 0 is its value.
- **Hidden filter kept:** a highlight entry declared `hidden: true` is
skipped (the next numeric entry wins); the sort never orders on it.
- **Same read, no new request:** the figure comes from the per-object
`getObjectSchema` read the page already makes (one per distinct object
per mount; the pinned cost test still asserts 2 reads for 3 rows across
2 objects). That read's hook lived in `hiddenFields.ts` and kept only
the hidden-field names, so it now derives the figure field per object
(`inboxFigureField` / `readInboxFigureField` /
`useInboxFigureFieldByObject`). Until the read answers, or when it
fails, the row shows no figure (before: a guessed one).
Files to read first, by risk:
1. `ui/apps/console/src/pages/system/hiddenFields.ts` —
`inboxFigureField` (the rule) and the hook.
2. `ui/apps/console/src/pages/system/ApprovalsInboxPage.tsx` —
`declaredFigureEntry` and the amount-sort comparator.
3.
`ui/apps/console/src/pages/system/ApprovalsInboxPage.queueHiddenAmount.test.tsx`
— the fixture table in its header.
## Tests
Run at head `e6dddc0f`.
<details><summary>Affected test files: 2 files, 22 tests
passed</summary>
`pnpm --dir ui exec vitest run --maxWorkers=2
apps/console/src/pages/system/ApprovalsInboxPage.queueHiddenAmount.test.tsx
apps/console/src/pages/system/hiddenFields.test.ts` under
`os-verify-lock.sh`: `Test Files 2 passed (2)`, `Tests 22 passed (22)`,
`VERDICT command-exit 0`.
- `ApprovalsInboxPage.queueHiddenAmount.test.tsx` was rewritten in place
for the new rule. The fixture puts a money-named key (`total_amount`,
`overdue_amount`, `service_fee`) before the declared field on every row,
across two objects with different declarations. It pins the card's repro
(`overdue_amount` 80,000 declared before the highlighted `total_score`
81 now shows 81), a hidden highlight entry being skipped, a declared 0
showing, no figure without a declaration, no figure when the read fails,
the one-read-per-object cost, and the sort following the declaration
(with a counter-probe and a hidden case).
- `hiddenFields.test.ts`: `inboxFigureField` order, both `fields`
shapes, the numeric type set, formula `returnType`, hidden and undefined
entries skipped, no declaration means null; `readInboxFigureField` never
rejects.
</details>
<details><summary>Ablation: the new page test against the base page and
module</summary>
Both source files were put back to the base commit with `git restore
--source=BASE` (test files kept). On disk afterwards: `AMOUNT_KEY_RE` 3
hits in the page, `inboxFigureField` 0 hits in the module. Result:
`Tests 4 failed | 3 passed (7)`. The 4 behaviour pins went red (declared
figure, no declaration, unknown declaration, sort sink). The 3 that pass
are behaviour the base already had: the cost pin, the counter-probe
(`service_fee` matches the old regex) and the hidden-sort case (the base
trims hidden fields too). Restore: `git checkout HEAD -- …`,
hash-checked against the HEAD blobs, `git diff HEAD` empty.
A first attempt restored only the page file. Its run was void: 7/7
failed on `useHiddenFieldsByObject is not a function`, an import error,
not an assertion. It is not counted.
</details>
## Acceptance notes
- **File surface:** the order's surface is `ApprovalsInboxPage*.tsx`
plus its tests. `hiddenFields.ts` and `hiddenFields.test.ts` are outside
it. They are touched because the existing per-object read lives there,
and the order says to reuse it rather than fetch twice. Declared as a
deviation in the report.
- `isBookkeepingKey` was removed from the page; its only reader was the
name scan. The `@object-ui/types` `isSystemManagedField` import went
with it. A declared highlight is taken as the author's choice.
- The module keeps its file name `hiddenFields.ts`. Its header now
describes both declarations it reads.
- The sort option keeps its label "Amount (high→low)". It now orders on
the declared figure, which can be a score or a count rather than an
amount (observation; no change made).
- No docs page describes the inbox figure today
(`content/docs/automation/approvals.mdx` and
`content/docs/capabilities/approvals.mdx` do not mention it), so no docs
edit.
## Verification
Two-minute check: run the vitest command under Tests. Expected: `Tests
22 passed (22)`. In the running console, an object whose
`highlightFields` lists a numeric field shows that field's value on each
inbox row. An object without one shows no figure.
All readings below were taken at head `e6dddc0f`.
<details><summary>Local gates: type-check, lint, 37/37 derived families
exit 0</summary>
- `pnpm exec turbo run type-check --concurrency=2
--filter=@object-ui/console` under the lock: `Tasks: 76 successful, 76
total`, console `cache miss, executing`, `VERDICT command-exit 0`. The
console `tsconfig.json` `include` is `src`, `dev`, `scripts` with no
exclude, so it reaches the test files. (A first bare `pnpm --filter
@object-ui/console run type-check` exited 2 on `Cannot find module
'@object-ui/*'`: the dependency `dist` was not built yet. That was a
prerequisite failure, not a verdict.)
- `pnpm --dir ui exec eslint` over the 4 changed source/test files: exit
0.
- `node scripts/pm/dispatch-gates.mjs --commands` derived 37 commands.
Each was run, and each exited 0, with the exit code captured before any
pipe. `--ran` reconciliation: `37 derived famil(ies) accounted for — 37
run, 0 NOT-MEASURED`.
- Dogfood battery: n/a. The title has no `!` and there is no
`(narrowing)` arm.
- Every family CI runs (the required UI lanes included) is CI's verdict
on this PR.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzi4PechTRCTBrfxV8W)_
<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufzi4PechTRCTBrfxV8W -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 70d07fd commit 6206939
6 files changed
Lines changed: 437 additions & 329 deletions
File tree
- .changeset
- ui/apps/console/src/pages
- system
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
82 | 88 | | |
83 | 89 | | |
84 | 90 | | |
| |||
169 | 175 | | |
170 | 176 | | |
171 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
172 | 181 | | |
173 | 182 | | |
174 | 183 | | |
| |||
0 commit comments