Skip to content

Commit c261a7c

Browse files
feat(automation): the stage confirms name the flows a move would start (#35928) (#36316)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XTRdLmK9YYgMSCJ7NH2PuUY)_ repo:objectstack#7 · zhuangjianguo · session_01QsR2jVTYADzVWfarACx5j3 Fixes #35928 Clause-②: yes (widening: one new public read, `POST /api/v1/automation/_record-starts`, and the UI exports that read it) Metadata-protocol: added Skills-docs: none — no skill under `skills/**` teaches the console's stage confirms; `content/docs/automation/flows.mdx` and `content/docs/frontend/plugins/plugin-grid.mdx` document the read and the list in this change. Ruling-ref: 7073655354 ## 维护者速读 - 用户在列表单元格或记录页改阶段时,确认框在原来那句话下面列出这次改动会启动的流程名称(按用户语言显示),带审批的流程标「发起审批」;以前只写「可能触发相关自动化」。 - 属于行内编辑专题,按维护者的裁定「能改这条记录的人都看到流程名称」,让用户确认前就知道保存后会发生什么。 - 出错时最多是清单少列或不显示,确认框退回今天那句话,保存本身不受影响;整个改动可以直接撤回。 - 无。 ## What changes **Server (one new read).** - `@objectstack/spec/api`: `RecordUpdateStartsRequestSchema` (`{ object, recordId, changes }`, strict), `RecordUpdateStartSchema` (`{ name, label, startsApproval }`), `RecordUpdateStartsResponseSchema`, and the contract entry `listRecordUpdateStarts` (`POST /api/v1/automation/_record-starts`). `_record-starts` joins the `/automation` domain's reserved position literals (underscore-led, so the package-namespace install gate is not narrowed). - `@objectstack/spec/contracts`: `RecordUpdateStartsInput` and the optional `IAutomationService.listRecordUpdateStarts`. - `@objectstack/spec/automation`: `recordChangeTriggerHookEvents` / `recordChangeTriggerFiresOnUpdate`, the record-change token grammar MOVED out of `@objectstack/trigger-record-change` (whose `triggerTypeToHookEvents` now delegates to it), so the trigger and the preview read one rule. - `@objectstack/service-automation`: `AutomationEngine.listRecordUpdateStarts` (`record-update-starts.ts`). A flow is asked only when it is enabled and armed on a `record_change` trigger for this object whose token binds an update; whether it starts is `startConditionHolds`, the one start-condition gate every run attempt passes, over the variables `seedRunVariables` seeds (`record`, its flattened fields, `previous`). The approval mark is the presence of an `APPROVAL_NODE_TYPE` node (ADR-0019). A condition that throws is not listed. Hooks are never listed (ADR-0077 §2). - `@objectstack/runtime`: the `/automation` domain's `_record-starts` door, mounted in the dispatcher plugin and recorded in the route ledger. Order: query parameters refused `400 VALIDATION_ERROR`; body parsed through the request schema (`400 VALIDATION_FAILED`); `501` when the engine has no preview; the record read AS THE CALLER through the `/data` door's own `get` (`callData`), so an unreadable record answers `404 RECORD_NOT_FOUND` exactly like an absent one and the engine is never asked; a read that answers no record is refused the same `404`; every `changes` key must be a declared field of the object (else `400 VALIDATION_FAILED` on `changes.KEY`, the engine never asked); then the engine is handed `previous` = the record read, `record` = that record with `changes` applied, and the caller's `userId` / `tenantId`. Anonymous `401`. - `@objectstack/client`: `client.automation.listRecordUpdateStarts(request)`. **UI (two confirms, one reader).** - `@object-ui/plugin-detail`: `stageChangeStarts.tsx` — `useRecordUpdateStarts(ask)` (asks the route once per pending move through the host's `apiFetch`, parses the answer through `RecordUpdateStartsResponseSchema`, answers `[]` while in flight, refused, failing, malformed or empty) and `StageChangeStarts` (the list under the sentence: each flow by its label translated through `activeFlowsBundle` + the spec's `translateFlow`, the flow runner's reading; an approval flow marked). Exported for the grid. - Record page: `recordPathStageChange.tsx` draws it in both confirmations (the path's `AlertDialog` and the header stage menu's `RequiredFieldsDialog`, via a new optional `notice` slot in `@object-ui/fields`). - List cell: `ObjectGrid`'s state-machine confirm draws it; `StateChangeConfirm` gains an optional `ask` (the row's record id and the move). - `@object-ui/i18n`: `activeFlowsBundle` moves here from `@object-ui/app-shell`'s module-internal `utils/flowsBundle` (its three app-shell importers repointed), since the confirms' packages do not depend on the console; two keys in all eleven packs: `detail.stageChangeStartsHeading`, `detail.stageChangeStartsApproval`. - The confirm's sentence is never replaced (not this card: #35685 S3). A move that starts nothing, and a failed read, leave the confirm exactly as today. Docs: `content/docs/automation/flows.mdx` (§ Which flows a record update would start), `content/docs/frontend/plugins/plugin-grid.mdx` (the confirm now names the flows). Changesets: `35928-record-update-starts-read.md`, `35928-stage-confirm-names-flows.md`, both carrying the Clause-② and Metadata-protocol lines. ## Tests - Engine `record-update-starts.test.ts` (8): condition holds / does not hold; approval mark CONTROL (an approval flow and a plain flow side by side); no condition; create / delete / other object / obsolete never named while `record-before-write` is; an unevaluable condition not named; an unarmed engine answers nothing; `current_user` evaluated as the writer named. - Door `automation-record-update-starts.test.ts` (13): a member is answered (body parsed through the response schema) and the engine is handed exactly the record read as the caller; empty list; unreadable record `404 RECORD_NOT_FOUND` with the engine never asked; unreadable and absent answer alike; anonymous `401` before any read; malformed body `400 VALIDATION_FAILED`; query parameter `400 VALIDATION_ERROR`; `501` without the preview; a GET of the literal is not this door.; a change key that is not a field `400 VALIDATION_FAILED` on that key (an undeclared key, a key off the field-name grammar, an inherited member name), the engine never asked; a change on an object the registry does not declare refused alike; a read that answers no record `404 RECORD_NOT_FOUND`, never previewed; and the ledger row names `RecordUpdateStartsRequestSchema` / `RecordUpdateStartsResponseSchema`, as the clone and publish-drafts suites pin theirs. - Spec `automation-api.zod.test.ts`: contract count and the new entry's method/path; request strictness; a leaked `condition` / `nodes` dropped by the response parse. Each `changes` key is held to the field-name grammar (refused: a dotted, an upper-case, a digit-initial, a spaced and an empty key). - List cell, in its confirm's harness `ObjectGrid.autosave-35685.test.tsx` (new top-level describe, 3): list (request body pinned, labels, approval mark under the unchanged sentence), empty, failure (and Change still saves the move). - Record page, in each confirm's harness (new top-level describe in each, 3 + 3): `record-path.stageChange-28199.test.tsx` (the path's confirmation) and `RecordStageMenu-35891.test.tsx` (the header stage menu's dialog): list, empty, failure (a refused read, a network error and a malformed envelope each draw no list). - `stageChangeStarts-label-35928.test.tsx` (2): a flow named by its translation where the app's `flows` bundle has one, by its authored label where not; nothing drawn for no flows. - Ablation (one-shot under the verify lock, restored by trap, `git diff HEAD` on both sources empty): removing the `StageChangeStarts` render from `ObjectGrid.tsx` and from both confirmations in `recordPathStageChange.tsx` turns exactly the three `list:` pins red (`Tests 3 failed | 6 passed`); empty and failure pins stay green, as they should. ## Acceptance notes - Card acceptance: "Changing a stage that starts a flow shows that flow by name in both confirms" — pinned in both confirms (list cell, and both record-page confirmations) and measured live (below); "a stage with nothing attached shows no list" — the empty pins; "a read failure falls back to the generic sentence" — the failure pins. - Residual, stated in the contract docblocks and `flows.mdx`: the preview binds the caller's user id and tenant only, not their positions, request params or expand as a live run does, so for a condition reading those the preview can differ from the save in either direction (it can miss a flow, or list one a negated test of the writer would stop); the seat files the follow-up for positions. - Residual (not widened here): conditions are judged on the record as the CALLER reads it (field-level security applied), so a condition that reads a field the caller cannot see is judged on what they see, and one that throws on a missing field is not listed. The preview can therefore under-list for a caller with masked fields; it never reveals a masked value. Documented in `flows.mdx`. - Residual: the header stage menu's dialog asks with the stage alone; values typed into that dialog for required fields are not part of the preview's `changes`. - Two existing confirm suites (`RecordStageMenu-35891`, `record-path.stageChange-28199`) now stub `fetch` with a `501` answer in `beforeEach`, so the new read does not leave for the network under test; no existing assertion changed. Across the touched UI packages the run shows 0 `ECONNREFUSED`. - The approval mark is the ruling's test, "the flow contains an approval node". Measured live, showcase's `showcase_project_closure` reaches its sign-off approval through a `subflow` node (the approval node lives in `showcase_closure_signoff`), so the preview lists it with `startsApproval: false`. Following subflow references for the mark is a reading beyond the ruling: filed #36322. - Overlap (`overlap-check.mjs` at the head below, exit 1, reported and not merged around): #36296 and #36236 have landed and are merged in. #36335 (part of #35979) moves `activeFlowsBundle` into `@object-ui/i18n` too and conflicts in `ui/packages/i18n/src/flowsBundle.ts`, `ui/packages/i18n/src/index.ts` and `ui/packages/app-shell/src/views/metadata-admin/previews/flow-label-translations.tsx`; it lands after this PR and drops its copy of the move. Every other open PR that shares a file merges cleanly. - Declaration correction: the claim and ruling 7073655354 read `Metadata-protocol: none`, but the three new `@objectstack/spec/api` schemas enter the `api` authorable-surface shard (10 keys), which `Check Changeset` reads as `added` (`none-baseline-moved`). The line is `added` and `@objectstack/spec` is graded `minor`, as #32251, #35789 and #31883 were for new api request/response schemas. No flow or other metadata key is added, so the ruling's "no new authorable key" still holds. ## Verification - Read first: `packages/runtime/src/domains/automation.ts` `respondToRecordUpdateStarts` (the order of refusals and the caller-scoped read that admits the engine), then `packages/services/service-automation/src/record-update-starts.ts` (which flows are asked and the one gate they pass). - Live, on a fresh showcase (`pnpm dev -- --fresh`), as a member created by the admin (`role: user`, not an admin): - `Website Relaunch` `status: active → completed`: `200 {"flows":[{"name":"showcase_project_closure","label":"Project Closure with Sign-off (nested pause)","startsApproval":false}]}` - same record `→ on_hold` (CONTROL): `200 {"flows":[]}` - same record `budget 150000 → 250000`: `200 {"flows":[{"name":"showcase_budget_approval","label":"Project Budget Approval","startsApproval":true}]}` - an absent record: `404 RECORD_NOT_FOUND`; anonymous: `401 UNAUTHENTICATED`; a body without `changes`: `400 VALIDATION_FAILED` naming `changes`. - Zone 2 premise, measured before any code: the same kind of member reads `GET /api/v1/meta/flow` (200, 33 flows with labels, the admin's set) and `GET /api/v1/meta/flow/showcase_closure_signoff` (200, its nodes). - The console itself was not driven in a browser (its dist is not built in this container); both confirms are pinned through the real components above. - Local, all under `scripts/pm/os-verify-lock.sh` (shared box): - touched UI packages (`plugin-detail`, `plugin-grid`, `fields`, `i18n`): `Test Files 1131 passed | 2 skipped` · `Tests 13186 passed | 38 skipped`; after folding the pins into their harness files the three files plus the label file: `Tests 77 passed (77)`. - type-check: `tsc --noEmit` (src and test projects) for `i18n`, `fields`, `plugin-detail`, `plugin-grid`, and src for `app-shell`; `service-automation`, `runtime`, `client` exit 0. - server: engine 8/8, door 9/9, `route-ledger.conformance` + `automation-api-contract-mounts` + `http-dispatcher` green, client conformance 11, spec `automation-api.zod` + `address-grammar` 87, `trigger-record-change` 122. - `dispatch-gates.mjs --commands` (129 families) run and reconciled with `--ran`: `129 run, 0 NOT-MEASURED`. First pass reds were all this diff's own owed artefacts, fixed and re-run green: spec `gen:api-surface` / `gen:docs` / `gen:export-origins` / `gen:declaration-map` / `gen:strictness-ledger` (api count 533 → 536: the three new schemas), the route-ledger census sentence (149 → 150), and `check:test-source-alias` (a spec/automation alias in the trigger package's vitest config; the door test pays `@objectstack/metadata` at collection). - Re-verified after the hand-over (seat 7), main `b3bcfefc` merged in at `472457d9`, the generated surfaces regenerated at `6bd111ff` (`gen:schema` → spec build → `gen:api-surface` → `gen:export-origins` → `gen:declaration-map` → `gen:docs` → `gen:strictness-ledger`; `check-regen-pending` clear), the changeset correction at `99bfd857`. Under the verify lock at `6bd111ff`: - type-check exit 0: `@object-ui/i18n`, `fields`, `plugin-detail` (src and test; the hand-over's stale-dist red is gone after the closure build), `plugin-grid`, `app-shell`; `@objectstack/spec`, `runtime` (src and test layer, after building `@objectstack/driver-turso`), `service-automation`, `client`, `trigger-record-change`. - tests: `runtime` Tests 11745 passed | 25 skipped; `service-automation` 4224 passed; `client` 820 passed; `trigger-record-change` 122 passed; spec `automation-api.zod` + `address-grammar` 87 passed; `plugin-detail` + `plugin-grid` + `fields` + `i18n` Test Files 1135 passed | 2 skipped, Tests 13300 passed | 38 skipped. - `dispatch-gates.mjs --commands` (129 families): run at `99bfd857` (the six that started before that commit re-run on it) and reconciled with `--ran`: `129 derived, 128 run, 1 NOT-MEASURED, 0 UNRUN`. The one NOT-MEASURED is `check:dual-build-cjs-loads` (exit 3, PREREQUISITE NOT MET: it needs every package's dist, which this container does not build); CI runs it in its Lint jobs, green at this head. - CI at `99bfd857`: every check-run green or skipped by design. Check Changeset shows two runs: the `synchronize` run (09:07Z, before the body said `added`) red, the `edited` run (09:08Z) green. - Contract review rework (L2 at `99bfd857`), at `3ba211dc` and `d2279e6c` (head): - the door refuses a change key that is not a declared field of the object and a read that answers no record; the request schema holds each change key to the field-name grammar; the ledger row is pinned; the preview's caller binding is stated in the contract docblocks and `flows.mdx`; `_record-starts` joins the address module's literal list. - ablation, one-shot under the verify lock (`ablation-replace.mjs`, restored by trap, blob == HEAD and `git diff HEAD` empty after each): the declared-field refusal disabled → `Tests 2 failed | 11 passed` (the two refusal pins); the no-record refusal disabled → `Tests 1 failed | 12 passed` (its pin). - local: `runtime` Test Files 637 passed, Tests 11749 passed | 25 skipped; door suite 13/13 at the head; spec `automation-api.zod` + `address-grammar` 88 passed; type-check exit 0 for `spec`, `runtime` (src and test layer, at `d2279e6c`), `service-automation`, `client`, `plugin-detail`. - `dispatch-gates.mjs --commands` at `3ba211dc`: `129 derived, 129 run, 0 NOT-MEASURED, 0 UNRUN`; the 37 families that read test files re-run at `d2279e6c` (a one-line test-type fix), all exit 0. - CI at `d2279e6c`: 70 check-runs, 61 success and 9 skipped by design, Check Changeset green. - Delta round (L1-d 7078831268, L2 nit N3 from 7078841748), at `41487226` (head): the 401 and 501 pins assert `body.error.code` (`UNAUTHENTICATED`, `NOT_IMPLEMENTED`) beside the status; the spec changeset names the undeclared-change-key `400 VALIDATION_FAILED` and the no-record `404` among the door's refusals; the caller-binding limit reads "can differ from the save in either direction" in the request schema's docblock, `RecordUpdateStartsInput` and `flows.mdx`. Door suite 13/13; type-check exit 0 for `spec` and `runtime` (src and test layer); `dispatch-gates.mjs --commands` at `41487226`: `129 derived, 129 run, 0 NOT-MEASURED, 0 UNRUN`; CI at `41487226`: 70 check-runs, 61 success and 9 skipped by design. https://claude.ai/code/session_01FEkQ5keqTTiV8ptWFNc6ZF https://claude.ai/code/session_01QsR2jVTYADzVWfarACx5j3 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- signed: repo:objectstack#7 · zhuangjianguo · session_01QsR2jVTYADzVWfarACx5j3 --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 39e9a82 commit c261a7c

60 files changed

Lines changed: 1669 additions & 57 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
'@objectstack/spec': minor
3+
'@objectstack/service-automation': patch
4+
'@objectstack/trigger-record-change': patch
5+
'@objectstack/runtime': patch
6+
'@objectstack/client': patch
7+
---
8+
9+
feat(automation): `POST /api/v1/automation/_record-starts` answers which flows a proposed update of one record would start
10+
11+
Clause-②: yes (widening) — one new public read: the route `POST /api/v1/automation/_record-starts` (`automation.listRecordUpdateStarts` in the API contract and in `@objectstack/client`); `@objectstack/spec/api` adds `RecordUpdateStartsRequestSchema`, `RecordUpdateStartSchema`, `RecordUpdateStartsResponseSchema` and their types; `@objectstack/spec/contracts` adds `RecordUpdateStartsInput` and the optional `IAutomationService.listRecordUpdateStarts`; `@objectstack/spec/automation` adds `recordChangeTriggerHookEvents` and `recordChangeTriggerFiresOnUpdate`; `_record-starts` joins the `/automation` domain's reserved position literals. Nothing existing is removed or re-typed.
12+
Metadata-protocol: added — the three new `@objectstack/spec/api` schemas enter the `api` authorable-surface shard (10 keys: `RecordUpdateStart:name/label/startsApproval`, `RecordUpdateStartsRequest:object/recordId/changes`, `RecordUpdateStartsResponse:success/data/error/meta`); no flow or other metadata key is added
13+
Skills-docs: none — no skill under `skills/**` teaches the console's stage confirms; `content/docs/automation/flows.mdx` gains the read in this change.
14+
15+
The console's stage confirms now name the flows a move would start (objectstack#35928, ruling record 7073655354). They ask the server:
16+
17+
- **Request** `{ object, recordId, changes }`; **response** `{ success, data: { flows: [{ name, label, startsApproval }] } }`.
18+
- **Who is answered:** a signed-in caller who can read the record. The record is read as the caller through the `/data` door's own `get`, so a record they cannot read answers `404 RECORD_NOT_FOUND` exactly as an absent one, and the engine is never asked. Anonymous `401`; a malformed body `400 VALIDATION_FAILED`; a `changes` key that is not a declared field of the object `400 VALIDATION_FAILED` on that key, the engine never asked; a read that answers no record `404 RECORD_NOT_FOUND`; any query parameter `400 VALIDATION_ERROR`; an engine without the read `501`.
19+
- **Which flows:** enabled `record_change` flows of the object, armed on their trigger, whose `triggerType` binds an update, and whose start condition holds for the record read with `changes` applied (`previous` is the record read). The condition goes through the engine's one start-condition gate, the one every run passes; the token grammar `@objectstack/trigger-record-change` binds hooks by moved into the spec (`recordChangeTriggerHookEvents`) so the preview reads the same rule, with no second copy. A condition that cannot be evaluated against the record is not listed. Hooks are never listed.
20+
- **Per flow:** `name`, the authored `label` (a client translates it by name) and `startsApproval`, true for a flow holding an `approval` node (ADR-0019). No description, condition or nodes.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
'@object-ui/plugin-detail': patch
3+
'@object-ui/plugin-grid': patch
4+
'@object-ui/fields': patch
5+
'@object-ui/i18n': patch
6+
'@object-ui/app-shell': patch
7+
---
8+
9+
feat(console): a stage confirm names the flows the move would start, in the list cell and on the record page
10+
11+
Clause-②: yes (widening) — `@object-ui/plugin-detail` adds the exports `useRecordUpdateStarts`, `StageChangeStarts`, `RECORD_UPDATE_STARTS_PATH` and the type `RecordUpdateStartsAsk`; `@object-ui/fields`' `RequiredFieldsDialog` takes an optional `notice`; `@object-ui/i18n` adds the export `activeFlowsBundle` (with the types `FlowsTranslation` and `TranslationResourceReader`, moved from `@object-ui/app-shell`'s internal `utils/flowsBundle`) and two keys to every pack: `detail.stageChangeStartsHeading`, `detail.stageChangeStartsApproval`. `@object-ui/plugin-grid`'s `StateChangeConfirm` gains an optional `ask`. Nothing existing is removed or re-typed.
12+
Metadata-protocol: none
13+
Skills-docs: none — no skill under `skills/**` teaches the console's stage confirms; `content/docs/frontend/plugins/plugin-grid.mdx` names the list in this change.
14+
15+
When a stage move would start a flow, its confirm now says so (objectstack#35928, ruling record 7073655354):
16+
17+
- The list cell's state-machine confirm and the record page's stage confirm (the path's press and the header's stage menu) keep their sentence and add, under it, 「保存后将启动以下流程:」 ("Saving this change starts these flows:") and each flow by its label in the reader's language. A flow that starts an approval is marked 「发起审批」 ("starts an approval").
18+
- Both confirms ask one read, `POST /api/v1/automation/_record-starts`, through one shared hook, so the two surfaces cannot disagree. The server decides which flows start; nothing is judged in the browser.
19+
- A move that starts nothing shows no list, and a read that fails or is refused leaves the confirm exactly as it was.
20+
- A flow label is translated as the flow runner translates it: the app's `flows` translations, read through `activeFlowsBundle`, which now lives in `@object-ui/i18n` so the confirms' packages can read it; the console's flow runner and designer import it from there.

‎content/docs/automation/flows.mdx‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2586,6 +2586,50 @@ uncached one: it is read live on every call and kept out of the ETag, so a
25862586
read that carries it is always answered in full, never with `304 Not
25872587
Modified`. It is the verdict of the engine in the process that answered.
25882588

2589+
### Which flows a record update would start
2590+
2591+
`POST /api/v1/automation/_record-starts` answers, before anything is written,
2592+
which flows a proposed update of one record would start. The console's stage
2593+
confirms read it: the list cell's state-machine confirm and the record page's
2594+
stage confirm name those flows under their sentence (objectstack#35928).
2595+
2596+
```json
2597+
// request
2598+
{ "object": "project", "recordId": "p1", "changes": { "status": "completed" } }
2599+
// response
2600+
{ "success": true, "data": { "flows": [
2601+
{ "name": "project_closure", "label": "Project Closure", "startsApproval": true }
2602+
] } }
2603+
```
2604+
2605+
- **Who is answered:** any signed-in caller who can read the record. The
2606+
record is read as the caller, through the `/data` door's own `get`, so a
2607+
record they cannot read answers `404 RECORD_NOT_FOUND` exactly as one that
2608+
does not exist. An anonymous call is refused `401`, a malformed body `400
2609+
VALIDATION_FAILED`, a `changes` key that is not a declared field of the
2610+
object `400 VALIDATION_FAILED`, any query parameter `400 VALIDATION_ERROR`,
2611+
and an engine without the read `501`.
2612+
- **Which flows:** enabled `record_change` flows of that object, armed on their
2613+
trigger, whose `triggerType` binds an update (`record-…-update` or
2614+
`record-…-write`), and whose start `condition` holds for the record with
2615+
`changes` applied, with `previous` as the record read. The condition is judged
2616+
by the same gate every run passes, on the record as the caller reads it. A
2617+
condition that cannot be evaluated against it is not listed. Hooks are never
2618+
listed.
2619+
- **What is served per flow:** its `name`, its authored `label` (a client
2620+
translates it by `name`, as it translates any flow label) and
2621+
`startsApproval`, true when the flow holds an `approval` node. No
2622+
description, condition or nodes.
2623+
2624+
The answer is a preview, not a promise: the write itself is judged when it
2625+
happens, and a condition that reads a field the caller cannot see is judged
2626+
here on what the caller sees. Of the caller, the preview binds the user id and
2627+
the tenant only. A live save also binds the writer's positions, the request's
2628+
params and its expand, so a condition that reads those is judged here without
2629+
them, and the preview can differ from the save in either direction: it can miss
2630+
a flow the save starts, or list one the save does not (a negated test of the
2631+
writer reads true here).
2632+
25892633
## Expressions in flows
25902634

25912635
A flow computes with **one expression dialect, CEL**: every condition is bare

‎content/docs/frontend/plugins/plugin-grid.mdx‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,8 +487,14 @@ row whose new value would sort it elsewhere stays in place until the next load
487487
confirm that names the field and both values and says saving may trigger
488488
related automation ("Status changes from On Hold to Active. Saving may
489489
trigger related automation."). Cancel writes nothing and the cell keeps the
490-
value it had; Change saves it as any commit is saved. The confirm does not
491-
list the flows. A host asks this through `GridCellSelection.confirmCommit`.
490+
value it had; Change saves it as any commit is saved. Under that sentence the
491+
confirm names the flows the move would start, each by its label in the
492+
reader's language and a flow that starts an approval marked so, as the
493+
server's `POST /api/v1/automation/_record-starts` answers them (the record
494+
page's stage confirm reads the same answer, through `@object-ui/plugin-detail`'s
495+
`useRecordUpdateStarts`). A read that fails or names no flow leaves the
496+
sentence alone (objectstack#35928). A host asks this through
497+
`GridCellSelection.confirmCommit`.
492498
- **A change that makes other fields required asks for them** (objectstack#35956).
493499
When the new value makes a field's `requiredWhen` true while that field is
494500
still empty (a win reason on "Won", say), nothing is written yet: a dialog

‎content/docs/references/api/automation-api.mdx‎

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ POST /api/v1/automation/:name/toggle — Enable/disable a packaged flo
4949
POST /api/v1/automation/:name/clone — Copy a flow, switched off, into a package
5050
GET /api/v1/automation/:name/runs — List execution runs
5151
GET /api/v1/automation/:name/runs/:runId — Get single execution run
52+
POST /api/v1/automation/_record-starts — Flows a proposed record update would start
5253
```
5354

5455
<Callout type="info">
@@ -58,8 +59,8 @@ GET /api/v1/automation/:name/runs/:runId — Get single execution run
5859
## TypeScript Usage
5960

6061
```typescript
61-
import { AutomationApiErrorCode, AutomationFlowPathParamsSchema, AutomationRunPathParamsSchema, CloneFlowRequestSchema, CloneFlowResponseSchema, CreateFlowRequestSchema, CreateFlowResponseSchema, DeleteFlowRequestSchema, DeleteFlowResponseSchema, FlowFailureDetailsSchema, FlowInnerRefusalSchema, GetFlowRequestSchema, GetFlowResponseSchema, GetRunRequestSchema, GetRunResponseSchema, ListRunsRequestSchema, ListRunsResponseSchema, ResumeFailureDetailsSchema, ToggleFlowRequestSchema, ToggleFlowResponseSchema, TriggerFlowRequestSchema, TriggerFlowResponseSchema, UpdateFlowRequestSchema, UpdateFlowResponseSchema } from '@objectstack/spec/api';
62-
import type { AutomationApiErrorCode, AutomationFlowPathParams, AutomationRunPathParams, CloneFlowRequest, CloneFlowResponse, CreateFlowRequest, CreateFlowResponse, DeleteFlowRequest, DeleteFlowResponse, FlowFailureDetails, FlowInnerRefusal, GetFlowRequest, GetFlowResponse, GetRunRequest, GetRunResponse, ListRunsRequest, ListRunsResponse, ResumeFailureDetails, ToggleFlowRequest, ToggleFlowResponse, TriggerFlowRequest, TriggerFlowResponse, UpdateFlowRequest, UpdateFlowResponse } from '@objectstack/spec/api';
62+
import { AutomationApiErrorCode, AutomationFlowPathParamsSchema, AutomationRunPathParamsSchema, CloneFlowRequestSchema, CloneFlowResponseSchema, CreateFlowRequestSchema, CreateFlowResponseSchema, DeleteFlowRequestSchema, DeleteFlowResponseSchema, FlowFailureDetailsSchema, FlowInnerRefusalSchema, GetFlowRequestSchema, GetFlowResponseSchema, GetRunRequestSchema, GetRunResponseSchema, ListRunsRequestSchema, ListRunsResponseSchema, RecordUpdateStartSchema, RecordUpdateStartsRequestSchema, RecordUpdateStartsResponseSchema, ResumeFailureDetailsSchema, ToggleFlowRequestSchema, ToggleFlowResponseSchema, TriggerFlowRequestSchema, TriggerFlowResponseSchema, UpdateFlowRequestSchema, UpdateFlowResponseSchema } from '@objectstack/spec/api';
63+
import type { AutomationApiErrorCode, AutomationFlowPathParams, AutomationRunPathParams, CloneFlowRequest, CloneFlowResponse, CreateFlowRequest, CreateFlowResponse, DeleteFlowRequest, DeleteFlowResponse, FlowFailureDetails, FlowInnerRefusal, GetFlowRequest, GetFlowResponse, GetRunRequest, GetRunResponse, ListRunsRequest, ListRunsResponse, RecordUpdateStart, RecordUpdateStartsRequest, RecordUpdateStartsResponse, ResumeFailureDetails, ToggleFlowRequest, ToggleFlowResponse, TriggerFlowRequest, TriggerFlowResponse, UpdateFlowRequest, UpdateFlowResponse } from '@objectstack/spec/api';
6364

6465
// Validate data
6566
const result = AutomationApiErrorCode.parse(data);
@@ -1022,6 +1023,75 @@ const result = AutomationApiErrorCode.parse(data);
10221023
| **hasMore** | `boolean` | ✅ | Whether more runs matched than this response carries — widen `limit` to see them. Under `status`, `false` means no further match within the scanned window rather than none at all: the window is taken before the filter is applied. |
10231024

10241025

1026+
---
1027+
1028+
## RecordUpdateStart
1029+
1030+
### Properties
1031+
1032+
| Property | Type | Required | Description |
1033+
| :--- | :--- | :--- | :--- |
1034+
| **name** | `string` | ✅ | The flow's machine name — the key a client translates its label by (`flows.<name>.label`). |
1035+
| **label** | `string` | ✅ | The flow's display label as authored (a client translates it by `name`). |
1036+
| **startsApproval** | `boolean` | ✅ | Whether the flow contains an approval node, so the update starts an approval. |
1037+
1038+
1039+
---
1040+
1041+
## RecordUpdateStartsRequest
1042+
1043+
### Properties
1044+
1045+
| Property | Type | Required | Description |
1046+
| :--- | :--- | :--- | :--- |
1047+
| **object** | `string` | ✅ | Machine name of the record's object. |
1048+
| **recordId** | `string` | ✅ | Id of the record the update would write. |
1049+
| **changes** | `Record<string, any>` | ✅ | The proposed update: each field it sets and its new value, keyed by the field's machine name. Every key must be a declared field of `object`; the door refuses any other key `400 VALIDATION_FAILED` before the engine is asked. The record's other fields are read as stored. |
1050+
1051+
1052+
---
1053+
1054+
## RecordUpdateStartsResponse
1055+
1056+
### Properties
1057+
1058+
| Property | Type | Required | Description |
1059+
| :--- | :--- | :--- | :--- |
1060+
| **success** | `boolean` | ✅ | Operation success status |
1061+
| **error** | `{ code: Enum<'VALIDATION_ERROR' \| 'INVALID_FIELD' \| 'MISSING_REQUIRED_FIELD' \| …>; declaredCode?: string; message: string; userMessage?: string; … }` | optional | Error details if success is false |
1062+
| **meta** | `{ timestamp: string; duration?: integer; requestId?: string; traceId?: string }` | optional | Response metadata |
1063+
| **data** | `{ flows: object[] }` | ✅ | |
1064+
1065+
### Nested Shape: `RecordUpdateStartsResponse.error`
1066+
1067+
| Property | Type | Required | Description |
1068+
| :--- | :--- | :--- | :--- |
1069+
| **code** | `Enum<'VALIDATION_ERROR' \| 'INVALID_FIELD' \| 'MISSING_REQUIRED_FIELD' \| …>` | ✅ | Error code (e.g. VALIDATION_ERROR; StandardErrorCode ∪ the ledger the serving side registers — ERROR_CODE_LEDGER for framework packages) |
1070+
| **declaredCode** | `string` | optional | The producer-declared code, verbatim, when it is not a member of the closed `code` vocabulary — the open, author-authored channel (app-specific spellings; ADR-0112) |
1071+
| **message** | `string` | ✅ | Readable error message |
1072+
| **userMessage** | `string` | optional | Producer-marked user-facing refusal text, verbatim, in the request's locale: platform-composed text falls back to the workspace default locale, then `en`; an app-authored refusal falls back to its declared wording. Present exactly when the producer opted in at throw time; consumers render it to end users as received and keep their generic substitution for anything unmarked. Status-agnostic; never replaces `message`. |
1073+
| **refusal** | `true` | optional | Producer-declared: the 5xx this envelope carries is a deliberate refusal whose `message` is authored for the caller, so a boundary that reads the declaration keeps it verbatim (until the withhold arms read it, a declared refusal is still withheld). Absent (the default) on a declared fault, whose `message` is withheld from the body and logged for the operator; redundant on a 4xx. Presence is the declaration — `true` is the only value. |
1074+
| **category** | `string` | optional | Error category (e.g. validation, authorization) |
1075+
| **httpStatus** | `integer` | optional | HTTP status of the response carrying this error |
1076+
| **details** | `any` | optional | Additional error context (e.g. field validation errors) |
1077+
| **requestId** | `string` | optional | Request ID for tracking |
1078+
1079+
### Nested Shape: `RecordUpdateStartsResponse.meta`
1080+
1081+
| Property | Type | Required | Description |
1082+
| :--- | :--- | :--- | :--- |
1083+
| **timestamp** | `string` | ✅ | |
1084+
| **duration** | `integer` | optional | Server-side processing duration in milliseconds |
1085+
| **requestId** | `string` | optional | |
1086+
| **traceId** | `string` | optional | |
1087+
1088+
### Nested Shape: `RecordUpdateStartsResponse.data`
1089+
1090+
| Property | Type | Required | Description |
1091+
| :--- | :--- | :--- | :--- |
1092+
| **flows** | `{ name: string; label: string; startsApproval: boolean }[]` | ✅ | The flows the update would start, in no promised order. |
1093+
1094+
10251095
---
10261096

10271097
## ResumeFailureDetails

0 commit comments

Comments
 (0)