Repository navigation
Commit e15897c
fix(plugin-approvals): the approval request page's highlights strip names the flow by its label (#24279)
Fixes #24264
Clause-②: no
The served `sys_approval_request_detail` record page's highlights strip
now names the flow by its label, `process_label` (the "Flow" field).
Before, it listed the machine source `process_name`, so its first chip
read like `flow:deal_desk`. The object's `highlightFields` makes the
same swap: `process_label` takes the place of `process_name`, and
`record_id` stays on the object's list and off the strip.
Responsibility: `plugin-approvals`' own declarations (the page's
highlights `fields` and the object's `highlightFields`) | the platform
path already serves the flow label: `process_label` is declared on the
object, served by the approvals get, and read by the record title's
formula and every request list | reached by every user who opens a
served approval request record page.
## The choice: object-level, not page-only
Readings are against objectstack `53ef75243` and objectui at the console
pin `.objectui-sha` = `5e15928b4`, by `git show` and `git grep`. The
page was not driven in a browser.
**The page's own Details tab reads the object's list, so a page-only
edit is not page-only.** The Details tab is a `record:details` node with
neither `sections` nor `fields`. The spec declares what such a node
draws (`RecordDetailsProps`, `packages/spec/src/ui/component.zod.ts`):
the object's `highlightFields`. At the pin, objectui's
`record-details.tsx` (objectui#12433) draws that list minus every field
the mounted strip registers and minus the H1 field. Its pin
`record-details.highlightFieldsFallback-12433.test.tsx` names this page
as the case it was built for. So the Details tab is the object's list
minus the strip:
| | strip | Details tab |
|---|---|---|
| `main` today | `process_name`, `object_name`, `status`,
`current_step`, `submitter_id`, `updated_at` | `record_id` (the target
record card) |
| page-only | `process_label`, … | `process_name`, `record_id`: a
"Source: flow:NAME" row appears in the tab |
| object-level (this PR) | `process_label`, … | `record_id`, unchanged |
The page's header slot falls through to the synthesizer. Since the page
authors `highlights`, the synthesizer's derived strip and `record:path`
are not emitted (`buildDefaultPageSchema`'s highlights branch), so the
header reads nothing from this list.
**Other readers of the object's `highlightFields`, and whether a request
surface reaches them today:**
- `ObjectView` / `ObjectGrid` default columns: used only by a list view
that declares no `columns`. All four `sys_approval_request` list views
declare columns, and every one already lists `process_label`. Not
reached.
- `InterfaceListPage` default columns, `ObjectKanban` default card
fields, and `RelatedList` default columns and picker: no interface page,
kanban view or related list of requests is declared in this repository.
Not reached.
- `LookupField` dropdown preview columns (`deriveLookupColumns`): the
two lookups to a request, `sys_approval_action.request_id` and
`sys_approval_approver.request_id`, sit on objects whose
`enable.apiMethods` is `['get', 'list']`, so no create or edit form
opens that picker. Not reached. The Action History list's request cell
draws the request's title, not this list.
- `RecordPreviewCard`, the pointer card a `referenceVia` pair draws:
reached only where a pointer pair names a request row, for example an
audit or activity row about a request. Whether such rows exist is NOT
MEASURED. Where they do, the card shows the Flow label where it showed
the Source.
- Studio's object settings panel shows the list as authored, now with
`process_label`.
- Backend readers: `@objectstack/lint` (field references and semantic
roles), `metadata-core`'s field-security fold of the served schema, and
`metadata-protocol`'s build probes. None of these changes behaviour for
a list of existing fields. The page test's build-rule leg stays green.
objectui's console served-page pin copies
(`apps/console/src/services/approvalRequestsDataSource.servedPage*.test.tsx`
at the pin) copy both lists with `process_name`.
objectstack-ai/objectui#12484 rewrites them, and they are not touched
here.
## The null case, within declared fields
The console reads a request through the approvals get
(`routeApprovalRecordReads`, `apps/console/src/AppContent.tsx` at the
pin). There, `rowFromRequest` serves `process_label` by the one chain in
`display-labels.ts` (`requestDisplayLabels`): the stored label, else the
node-config snapshot's `__flowLabel`, else `process_name` humanized
(`flow:deal_desk` becomes `Deal Desk`). `approval-service.test.ts` pins
that fallback ("rows fall back to prettified machine names when labels
are absent"). What a user sees:
- **A label is stored, or the snapshot carries one:** the Flow chip
shows the flow's authored label.
- **No label stored** (a row written before the column, before or after
a failed boot fill): the Flow chip shows the humanized machine name,
never `flow:NAME`.
- **The chain yields nothing:** this needs a `process_name` that
humanizes to nothing (`flow:` followed by nothing), and
`openNodeRequest` never writes one (it writes `flow:` plus the flow name
or the node id). The field then has no value, and the console's strip
draws no chip for a field with no value in read mode, so there is no
Flow chip. The record title still names `process_name`: on the approvals
get through `titleFormat`, since that get serves no `display_title`, and
on the data API through `display_title`'s fallback.
- **The same record read through the generic data API** (a host without
the console's routing): `process_label` is the stored column, null on a
row the boot fill has not labelled. The chip is then absent, and
`display_title` reads `process_name · record_id`.
No other field fills the chip. No field, formula or column is added, and
there is no spec row: `record:highlights` `fields` already admits the
field.
## Tests (at `046ca5b66`)
- `pnpm --filter '@objectstack/plugin-approvals^...' build`: VERDICT
command-exit 0. `pnpm --filter @objectstack/plugin-approvals build`:
exit 0.
- `pnpm --filter @objectstack/plugin-approvals exec vitest run
--maxWorkers=2 src/sys-approval-request-page.test.ts
src/sys-approval-request.object.test.ts
src/sys-approval-display-title.test.ts`: 3 files, 36 tests passed.
- `pnpm --filter @objectstack/plugin-approvals test`: `Test Files 81
passed (81)`, `Tests 1108 passed (1108)`. The package has 81 test files.
- `pnpm --filter @objectstack/plugin-approvals typecheck`: exit 0, with
`check:test-typecheck: OK`.
- The pin `sys-approval-request-page.test.ts` moves. Its existing case
still holds the strip to the object's list minus `record_id`. A new case
asserts three things: both lists lead with `process_label`, neither
lists `process_name`, and the object's list minus the strip is exactly
`record_id` (the Details tab).
**Ablation (one run, then restored).** `node
scripts/ablation-replace.mjs` put `process_name` back at the head of the
page's strip. Its on-disk evidence: anchor x1 → x0, replacement x0 → x1,
blob `aea7e3212b97` → `822555700a37`. The pin went red: `Tests 2 failed
| 15 passed (17)`. The new case failed with `expected 'process_name' to
be 'process_label'`, and the existing case failed on the strip no longer
equalling the object's list minus `record_id`. The restore leg: blob
after restore == HEAD (`aea7e3212b97`), `git diff HEAD` empty, `git
status` clean. No test file is left behind by the ablation.
## Gates
`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` at `046ca5b66` derived 67 commands for this
diff. All 67 ran locally at `046ca5b66`, each exit code captured before
any pipe:
- 65 exited 0 on the first pass.
- Two first refused with exit 3, PREREQUISITE NOT MET: `pnpm check:i18n`
(the CLI was not built) and `pnpm check:dual-build-cjs-loads` (packages
without `dist/`). After the prerequisite builds (the i18n gate's own
one-command closure, then `turbo run build
--filter=!@objectstack/docs`), both exited 0. `check-i18n-bundles: OK
(10 package(s) — all bundles in sync, no undeclared authoring keys)`; `✓
check:dual-build-cjs-loads — 111 published require entry point(s) across
69 package(s) load`.
- `node scripts/pm/dispatch-gates.mjs --ran` reconciliation: `67
derived, 67 run, 0 NOT-MEASURED, 0 UNRUN`.
The repo-wide scans (`pnpm lint` and the rest of the CI battery) are
CI's. Their PR check-runs are the reading.
## Acceptance notes
- Out of scope, reported to the seat and left as it is: the strip's
Current Step chip draws `current_step`, the Approval node's machine id
(`openNodeRequest` writes `current_step: input.nodeId`, and
`rowFromRequest` serves it as written). It is the same machine-name
shape. Swapping in `current_step_label` the same way would draw nothing
on the served page, because the approvals get serves the step label as
`step_label`, not under the column's name.
- The served page's H1 reads `flow:NAME · ID` on the approvals get,
which serves no `display_title`. objectstack-ai/objectui#12484 carries
the H1 (the face 5 fit-check reading `6246163097` on
objectstack-ai/objectui#12491). This PR does not touch it.
- The page header's tabs bullet said the Details tab holds "the
request's own fields by the object's field groups". At the pin it draws
the object's `highlightFields` minus the strip, which is `record_id`
only. The same header edit corrects it.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01Nk17Z26X5DB59iQztDBADH)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent baac8e1 commit e15897c
4 files changed
Lines changed: 51 additions & 6 deletions
File tree
- .changeset
- packages/plugins/plugin-approvals/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
| 145 | + | |
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
153 | 168 | | |
154 | 169 | | |
155 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
65 | 70 | | |
66 | 71 | | |
67 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | | - | |
36 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
37 | 49 | | |
38 | 50 | | |
39 | 51 | | |
| |||
68 | 80 | | |
69 | 81 | | |
70 | 82 | | |
71 | | - | |
| 83 | + | |
72 | 84 | | |
73 | 85 | | |
74 | 86 | | |
| |||
0 commit comments