Repository navigation
fix(automation): a screen flow refuses a required field of only spaces at the field, and a screen refusal reaches the user at its fields in their language - #37643
Conversation
…t the field, and a screen refusal is placed at its fields in the user's language The flow screen dialog's required check trims, as the engine's does. The engine's INVALID_SCREEN_INPUT result carries its findings as fields, the resume door serves them in error.details.fields, and the dialog marks each field it names by its label in the display language, with a catalog banner instead of the engine's sentence. Claude-Session: https://claude.ai/code/session_01L6bhgU7eeqHgQrtv5CeJK6 Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 3 package(s): 6 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 5 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 182 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin b00e8b53c31815e5a4fb3d21282f5176ab98c422 && git checkout b00e8b53c31815e5a4fb3d21282f5176ab98c422
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 87af66e5b6c75af7989ecbdc8820f1ca4a66596a 275dd464efd6bf1b7b0acdf42afe759ce2bbedf6 && git checkout -B drift-repro 87af66e5b6c75af7989ecbdc8820f1ca4a66596a && git merge --no-ff 275dd464efd6bf1b7b0acdf42afe759ce2bbedf6
node scripts/docs-audit/affected-docs.mjs --json 87af66e5b6c75af7989ecbdc8820f1ca4a66596a
|
…t collection Claude-Session: https://claude.ai/code/session_01L6bhgU7eeqHgQrtv5CeJK6 Co-authored-by: Claude <noreply@anthropic.com>
|
Final head for review: Since the PR opened, Owed: L1 and L2 (seat). The L2 surfaces are the optional Generated by Claude Code |
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA Contract reviewServed-tier: First round. Read: card #37526 with its two comments, the PR body and its two comments, the 25-file net diff against ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
Implementing files agree with the contract: Tried to break it, and it held:
No must-fix, no should-fix. N1 (nit) — "one entry per violated field" (the contract jsdoc and the schema describe, and from there the reference page, N2 (nit) — the jsdoc on Implemented-by: VERDICT: PASS |
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA 席位核对 — ACCEPT · head 275dd46 · card #37526 · area s2-ux-P · 2026-11-26T18:01ZL1 checklist
Tier: S. Landing: ready + auto-merge by this stroke. |
Requested by Sales · project thread
Fixes #37526
What changes
Client: spaces are no answer. The flow screen dialog's
requiredcheck (FlowRunner.tsx, new exportedisUnanswered) counts a string that is empty once trimmed as missing, as the engine'sisPresentdoes. Three spaces in a required field are refused under the field with the samevalidation.requiredmessage an empty field gets, focus moves there, and no resume request is made. An uncheckedfalseand0stay answers.Wire: a screen refusal names its fields in a structured slot.
400 INVALID_SCREEN_INPUTnow carrieserror.details.fields: one{ field, code, message }per violated screen field,codean ADR-0114FieldErrorCode(required,invalid_type,invalid_value,min_value,max_value,unknown_field). These are the entriesVALIDATION_FAILEDalready serves in the same slot, and each parses underFieldErrorSchema.@objectstack/spec:AutomationResultgains the optionalfields?: FieldError[], set withcode: 'INVALID_SCREEN_INPUT'only, andTriggerFlowResponseSchema.datamirrors it asz.array(FieldErrorSchema).optional()(the Twopackages/specroute response schemas declare adataNARROWER than the contract their route relays —AnalyticsResultResponseSchemaandTriggerFlowResponseSchema#13078 identity pinTriggerFlowDataMatchesContractholds the two equal). The generated reference pagecontent/docs/references/api/automation-api.mdxis regenerated.@objectstack/service-automation:refuseInvalidScreenInputfills it from thevalidateScreenInputsissues it already computed.@objectstack/runtime:classifyResumeResultserves it asdetails.fieldson that row only, so the REST door and MCPresume_runanswer it alike. Another row, or an empty list, serves no details, as before.error.messageis byte-identical: the sentence with the declared field names stays for logs and API callers.Console: the refusal is placed at its fields, in the user's language.
interpretFlowResponsereads the findings (screenInputFindings,{ field, code }only) onto a failed outcome's newscreenInput.FlowRunnermarks each on-screen field named, by the label it shows and in the display language:required→validation.required, a bound →validation.min/maxwhen the field declares it, anything else → newflowRunner.fieldNotAccepted. Focus moves to the first. The banner and toast read newflowRunner.invalidScreenInputinstead of the engine's sentence, also from a server that sends no findings. Both keys are in all 11 locales. The #36831 re-read of the run before a retry is unchanged and still runs first.Docs:
content/docs/automation/flows.mdx§ Ascreenresume is checked against the declared fields documentsdetails.fieldsand the runner's behaviour.Why
The card measured on 18.6.0 (zh-CN console, HotCRM Close Case): three spaces in the required
resolutionpassed the dialog, the engine trimmed and refused, and the dialog showedInvalid screen input: Screen field "resolution" is required — declared fields: 'resolution', 'resolved_by_article'verbatim. Premise re-read onmain33a31dc: the dialog's check did not trim (FlowRunner.tsx:848-849), the engine's does (screen-input-contract.ts:58-59), and the refusal envelope carried onlydetails.code. The dialog's own header said why the sentence stayed in the banner: "the envelope names no field in a structured slot, so placing it at a field would mean parsing prose". This PR adds that slot instead of parsing.Verification
service-automationbuiltin/screen-input-whitespace-fields-37526.test.ts(realAutomationEngine, Close Case screen):' 'refusedrequiredwithfieldsand the unchanged sentence, the pause kept; one entry per violated field (required,min_value,unknown_field); a real answer resumes with nofields.runtimedomains/automation-resume-screen-input-fields-37526.test.ts(REST resume door):details.fieldsserved,messageunchanged, the envelope parses underApiErrorSchemaand each entry underFieldErrorSchema; an empty list and another row serve no details.automation-resume-refusal-codes.test.ts(every row: empty details when the engine sends no fields) andmcp-resume-run.test.tsstay green.app-shellFlowRunner.whitespaceRequired-37526.test.tsx(7 tests): spaces refused at the field in en and zh with no request; findings placed by label (Resolution is required,Hours must be at least 0), focus on the first, catalog banner and toast, no API field name on screen; zh banner andfieldNotAcceptedmessage; no findings → catalog banner, no field marked; editing retires the message and the resubmit completes. Ablation: againstmain'sFlowRunner.tsxandflowResponse.ts, 7 of 7 red.FlowRunner.requiredAtField-26882.test.tsxandFlowRunner.resumeResult.test.tsxasserted the engine's sentence in the banner. They now assert the catalog sentence, and that the engine's is absent.screen+resume30 files / 345 tests; runtimeresume+http-dispatcher40 / 825; clientautomation-resume1 / 8; uii18n+ allFlowRunner*+flowResponse132 / 2237 (13 skipped).api/automation-api*+contracts58 files / 585 tests;check:generated14 of 14 green (incl.check:test-typecheck, which caught the missing Zod mirror first).tsc --noEmit: service-automation and runtime exit 0. app-shelltscandtsconfig.test.jsonshow no error in the changed files (the 6 / 7 errors are in untouched files, from stale local dists of other ui packages). eslint on the changed files: 0 errors.overlap-checkclean againstorigin/maind92684a and 1 PR head (feat(spec)!: form is a metadata type of its own, and the form doors read a form over both types #37422, shares the locale files and the generated reference page, merges cleanly).Small decisions (dev thread)
details.fields[].messagecarries, and why it is there. The claim said the findings would carry no message with author keys. The PR uses the existingFieldErrorSchemaentry{ field, code, message }instead of a new two-member shape, becausemessageis required there and the slot is the oneVALIDATION_FAILEDalready fills. Themessageis the engine's English line for that one finding, verbatim, and it is a substring oferror.message, which this PR does not change:Screen field "resolution" is required,Screen field "hours" must be at least 0,Unknown screen field "nickname" — not declared on this screen. So it names the field by its machine name, whichfieldnames anyway. Forunknown_fieldit echoes the key the CALLER sent. It never carries the declared-fields list, the other fields' names, or a value. Nothing new reaches the wire: every string indetails.fieldswas already in the same response'serror.message. The console never rendersmessage.screenInputFindingskeeps only{ field, code }, and the text under a field is the console's own catalog sentence with the field's label. The server log is unchanged: the findings ride its structured slot ({ issues }), never its message (finding(service-automation): engine.ts's five name-shaped splices — author-metadata / caller-supplied identifiers interpolated into log messages with no newline constraint #6654).min_value/max_valuefinding reads asvalidation.min/maxwith the limit taken from the screen field's declaredmin/max, because the engine's entry carries no constraint. Without that declaration it falls back toflowRunner.fieldNotAccepted.c40f3b8ca), now with the catalog sentence. Only the client-side required refusal raises no toast (Screen flow dialog: an empty required field makes Submit a silent no-op, and a refused submit removes Submit so the user must close and retype everything #26882), and that is unchanged.Clause-②: yes (widening)
Metadata-protocol: none
Owed: L1 (seat); L2 (seat arranges: the new optional
details.fieldsmember on400 INVALID_SCREEN_INPUTandAutomationResult.fields).Human Minimum
packages/specholds no runtime logic. (The wire member is Zod onTriggerFlowResponseSchema, elementFieldErrorSchema; the contract interface mirrors it.)pnpm lintpasses.main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (gen:docs;check:generated14 of 14 green against a fresh build)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01L6bhgU7eeqHgQrtv5CeJK6
Generated by Claude Code