Skip to content

fix(console): word a closed record apart from one in approval, and save a closing header last (ADR-0162 item 4) - #38994

Merged
objectstack-fleet[bot] merged 12 commits into
mainfrom
claude/issue-37773-console-closed-lock
Dec 1, 2026
Merged

objectstack-fleet[bot] merged 12 commits into
mainfrom
claude/issue-37773-console-closed-lock

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Part of #37773: this PR lands the grid, the line grid and the closing-header-last save. The record-page half stays open on the card and waits on #38995.
Clause-②: no
Metadata-protocol: none

维护者速读

  • 控制台表格和明细表格里已关闭的行(如已付款发票及其明细行)编辑时提示“已关闭,无法更改”,不再提供编辑和删除;审批中的行与今天一样;记录页本身暂不变。
  • 属于“记录关闭态锁”这一组工作(ADR-0162 第 4 项),让用户分清“已关闭”和“审批中”,并让同时改明细和关单的一次保存整单成功。
  • 出错时表格里可能显示错误的锁原因,或关单保存被整单拒绝;改动只在控制台和一段文档,可直接撤回。
  • 无

What changes

ADR-0162 item 4, the grid half: the grid and the line grid ask the data layer's one lock read (D9, landed in #38913) for a row's edit and delete affordances, and word the reason from its lockReason. The master-detail form writes a closing header last.

  • Grid and line grid (ui/packages/plugin-grid/src/hooks/useRowApprovalLocks.ts): the on-demand page read now goes to POST /api/v1/data/OBJECT/locks, chunked at RECORD_LOCKS_MAX_RECORD_IDS. It is gated on routes.data in discovery (not on the approvals service), and the 501 latch is kept. Each answer keeps lockReason. New members closed(id) and deleteRefused(id); heldByMaster is gone. deleteRefused is true on closed_state for either source, and on approval only for lockSource: 'master', which is the published rule. Same request count as before.
  • Grid wording (objectGridCellFacts.ts, ObjectGrid.tsx, objectGridTranslations.ts): a new closedLocked read-only kind, checked before approvalLocked. A cell on a closed row opens no editor and says "This record is closed, so it can't be changed."; a closed row that is also held reads as closed.
  • Row menu (objectGridActionsColumn.tsx): Edit and Delete read the same answer, so a closed row offers neither. Greying Edit instead of hiding it is Console grid: grey the row menu's Edit on a locked row with the reason, instead of hiding it #38996.
  • Master-detail save (ui/packages/plugin-form/src/masterDetailTx.ts, MasterDetailForm.tsx): an edit save whose header data sets a value the header object lists in closedStates puts the header update after every line write (ADR-0162 D4). Otherwise the header stays first. The form reads closedStates from the header's own served definition, and the result mapping finds the parent by object and id, not by index 0. Create stays parent-first, because its lines point at operation 0.
  • Strings: grid.readOnlyReason.closedLocked in all eleven console locales; zh-Hant is generated from zh-Hans.
  • Docs (content/docs/data-modeling/closed-states.mdx, § Line edits go before the closing write): the passage that said the console's master-detail form saves the header first now says it writes a closing header last, so such a save lands whole. Only that passage changes.
  • userActions predicates and action buttons are untouched: the lock read hides no action.

Tests

  • New: plugin-form/src/masterDetailTx.closingHeaderLast-37773.test.ts (7) and MasterDetailForm.closingHeaderLast-37773.test.tsx (2). The second drives the real form: it picks paid, edits a line, and pins ['update invoice_line', 'update invoice']. A second save diffs against what the first wrote, and the control keeps the header first.
  • New blocks: rowMenuApprovalLock-36911.test.tsx (2: closed own and closed line offer neither Edit nor Delete, own approval keeps Delete) and ObjectGrid.cellSelection-35684.test.tsx (closed wording; closed and held reads as closed).
  • Moved to the data door: the grid lock pins (36911, 35684, 35685, 27365, the row CRUD verdict, discovery 38849).
  • app-shell is unchanged from main. Its one-request record-open pins (27627, 28470, 12701, 13010, 28737) pass unedited against this grid.
Ablations (one per fix, each restored)
  • Save order: forcing closing = false in buildMasterDetailEditBatch turns 3 of the 9 new plugin-form tests red.
  • Grid: dropping closed_state from deleteRefused and closed turns the three closed pins in 36911 and 35684 red (42 of 45 still pass).

Acceptance notes

Verification

Browser, on the showcase (paid invoice from #38917) through this branch's console source: https://claude.ai/artifact/1WWaA6gcswQuZHN2yJDnW8 (private until shared). For this PR, the grid frame applies: an edit on the paid row INV-1003 opens no editor and shows the closed sentence. The record-page frames there show the half that moved to #38995.

Two-minute check: in the showcase, open Invoices, select the Owner Email cell of a paid invoice and press Enter. Expect "This record is closed, so it can't be changed." and no editor; a draft invoice's cell opens its editor.

Local readings
  • plugin-grid full suite, in three parts: 323 files, 2,850 tests passed. plugin-form and i18n full suites: green after the zh-Hant regeneration.
  • app-shell: the five one-request pin files plus the four test files back on main, with i18n: 119 files, 2,031 passed, 13 skipped.
  • dispatch-gates --ran on the final tree (73 derived, the docs families included): 73 run, all exit 0, 0 NOT-MEASURED.
  • ui check:spec-symbols, check:i18n-keys, check:i18n-drift and check:new-line-citations: exit 0. overlap-check: clean against origin/main.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WGufzhKEbEnW8pwZRgK2gJ

… from in approval, save a closing header last (ADR-0162 item 4)

Claude-Session: https://claude.ai/code/session_01WGufzhKEbEnW8pwZRgK2gJ
Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzhKEbEnW8pwZRgK2gJ
Co-authored-by: Claude <noreply@anthropic.com>
…nsole-closed-lock

Claude-Session: https://claude.ai/code/session_01WGufzhKEbEnW8pwZRgK2gJ
Co-authored-by: Claude <noreply@anthropic.com>
…nsole-closed-lock

Claude-Session: https://claude.ai/code/session_01WGufzhKEbEnW8pwZRgK2gJ
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/xl 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 Dec 1, 2026
…ock half moves to a follow-up

The record page's data-lock read, its closed wording and its two strings are
kept on claude/issue-37773-record-page-half-wip for the record-page payload
card to re-apply. The grid, the line grid and the closing-header-last save stay.

Claude-Session: https://claude.ai/code/session_01WGufzhKEbEnW8pwZRgK2gJ
Co-authored-by: Claude <noreply@anthropic.com>
…nsole-closed-lock

Claude-Session: https://claude.ai/code/session_01WGufzhKEbEnW8pwZRgK2gJ
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhKEbEnW8pwZRgK2gJ

Final green head · 2026-12-01T20:12Z · zone osa-data
Head-sha: 0ac0c97

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm

L1 review · PR #38994 (Part of #37773) · head 0ac0c97 · 2026-12-01T20:15Z

VERDICT: ACCEPT. No must-fix and no should-fix.

  • Face. l1-face is CLEAN at 0ac0c97, with 13 items read and none flagged. Checks are 54 success, 14 expected skip, 0 failed and 0 pending. The changeset covers plugin-grid, plugin-form and i18n. Clause-②: no and Metadata-protocol: none are right: only console code, strings and one docs passage move, and no published contract changes.
  • Zone question (b): no L2 is owed. check-governed-merges --pr 38994 on the final list reads 0 of 28 paths on the register: NOT governed, 808 changed lines, under the 3,000 line. No spec, contract or protocol surface is touched.
  • Part of is right. The card's record-page boxes (Edit greyed with closed wording on the record page, and no console path asking the approvals-family read) stay open until Record page payload: answer the data layer's record lock in the same request (ADR-0162 D9, for the console's closed-record affordances) #38995 and the record-page half land. Per landing rule B, Console: read the one lock read, word "closed" apart from "in approval", and save a closing header last (ADR-0162 item 4) #37773 keeps pm:dispatched after this merges, and the label is removed by hand only when the card closes. The record-page work is on backup branch claude/issue-37773-record-page-half-wip at ca71605f.
  • Zone question (a): hiding Edit in the row menu is acceptable here, with greying as Console grid: grey the row menu's Edit on a locked row with the reason, instead of hiding it #38996 (open). Main already hides the row menu's Edit on an approval-locked row (记录页的相关列表:服务端已锁定(RECORD_LOCKED)的行仍提供编辑和删除,点了才知道被锁 #36911). This PR extends that same treatment to a closed row and does not start a new pattern. The card's "Edit greyed with the closed wording" is met on the cell: no editor opens, and the reason sentence shows. Moving the menu from hidden to greyed changes both locks at once, so it belongs in its own card.
  • Grid read. useRowApprovalLocks now posts to POST /api/v1/data/:object/locks, chunked at RECORD_LOCKS_MAX_RECORD_IDS (200, @objectstack/spec/api, the same bound as before).
    • It reads each entry by recordId and position, which matches record-lock-routes.ts on main. lockAnswerOf keeps only values the door serves.
    • closed and deleteRefused count only an ANSWER, never a guess. deleteRefused is closed_state for either source, or approval with source master, which is the published RecordLockSourceSchema rule.
    • isLocked returns true on a closed answer before the approval rule. cellReadOnlyKind checks closedLocked before approvalLocked, so a row that is both closed and held reads as closed. The ablation shows the closed pins really bite.
    • The gate moved from routes.approvals to routes.data, which is right for a data-family door. The 501 latch now means "no lock read", which is the door's own 501.
  • Save order. closesRecord reads the served closedStates in its declared shape ({ select field: [values] }, object.zod.ts). It closes only when the payload carries a listed field holding a listed value. buildMasterDetailEditBatch then puts the parent update after every line create, update and delete. Create stays parent-first. Every consumer that used to hard-code index 0 now takes parentIndex: refusedChildObjects, both loops in childRowsAfterSave, and the create pairing. The served object carries closedStates with no projection in the way. The real-form test pins ['update invoice_line', 'update invoice'], and the ablation turns 3 of 9 red.
  • Sentence reads. I read the changeset and the closed-states.mdx passage. Both are true of this head, and the docs edit changes only that passage. The zh-Hans string reads naturally.
  • Nits, accepted.

Next: zone landing. #37773 stays open with pm:dispatched for the record-page half.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhKEbEnW8pwZRgK2gJ

2026-12-01T20:16Z · Landing: L1 ACCEPT on head 0ac0c97 (7324367731; both zone questions answered: no L2 owed, hiding Edit is acceptable with greying as #38996; three accepted nits). Not governed (0 of 28 paths), 808 lines ≤ 3000, CI 54 success / 0 failure, mergeable clean. Ready for review and auto-merge (squash). Part of #37773: the card keeps pm:dispatched for its record-page half, which waits on #38995 (backup branch claude/issue-37773-record-page-half-wip).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review December 1, 2026 20:17
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Dec 1, 2026
Merged via the queue into main with commit 5064289 Dec 1, 2026
69 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-37773-console-closed-lock branch December 1, 2026 20:39
os-support-ai pushed a commit that referenced this pull request Dec 1, 2026
…ad request (ADR-0162 item 4)

Re-applies the record-page half held back from #38994. Edit and Delete
read the data layer's lock (`dataLock`), which the page payload now
carries (`dataLock: true` on `POST /data/:object/:id/page`), so a closed
record is greyed and worded as closed without a second request. Reads
the hook sends itself (the edit dialog over a list, a refresh after a
change) keep asking `GET /data/:object/:id/lock`.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzhKEbEnW8pwZRgK2gJ
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.

2 participants