Repository navigation
fix(plugin-form): a form section naming a field the object lacks draws no control - #29194
Merged
Merged
Conversation
…s no control fromObjectSchema fell back to an untyped input stub for a name the object does not declare, so the tabbed, wizard, drawer and modal arms drew an editable box whose value the save never sent. It now builds nothing for such a name, and buildSectionFields drops the entry, matching the lint's FORM_FIELD_UNKNOWN and the default arm's pool. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTfpYE3Paxw3g66yLu
…solved A form mounted without a data source, whose host submitHandler owns the write, has no object to judge a name against; the lint's rule likewise judges only a known object. Adds a render pin on the four pool-less arms: an unknown section member draws nothing, and saving sends no key for it. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTfpYE3Paxw3g66yLu
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTfpYE3Paxw3g66yLu
This was referenced Nov 2, 2026
Contributor
Author
|
domain:ui#4 · zhuangjianguo · session_01QsR2jR7ZFkpqmm4U8S1f9y 席位核对 · ACCEPT · 2026-11-02T09:35ZHead-sha:
Generated by Claude Code |
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 Steedos · project thread
Fixes #29021
Clause-②: no
Metadata-protocol: none
维护者速读
form-field-unknown早就说这种字段“不会渲染”,现在表单与 lint 一致。ui/packages/plugin-form/src/sectionFields.ts(fromObjectSchema与buildSectionFields),ui/packages/plugin-form/src/__tests__/unknownSectionField-29021.test.tsx,ui/packages/plugin-form/src/flatFields.ts。cd ui && pnpm exec vitest run packages/plugin-form/src/__tests__/unknownSectionField-29021.test.tsx,预期 8 个用例全绿(四种布局各两条)。What changes
fromObjectSchema(ui/packages/plugin-form/src/sectionFields.ts) used to answer a name the object does not declare with a bare{ name, label: name, type: 'input' }stub. The four arms that build a section with no field pool (tabbed,wizard,drawer,modal) drew it as a live text box labelled with the raw name. It now answersundefinedwhen an object schema is resolved and does not declare the name,normalizeSectionFieldpasses that through, andbuildSectionFieldsdrops the entry. This is the answer the lint'sFORM_FIELD_UNKNOWNalready gives ("silently skipped and never renders on the form") and the one the default arm's pool andbuildFlatFieldsalready gave.What is still drawn, unchanged:
customFieldsmember naming the field (it is a whole definition);name(shape 3);submitHandlerowns the write (submitTargetRefusal.test.tsx). There is no object to call the name unknown, the lint likewise judges only a known object, and the value does reach that host.An authored
typeorlabelon a spec{ field }entry does not make the field exist: such an entry is dropped too, as the lint reports it.Empty sections. A section whose every member is unknown now builds no field. Each arm keeps whatever it already does with an empty section; nothing here changes that. On the default arm this is the existing behaviour pinned by
objectFormSectionMembers-8071row 2 (the section is dropped whole, heading included).Design and preview paths. No designer relies on the fallback. Studio's object form designer (
StudioDesignSurface) renders a flatobject-formwith top-levelfields(thebuildFlatFields/ pool path, which already skipped unknown names). The metadata-admin view preview (ViewPreview) renders the draft form view through the sameobject-formarms, so it now shows what the record form shows; the author's signal for the unknown name stays the lint'sform-field-unknown.fromObjectSchemaandnormalizeSectionFieldnow returnFormField | undefined. Neither is exported from the package entry (onlysectionEntryNameis), so the public surface is unchanged.flatFields.tsreads the new answer instead of its own duplicate declaration check.Tests
ui/packages/plugin-form/src/__tests__/unknownSectionField-29021.test.tsx: for each oftabbed,wizard,drawer,modal, an EDIT form of a real record whose section liststitlebesideno_such_field(bare name) and{ field: 'other_ghost', label: 'Other ghost' }:titleis drawn, no control and no label for either unknown name (the known input with its loaded value is the non-vacuity control);titleand saving callsdataSource.update('task', 't1', payload)withtitle: 'New title'and no key for either unknown name.sectionFields.test.ts:normalizeSectionFieldbuilds nothing for an unknown name in both named shapes (also with an authoredtype); withobjectSchema: nullthe bare stub is still built (the boundary);buildSectionFieldsdrops unknown entries keeping known ones in order, builds[]for an all-unknown section, and still draws acustomFieldsmember and an inline entry.ghostfield as a blank slate now use a declared bare field (sectionFields.spec-parity.test.tsdeclaresplain: { type: 'number' });selectMultipleGroupLabel.test.tsx's "keeps its fallback type" row now pins that no field is built. Other call sites take!where the field is declared.Acceptance notes
if (ctx.objectSchema != null) return undefined;throughscripts/ablation-replace.mjs, anchor 1 -> 0, blob restored to HEAD after) turned 7 cases red: the four "draws only the known field" rows and threesectionFields.test.tsrows. The four save rows stay green under the ablation, as expected: the stub's value was already stripped on save before this change (the card saw nono_such_fieldkey either). They pin the save half so it cannot regress once the box is gone.ghostinto the stub and saving sent{"title":"Old title","notes":"kept"}, every drawn field, on all four arms. That isdirtyEditPayload(sanitize.ts) by design: the unknown key is stripped, so the diff against the loaded record is empty, and an empty diff sends the whole payload so the save stays a real write. With this fix the ghost box is gone, so typing into it can no longer produce that save. A save with nothing changed still sends every drawn field (measured: the same payload on all four arms). That is the documented empty-diff rule, left as is per the card's ruling._diagnosticson the metadata read door is the Zod verdict (packages/metadata-protocol/src/metadata-diagnostics.ts);validateFormLayout, which ownsform-field-unknown, is wired into the authoring-rule registry (os validate/os lint) and not into the door, so a form view naming an unknown field still readsvalid: truethere. That belongs todomain:server; nothing underpackages/**is touched here.ObjectForm'stabbedarm, the same component the render pins drive.Verification
All readings at head
49b88da9(mainfea2dbb7merged in; the 14 later main commits touch nothing underui/packages/plugin-form).plugin-form suite: 218 files, 2419 tests green
cd ui && pnpm exec vitest run --maxWorkers=2 FILES, underos-verify-lock, in two halves of the package's 218 test files:type-check and lint
pnpm exec turbo run type-check --concurrency=2 --filter=@object-ui/plugin-form: Tasks 48 successful, 48 total (coverstsconfig.test.json, so the test files are compiled).pnpm exec eslinton the seven touched files: exit 0, 0 errors (59 pre-existingno-explicit-anywarnings).ablation
node scripts/ablation-replace.mjs --file ui/packages/plugin-form/src/sectionFields.ts --anchor 'if (ctx.objectSchema != null) return undefined;' ...(anchor 1 -> 0, blob d6b678291c7c -> 50ccedea3703), then the new render pin plussectionFields.test.ts: Test Files 2 failed (2), Tests 7 failed, 37 passed (44). Restored: blob == HEAD (d6b678291c7c),git diff HEADempty.derived gates: 34 of 34 exit 0
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 34 commands from this diff; each ran and exited 0, includingnode scripts/check-sdui-manifest.mjs(manifest intact, 106 components), the changeset gates against this body,pnpm check:type-check-debt(0 raw tsc errors above ledger) andpnpm --dir ui exec vitest run scripts/(169 files passed, 2 skipped).--ranreconciliation: 34 derived, 34 run, 0 NOT-MEASURED, 0 UNRUN.Generated by Claude Code