Skip to content

Commit e15897c

Browse files
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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@objectstack/plugin-approvals': patch
3+
---
4+
5+
fix(plugin-approvals): the approval request page's highlights strip names the flow by its label, not `flow:NAME`
6+
7+
Clause-②: no
8+
9+
- **The strip's first chip is the flow's label.** `sys_approval_request_detail` lists `process_label` (the "Flow" field) where it listed `process_name`, so a request opened by the Deal Desk flow reads `Deal Desk` there instead of `flow:deal_desk`. The request lists already showed this label.
10+
- **The object's `highlightFields` makes the same swap** (`process_label` in place of `process_name`, `record_id` kept). The page's Details tab is a bare `record:details` node, which draws the object's `highlightFields` minus the strip. A change to the strip alone would have moved `process_name` into that tab. Changed together, the tab still shows only the target record card. Other surfaces that read the object's list show the flow's label too: a request's record preview card, Studio's object settings, and the default columns of a list, kanban, related list or lookup picker that declares none. No first-party request list uses the default columns: each request list view declares its own.
11+
- **When no label is available.** The console reads a request through the approvals get, which serves `process_label` as the stored label, else the flow label in the request's node-config snapshot, else the humanized machine name (`flow:deal_desk` → `Deal Desk`). A request the boot backfill has not labelled still shows a Flow chip. Only when all three are empty does the field have no value: the strip then draws no Flow chip, and the record title still names `process_name`.
12+
13+
A patch: one entry in one platform object's field list and the same entry in its page. No export, type, accepted value or stored column changes.

‎packages/plugins/plugin-approvals/src/sys-approval-request-page.test.ts‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,29 @@ describe('sys_approval_request detail page — the slot map', () => {
142142
// The seat's choice on the ui seat's design input: the page's strip drops
143143
// `record_id` so the details grid keeps it (that grid is where the console
144144
// draws the target-record card of the `record_id` / `object_name` pointer
145-
// pair), and the object's `highlightFields` is left as it is.
145+
// pair), and the object's `highlightFields` keeps it.
146146
const declared = SysApprovalRequest.highlightFields ?? [];
147147
expect(declared).toContain('record_id');
148148
expect(SLOTS.highlights?.type).toBe('record:highlights');
149149
expect(SLOTS.highlights.properties.fields).toEqual(declared.filter((f: string) => f !== 'record_id'));
150150
expect((SysApprovalRequest.fields as AnyRec).record_id?.referenceVia).toBe('object_name');
151151
});
152152

153+
it('names the flow by its label, process_label, in the strip and in the object\'s list alike', () => {
154+
// `process_name` is the machine source (`flow:NAME`); `process_label` is the
155+
// flow's label, served under that name by the approvals get. The object's
156+
// list moves with the strip: the Details tab's bare `record:details` node
157+
// draws the object's `highlightFields` minus the strip, so a strip-only
158+
// change would put `process_name` in that tab.
159+
const strip = SLOTS.highlights.properties.fields as string[];
160+
const declared = SysApprovalRequest.highlightFields ?? [];
161+
expect(strip[0]).toBe('process_label');
162+
expect(declared[0]).toBe('process_label');
163+
expect({ strip: strip.includes('process_name'), declared: declared.includes('process_name') })
164+
.toEqual({ strip: false, declared: false });
165+
expect(declared.filter((f: string) => !strip.includes(f))).toEqual(['record_id']);
166+
});
167+
153168
it('tabs: Details is record:details, Timeline is sys_approval_action as a related list on request_id', () => {
154169
expect(TAB_ITEMS.map((t) => t.label?.en)).toEqual(['Details', 'Timeline']);
155170
expect(TAB_ITEMS[0].children).toEqual([{ type: 'record:details' }]);

‎packages/plugins/plugin-approvals/src/sys-approval-request.object.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@ export const SysApprovalRequest = ObjectSchema.create({
6161
displayNameField: 'display_title',
6262
nameField: 'display_title', // [ADR-0079] canonical primary-title pointer (mirrors deprecated displayNameField)
6363
titleFormat: '{process_name} · {record_id}',
64-
highlightFields: ['process_name', 'object_name', 'record_id', 'status', 'current_step', 'submitter_id', 'updated_at'],
64+
// [ADR-0085] The flow is named by its label, `process_label`, never by the
65+
// machine source `process_name` (`flow:NAME`), as the request lists name it.
66+
// The record page's highlights strip is this list minus `record_id`, and the
67+
// page's bare `record:details` node draws this list minus the strip, so the
68+
// two move together (`sys-approval-request.page.ts` says why).
69+
highlightFields: ['process_label', 'object_name', 'record_id', 'status', 'current_step', 'submitter_id', 'updated_at'],
6570

6671
// Curated built-in list views — render as segmented tabs in the console.
6772
// Filters use {current_user_id} substitution wired by the console.

‎packages/plugins/plugin-approvals/src/sys-approval-request.page.ts‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,22 @@ import type { Page } from '@objectstack/spec/ui';
3030
* `record_id` / `object_name` is a declared `referenceVia` pointer pair that
3131
* the console draws as a card of the target record IN THE DETAILS GRID — a
3232
* strip carrying `record_id` would take the card off the page. The object's
33-
* own `highlightFields` is left as it is: other surfaces read it, and only
33+
* own `highlightFields` keeps `record_id`: other surfaces read it, and only
3434
* this page has a grid the pair must stay in.
35-
* - `tabs` is authored: Details (`record:details`, the request's own fields
36-
* by the object's field groups) and Timeline — `sys_approval_action` as a
35+
* - The strip and the object's list change together, never the strip alone.
36+
* The Details tab's `record:details` node authors neither `sections` nor
37+
* `fields`, so it draws the object's `highlightFields` (the spec's declared
38+
* fallback) minus the strip: a field the object lists and the strip drops
39+
* moves into that tab.
40+
* - The flow chip is `process_label` (the flow's label), not `process_name`
41+
* (the machine source, `flow:NAME`). The console reads a request through
42+
* the approvals get, which serves `process_label` by the one display-label
43+
* chain (`display-labels.ts`): the stored label, else the node-config
44+
* snapshot's, else the humanized machine name. Where the chain yields
45+
* nothing, the field has no value, the strip draws no Flow chip, and the
46+
* record title still names `process_name`.
47+
* - `tabs` is authored: Details (`record:details`, a bare node: see the
48+
* strip above) and Timeline — `sys_approval_action` as a
3749
* related list keyed on `request_id`, newest first. The `tabs` slot is
3850
* authored rather than `details` because the console builds the tab strip
3951
* from `tabs` when both are present; the details body therefore lives in
@@ -68,7 +80,7 @@ export const SysApprovalRequestDetailPage: Page = {
6880
highlights: {
6981
type: 'record:highlights',
7082
properties: {
71-
fields: ['process_name', 'object_name', 'status', 'current_step', 'submitter_id', 'updated_at'],
83+
fields: ['process_label', 'object_name', 'status', 'current_step', 'submitter_id', 'updated_at'],
7284
},
7385
},
7486

0 commit comments

Comments
 (0)