Skip to content

fix(plugin-form): a parent's whole-record hand lock locks the record page's line panels - #38547

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-38521-line-items-panel-hand-lock
Nov 29, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-38521-line-items-panel-hand-lock

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #38521

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:控制台记录详情页上,父单据整单手动锁定时,明细行面板和详情页编辑状态里的明细表不能再手动增、删、改、排序明细行;之前这两处都能改。
  • 为什么做:上一次修复只锁住了编辑表单里的明细行,这次把详情页上另外两处能手改明细的地方按同一套规则锁住。
  • 出错会怎样:只影响控制台里人手编辑明细行;接口、导入、动作和流程写入不变;可以直接撤回。
  • 要你做什么:无。

What changes

Measured first on main (63acc6cd): a parent whose object-level uiReadonlyWhen holds, with one stored line, on both record-page line surfaces. On both, the first line cell was an enabled input (expected false to be true on disabled). Add, Duplicate, Remove and reorder read only the child grants and schema.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 gave editFormLockedByState), 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, in deriveMasterDetail.ts, not exported from . or ./core) is the parent verdict through fieldReadOnlyByHand. It reads fieldReadOnlyByHand({}, row, { object: { uiReadonlyWhen } }) over the parent row, with every parent field seeded null and previous set to the stored row, in the host's predicate scope. It answers false when the parent declares no uiReadonlyWhen. 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 (data plus the inline draft), with the stored row as previous, as MasterDetailForm judges its header.
  • While the lock holds, both withhold allowAdd (Add, the entry row and Duplicate), allowDelete and reorder (allowReorder: false). Every column whose child field owns no hand lock goes through lockColumnsByParentHandLock. A child field's own uiReadonlyWhen or uiReadonly: true judges its cell instead, so uiReadonlyWhen: 'false' keeps that one cell editable.
  • Declared writes (REST, import, actions, flows) are untouched, per the ruling on spec: a field a person changes only through actions — read-only on every UI surface, still writable by the API, import and action writes, judged by validations #36806: nothing on the server reads either key.

No file under ui/packages/app-shell/src/views/ is touched.

Tests

LineItemsPanel.parentHandLock-38521.test.tsx (7) and RecordBodyTableEditor.parentHandLock-38521.test.tsx (5), through the real components and GridField:

  • a locked parent offers no add, duplicate, remove or reorder, and locks a cell whose child field owns no lock;
  • uiReadonlyWhen: 'false' on a child field keeps that cell editable while its sibling stays locked;
  • uiReadonly: true on a child field stays locked;
  • panel only: a parent row the record context has not loaded yet locks the lines (fails closed);
  • CONTROL: the predicate does not hold, so everything is offered and editable;
  • CONTROL: the parent declares no uiReadonlyWhen, so the lines are open;
  • CONTROL (panel): a panel bound to another parent id than the record context's is not judged by that record.
Measurement on main, the fix, ablations, package suite (head 37ef5d5)
  • On main's source (fix set aside): Tests 6 failed | 4 passed (10). Every lock pin failed on expected false to be true (the first line cell enabled), and every control passed.
  • With the fix: Test Files 2 passed (2), Tests 12 passed (12).
  • Ablations via scripts/ablation-replace.mjs (anchor hit 1 to 0, blob moved, then restored to HEAD with git diff HEAD empty each time):
    • panel verdict () => false: 4 failed | 8 passed;
    • panel column lock removed: 4 failed | 8 passed;
    • panel reorder line deleted: 3 failed | 9 passed;
    • editor verdict () => false: 3 failed | 9 passed;
    • editor column lock removed: 3 failed | 9 passed;
    • editor reorder line deleted: 2 failed | 10 passed.
    • Controls stayed green in every run.
  • 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 --listFiles lists both new test files.
  • eslint on the five changed files: 0 errors.
Derived gates (head 37ef5d5)

node scripts/pm/dispatch-gates.mjs --commands: 39 families, each run with its exit code captured before any pipe, all exit 0. --ran reconciliation: 39 derived famil(ies) accounted for — 39 run, 0 NOT-MEASURED (a DERIVED zero). overlap-check.mjs against origin/main d1a06a3d: VERDICT clean exit 0.

Acceptance notes

  • File surface: the claim's two files and their co-located tests, plus ui/packages/plugin-form/src/deriveMasterDetail.ts for the shared verdict (check-handover.mjs --inflight: clear).
  • A record:line_items panel bound to a parent other than the record page's own record (an authored parentId on 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.
  • MasterDetailForm keeps its own inline judgement of the same verdict. Moving it onto parentHandLockHolds is a possible later tidy-up, left out of this card.
  • main moved to d1a06a3d after the branch point. The incoming commits touch only ui/packages/plugin-chatbot under ui/ and merge cleanly, so they were not merged.

Verification

Files to read first, by risk:

  1. ui/packages/plugin-form/src/deriveMasterDetail.ts: parentHandLockHolds (seeding, and the empty record when there is no row).
  2. ui/packages/plugin-form/src/LineItemsPanel.tsx: the recordIsParent gate.
  3. ui/packages/plugin-form/src/RecordBodyTableEditor.tsx: live row versus previous.

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

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 29, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

L1: ACCEPT · head 37ef5d5a48 · 2026-11-29T09:29Z · card #38521

席位核对

  1. Shape: l1-face.mjs --pr 38547 reads CLEAN (13 items).

    • The first line is Fixes #38521 only.
    • The @object-ui/plugin-form changeset is patch.
    • The PR body and the changeset both read Clause-②: no · Metadata-protocol: none. That is right: parentHandLockHolds is a module export of deriveMasterDetail.ts, not re-exported from the package's . or ./core entries, so no published surface moves.
    • Fixes is right. Both record-page line surfaces (the record:line_items panel and the edit state's RecordBodyTableEditor) now follow the parent's lock.
  2. Premise measured on main (63acc6cd): a person could add, edit, remove and reorder lines by hand under a hand-locked parent. The fix uses the rule of PR fix(console): a parent's whole-record hand lock locks its inline master-detail lines in the edit form #38388:

    • the parent verdict through fieldReadOnlyByHand, failing closed with no row;
    • lockColumnsByParentHandLock;
    • the child field's own lock as the opt-out.
      No key is added. Ablations go red without the fix (dev report).
  3. Gates at this head:

    • check-runs: 39 success · 13 expected skip · 0 failed · 0 pending;
    • check-governed-merges.mjs: NOT governed (+408/−14);
    • main is 11 commits past the head, under the K bar.
  4. L2: not owed. No contract face is touched: no Clause-②: yes, no published schema, no governed text, no narrowing. This is CI plus the seat's self-read, as contract-review.md puts it.

  5. Read by the seat:

    • the parentHandLockHolds docblock against its body;
    • the changeset sentence by sentence.

    Accepted deviations:

    • one push before the overlap check, which read clean right after;
    • main not merged before the PR (the incoming ui/ commits touch only plugin-chatbot; the merge reads clean).

    ui/packages/app-shell/src/views/** (Bulk actions declared on the action (selection) with a selection arm in the object action layout, moved from view bulkActions #36496's claim) is untouched.

  6. Open question: ruled A by the seat (a panel bound to another record is left unjudged and pinned as a control).

Landing: non-governed, ≤3000 lines. The seat lands it through the ordinary queue.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 29, 2026 09:30
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 29, 2026
Merged via the queue into main with commit ade59c0 Nov 29, 2026
53 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-38521-line-items-panel-hand-lock branch November 29, 2026 09:52
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 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.

console: the record page line-items panel under a parent's whole-record hand lock — measure, and lock it like the edit form (follow-up of PR #38388)

2 participants