Skip to content

Commit 7d6742a

Browse files
docs(spec): screen-input refusal fields carry one entry per finding (#38814)
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Fixes #37659 Clause-②: no Metadata-protocol: none ## 维护者速读 用户无感:接口说明与流程文档里关于屏幕输入被拒时逐项错误列表的说法改准了,接口返回内容不变。 所属流程自动化,替调用方解决:按「每个字段一条」去数错误条目的客户端会看到重复行却不知原因。 只改文字,没有任何运行行为变化,可直接撤回。 无 ## What changes Text and doc comments only; the response is unchanged. - `packages/spec/src/contracts/automation-service.ts`: the `AutomationResult.fields` jsdoc now says one entry per finding, says one field can carry more than one entry (with the `min`-above-`max` case as its example), says a runner groups by `field`, and says that for `unknown_field` the `field` is the key the caller sent (N1). - `packages/spec/src/api/automation-api.zod.ts`: the `TriggerFlowResponseSchema` `data.fields` describe says the same (N1); `packages/spec/docs/references/api/automation-api.md` regenerated from it with `gen:docs` (the generator `check:generated` named). - `content/docs/automation/flows.mdx`: the hand-written copy of the sentence, reworded the same way (N1). - `packages/services/service-automation/src/screen-input-contract.ts`: the `ScreenInputIssue.code` jsdoc points at `error.details.fields` instead of "ride inside the refusal's message" (N2). - `packages/services/service-automation/src/engine.ts`: the comment above the `fields` mapping in the screen-input refusal says one entry per finding, not one per field (comment only). - `.changeset/37659-screen-input-fields-wording.md`: `@objectstack/spec` patch (the describe ships in the JSON schema). The service-automation edit is a comment only, so it takes no bump. The example is checked against `validateScreenInputs`, and the engine maps its issues one to one onto `fields`. For a field whose `min` exceeds its `max`, only a value above `max` and below `min` trips both `min_value` and `max_value`. A value at or under `max` trips `min_value` alone, and the wording says exactly that. No authoring rule refuses `min` above `max`, so a published flow can serve it. The first round also named a `required` `record_link` field sent `null`. That case is removed: the screen-field authoring schema refuses `required` on a `record_link` field at publish, so no served screen can produce it. The text says "more than one entry", not "two", because two is not a ceiling. ## Tests No behaviour changed, so no test was added or ablated. Local readings at `7ec661d938`: <details><summary>Local runs</summary> - `pnpm --filter @objectstack/spec build`: VERDICT command-exit 0. - `pnpm --filter @objectstack/spec check:generated`: first run named one stale artifact (`content/docs/references/**`, regenerate with `gen:docs`); after `gen:docs`, `check:docs` printed "249 generated files in sync with packages/spec", exit 0, and a rerun of `check:generated` exited 0. - `pnpm --filter @objectstack/spec typecheck` plus `vitest run src/api/automation-api.zod.test.ts`: VERDICT command-exit 0, 77 tests passed (first round, at `19efb34bd4`; the second round changed only describe text and comments). - `check:api-surface` "public API surface + factory signatures unchanged", `check:authorable-surface`, `check:nul-bytes`, `check:doc-authoring`, `check-issue-citations` and 15 more derived families: exit 0. </details> ## Acceptance notes - The dispatch order's zero-hit grep for the sentence in `flows.mdx` was a line-wrap miss: the guide carried it across two lines ("one" ending one line, "entry per violated field" opening the next). It is reworded here. - Copies left outside this card's file surface, noted, not filed: the Console runner's doc comment in `ui/packages/app-shell/src/views/FlowRunner.tsx` ("per violated field"), two copies in `packages/services/service-automation/src/builtin/screen-input-whitespace-fields-37526.test.ts` (its header comment at line 5 and a test title at line 89), the header comment of `packages/runtime/src/domains/automation-resume-screen-input-fields-37526.test.ts` (line 7), and the released changeset text in `.changeset/pre/` and the package CHANGELOGs (shipped release notes, not rewritten). - Local gate coverage is a declared narrowing: 21 of the 111 derived families ran here; the rest are CI's. `check:docs-transcript-drift`, `check:doc-security-posture` and `check:doc-formula-expressions` reported PREREQUISITE NOT MET (the lint package is not built in this container), so they are NOT MEASURED locally and read from CI. ## Verification Read first: `packages/spec/src/api/automation-api.zod.ts` (the describe text that feeds the published JSON schema and reference page), then `packages/spec/src/contracts/automation-service.ts`. Two-minute check: `git grep -n "per violated field" -- packages/spec/src packages/spec/docs content/docs` prints nothing (the released CHANGELOG text still carries it, by design); the four edited passages each say "one entry per finding". --- _Generated by [Claude Code](https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 00f97b3 commit 7d6742a

7 files changed

Lines changed: 31 additions & 9 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/spec': patch
3+
---
4+
5+
docs(spec): the screen-input refusal's `fields` carries one entry per finding, not one per field
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The `AutomationResult.fields` contract comment, the `TriggerFlowResponseSchema` `data.fields` description and the flows guide said a `400 INVALID_SCREEN_INPUT` refusal carries one `error.details.fields` entry per violated field. It carries one entry per finding, so one field can carry more than one entry: a value above a field's `max` but below its larger `min`, for instance, breaks both bounds. For `unknown_field`, `field` is the key the caller sent, not a declared screen field name. A runner that sizes its error display by one row per field groups the entries by `field`. The `ScreenInputIssue.code` comment now points at `error.details.fields`, where these codes travel. Text only: the response is unchanged.

‎content/docs/automation/flows.mdx‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,10 +1522,14 @@ is consumed: nothing is applied, the run stays parked, and the corrected
15221522
submission still lands.
15231523

15241524
The refusal also names each finding on its own, in `error.details.fields`: one
1525-
`{ field, code, message }` entry per violated field, with the field's `name`
1525+
`{ field, code, message }` entry per finding, with the field's `name`
15261526
and an ADR-0114 field code (`required`, `invalid_type`, `invalid_value`,
15271527
`min_value`, `max_value`, `unknown_field`), the same entries a
1528-
`VALIDATION_FAILED` carries. A client places the refusal at its fields from
1528+
`VALIDATION_FAILED` carries. One field can carry more than one entry: a value
1529+
above a field's `max` but below its larger `min`, for instance, breaks both
1530+
bounds.
1531+
For `unknown_field`, `field` is the key the caller sent, not a declared
1532+
screen field name. A client places the refusal at its fields from
15291533
those, in its own language; `error.message` keeps the whole sentence, with the
15301534
declared field names, for logs and API callers. The Console's flow runner marks
15311535
each field it names, by the label it shows, and its banner reads a sentence of

‎packages/services/service-automation/src/engine.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9853,7 +9853,7 @@ export class AutomationEngine implements IAutomationService {
98539853
error:
98549854
`Invalid screen input: ${summary} — declared fields: ` +
98559855
`${declared.map((n) => `'${n}'`).join(', ') || '(none)'}`,
9856-
// [#37526] The same findings, one per field, so a runner can place
9856+
// [#37526] The same findings, one entry per finding, so a runner can place
98579857
// each at its field in its own language rather than show `error`,
98589858
// which names the screen's declared fields for logs and API callers.
98599859
fields: issues.map(({ field, code, message }) => ({ field, code, message })),

‎packages/services/service-automation/src/screen-input-contract.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ export interface ScreenInputIssue {
4242
* #17306 added three conditions to this surface and no code to that catalog.
4343
*
4444
* NOT an `error.code` (ADR-0112 D1). These are FIELD-ADDRESSED validator
45-
* codes that ride inside the refusal's message; the refusal's own machine
46-
* code is the SCREAMING `INVALID_SCREEN_INPUT` the engine returns.
45+
* codes that ride on the refusal's `error.details.fields`, one entry per
46+
* issue; the refusal's own machine code is the SCREAMING
47+
* `INVALID_SCREEN_INPUT` the engine returns.
4748
*/
4849
code: FieldErrorCode;
4950
message: string;

‎packages/spec/docs/references/api/automation-api.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,7 @@ const result = AutomationApiErrorCode.parse(data);
12231223
| **error** | `string` | optional | Error message if execution failed |
12241224
| **durationMs** | `number` | optional | Execution duration in milliseconds |
12251225
| **code** | `Enum<'PERMISSION_DENIED' \| 'INVALID_SIGNAL' \| 'RUN_NOT_FOUND' \| 'STORE_UNAVAILABLE' \| …>` | optional | Machine-readable failure classification, set alongside `error` when the caller must distinguish WHY it failed. A closed union - the members and their transport mappings are documented on the contract (`AutomationResult.code`, contracts/automation-service.ts). |
1226-
| **fields** | `{ field: string; code: Enum<'required' \| 'invalid_type' \| 'invalid_shape' \| 'unknown_field' \| …>; message: string; label?: string; … }[]` | optional | The field-addressed findings behind an `INVALID_SCREEN_INPUT` refusal, one per violated screen field: its `name`, the field-level code it broke and the engine's English line. Set with that code only. A transport serves it as `error.details.fields` |
1226+
| **fields** | `{ field: string; code: Enum<'required' \| 'invalid_type' \| 'invalid_shape' \| 'unknown_field' \| …>; message: string; label?: string; … }[]` | optional | The field-addressed findings behind an `INVALID_SCREEN_INPUT` refusal, one entry per finding: the screen field's `name`, the field-level code it broke and the engine's English line. One field can carry more than one entry (for instance, a value above a field's `max` but below its larger `min` breaks both bounds). For `unknown_field`, `field` is the key the caller sent, not a declared screen field name. Set with that code only. A transport serves it as `error.details.fields` |
12271227
| **status** | `Enum<'completed' \| 'paused' \| 'failed' \| 'stranded' \| 'refused'>` | optional | Lifecycle status. `paused` means the run suspended at a node and can be continued with the resume route. Absent or `completed`/`failed`/`stranded`/`refused` means the run reached a terminal state. `refused` is a first-class refusal: the flow reached an `end` node declaring `outcome: 'refused'` — a successful evaluation that said no, so `success` is true, `successMessage` is absent and the per-record reason is on `refusalMessage`; a runner shows it with Close only. `stranded` is the terminally-failed-but-repairable run: a resume consumed the suspension and a downstream node threw, so the run is recorded as failed and can be re-armed only by an explicit operator verb - never by the resume route, which answers RUN_NOT_FOUND for it. |
12281228
| **runId** | `string` | optional | Run id - set when `status` is `paused`, so callers can resume it |
12291229
| **screen** | `{ nodeId: string; title?: string; description?: string; fields: object[]; … }` | optional | The screen to render - set when the run paused at a `screen` node awaiting user input. The client collects values for `screen.fields` and resumes the run with them. |

‎packages/spec/src/api/automation-api.zod.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,11 @@ export const TriggerFlowResponseSchema = lazySchema(() => BaseResponseSchema.ext
433433
// #37526 — mirrors `AutomationResult.fields`; the element IS the error
434434
// envelope's `FieldErrorSchema`, the entries `VALIDATION_FAILED` serves.
435435
fields: z.array(FieldErrorSchema).optional().describe(
436-
'The field-addressed findings behind an `INVALID_SCREEN_INPUT` refusal, one per violated '
437-
+ 'screen field: its `name`, the field-level code it broke and the engine\'s English line. '
436+
'The field-addressed findings behind an `INVALID_SCREEN_INPUT` refusal, one entry per '
437+
+ 'finding: the screen field\'s `name`, the field-level code it broke and the engine\'s '
438+
+ 'English line. One field can carry more than one entry (for instance, a value above a '
439+
+ 'field\'s `max` but below its larger `min` breaks both bounds). For `unknown_field`, '
440+
+ '`field` is the key the caller sent, not a declared screen field name. '
438441
+ 'Set with that code only. A transport serves it as `error.details.fields`',
439442
),
440443
// `stranded` is the contract half of the #13937 shape-4 ruling (#14384);

‎packages/spec/src/contracts/automation-service.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,10 +695,14 @@ export interface AutomationResult {
695695
code?: 'PERMISSION_DENIED' | 'INVALID_SIGNAL' | 'RUN_NOT_FOUND' | 'STORE_UNAVAILABLE' | 'RESUME_IN_PROGRESS' | 'RESUME_CHILD_PENDING' | 'INVALID_SCREEN_INPUT' | 'FLOW_DISABLED' | 'FLOW_NO_START_NODE' | 'FLOW_INPUT_SCHEMA_INVALID';
696696
/**
697697
* [#37526] The field-addressed findings behind an `'INVALID_SCREEN_INPUT'`
698-
* refusal, one entry per violated field: the screen field's `name`, the
698+
* refusal, one entry per finding: the screen field's `name`, the
699699
* `FieldErrorCode` it broke (ADR-0114 D2: `required`, `invalid_type`,
700700
* `invalid_value`, `min_value`, `max_value`, `unknown_field`) and the
701701
* engine's English line for it. Set with that code only; absent otherwise.
702+
* One field can carry more than one entry — a value above a field's `max`
703+
* but below its larger `min` breaks both bounds, for instance — so a runner
704+
* groups by `field` rather than counting one entry per field. For `unknown_field`,
705+
* `field` is the key the caller sent, not a declared screen field name.
702706
*
703707
* It is what lets a runner place the refusal AT the field, in its own
704708
* language, by the label it shows, instead of reading `error`: `error`

0 commit comments

Comments
 (0)