Repository navigation
fix(console): a served form row marked required holds Save when left empty - #28293
Merged
Merged
Conversation
…t empty A form row's required flag is a layout override the schema may not share, so the live Zod pass and the server both accept the empty field. SchemaForm now reports the rows it offers whose served row says required (visible, editable), and the metadata edit page shows an unset one as the field's required error and holds Save on it. Claude-Session: https://claude.ai/code/session_01L9qibzECC3G6Nyga7Ysbjd Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibzECC3G6Nyga7Ysbjd Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibzECC3G6Nyga7Ysbjd Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Author
|
domain:ui#3 · os-tesla · session_01L9qibz8HEj53Wx2uphTo2o 维护者速读
席位意见:「哪些行算提供给作者」只用表单渲染时同一条可见性规则判断,不另抄一份;拦截只在表单比 schema 更严处生效,不改服务端,可直接落地。 席位核对ACCEPT · seat
|
This was referenced Oct 31, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Tesla · project thread
Fixes #28179
Clause-②: no
Metadata-protocol: none
维护者速读
required: true:这类行留空时,该字段下显示「This field is required.」,点保存不发请求;适用于所有元数据类型,不是权限集特例。PermissionSetSchema.label仍是可选,页面只按 Zod 校验、服务端也接受,所以留空照样保存成功,星号只是装饰。ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.tsx(requiredRowIssues与doSave中紧随 Name 拦截的那段),SchemaForm.tsx(SectionedSchemaForm的visibleFields/requiredRowKey),ResourceEditPage.requiredRow-28179.test.tsx。pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/ResourceEditPage.requiredRow-28179.test.tsx,预期 3 个用例全绿;或在 Console 设置 › 权限集 › 新建,只填 Name 点保存,Label 下出现必填提示且没有保存。What changes
SchemaFormgains an optionalonRequiredRowFieldsChange(fields)prop.SectionedSchemaFormreports the top-level rows it offers whose served row saysrequired: true: in a visible section (collapsed sections and other tabs count), not hidden, with a schema property, and editable (notreadonly, notimmutableoutside create, not a read-only form). The row visibility filter is now one local function (visibleFields) that the rendered rows, the tab list and this report all read, so the hold and what is on screen cannot disagree. The callback is keyed on the joined field names, never on an array identity, and reports an empty set on unmount. Any non-sectioned face reports nothing.ResourceEditPagekeeps those fields beside the existinginlineIssueFieldsstate and derivesrequiredRowIssuesfrom the draft: a reported field that is empty (absent, null, blank string, empty array) is a located issue with the newengine.validation.fieldRequiredmessage. It is skipped where the served schema already requires the field (that field keeps its own verdict) or gives it a default. The issues joindisplayIssues, anddoSavereturns before any request while one stands, right after the existing Name hold, on create and on edit.engine.validation.fieldRequiredin the studioenandzhpacks (the only two the namespace ships), one block each.Why
A served form row's
requiredis a layout override (FormFieldSchema.required, "Required override"). PR #28152 made the permission set's Label row required whilePermissionSetSchema.labelstaysz.string().optional(), so the live Zod pass, the save-time checks and the server all accepted an empty Label: the star was the only thing that said otherwise.Why this predicted verdict may hold Save when the live Zod pass may not: the advisory ruling at
blockingReportguards against a client stricter than the server dead-bolting a draft the author cannot fix. Only rows the form on screen offers and lets the author edit report, so the author can always fill what holds the save, the same bound the Name hold (#27865) relies on.Tests
ResourceEditPage.requiredRow-28179.test.tsx(real page, realMetadataClientover an in-memory server, real served form fromMETADATA_FORM_REGISTRY.permission):sales_ops, Save: the inline issue is on the Label row and nowhere else, noPUTleaves; typing a Label clears it and Save sends{ name: 'sales_ops', label: 'Sales Ops' }.requiredremoved: an empty Label saves.label: the page gives the verdict it gave before (the create seed's placeholder refusal, objectui#12810), and the new message is not added.SchemaForm.requiredRows-28179.test.tsx: which rows are reported: an offered required row (also in a collapsed section); a predicate-hidden row only once its predicate shows it;readonly,immutableoutside create and a read-only form are left out; a host-hidden row is left out; the flat fallback reports nothing; unmount reports an empty set.Acceptance notes
main(6285203d): with the served permission form, the Label row draws the star and no issue appears after Save (reverse leg below). The page onmainnever reads a row'srequiredoutside the star, so Save takes the same path as CONTROL (b): thePUTgoes out with nolabeland the page lands. The server accepting it follows fromPermissionSetSchema.labelbeing optional; not measured live against a running server.ui/AGENTS.md✨ Set up Copilot instructions #2 (docs): no README orcontent/docs/frontend/page describes the metadata editor's save checks, so no doc page changed.doSavebeside the Setup → metadata edit page saves a bad name anyway and stacks three messages (server refusal, client summary, inline error) (#27521 row 16) #27865 Name hold, as the claim's file surface records. No line in Studio: one item toolbar — layers, references, history with rollback, audit, source — on every pillar item #28239's regions (import block, references code, item-tool sheets) changed.Verification
All local readings on head
75f14a8cunless stated.New tests, and the reverse leg on main's sources
pnpm --dir ui exec vitest runon the two new files:Test Files 2 passed (2),Tests 9 passed (9).ResourceEditPage.tsxandSchemaForm.tsxrestored to base6285203d(marker counts after the restore:fieldRequired0,onRequiredRowFieldsChange0), same command:Tests 6 failed | 3 passed (9); the 6 are the five SchemaForm report cases and page case (a) (Unable to find an element by: [data-testid="schema-form-issue"]inside the Label row, which shows only its star). (b) and (c) pass on both trees. Restore proven by an emptygit diff HEAD.Neighbouring suites, type-check, lint
ResourceEditPage.*.test.tsxandSchemaForm*.test.tsxinmetadata-adminpluspackages/i18n/src/__tests__/studio-namespace.test.ts:Test Files 78 passed (78),Tests 568 passed (568).pnpm --filter @object-ui/app-shell --filter @object-ui/i18n run type-check(after a dts build of@object-ui/app-shell^...): exit 0.eslinton the changed files: 0 errors (warnings pre-existing). With--no-inline-configit reports the threereact-hooks/static-componentslines main already disables inline; none is in this diff.pnpm --dir ui run check:new-line-citations:0 new citation(s), exit 0.Derived gates (dispatch-gates --commands, 34 families)
All 34 exit 0, including
node scripts/check-sdui-manifest.mjs(and--self-test),pnpm --dir ui exec vitest run scripts/,check:adr-0087-registration,check:changeset-no-major,check:empty-changeset,check:published-files,check:type-check-coverage,check:type-check-debt,check:test-source-alias,check:cross-package-test-inputs,check:undeclared-dep-imports,check:nul-bytes.dispatch-gates --ran: 34 derived, 34 run, 0 NOT-MEASURED, 0 UNRUN, exit 0. The full farm is CI's.Human Minimum
packages/specholds no runtime logic. (untouched)pnpm lintpasses. (changed files linted locally; the repo-wide run is CI's)main, one pull request.packages/spectouched: n/a.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01L9qibzECC3G6Nyga7Ysbjd
Generated by Claude Code