Repository navigation
fix(console): a parent's whole-record hand lock locks its inline master-detail lines in the edit form - #38388
Conversation
…ine lines Claude-Session: https://claude.ai/code/session_017xRBcSAaBEfQpU2yJexSJ8 Co-authored-by: Claude <noreply@anthropic.com>
…s in the edit form The edit dialog's master-detail lines now follow the parent object's uiReadonlyWhen: while it holds, no line is added, duplicated, removed, reordered or opened in the row editor, and every line cell whose child field owns no hand lock is locked. A child field that declares its own (uiReadonly: true or a uiReadonlyWhen) is judged by it, so uiReadonlyWhen 'false' keeps that cell editable. The record page's Edit greys when the lock holds and no child field can open a line. Claude-Session: https://claude.ai/code/session_017xRBcSAaBEfQpU2yJexSJ8 Co-authored-by: Claude <noreply@anthropic.com>
… lock Claude-Session: https://claude.ai/code/session_017xRBcSAaBEfQpU2yJexSJ8 Co-authored-by: Claude <noreply@anthropic.com>
… with inline lines Claude-Session: https://claude.ai/code/session_017xRBcSAaBEfQpU2yJexSJ8 Co-authored-by: Claude <noreply@anthropic.com>
…line-lines-hand-lock
The new plugin-form export and the optional editFormLockedByState argument widen published surface: Clause-② yes (widening), patch, protocol none. Claude-Session: https://claude.ai/code/session_017xRBcSPkRxFWubkD5XfiDh Co-authored-by: Claude <noreply@anthropic.com>
…line-lines-hand-lock
|
repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8 Contract reviewServed-tier: Face: the ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: No must-fix, no should-fix. VERDICT: PASS |
|
repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8 L1: ACCEPT · head 席位核对
Landing: non-governed, ≤3000 lines, L2 PASS on this head. The seat lands it through the ordinary queue. |
Fixes #38249
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
What changes
Governing ruling: the maintainer on PR #38169 (the object-level hand lock), 「本 PR 按字面落地+立跟进卡」; this card is that follow-up. The opt-out reads the existing override rule of the two-tier lock model (ruling on #36806, Q1 = B on #37402): a field that declares a hand lock of its own —
uiReadonly: trueor auiReadonlyWhen— is judged by it instead of any object-level default, anduiReadonly: falseis not such a declaration. No key, value or schema property is added.@object-ui/plugin-formMasterDetailForm.tsx(the edit dialog's line grids): the header record feed also lands the parent object'suiReadonlyWhenwith its field names. On an EDIT form the lines judge it over the live header record (every header field seedednull, the stored row asprevious, the host's predicate scope) through the one hand-lock verdict (fieldReadOnlyByHandof a field that declares nothing, i.e. the object lock itself, failing closed). While it holds: no Add, Duplicate, Remove or drag-reorder, no per-row editor, and every line column whose child field owns no hand lock is locked on every row. A create is not judged.deriveMasterDetail.ts: derived and hydrated line columns carry an in-memory mark when their child field owns a hand lock (childFieldOwnsHandLock, which askseffectiveUiReadonlyWhenitself rather than restating the rule).lockColumnsByParentHandLocklocks every unmarked column.childLinesOpenUnderParentHandLockanswers whether some child field owns a non-static hand lock (exported from the root and from/core).@object-ui/app-shelleditFormLockedByState.ts: an object that places an inline child collection no longer keeps Edit live unconditionally. It greys Edit when the object's ownuiReadonlyWhenholds over the record, every drawn header field is read-only, and no placed child object has a field that could open a line cell. That needs the child definitions, through a new optionalchildObjectDefargument; without it, or for a child it cannot answer, Edit stays live (fail open, as before).RecordDetailView.tsx: passes the served object list as that resolver.Declared writes (REST, import, actions, flows) are untouched: nothing on the server reads either key (ruling on #36806).
Published surface, both additive (a non-protocol widening, so
patch):@object-ui/plugin-formexportschildLinesOpenUnderParentHandLockfrom its.and./coreentries, and the exportededitFormLockedByStateof@object-ui/app-shelltakes an optional fourth argument,childObjectDef; a caller that omits it behaves as before.Why
PR #38169's acceptance notes recorded that a parent's object lock did not reach its line rows, and its contract review (record 7236877945) escalated it. The maintainer summary of #37402 promises 「整单人手锁定」 for a confirmed order, while a person could still edit its lines.
Tests
MasterDetailForm.parentHandLock-38249.test.tsx(realMasterDetailFormandGridField): a locked parent offers no add / duplicate / remove / reorder and locks a line cell; a child field with its ownuiReadonlyWhen: 'false'stays editable while its sibling is locked;uiReadonly: truestays locked; a fully configured entry (no child schema read) locks every cell; CONTROL draft parent edits as before; CONTROL a create is not judged.__tests__/dialogHandLock-36806.test.ts, new top-level describe:childFieldOwnsHandLockover each spelling (uiReadonly: falseand a server lock are not ownership); derived and authored (typed and untyped) columns; an unmarked column fails closed;childLinesOpenUnderParentHandLock.editFormLockedByState.test.ts, new describe: true when the lock holds and no child field can open; false with a'false'child override; true with only a static child lock; false when the predicate does not hold; false when the header is locked field by field only; fail-open without child definitions.RecordDetailView.editLockedByState-32756.test.tsx, new top-level describe: Edit disabled with the state reason on a locked document with lines; CONTROL a'false'child override and a draft record keep it live.Acceptance notes
mainfirst: the new rendered pin against the unfixed code, 4 failed / 2 passed (a confirmed parent's line cell was editable; both controls green).uiReadonlyWhen(say over the line's own columns) is judged by that predicate, so the parent's lock does not reach that cell. Its default (no declaration) is now the child object's lock OR the parent's.inlineEdit: 'form', lines shown as a list) a child field's own opt-out has no surface while the parent is locked: that collection reads fully locked.null-seeded header fields; a predicate such asrecord.status == 'confirmed'then reads open until the record lands. This is the same window as the grid's own object-definition read noted on PR feat(spec,ui): an object declares when a whole record is read-only by hand (object-level uiReadonlyWhen) #38169.LineItemsPanel/ the record body table editor) is not changed here; whether it should follow the parent's lock is for its own card.Claude-Session:trailers name the dispatching seat's session (session_017xRBcSAaBEfQpU2yJexSJ8) instead of this dev session (session_017xRBcSPkRxFWubkD5XfiDh), a transcription slip; the history is left as pushed.check-handover.mjs --inflightclear:MasterDetailForm.tsx(the line grid),RecordDetailView.tsx(the Edit state's caller),core.tsandindex.tsx(one export each).Verification
Patch round (seat claim amendment 7247687945, head
1933251b):Clause-②corrected toyes (widening)here and in both changesets (stillpatch,Metadata-protocol: none);origin/mainmerged twice (212babcf,1933251b), no incoming commit touching this diff's files. On1933251b: the four pin files 4/4 files, 42/42 tests;dispatch-gates.mjs --commands38 families, all run, all exit 0 (the uiscripts/suite 172 files passed, 2 skipped / 5,159 tests);--ran: "38 run, 0 NOT-MEASURED";overlap-check.mjsVERDICT clean exit 0;check:nul-bytesOK. The readings below are the first round's.Two-minute check:
cd ui && pnpm exec vitest run packages/plugin-form/src/MasterDetailForm.parentHandLock-38249.test.tsx— expect 6 passed.First files to read (by risk):
ui/packages/plugin-form/src/MasterDetailForm.tsx(theparentHandLockedverdict and the three grid props it gates);ui/packages/plugin-form/src/deriveMasterDetail.ts(childFieldOwnsHandLockand the mark);ui/packages/app-shell/src/utils/editFormLockedByState.ts(the subform branch).Readings on
objectstack-ai/objectstack, head9166fa40(the gate union on81f9ef2c; the one later commit adds only the record-page test describe, and the derived list on9166fa40is byte-identical).Tests
@object-ui/plugin-formfull suite: 249 files / 2,816 passed, 1 skipped.@object-ui/plugin-formand@object-ui/app-shelltype-check(bothtsc --noEmitand the test tsconfig): exit 0.RecordDetailView.editLockedByState-32756.test.tsx+editFormLockedByState.test.ts27/27. The app-shell full suite is not run locally (CITest UIruns it).Shown red without the fix (scripts/ablation-replace.mjs, restored to HEAD each time, blob equal and git diff HEAD empty)
MasterDetailForm.tsxparent verdict forcedfalse: rendered pin 4 failed / 2 passed (controls green).editFormLockedByState.tsback to returning false for any subform: 2 failed / 18 passed (the two "is true" cases).deriveMasterDetail.tsownership mark removed: 3 failed (derived and authored column cases, and the rendered'false'override case).RecordDetailView.tsxresolver dropped: 1 failed / 6 passed (the Edit-disabled case).Gates
node scripts/pm/dispatch-gates.mjs --commands: 38 families, all run on81f9ef2c; 37 exit 0.pnpm --dir ui exec vitest run scripts/exit 1: SIGKILLed by the container's memory limit while the plugin-form suite ran beside it, so not measured on that run. Rerun alone under the verify lock with--maxWorkers=2: 172 files passed, 2 skipped / 5,159 tests, exit 0.dispatch-gates.mjs --ran: "38 derived famil(ies) accounted for — 38 run, 0 NOT-MEASURED" over the raw record (the exit 1 above as recorded).overlap-check.mjsbefore every push: VERDICT clean exit 0.pnpm check:nul-bytes: OK.!, no(narrowing)arm).Human Minimum
packages/specholds no runtime logic.pnpm lintpasses (CI).main, one pull request.packages/spectouched: not touched.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_017xRBcSPkRxFWubkD5XfiDh
Generated by Claude Code