Repository navigation
fix(plugin-form): a parent's whole-record hand lock locks the record page's line panels - #38547
Conversation
…'s hand lock Claude-Session: https://claude.ai/code/session_017xRBcSccr4AxYAvAhMKBw1 Co-authored-by: Claude <noreply@anthropic.com>
…page's line panels Claude-Session: https://claude.ai/code/session_017xRBcSccr4AxYAvAhMKBw1 Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8 L1: ACCEPT · head 席位核对
Landing: non-governed, ≤3000 lines. The seat lands it through the ordinary queue. |
Fixes #38521
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
Measured first on
main(63acc6cd): a parent whose object-leveluiReadonlyWhenholds, with one stored line, on both record-page line surfaces. On both, the first line cell was an enabled input (expected false to be trueondisabled). Add, Duplicate, Remove and reorder read only the child grants andschema.readonly, and the parent's lock never entered. So a person could add, edit, remove and reorder lines by hand on a locked document. The record page keeps Edit live on such a document whenever a header field or a child field owns a lock that can still open (the rule PR #38388 gaveeditFormLockedByState), so the edit state's body-table editor was reachable too.Both surfaces now follow the rule PR #38388 gave the edit form, and add no new key:
parentHandLockHolds(new, inderiveMasterDetail.ts, not exported from.or./core) is the parent verdict throughfieldReadOnlyByHand. It readsfieldReadOnlyByHand({}, row, { object: { uiReadonlyWhen } })over the parent row, with every parent field seedednullandpreviousset to the stored row, in the host's predicate scope. It answersfalsewhen the parent declares nouiReadonlyWhen. With no row yet, the predicate is judged over an empty record, which locks: the hand lock fails closed.LineItemsPanel(record:line_items) judges the lock when the record context is the panel's parent (same object, same id): the record page it sits on, with its served definition (objectSchema) and row (data).RecordBodyTableEditor(the edit state's body table) judges it over the record as the user has it in the open edit (dataplus the inline draft), with the stored row asprevious, asMasterDetailFormjudges its header.allowAdd(Add, the entry row and Duplicate),allowDeleteand reorder (allowReorder: false). Every column whose child field owns no hand lock goes throughlockColumnsByParentHandLock. A child field's ownuiReadonlyWhenoruiReadonly: truejudges its cell instead, souiReadonlyWhen: 'false'keeps that one cell editable.No file under
ui/packages/app-shell/src/views/is touched.Tests
LineItemsPanel.parentHandLock-38521.test.tsx(7) andRecordBodyTableEditor.parentHandLock-38521.test.tsx(5), through the real components andGridField:uiReadonlyWhen: 'false'on a child field keeps that cell editable while its sibling stays locked;uiReadonly: trueon a child field stays locked;uiReadonlyWhen, so the lines are open;Measurement on main, the fix, ablations, package suite (head 37ef5d5)
main's source (fix set aside):Tests 6 failed | 4 passed (10). Every lock pin failed onexpected false to be true(the first line cell enabled), and every control passed.Test Files 2 passed (2),Tests 12 passed (12).scripts/ablation-replace.mjs(anchor hit 1 to 0, blob moved, then restored to HEAD withgit diff HEADempty each time):() => false: 4 failed | 8 passed;() => false: 3 failed | 9 passed;pnpm --filter @object-ui/plugin-form test:Test Files 252 passed (252),Tests 2830 passed | 1 skipped (2831).pnpm --filter @object-ui/plugin-form type-check: exit 0.tsc -p tsconfig.test.json --listFileslists both new test files.Derived gates (head 37ef5d5)
node scripts/pm/dispatch-gates.mjs --commands: 39 families, each run with its exit code captured before any pipe, allexit 0.--ranreconciliation:39 derived famil(ies) accounted for — 39 run, 0 NOT-MEASURED (a DERIVED zero).overlap-check.mjsagainstorigin/maind1a06a3d:VERDICT clean exit 0.Acceptance notes
ui/packages/plugin-form/src/deriveMasterDetail.tsfor the shared verdict (check-handover.mjs --inflight: clear).record:line_itemspanel bound to a parent other than the record page's own record (an authoredparentIdon another record's page) has neither the parent's row nor its definition in context, so it is not judged, as before. That case is pinned as a control.MasterDetailFormkeeps its own inline judgement of the same verdict. Moving it ontoparentHandLockHoldsis a possible later tidy-up, left out of this card.mainmoved tod1a06a3dafter the branch point. The incoming commits touch onlyui/packages/plugin-chatbotunderui/and merge cleanly, so they were not merged.Verification
Files to read first, by risk:
ui/packages/plugin-form/src/deriveMasterDetail.ts:parentHandLockHolds(seeding, and the empty record when there is no row).ui/packages/plugin-form/src/LineItemsPanel.tsx: therecordIsParentgate.ui/packages/plugin-form/src/RecordBodyTableEditor.tsx: live row versusprevious.Two-minute check: from
ui/,npx vitest run packages/plugin-form/src/LineItemsPanel.parentHandLock-38521.test.tsx packages/plugin-form/src/RecordBodyTableEditor.parentHandLock-38521.test.tsx. Expected: 12 passed.Generated by Claude Code