Skip to content

fix(console): a parent's whole-record hand lock locks its inline master-detail lines in the edit form - #38388

Merged
objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/issue-38249-inline-lines-hand-lock
Nov 29, 2026
Merged

objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/issue-38249-inline-lines-hand-lock

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

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: true or a uiReadonlyWhen — is judged by it instead of any object-level default, and uiReadonly: false is not such a declaration. No key, value or schema property is added.

@object-ui/plugin-form

  • MasterDetailForm.tsx (the edit dialog's line grids): the header record feed also lands the parent object's uiReadonlyWhen with its field names. On an EDIT form the lines judge it over the live header record (every header field seeded null, the stored row as previous, the host's predicate scope) through the one hand-lock verdict (fieldReadOnlyByHand of 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 asks effectiveUiReadonlyWhen itself rather than restating the rule). lockColumnsByParentHandLock locks every unmarked column. childLinesOpenUnderParentHandLock answers whether some child field owns a non-static hand lock (exported from the root and from /core).

@object-ui/app-shell

  • editFormLockedByState.ts: an object that places an inline child collection no longer keeps Edit live unconditionally. It greys Edit when the object's own uiReadonlyWhen holds 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 optional childObjectDef argument; 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-form exports childLinesOpenUnderParentHandLock from its . and ./core entries, and the exported editFormLockedByState of @object-ui/app-shell takes 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

  • New MasterDetailForm.parentHandLock-38249.test.tsx (real MasterDetailForm and GridField): a locked parent offers no add / duplicate / remove / reorder and locks a line cell; a child field with its own uiReadonlyWhen: 'false' stays editable while its sibling is locked; uiReadonly: true stays 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: childFieldOwnsHandLock over each spelling (uiReadonly: false and 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

  • Measured on main first: the new rendered pin against the unfixed code, 4 failed / 2 passed (a confirmed parent's line cell was editable; both controls green).
  • Precedence, as the existing override rule gives it: a child field with its own conditional 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.
  • A row-level opt-out for adding or removing lines does not exist: under a locked parent no line is added, duplicated, removed or reordered, whatever the child fields declare. A field-level declaration opens only that field's cell on stored lines.
  • The per-row editor is not offered under a locked parent, because it edits every child field. So in a form-factor collection (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.
  • A fully configured entry (typed columns and the relationship field) reads no child schema, so its columns carry no ownership mark and all lock under the parent lock (the hand lock fails closed).
  • Before the header record lands, the parent predicate is judged over null-seeded header fields; a predicate such as record.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.
  • Scope: the console edit form and the record page's Edit state. The record page's own line-items panel (LineItemsPanel / the record body table editor) is not changed here; whether it should follow the parent's lock is for its own card.
  • The four commits' 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.
  • File surface beyond the two claimed files, each check-handover.mjs --inflight clear: MasterDetailForm.tsx (the line grid), RecordDetailView.tsx (the Edit state's caller), core.ts and index.tsx (one export each).

Verification

Patch round (seat claim amendment 7247687945, head 1933251b): Clause-② corrected to yes (widening) here and in both changesets (still patch, Metadata-protocol: none); origin/main merged twice (212babcf, 1933251b), no incoming commit touching this diff's files. On 1933251b: the four pin files 4/4 files, 42/42 tests; dispatch-gates.mjs --commands 38 families, all run, all exit 0 (the ui scripts/ suite 172 files passed, 2 skipped / 5,159 tests); --ran: "38 run, 0 NOT-MEASURED"; overlap-check.mjs VERDICT clean exit 0; check:nul-bytes OK. 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 (the parentHandLocked verdict and the three grid props it gates); ui/packages/plugin-form/src/deriveMasterDetail.ts (childFieldOwnsHandLock and the mark); ui/packages/app-shell/src/utils/editFormLockedByState.ts (the subform branch).

Readings on objectstack-ai/objectstack, head 9166fa40 (the gate union on 81f9ef2c; the one later commit adds only the record-page test describe, and the derived list on 9166fa40 is byte-identical).

Tests
  • @object-ui/plugin-form full suite: 249 files / 2,816 passed, 1 skipped.
  • @object-ui/plugin-form and @object-ui/app-shell type-check (both tsc --noEmit and the test tsconfig): exit 0.
  • app-shell targeted: RecordDetailView.editLockedByState-32756.test.tsx + editFormLockedByState.test.ts 27/27. The app-shell full suite is not run locally (CI Test UI runs it).
  • New and extended pins together (plugin-form + app-shell utils): 35/35.
Shown red without the fix (scripts/ablation-replace.mjs, restored to HEAD each time, blob equal and git diff HEAD empty)
  • MasterDetailForm.tsx parent verdict forced false: rendered pin 4 failed / 2 passed (controls green).
  • editFormLockedByState.ts back to returning false for any subform: 2 failed / 18 passed (the two "is true" cases).
  • deriveMasterDetail.ts ownership mark removed: 3 failed (derived and authored column cases, and the rendered 'false' override case).
  • RecordDetailView.tsx resolver dropped: 1 failed / 6 passed (the Edit-disabled case).
Gates
  • node scripts/pm/dispatch-gates.mjs --commands: 38 families, all run on 81f9ef2c; 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.mjs before every push: VERDICT clean exit 0.
  • pnpm check:nul-bytes: OK.
  • Full dogfood battery: n/a (no !, no (narrowing) arm).

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes (CI).
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: not touched.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.

🤖 Generated with Claude Code

https://claude.ai/code/session_017xRBcSPkRxFWubkD5XfiDh


Generated by Claude Code

…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>
… with inline lines

Claude-Session: https://claude.ai/code/session_017xRBcSAaBEfQpU2yJexSJ8
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l 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 28, 2026
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>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 1933251b21682d5dfd7e49837cde190defefd0d5
Local-runs: none

Face: the Clause-②: yes (widening) declaration alone. There is no published schema, no governed path and no narrowing in the diff (check-governed-merges.mjs --pr 38388: NOT governed). The lane seat reviews it, as the declaration face asks.

① Derived judgments

  • Public surface, two additions, both additive:
    • childLinesOpenUnderParentHandLock(childSchema), exported from @object-ui/plugin-form's . (src/index.tsx) and ./core (src/core.ts) entries. It is a pure reading over a child object's field map. It returns false on a missing map, and its one consumer then keeps Edit live, so the greying fails open.
    • editFormLockedByState (@object-ui/app-shell) gains an optional fourth parameter childObjectDef. Without it the function answers exactly as before: if (subforms && !childObjectDef) return false is the old early return.
  • The override is read, not restated. childFieldOwnsHandLock asks effectiveUiReadonlyWhen with a probe default that no field can declare. A child field's own uiReadonly: true or uiReadonlyWhen keeps its verdict, and uiReadonly: false is not an own lock. The mark uiReadonlyOwn is in-memory on derived and hydrated columns only, never an authored inlineColumns key. An authored column with no child schema read carries no mark and locks: the form fails closed.
  • Accept set unchanged. Nothing on the server reads the keys. 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. A create is not judged (formMode !== 'edit').
  • The parent's lock is judged through the one verdict. It uses fieldReadOnlyByHand of a field that declares nothing, over the live header record with every field seeded null, and the stored record as previous, in the host's predicate scope. This matches how the header's own fields are judged.

② Semver level

  • @object-ui/plugin-form and @object-ui/app-shell are at patch. Metadata-protocol: none.
  • This is right by AGENTS.md Post-Task Checklist step 3: a non-protocol widening ships patch.
  • Both changesets and the PR body carry Clause-②: yes (widening) and Metadata-protocol: none (commit 68f8bbbd65).

③ Boundary flags

Implemented-by: claude/issue-38249-inline-lines-hand-lock
Reviewed-by: session_017xRBcSAaBEfQpU2yJexSJ8

No must-fix, no should-fix.

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

L1: ACCEPT · head 1933251b21682d5dfd7e49837cde190defefd0d5 · 2026-11-29T06:58Z · card #38249

席位核对

  1. Shape: l1-face.mjs --pr 38388 reads clean on every row but all-checks, which was flagged for one skip (Test Core (${{ matrix.shard }}/12)). check-expected-skips.mjs --pr 38388 exits 0 on main's roster, so every skip is expected.
    • First line Fixes #38249 only.
    • Two changesets (@object-ui/plugin-form, @object-ui/app-shell, patch).
    • Clause-②: yes (widening) · Metadata-protocol: none on the body and both changesets.
    • Fixes is right: the card's title scopes the console edit form, and the expected behaviour is delivered there (no add, duplicate, remove, reorder or row editor; every cell without its own hand lock is locked; a create is not judged).
  2. Premise measured: the opt-out is carried by an existing field-level uiReadonlyWhen / uiReadonly, and no key was added. That was triage's dispatch condition. Ablation pins go red without the fix (dev report).
  3. Gates at this head:
    • check-runs: 41 success · 15 expected skip · 0 failed · 0 pending;
    • check-governed-merges.mjs: NOT governed (+516/−22 before the main merges);
    • main is 7 commits past the head, under the K bar.
  4. L2: the declaration face (Clause-②: yes) owes TIER_DEFAULT. The seat's record 7252129296 on this head is PASS, with no open finding.
  5. Read by the seat: both changeset bodies, sentence by sentence, are true to the diff.
  6. Out of scope: the record page's line-items panel (LineItemsPanel / RecordBodyTableEditor) under the parent lock is not measured. The seat files it as a follow-up at clock-out. Skills-docs: is not owed.

Landing: non-governed, ≤3000 lines, L2 PASS on this head. The seat lands it through the ordinary queue.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 29, 2026 06:59
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 29, 2026
Merged via the queue into main with commit fa345c4 Nov 29, 2026
57 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-38249-inline-lines-hand-lock branch November 29, 2026 07:21
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/l 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.

console: a parent record's whole-record hand lock (object uiReadonlyWhen) does not cover its inline master-detail line rows in the edit form

2 participants