Repository navigation
Description
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA
Filing gate: ③ maintainer-directed · Source: ADR-0162 Execution item 2 (accepted by merge 972114d)
维护者速读
- 做什么:提供一个统一的查询,任何界面或程序问一次就知道某条记录是不是被锁住,以及是「审批中」还是「已关闭」。
- 用户会看到什么:界面能把「审批中,请等待」和「单据已关闭」分开说清楚,不再给出一个点了会被拒的编辑入口。
- 不做会怎样:平台已经会拒绝对已关闭单据的修改,但界面不知道原因,只能在用户点了保存之后才报错。
- 顺序:排在声明和执行那张卡之后;没装审批功能的应用也能用这个查询。
What happens
The only lock read on main belongs to the approvals family. IApprovalService.getRecordLock and getRecordLocks (packages/spec/src/contracts/approval-service.ts) answer whether a record is held by a locking approval, through two routes in packages/rest/src/approvals-routes.ts and two SDK methods (client.approvals.getRecordLock, getRecordLocks). They know nothing of closed states, and an app that installs no approvals has no lock read at all.
ADR-0162 D9 decides one read for both producers. The maintainer adopted it on 2026-11-26, 「全部按推荐」 (ruling record 7200732942 on #36253), with the point that every caller who can read the record is told the lock and its reason.
Expected
- The answer (D9). For one record, as the caller:
{ locked, lockSource?: 'record' | 'master', lockReason?: 'closed_state' | 'approval' } | null.nullwhen the caller cannot read the record or it does not exist.lockSourceandlockReasonare present exactly whenlockedis true. - Two producers, composed. The engine's closed-state judgement and the approvals plugin's pending-request judgement, through a seam that is internal to the two packages. A third producer is a new decision.
- It exists without the approvals plugin.
- Who is told. Every caller who can read the record, whether or not it may write it, and whether or not field permissions let it read the state field. The read never says which field or value closed the record, and carries no request id or participants.
- One answer when several hold.
closed_statebeforeapproval; within a reason,masterbeforerecord. lockSourceand delete. The approvals contract reads "may still be deleted" offlockSource: 'record'. On this read that holds only underlockReason: 'approval'. Underclosed_statea caller's delete is refused for either source.- Readable means what it means today, door by door. The single read and the page read each keep the readability anchor of their approvals counterpart. The page form keeps the bound of 200 ids.
- Doors. The data family gains the read for one record and for a page of records, with SDK methods beside the other data reads. The path spelling is this card's.
- First-party askers move to it. The console's record page, grid and line grid ask this read (the console's own rendering is the console card, item 4). The upload-link door asks it before it issues a link, and chooses between its two sentences by the reason.
- Not touched. The approvals-family routes, their SDK methods and the two contract members stay exactly as published and go on answering for approvals only. The record page's approvals part keeps its
lockas the approvals producer's answer. What becomes of those routes is the card for item 6.
Done when
- The read answers each combination, with a test: closed by its own state, a line of a closed master, held by an approval, a line of a held master, both locks at once, neither, unreadable, missing.
- It answers with the approvals plugin absent.
- A reader whom field permissions keep from the state field is told
closed_stateand nothing of the field or the value. - The page form refuses more than 200 ids and answers entry by entry.
- The answer shape says how
lockSourcebehaves underapprovalwhen the approvals implementation omits it: either the internal seam requires the source, or the member stays optional underapproval. The approvals contract lets an implementation omit it today (review note N12). - The upload-link door refuses with the closed-state sentence on a closed record and with the approval sentence on a held one.
-
git diffshows no change to the approvals-family routes, SDK methods or contract members. - Reference docs for the two data-family routes and the SDK methods.
Category ③: maintainer-directed. A build card of ADR-0162, child of #36253.
Grade: area:data · Feature · n/a (not a defect) · reach: every first-party client of a declaring app · evidence: read (ADR-0162 D9 and its Readings)
Suggested-grade: p2 · part of the feature #36253, and it gates the console card
Size: L (the engine, the approvals seam, the REST routes, the SDK, the storage service). Could split into the read with its seam, and the doors with the askers.
Business reason: carried from #36253. Without it a client cannot tell a closed document from one in approval, and offers edits the server refuses.
Reader: seat 2 (repo:objectstack#2), a card thread, effort high.
Blocked-by: #37768 (item 1) (the engine's closed-state judgement is one of the two producers).
Clause-②: yes (widening). New routes, new SDK methods and a new published answer shape. No published answer changes.
Metadata-protocol: none
Dedupe: searched getRecordLock (open issues): #37195, which concerns the record page's approvals part and is a neighbour, not this mechanism.
Related: #36253, PR #37606 (ADR-0162), #25934 (the 2026-10-26 ruling on who is told a lock), #37195.
Activity
objectstack-fleet commentedon Nov 27, 2026
triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH
Triage: lands in area:data · domain:server · Feature · priority:p2 ·
pm:blocked· size M; rationale: closedStates. One data-layer lock read answers "is this record locked, and by which lock". Part of #36253; p2 as suggested. It keeps its named blocker.