Skip to content

fix(plugin-form): a placed row editor is not nested in a form, and a save refused on placed lines marks their tab - #36088

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-36019-placed-lines-form
Nov 21, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-36019-placed-lines-form

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Sales · project thread

Fixes #36019

Clause-②: no
Metadata-protocol: none
Skills-docs: none — no authorable key and no behaviour a skill teaches moves
repo:objectstack#1 · os-sales · session_01L6bhgW85kwjGaz7HqsmEuv

维护者速读

  • 用户能看到什么变化:在“表头加明细”的录入表单里,明细表放在某个字段分组处时,展开一行明细编辑不再在开发控制台报“表单嵌套表单”的警告;分页签的表单里,保存被服务器以某一行明细为由拒绝时,明细所在的页签会像表头字段出错时一样标红点。
  • 为什么做:这是“明细表放在字段分组处”那项工作(主从表单布局)评审时留下的两条收尾意见,补上明细出错时用户找不到原因的缺口。
  • 出错会怎样:最坏情况是明细页签该标红没标、或多标了一个页签,保存本身照旧被拒、数据不会写错;整个改动可直接撤回。
  • 要你做什么:无

What changes

  1. Row editor in a placed slot (N2 of the L2 record on fix(ui): the entry form draws a group-placed master-detail table at its field group #36009). FormSlotPlacement takes ownsForm: when its children already are a form of their own, it portals them into the slot with no wrapper form. The expanded row editor (an ObjectForm, its only other control a type="button") is placed with ownsForm, so its form is no longer a React child of the slot's wrapper form, and React's DOM-nesting check stops logging "form cannot be a descendant of form". This is the measured S2 patch, re-applied on main (git apply --check clean, offsets +24/+78).
  2. Tab marker for a refused line (N3 of the L2 record, L1-c's nit). A batch refusal is attributed to the placed collections it was refused on, using the same evidence the record page's attributeRecordEditRefusal reads: the operation the server names in details.failedOperation.index when it names one (a line's operation, never operation 0, the parent), else each field in fields[] that only line operations write. A field the parent operation carries stays the header form's to mark. FormSlotStore records those collection ids (refuse(ids), cleared when the next save gets past validation, as the renderer clears its own markers). TabbedForm subscribes to the store and rebuilds its slot rows, each carrying slotRefused when its collection was refused. The form renderer's erroredFieldTabs marks the tab of a refused slot row with the treatment a refused header field gets (data-error, destructive text, the dot).

No export, prop or i18n key is added. FormSlotHost and FormSlotRow live in formSlots.ts, which @object-ui/plugin-form does not export. The renderer reads slotRefused off a form-slot row the same way it reads slotRef: a key only a host can produce.

Tests

  • MasterDetailForm.groupPlacement-35889.test.tsx, existing describe: an expanded row editor opens in the slot beside its collection, its inputs are owned by its own form, and no nesting warning is logged.
  • Same file, new top-level describe (a refused save marks the tab of the placed lines it was refused on): a field only a line writes marks the lines tab and not the header tab; a server-named failed line operation marks the lines tab; control: a refusal on the header's own field marks its tab and leaves the lines tab unmarked.
  • formSlots.test.ts: refuse marks the slot row until retired, de-duplicates, and an equal refusal emits nothing.

All readings at head 9ac514e3.

Suites and type-check
  • pnpm exec vitest run --maxWorkers=2 packages/plugin-form/ packages/components/src/renderers/form/ (from ui/, under the verify lock): Test Files 332 passed (332), Tests 3359 passed | 18 skipped (3377), VERDICT command-exit 0.
  • pnpm --filter @object-ui/plugin-form --filter @object-ui/components run type-check (both run tsc --noEmit && tsc -p tsconfig.test.json): VERDICT command-exit 0.
  • eslint over the six changed source and test files: 0 errors (106 warnings, all on lines this diff does not touch).
Ablations (one per fix, through `scripts/ablation-replace.mjs`, restore proven)
  • Fix 1: ownsForm removed from the row editor's placement (anchor 1 to 0, blob 632b58a14b7d to f73ce79e3a8b). The nesting pin goes red with React's own message, "In HTML, a FORM cannot be a descendant of a FORM" (its DOM-nesting check); Tests 1 failed | 10 passed (11). Restored: blob equals HEAD (632b58a14b7d), git diff HEAD empty. This mutation is the code on main, so the pin fails on main and passes with the fix.
  • Fix 2: the slotStore.refuse(...) call in sendBatch's catch deleted (anchor 1 to 0, blob to 2e2969a6db0b). Both tab pins go red, and the control (a header-field refusal) stays green; Tests 2 failed | 9 passed (11). Restored: blob equals HEAD, git diff HEAD empty.
Derived gate families

node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 38 commands. Every one exited 0. --ran reconciliation: "38 derived famil(ies) accounted for — 38 run, 0 NOT-MEASURED (a DERIVED zero — all 38 recorded an exit code and none of them is 3)". The type-check lanes, artifact rosters and wide-population families are CI's.

Overlap

node scripts/pm/overlap-check.mjs --branch=HEAD --pr=36039,36054: origin/main, #36039 and #36054 each merge cleanly, VERDICT clean exit 0.

Acceptance notes

  • The marker is the whole of the header-field treatment that applies here. A refused header field also activates its tab and focuses the field; a refused line does not switch tabs, because the renderer's catch runs before the host's refusal reaches the tab rows, and the lines show no per-row reason today (the master-detail form shows the refusal as the form's banner, as before). The acceptance names the marker only.
  • A refusal that names neither a failed operation nor a field (a lock, a permission denial) is on no collection, and marks nothing, as before.
  • File surface beyond the claim's wording: the tab marker is drawn by the form renderer (ui/packages/components/src/renderers/form/form.tsx), not by TabbedForm, and the refusal travels through formSlots.ts. Both are named here.
  • The editor's form still sits inside the header's form in the DOM (the slot element is inside it), as the lines' wrapper form already did; ownership is answered by the innermost form, which the pin asserts.

Verification

Two-minute check: pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-form/src/MasterDetailForm.groupPlacement-35889.test.tsx: expect 11 tests passed.

Read first: (1) MasterDetailForm.tsx refusedChildObjects and its call in sendBatch (which refusals count as a line's); (2) form.tsx erroredFieldTabs (the renderer's new read); (3) TabbedForm.tsx the useSyncExternalStore on the slot host.


🤖 Generated with Claude Code

https://claude.ai/code/session_01L6bhgW85kwjGaz7HqsmEuv

…wrapper form

The expanded row editor is an ObjectForm of its own, so its placement in a
group slot draws no wrapper form: a form inside a form is a nesting React
refuses. Pinned: the editor's inputs are owned by its own form and no
nesting warning is logged.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgW85kwjGaz7HqsmEuv
…olds them

In a tabbed master-detail form a group-placed line table lives in a tab of
its own. A batch the server refuses on a line (the failed operation is a
line's, or the refused field is one only the lines write) now marks that
tab the way a refused header field marks its own: the slot store records
the refused collections, the tabbed form rebuilds its slot rows from it,
and the form renderer marks the tab of a refused slot row. The mark
retires when the next save gets past validation.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgW85kwjGaz7HqsmEuv
@github-actions github-actions Bot added documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 21, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgW85kwjGaz7HqsmEuv

Final green head · 2026-11-21T13:27Z · area b1-DB

  • Head 9ac514e35be5fde74ba724db50b6afd33d1a6a3f: 45 success, 13 skipped, 0 failed; mergeable clean.
  • check-governed-merges --pr 36088: NOT governed, +230 / −14.
  • Item 1: the expanded row editor's placement draws no wrapper form (ownsForm), because the editor is already a form. Pin: its inputs belong to its own form and React logs no form-in-form warning; removing ownsForm (main's code) turns it red.
  • Item 2: a batch refusal on placed lines (the server's failedOperation.index naming a line op, or a fields[] name only line ops write) is recorded in the form-slot store; the slot row carries slotRefused, and the form renderer marks its tab like a header-field error. Cleared once the next save passes validation. Pins: line field → lines tab only; index 1 → lines tab; control: header-field refusal → header tab only. Ablating the record call turns both line pins red, control green. Marker only, per the amended claim; switching to the tab is a possible follow-up.
  • Clause-②: no. Metadata-protocol: none. Changeset: @object-ui/plugin-form and @object-ui/components patch.
  • Next: L1-a review.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgTcFanGhTvqS1V2Q4U

席位核对 — ACCEPT (L1-a)

维护者速读

这个 PR 是「明细表放在字段分组处」那项工作留下的两条收尾,两条都做到了:

  • 展开一行明细编辑时,不再出现「表单里套表单」。开发控制台不会再报警告,输入框也仍然只属于明细自己的编辑表单。
  • 分页签的录入表单里,服务器以某行明细为由拒绝保存时,明细所在的页签会像表头字段出错一样标红点。下次保存通过校验后,红点消失。

我核过以下几点:

  • 判断「拒绝是不是因为明细」用的依据,和记录页已有的做法一致:服务器点名的是哪一步操作,或者出错的字段是否只有明细会写。
  • 表头自己的字段出错时,不会误标明细页签。
  • 两处修复各自撤回后,对应的测试都变红。

没有需要修的问题,不属于受管面,不需要 L2,可以按普通队列合并,合并后卡 #36019 关闭。下面记了两条小观察,不挡合并。

Head reviewed: 9ac514e35be5fde74ba724db50b6afd33d1a6a3f. Two commits, 7 files, +230/−14. git merge-tree onto current main is clean. check-governed-merges --pr 36088 (PR-head register) reads NOT governed, 0 of 7 paths. reviewFace with Clause-②: no gives face declaration → TIER_DEFAULT, so no L2 is owed. CI is as the thread reported. vitest was not run here (no node_modules).

What holds

  • Fix 1, ownsForm. FormSlotPlacement portals its children bare when ownsForm is set, and only the expanded row editor passes it. The other placement (the lines themselves) keeps the wrapper form with its disabled default button, so Enter and line buttons behave as before. The pin asserts three things: the editor sits in the placed slot, every editor input's form is inside the editor and is not the header's form, and no DOM-nesting error is logged. The ablation is main's code, and it fails with React's own message.
  • Fix 2, attribution (refusedChildObjects).
    • Both batch builders put the parent at operation 0 (masterDetailTx.ts buildMasterDetailBatch / buildMasterDetailEditBatch, the edit one unconditionally). So failedOperation.index > 0 is always a line operation, and index 0 correctly marks nothing on the host side.
    • runBatchTransaction passes ops through unchanged to the adapter's batchTransaction. The emulated fallback carries no failedOperation and falls to the fields[] branch.
    • A field that operation 0 carries is skipped, so a header field stays the header form's to mark (the control pin). carries ignores deletes, which have no data.
  • Store and redraw.
    • refuse de-duplicates and sorts, and an equal key does not emit.
    • submitViaBatch calls refuse([]) after the header form's validation has let the submit through, which is the same retirement point as the renderer's own rejectedFieldNames.
    • TabbedForm builds tabGroups and formSlotRows during render, unmemoised, so the useSyncExternalStore on refusedKey is enough to rebuild the rows with slotRefused.
    • In form.tsx, erroredFieldTabs adds the slot row's tab through tabKeyByFieldName, and fields joins its deps. fields is a memo there (:1907), so no per-render churn is added.
  • FormSlotHost gains two members. Its one implementer is FormSlotStore, which type-check holds. formSlots.ts is not reachable from plugin-form's index.tsx or core.ts, and form.tsx only reads an optional key off a form-slot row. No published type moves, so Clause-② no is right. The patch bump on both packages is right.
  • File surface. form.tsx and formSlots.ts are beyond the claim's first wording. The body names them, and the claim's revision covers them.

Observations (no change asked)

  • O1: attribution is by child object, not by entry. refused.has(e.config.childObject) marks every placed entry of that child object. Suppose one form places two collections of the same child object through different relationship fields, in different tabs. A refusal on one of them then marks both tabs. This is rare, the body's "at worst one tab too many" covers it, and the operation index alone cannot tell the entries apart without mapping ops back to entries.
  • O2: retirement is pinned at the store, not end to end. formSlots.test.ts pins that refuse([]) clears the row. No integration case saves again and sees the lines tab's data-error go away. The call site is one line beside setSaveTried, so the risk is low.
  • The renderer catch also calls setError on a line-only field that shares a header field's name. That is declared in Acceptance notes and not reproduced. It is pre-existing and out of scope.

Landing terms

  • Not governed: the seat lands it through the ordinary queue. Fixes #36019 closes the card on merge.
  • A new push needs a delta L1 unless it is a clean main merge.
  • This review does not approve, mark ready, enqueue or request review.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

Seat landing · 2026-11-21T13:32Z · The b1-DB PR for #36019: a line table placed in a form's field group opens its row editor without nesting a form inside a form (the S2 patch from #36009, re-applied on main), and a line refused on Save now marks the tab that holds the placed lines, styled like a header-field error. The marker sits in the components form renderer and reads refusals recorded in FormSlotStore, as the seat's claim amendment on #36019 reads it; switching to and focusing that tab is not in this PR. Clause-②: no, so no declaration-face L2 is owed. L1-a ACCEPT 7063342876 on 9ac514e3 (this head); its two observations (marking by child object rather than by entry, and the clear pinned at the store layer) do not block. check-governed-merges --pr 36088 reads NOT governed (+230/−14). The seat read K by hand: 10 first-parent commits since the merge base, under 15; main since then touches no translations/ bundle and two skills/ files this PR does not touch. On this head, 45 check-runs are success, 13 are skipped and none failed; mergeable clean. The seat readies this PR and arms auto-merge in the same step. The PR carries Fixes #36019.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 21, 2026 13:32
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit baf2678 Nov 21, 2026
59 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-36019-placed-lines-form branch November 21, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Master-detail form: a placed line table's row editor nests a form inside a form, and a line refusal can sit in an unopened tab

2 participants