Skip to content

fix(approvals, list): a list cell waits for the record's approval lock before it edits, and a page's locks are read in one request (#35795) - #36295

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/project-thread-ahwb54
Nov 22, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/project-thread-ahwb54

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Sales · project thread

repo:objectstack#1 · os-sales · session_01L6bhgXSK9qt8je9QbZvhKb

Fixes #35795

Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 列表里直接改格子时:如果这条记录「是否被审批锁住」或「我能不能改这条」还没查回来,双击、回车、F2 或直接打字都不会立刻弹出编辑框,格子上先显示「正在确认这条记录能否编辑…」;答案一回来,没锁就自动打开编辑框(打的那个字也保留),锁了就显示「此记录正在审批中,已锁定。」。不会再出现「能进编辑、保存才被拒」。
  • 查询中点了别的格子,就放弃这次等待,不会突然在别处弹出编辑框。查询中点开关、粘贴、清空:同样先提示正在确认,答案回来没锁才写入,锁了就不写并说明原因。
  • 一页数据只发一个锁查询:第一次点格子时把整页的锁一起问;之后用方向键走动不再发请求。新增服务端批量接口 POST /api/v1/approvals/records/:object/locks(一次最多 200 条,读不到的记录和不存在的一样答 null),SDK 有对应方法。
  • 风险:查询很慢时,用户第一次操作要等一下才出编辑框;没装审批服务的部署照旧(501 后不再问)。可直接撤回本 PR 回到原样。
  • 需要你决定的:无。

What changes

Server (new route, contract, SDK).

  • IApprovalService.getRecordLocks?(object, recordIds, context) (packages/spec/src/contracts/approval-service.ts, optional like getRecordLock): entry i answers recordIds[i] exactly as getRecordLock answers it ({ locked }, or null for an unreadable or missing record, never told apart). New export APPROVAL_RECORD_LOCKS_MAX_RECORD_IDS = 200 (the explain batch's cap, so a page splits the same way for both reads). api-surface/contracts.json and export-origins/contracts.json regenerated.
  • ApprovalService.getRecordLocks (plugin-approvals): two engine reads whatever the page size: the caller's id $in read of the ids (the same anchor getRecordLock reads as the caller), then one pending-request lookup judged by the record-lock hook's own judgement through the new recordsHeldByLockingApproval (lifecycle-hooks.ts, the many-record form of recordHeldByLockingApproval over the same lockingRequestsForRecords).
  • POST /api/v1/approvals/records/:object/locks (approvals-routes.ts): body { "recordIds": [...] } answers { success: true, data: { records: [{ recordId, locked }] } } in order, locked: null where the single read answers 404. Closed query set EMPTY (APPROVAL_RECORD_LOCKS_PARAMS); the body is closed too (readRecordLocksBody): any other key, a non-list, a non-string or blank id, an empty list or more than the cap is refused whole with 400 VALIDATION_ERROR, the service never asked. A service without getRecordLocks answers 501, never one getRecordLock per id. Route ledger row sdk → client.approvals.getRecordLocks(object, recordIds).

List grid.

  • useRowApprovalLocks asks the locks of the page in one request per APPROVAL_RECORD_LOCKS_MAX_RECORD_IDS ids when a cell is first selected (ObjectGrid's onCellSelect passes the selected row plus the page's ids); rows already asked are not asked again, rows a later page brings are asked on the next select. It exposes settling(recordId): the read the row waits on while it is on the wire.
  • useRecordCrudVerdicts exposes settling(): the explain questions on the wire as one promise (read from a ref, so it sees a question sent since the last render).
  • ObjectGrid.describeCell: when the cell has no read-only reason yet but the row's lock read, or its update verdict (when still unknown), is on the wire, the facts carry checking: { text, settled }.
  • @object-ui/components GridCellFacts.checking (optional, new): data-table's attemptEdit shows text on the cell, remembers the edit (with its typed seed) and asks it again when settled settles, unless another cell was selected, a newer edit was asked or an editor is open by then. A toggle, paste or clear asked meanwhile shows text and writes nothing (an intrinsic refusal such as "required" is still said first).
  • i18n: grid.readOnlyReason.checking in all 11 locales plus the plugin's English fallback.

Docs: content/docs/automation/approvals.mdx ("Reading the locks of a page of records"). Changeset .changeset/35795-batched-record-lock-read.md (patch on the seven packages the diff moves; Metadata-protocol: none ⇒ patch).

Why

PR #35747 read a row's lock with one GET …/:recordId/lock per selected row, sent on a double-click's first press and needed on its second. A slower answer let the editor open on a locked record and only the save was refused; the record verdict had the same window, and arrow keys sent one read per row (the L2 record 7034067196, S3 and N2). #35684 rules out 「能进编辑、保存被拒」.

Batch route over projection (premise, accepted by the seat with the claim 7072869185): the lock is the approvals plugin's own judgement; projecting it into GET /data/:object would teach the data layer about approvals or add a virtual-field protocol and charge every list read, while a batch route is the same shape as the explain batch the list already sends, asked only when the reader first acts on a cell.

Small calls made in this thread (Sales 22:19:27Z: listed here)

Verification

Each new pin was run against the fix, then with the fix ablated.

  • ObjectGrid.cellSelection-35684.test.tsx, new top-level describe "an edit waits for the row's lock and verdict (objectstack#35795)", 7 cases with fake timers for the slow reads: a slow lock read on a locked row says checking for 1999 ms and then locked, never an editor; on an unlocked row the editor opens by itself when it answers; a key typed while checking is the editor's value; a slow verdict holds it the same way; selecting another cell drops the wait; a page sends one lock read and the arrow keys send none (lock or explain); a 501 deployment is asked once and edits. The existing lock case now reads the page in one request. Ablating the checking branch of attemptEdit: 5 of the 7 red, restored.
  • rest-approvals-record-lock-route.test.ts, new top-level describe for the route: preservation (service asked once with the ids in order and the caller; one entry per id; a full page at the cap), nine refusal shapes (400 + nested VALIDATION_ERROR + service never called), the empty closed query set, 501 when only getRecordLock exists (and it is not called), a read refusal relayed at its own status.
  • record-lock-read.integration.test.ts (real ObjectQL + better-sqlite3 + ApprovalsServicePlugin.start()), new top-level describe: for each of submitter, approver and a non-participant reader, the page answer equals getRecordLock per id (repeated ids, unreadable, missing); two engine reads for a page of three; an outsider is refused 403 as for one record; a blank id answers null; deciding unlocks the page as the hook does.
  • client.test.ts: one POST, object segment encoded, body { recordIds }.
  • Local runs on the merged tree: see the next section.

Local runs (merged tree, main a5a5312f + this branch, after pnpm install --frozen-lockfile && pnpm build):

Acceptance notes

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (a contract interface member and a constant)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes.
  • 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: its generated artifacts are regenerated and committed.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English (the 维护者速读 block is the maintainer's summary, in the maintainer's language).
  • The Before Submitting list in CONTRIBUTING.md is done.

Generated by Claude Code

🤖 Generated with Claude Code

https://claude.ai/code/session_01L6bhgXSK9qt8je9QbZvhKb

…k before it edits, and the lock of a page is read in one request (#35795)

- New route POST /api/v1/approvals/records/:object/locks ({ recordIds },
  at most APPROVAL_RECORD_LOCKS_MAX_RECORD_IDS), answering one entry per id
  exactly as the single-record lock read does (null where it answers 404).
- IApprovalService.getRecordLocks (optional), implemented by the approvals
  plugin in two reads whatever the page size; client.approvals.getRecordLocks;
  route ledger row.
- ObjectGrid asks the locks of the whole page on the first cell select, and
  an edit asked while the row's lock or update verdict is on its way waits
  for it (GridCellFacts.checking) instead of opening an editor the server
  would refuse.

Claude-Session: https://claude.ai/code/session_01L6bhgXSK9qt8je9QbZvhKb
Co-authored-by: Claude <noreply@anthropic.com>
…d waits for it too; ledger the new route in the write-route ledgers; regenerate zh-Hant (#35795)

Claude-Session: https://claude.ai/code/session_01L6bhgXSK9qt8je9QbZvhKb
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet
objectstack-fleet Bot requested a review from os-sales November 22, 2026 04:49
@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 22, 2026
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 4 package(s): @objectstack/client, @objectstack/plugin-approvals, @objectstack/rest, @objectstack/spec, touching 18 documentable anchor(s). ⚠️ 2 changed file(s) yielded no anchor (packages/spec/api-surface/contracts.json, packages/spec/export-origins/contracts.json), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

31 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json 99fbaa6d1841e2556c48ba88de54226ae6b2de3f.

⛔ 8 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 2 changed file(s) yielded no anchor (packages/spec/api-surface/contracts.json, packages/spec/export-origins/contracts.json) — pages documenting those are invisible to this run
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 68 of 250 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 181 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 99fbaa6d1841e2556c48ba88de54226ae6b2de3f → packageMentionDocs.

Which tree this was computed on

This run read content/docs from a4a2d91f717971873b202c26826d9a8f43a808eb — the merge of head 37525bf219c3e3d932b6bdcb83f8f431a9c11474 into base 99fbaa6d1841e2556c48ba88de54226ae6b2de3f, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin a4a2d91f717971873b202c26826d9a8f43a808eb && git checkout a4a2d91f717971873b202c26826d9a8f43a808eb
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 99fbaa6d1841e2556c48ba88de54226ae6b2de3f 37525bf219c3e3d932b6bdcb83f8f431a9c11474 && git checkout -B drift-repro 99fbaa6d1841e2556c48ba88de54226ae6b2de3f && git merge --no-ff 37525bf219c3e3d932b6bdcb83f8f431a9c11474

node scripts/docs-audit/affected-docs.mjs --json 99fbaa6d1841e2556c48ba88de54226ae6b2de3f

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 99fbaa6d1841e2556c48ba88de54226ae6b2de3f → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…ute test (#35795)

check:test-source-alias: the new batch cases reach the server's lazy
objectql import inside a clocked window; load it at module top like the
sibling approvals route tests.

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

Copy link
Copy Markdown
Contributor Author

Test Core (3/10) on 1c9d33c is red on one case outside this PR's diff: packages/runtime/src/app-artifact-handlers.jobs.test.ts > "#21489: the sandbox job origin" > "a job body with no timeoutMs gets the runner's JOB default". The test expects the job to end with exceeded CPU budget of 30ms. On this shard the 30 ms budget fired while the sandbox was still setting up, so the error was failed to install the query argument encoder: InternalError: interrupted.

This PR does not touch packages/runtime or the sandbox. The rest of that shard passed: 11735 tests, with 1 failed. The same file passed 41/41 three times in a row locally on this head. This reads as a load-dependent timing failure in that test, not as something this change causes. Fixing it here would put an unrelated sandbox change into this PR, so I am leaving the test alone. The job needs a re-run.

repo:objectstack#1 · os-sales · session_01L6bhgXSK9qt8je9QbZvhKb


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

Seat flake judgment · 2026-11-22T05:36Z · head 1c9d33c75c: the one red, Test Core (3/10) (run 44987470711), is packages/runtime app-artifact-handlers.jobs.test.ts. There, the sandbox job's 30 ms CPU budget fired while the sandbox was still setting up. This PR changes no packages/runtime path, and the dev thread's note 7074724069 records the same file passing 41/41 three times locally. The seat judges it a timing flake and re-runs the failed jobs once. A second failure is treated as real.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

Posted 2026-11-22T05:38Z. The brief handed to the isolated contract-face reviewer for PR #36295 (CONTRACT_REVIEW_TIER). The record follows as its own comment.

Contract review brief — PR #36295 @ 1c9d33c75ce7c3d06589ceafea2b291bf91d77ee (card #35795)

You review at CONTRACT_REVIEW_TIER. Render ONE ## Contract review record on this head — its shape is
node scripts/pm/record-recognisers.mjs --template --paths packages/spec/src/contracts/approval-service.ts — with a PASS or FAIL verdict, and post it as ONE comment
on the PR or its card.

Inputs — these and nothing else:
· card #35795: its body and EVERY comment (rulings and earlier records included)
· the seat claim 7072869185 on #35795, and merged PR #35747 (the card's former Blocked-by) and the open PRs #36135 and #36144 (bodies only) for overlap context; the new REST route and its ledger rows are public surface and in scope as implementing files
· PR #36295: its body, its file list, and the net diff against main at 1c9d33c75ce7c3d06589ceafea2b291bf91d77ee
· the check-runs on 1c9d33c75ce7c3d06589ceafea2b291bf91d77ee: their conclusions ARE the gate verdicts
⛔ Not the dispatch order, ⛔ not the dispatching seat's own conclusions — this brief is adversarial by design.

Scope — the paths reviewFace returns as hits on this PR's file list: packages/spec/src/contracts/approval-service.ts;
plus every file IN THIS DIFF that directly implements or enforces them — the gate that enforces a rule, the code
a jsdoc or schema line describes, the validator a skill teaches — reviewed for agreement with the contract.
Widen it freely, ⛔ never below hits; the record's Scope: line names the implementing files apart from hits.
The rest of the diff (tests, unrelated modules, lockfiles, generated output, changesets) is the lane seat's
ACCEPT at TIER_DEFAULT, exactly as a standalone PR of those files.
④ judges the hits files and those implementing files ONLY:
lockfiles, generated output, changesets and prose elsewhere in the PR are not reviewed;
code outside the diff is READ to judge them, never reviewed.

⛔ READ-ONLY. No worktree, no checkout, no build, no test run, no gate re-run, no ablation: the check-runs
on the head already answered every derived gate family, and a local run costs more than it returns.
If ONE probe is unavoidable, the record's Local-runs: line says probe — REASON; otherwise none.
Scratch space is /tmp/claude-0/-home-user/3d3cbaf6-4903-5fed-92d4-c2b94a45e868/scratchpad/pr-36295/ alone; nothing there you did not write this round is read.

Judge, in the record's own sections:
① Derived judgments — every accept-set and public-surface change the diff implies, each named right or wrong.
② Semver level — the changeset (or skip-changeset) matches what the diff publishes, and the Clause-②: line.
③ Boundary flags — every dev flag and every open_questions entry answered, or escalated.
On every face, SQL push-down: a new id materialisation or in-app join where SQL could push down is a
finding unless a reason is given (AGENTS.md, Prime Directive 5: SQL first).
④ Design judgment — for EVERY hits file: does the change hold against the code it cites and the
scenario it is accepted against? A skill file against the card's eval prompt and the spec it teaches
on main; a schema file against the ruling or ADR it implements and its first consumer; an ADR
against its first consumer and its execution plan. For EVERY implementing file in the diff: does the
code agree with the contract, sentence by sentence? Read the cited code in the live tree, and try to
break the design.
Grade each finding must-fix, should-fix or nit — a nit has no effect on correctness or the contract.
A must-fix is a FAIL; a must-fix or should-fix earns a delta review of its fix; nits alone end the round.
Spell a must-fix or should-fix with its id and grade, S1 (should-fix) — …, and a clean round as
No must-fix, no should-fix.: the queue guard reads a graded finding as OPEN on this head and
refuses the record; the delta record names those it closes by id alone, S1: closed.
A nit is fixed only on the prose faces, or left as an accepted deviation or a follow-up card: a fix
anywhere else moves the head, and this record no longer covers it.
⛔ Judge the tree, never the PR body's account of it.
Sign Implemented-by: with the dev's branch and Reviewed-by: with your session id — the value is the FIRST
thing after each colon.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgUmopshYqDCrYekUj4

席位核对 — REWORK (L1-b)

Head-sha: 1c9d33c · read 2026-11-22T05:41Z · first read · card #35795 body unchanged since 02:22:45Z · claim 7072869185 · Fable contract L2 runs in parallel

维护者速读

大部分已经做到:列表上双击、回车或直接打字编辑一格时,如果这条记录的审批锁还没读回来,格子会显示「正在确认这条记录能否编辑…」,等答复回来再决定,锁住了就提示已锁定,没锁就直接打开编辑框,打的字也保留。一页的锁改成一次请求读完,用方向键移动不再每行发一次请求。还剩一处没做到:卡片要求「这条记录你有没有编辑权限」这项检查也一样要等。现在虽然会等,但答复回来的那一刻,判断用的还是旧结果,所以没有权限的记录仍会打开编辑框,要到保存时才被拒。这正是卡片想消掉的情况。不会丢数据,因为服务器照样拒绝保存。需要改一处并补一个测试。

Must-fix

  • M1 A record verdict that answers "no" after the wait still opens the editor.
    • Where: ObjectGrid.tsx describeCell, together with data-table.tsx retryWaitingEditRef.
    • The chain:
      • While the row's update verdict is unknown, describeCell adds recordVerdict.settling() to checking.
      • The wire's own callback (useRecordCrudVerdicts.ts, the Promise.all(settled).then) clears wireRef and calls publish(), which only schedules the re-render through setVerdicts.
      • Promise.all(reads) settles right after that callback. The retry is a .then on it, so it runs in a microtask, before React has re-rendered.
      • retryWaitingEditRef.current is the closure from the last render. Its factsOf reads the last render's gridCellSelection, so its describeCell still holds the old recordVerdict (the old verdicts map).
      • So recordUpdate is still undefined, and settling() is now null (cleared), so there is no checking either. cellReadOnlyKind treats recordUpdate: undefined as editable (objectGridCellFacts-35684.test.ts:33), and attemptEdit opens the editor.
    • What the reader sees: they wait for "Checking whether this record can be edited…", then an editor opens on a record they may not edit, and the save is refused. Card Done-when 1 names the record verdict beside the lock.
    • Why the lock path is fine: isLocked reads answersRef at call time, so its answer is current. Only the verdict is read from render state.
    • Why the tests miss it: the only verdict pin, "a slow record verdict holds the editor the same way", answers allowed: true and expects the editor open. That passes whether the verdict was read or not.
    • Fix: make the retry see the verdict that answered. Two options:
      • Have describeCell read the verdict at call time: a ref, or the module verdictCache through a lookup that is not render-captured.
      • Run the retry after the re-render that publishes it, for example by flagging a pending retry and taking it in an effect.
    • Pin to add: a slow explain that answers update not allowed (records: [{ recordId, visible: true, ... }] with the row refused) → after the timers advance there is no editor, and the cell shows grid.readOnlyReason.noRecordPermission. Add the same case for a typed key, and for a paste or toggle, which should write nothing.

Should-fix

  • S1 .changeset/35795-batched-record-lock-read.md, "What a list user sees": the outcomes it lists after the wait are "the same edit goes ahead … or the cell says the record is locked". Once M1 is fixed, add the third outcome: the cell says the reader has no permission to edit the record. Otherwise the sentence reads as if only the lock can refuse.

Nits

  • N1 useRowApprovalLocks.ts: a row whose lock read failed is stored as 'unanswered' and is not asked again until the object's data is invalidated, falling back to the approval_status column. This fails open and the server still refuses a locked write, so it is acceptable. A one-line comment saying "not retried until invalidation" would help the next reader.

Checked (no defect)

  • Contract (packages/spec/src/contracts/approval-service.ts):
    • getRecordLocks? is optional. Entry i answers recordIds[i] exactly as getRecordLock does, with a null that does not tell unreadable from missing.
    • APPROVAL_RECORD_LOCKS_MAX_RECORD_IDS = 200 is the explain batch's cap. The api-surface and export-origins baselines are regenerated.
    • Clause-② yes (widening) is right: a new optional member, a new export and a new route.
  • Service (plugin-approvals):
    • It makes two reads whatever the page size: one $in read of the ids as the caller (the same anchor as the single read), then recordsHeldByLockingApproval, which runs the same lockingRequestsForRecords judgement the single form and the beforeUpdate hook use.
    • Repeated ids are answered at each position, and a blank id answers null.
  • Route (approvals-routes.ts):
    • Auth comes first. The query string is closed, and the body is closed to recordIds and refused whole (not an object, unknown key, empty, non-string or blank, over the cap → 400 VALIDATION_ERROR).
    • A missing service member answers 501, never N single reads, and the answer's order follows the request.
    • The route is ledgered in rest-route-ledger.ts (sdk, approvals.getRecordLocks), the hook-refusal sentence ledger and the internal-fields tripwire. The client method and its test are added.
  • Grid:
    • onCellSelect probes the selected row plus pageRecordIds in one request per 200 ids. Rows already asked are joined and never asked again, so arrow keys send nothing; the pin counts one lock read and an unchanged explain count.
    • A 501 is latched.
    • An answer still on the wire when the data is invalidated lands in the map it was asked for, which has been dropped.
  • Lock path through data-table:
    • With checking present the cell shows the text and writes nothing. The retry re-reads rows, selection and editor at settle time, and drops out if another cell is selected or an editor is open.
    • Typed text is kept. Toggle, paste and clear wait the same way.
    • There is no retry loop: every lock wire and every explain batch resolves (each catches internally), and the verdict wireRef clears itself before Promise.all(reads) settles.
  • i18n: grid.readOnlyReason.checking is added in all 11 packs and in GRID_DEFAULT_TRANSLATIONS, and zh-Hant is regenerated.
  • Docs: I read the changeset and content/docs/automation/approvals.mdx sentence by sentence. Both match the route and SDK as built, apart from S1.
  • Fixes #35795: right once M1 lands, because the batch half and the lock half of Done-when are delivered.
  • CI at read: 59 success, 9 skipped, 0 failed. Test Core (3/10) is the re-run in progress, in a runtime sandbox timing path this PR does not touch.

Owed

  • M1 with its pin, and S1, as a delta. L1-b reads it.
  • Test Core (3/10) green on the final head.

… that settled the wait (#35795)

L1-b M1: the re-asked edit ran before the render that published the
verdict, so describeCell read the old (unknown) verdict and opened the
editor on a row the explain engine refuses. RecordCrudVerdicts gains
current(), answered from the map published last, and describeCell reads
it. Pins: a refusing slow verdict opens no editor on double-click, on a
typed key, and writes nothing on paste. Changeset names the third
outcome; a note on the unanswered lock state.

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgUmopshYqDCrYekUj4

席位核对 — delta ACCEPT (L1-b)

Head-sha: 37525bf · read 2026-11-22T05:55Z · prior REWORK 7074900129 @1c9d33c7 · delta 1c9d33c..37525bf, one commit · card #35795 unchanged since 02:22:45Z

维护者速读

上次提的问题已经修好:权限检查晚回来、结果又是「不允许」时,格子不再打开编辑框,而是提示没有编辑这条记录的权限。双击、直接打字、粘贴这几种情况都补了测试,粘贴不会写入任何数据。说明文字也补上了这种结果。其余部分和上次审过的一样。本轮发出时 CI 还在跑,要等全绿才能合。

Must-fix

None. M1 is closed.

Should-fix

None. S1 is closed.

Nits

None. N1 is closed: LockAnswer now says 'unanswered' is not asked again until invalidation.

Checked

  • useRecordCrudVerdicts.ts: publishedRef is written in the same statement as each setVerdicts, in publish() and on the empty path. current(recordId, operation) reads that ref. publish() runs inside the wire's own callback, and Promise.all(reads) settles after that callback, so the re-asked edit reads the answer that settled the wait.
  • A wire cancelled by a re-run effect does not publish. In that case current still answers undefined, settling() returns the new effect's wire (it joins the in-flight batch through pendingVerdicts), and the edit waits again. It never opens on a stale undefined.
  • ObjectGrid.tsx describeCell reads recordVerdict.current(recordId, 'update'). The other readers of the render map are unchanged.
  • New pins:
    • A slow refusing verdict on a double-click opens no editor and shows noRecordPermission.
    • A typed key in the same case opens nothing, shows the reason, and leaves the cell's value as it was.
    • A paste in the same case is never written (ds.update is not called) and the cell says why.
    • The thread reports these go red with the old lookup. Their shape bears that out: each asserts the editor and the write that the stale undefined produced.
  • Changeset "What a list user sees" now names the no-permission outcome beside the lock.
  • Only plugin-grid and the changeset changed. The contract, route and docs are as ACCEPT-checked at 1c9d33c. git merge-tree --write-tree --name-only origin/main 37525bf2: clean.
  • CI on 37525bf at read: 19 queued, 3 skipped, nothing finished. This ACCEPT is final once that run is green on this head with no new commit, including Test Core (3/10).

Owed

  • Green CI on 37525bf (the seat reads it).
  • The Fable contract L2 record covering this head.
  • Fixes #35795 is right: all three Done-when items are delivered.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 1c9d33c75ce7c3d06589ceafea2b291bf91d77ee
Local-runs: none
Scope: packages/spec/src/contracts/approval-service.ts + packages/plugins/plugin-approvals/src/approval-service.ts, packages/plugins/plugin-approvals/src/lifecycle-hooks.ts, packages/rest/src/approvals-routes.ts, packages/rest/src/rest-route-ledger.ts, packages/client/src/index.ts (the contract's implementation, door, ledger row and SDK), widened to the contract's first consumer and the card's first Done-when bullet: ui/packages/plugin-grid/src/hooks/useRowApprovalLocks.ts, ui/packages/plugin-grid/src/hooks/useRecordCrudVerdicts.ts, ui/packages/plugin-grid/src/ObjectGrid.tsx, ui/packages/components/src/renderers/complex/data-table.tsx, ui/packages/components/src/context/gridCellSelection.tsx. The rest of the diff (tests, i18n locales, the two generated spec JSON files, the docs page, the changeset prose) is the lane seat's ACCEPT.

Read: card #35795 with its three comments (two triage notes and the claim 7072869185), the bodies of #35747 (merged), #36135 and #36144 (open), PR #36295's body, file list (34 files) and net diff against main (merge base a5a5312f), and the check-runs on this head at 2026-11-22T05:55:30Z. The PR is a draft. The PR thread was listed only to find an earlier record on this head (there is none); the lane seat's L1-b note 7074900129 was seen there after S1 below had been formed and is not an input to it. Nothing was built or run; every statement below about behaviour is from reading the tree at this head.

① Derived judgments

  • IApprovalService.getRecordLocks? is a new OPTIONAL member. Right: every existing implementer still satisfies the contract, and the door probes for it and answers 501 (approvals-routes.ts, the new handler), never one getRecordLock per id. getRecordLock and its GET door are byte-identical to main. A widening, nothing narrowed.
  • APPROVAL_RECORD_LOCKS_MAX_RECORD_IDS = 200 is a new export of @objectstack/spec/contracts. Right, and the value equals EXPLAIN_BATCH_MAX_RECORD_IDS (packages/spec/src/security/explain.zod.ts:257), as its jsdoc says. api-surface/contracts.json and export-origins/contracts.json carry the one new line each; the generated-surface checks are green.
  • POST /api/v1/approvals/records/:object/locks is a new REST route. Right: it collides with no registered path (the only other approvals/records route is the GET …/:recordId/lock), its query set is closed and empty, its body is closed (readRecordLocksBody refuses a non-object, an unknown key, a non-list, a non-string or blank id, an empty list and more than the cap, each with 400 VALIDATION_ERROR before the service is resolved). The ledger row is sdk → approvals.getRecordLocks, and the two write-route ledgers (no-record-echo, the hook-refusal sentence driver) each carry a row: a read over POST, like POST /security/explain.
  • client.approvals.getRecordLocks(object, recordIds) is a new SDK method. Right: one POST, the object segment encoded, the same fetch and unwrapResponse path as its siblings.
  • GridCellFacts.checking (optional, @object-ui/components) and the i18n key grid.readOnlyReason.checking are additive. A host that sets no checking reads no change (data-table.tsx, both new branches are behind if (checking)).
  • No metadata an author writes changes: the PR's metadata-protocol declaration of none is right.

② Semver level

Clause-②: yes (widening)

The changeset .changeset/35795-batched-record-lock-read.md is patch on the seven packages the diff moves (@objectstack/spec, @objectstack/rest, @objectstack/plugin-approvals, @objectstack/client, @object-ui/plugin-grid, @object-ui/components, @object-ui/i18n), and no moved package is missing. patch is the level AGENTS.md gives a non-protocol widening. The declaration line reads the same in the PR body, the changeset and the claim. The widening arm is right: a new route, a new optional contract member, a new export, a new SDK method, a new optional component fact; no accept set is narrowed. @object-ui/plugin-grid now imports the new constant from @objectstack/spec/contracts; its dependency is workspace:^ and spec is bumped in the same changeset, so the published floor carries the symbol.

One sentence of the changeset is not true on this head, see S1: "a cell whose record's approval lock or edit permission is still being read no longer opens an editor that the server would then refuse on save" holds for the lock and not for a refusing permission verdict.

③ Boundary flags

  • Wait-then-open instead of the claim's premise. The claim 7072869185 took the card's "opens nothing and says the record is being checked" arm and ruled auto-opening out; the PR ships the card's other arm (the edit waits and is asked again). The card's first Done-when bullet allows either, so this is inside the card. The claim comment still states the other premise; the seat owns saying so on the card. Not a contract question.
  • fix(plugin-approvals): a locked record's lines read as locked, and deleting the locked record still lands #36135 (open draft) and "exactly what getRecordLock answers". On this head and on main the single read is the record half only, and the batch equals it. fix(plugin-approvals): a locked record's lines read as locked, and deleting the locked record still lands #36135 makes the single read answer true for a master_detail line of a locked record. Whichever lands second must carry that into getRecordLocks, or the contract sentence "entry i answers with exactly what getRecordLock answers for that id" becomes false on main. Nothing mechanical holds this: the integration case that compares the batch to the single read (record-lock-read.integration.test.ts) uses no line fixture, so it stays green either way. Escalated to the seat: a card or a line on fix(plugin-approvals): a locked record's lines read as locked, and deleting the locked record still lands #36135 before the first of the two lands.
  • Lazy ask, cap 200, unknown body key refused, locked: null and a failed read fall back to the approval_status column. Each read against the code and consistent with the single read's posture on main (fail open in the UI, the server's beforeUpdate hook still refuses). Accepted.
  • No principal key on the lock answers. Unchanged from feat(list): select a cell with a click, edit with a double-click, Enter or typing; no inline-edit toggle (#35684, #35687) #35747: answers live in a ref dropped on any data change of the object and on unmount. Accepted as carried. One consequence read in useRowApprovalLocks.ts: an invalidation while a read is on the wire swaps both maps, so settling(id) answers null and the row is not asked again until the next cell select; an Enter on the still-selected cell in that window does not wait. The column fallback and the server refusal still stand. For the lane seat's ACCEPT, not graded here.
  • SQL push-down. ApprovalService.getRecordLocks materialises the caller-readable ids (id $in, fields: ['id'], at most the ids asked) and then asks sys_approval_request by record_id $in. A reason is given and holds: the first read must go through the engine AS THE CALLER (object read, then row-level access, the 【能力需求】plugin-approvals 审批请求可见性:对业务记录有读权者应可只读查看审批动态(或提供可见性 hook) #8652 anchor), the second as SYSTEM over the bookkeeping, so one joined statement would have to run under one of the two contexts. Bounded at 200 by the door, two reads whatever the page size, and the second read names only the ids the caller could read. No finding.
  • Test Core (3/10). Red on its first attempt, cancelled on its second; see the check-run line at the end of ④.
  • Dev open questions. The PR body lists none ("需要你决定的:无"). The five "small calls" are the bullets above.

④ Design judgment

packages/spec/src/contracts/approval-service.ts (hits), against its implementation, its door and its first consumer. Sentence by sentence:

  • "Entry i answers recordIds[i] with exactly what getRecordLock answers for that id". Holds. getRecordLocks trims as getRecordLock trims, reads the ids as the caller with the same fields: ['id'] anchor, and judges through recordsHeldByLockingApproval, which is lockingRequestsForRecords (the function recordHeldByLockingApproval already calls) plus a set of record_id. A page of one readable id takes the single read's own pendingRequestFor path. A page of several reads record_id $in with limit: PENDING_LOCK_LIMIT + 1; the two forms could only differ on a record with more than one pending request, and approval-service.ts:5064 and the DUPLICATE_REQUEST refusal at :7451 keep one pending request per (object, record). The bookkeeping-object skip and the fail-open on an unreadable sys_approval_request are the same function for both.
  • "null when it cannot or when it does not exist, never an entry that tells the two apart". Holds: one branch (readableIds.has(id)) answers both, and the door maps it to locked: null with no other field. The pending lookup is asked only of readableAsked, so no timing or count of the second read depends on an unreadable id's lock.
  • "A repeated id is answered at each of its positions". Holds: the answer is mapped over the trimmed input list, the reads over its distinct members.
  • "A caller refused the object's read outright is refused the same way for every id". Holds: the caller's find throws before anything is answered, and the door relays it through handleRouteError, as the single door does.
  • "Optional, and its absence is loud … never one getRecordLock per id". Holds in the door.
  • "At most APPROVAL_RECORD_LOCKS_MAX_RECORD_IDS ids per call". Enforced at the door only; see N2.
  • First consumer (useRowApprovalLocks.ts): chunks under the same constant, sends distinct non-blank strings (so it can never draw the door's 400), reads entry i for chunk[i] and checks entry.recordId === id (the door echoes the id as sent), keeps the column fallback for null, latches 501. The contract carries what the list needs, and the answers are read through refs, so the lock half of the wait sees the answer at settle time.

The card's first Done-when bullet, on the widened files.

S1 (should-fix) — a slow record verdict that REFUSES update still opens the editor. ObjectGrid.tsx describeCell reads the verdict through recordVerdict(recordId, 'update'), a lookup memoised over React state (useRecordCrudVerdicts.ts, verdicts), and data-table.tsx waitForChecking stores a run that calls attemptEdit(r, c, seed), a closure of the render in which the edit was asked. When the explain read settles, the hook's own .then clears wireRef and calls setVerdicts; the retry then runs in the same microtask turn, before any re-render, and in any case through the ask-time attemptEdit, whose factsOf and rowMayEdit reach the ask-time describeCell and isRowEditable. That closure still reads the verdict as unknown, recordVerdict.settling() now answers null, so there is no read-only reason and no checking, and startEdit runs. The lock half does not have this hole (its answers are read from a ref). The pin "a slow record verdict holds the editor the same way" answers allowed: true and expects an editor, which it would also get had the answer been a refusal, so it does not tell the two apart. The card asks that an edit on a row whose "lock or record verdict is still being read" not open an editor the answer refuses, and the changeset says so for "edit permission". No data is harmed (the server refuses the save) and main is no better, which is why this is not graded higher on the contract face; the lane seat's own review owns the acceptance grade. Fix shape: the retry must judge with the verdict as it is at settle time (a live read of the verdict cache or a ref the lookup reads), plus a pin with a slow REFUSING verdict that expects the no-permission sentence and no editor. Read, not run.

Nits (no effect on the contract as the door serves it):

  • N1 — getRecordLocks maps the caller-readable rows back to the asked ids by string identity (readableIds.has(id)). An id sent in a spelling the store matches but does not return verbatim (a differently-cased id under a case-insensitive collation, "012" against an integer key) answers null here and { locked } on the single read. The single read is itself unreliable for such an id (its pending lookup is by the asked spelling), and a list only sends ids it read. Accepted deviation.
  • N2 — the constant's jsdoc says a longer list is "refused whole (400 VALIDATION_ERROR)" of one getRecordLocks call as well as of one request. Only the door refuses. The plugin's service answers 201 to 1000 ids, and above PENDING_LOCK_LIMIT readable ids it throws the write hook's RECORD_LOCKED 409 "refusing to authorize an update naming more than 1000 records", a sentence about a write. Unreachable through the door. A follow-up card or a jsdoc word ("the door refuses") settles it.
  • N3 — the door reads a short or malformed service answer (answers[index] missing) as locked: null, the same as unreadable. A third-party implementation that returns fewer entries is masked rather than refused. Accepted deviation.

Check-runs on this head (2026-11-22T05:55:30Z): 59 success, 9 skipped (opt-in and queue-only jobs), and Test Core (3/10) without a green attempt: attempt 1 (137101627773) ended red on one packages/runtime case, app-artifact-handlers.jobs.test.ts, a path this diff does not touch and the seat judged a timing flake (comment 7074851878); attempt 2 (137109453814) was cancelled at 2026-11-22T05:54:32Z, when a new commit was pushed to the PR, before it concluded. So that shard gives no gate verdict on this head, and its verdict has to be read on the head that replaced it. Every gate that derives from the contract face (spec generated surface, api-surface, route ledger, type check, the rest, client and plugin-approvals test shards, lint, the UI shards) is green on this head.

This head is no longer the PR's head. At 2026-11-22T05:54:11Z the PR moved to 37525bf2 (one commit, six files: the changeset, ObjectGrid.tsx, the two grid hooks and two grid test files; no file of the contract, its implementation, door, ledger or SDK). This record covers 1c9d33c7 alone. S1 stays open here and is closed, or not, by a delta read of that commit.

Implemented-by: claude/project-thread-ahwb54
Reviewed-by: session_01L6bhgUkbQqRUUFSiu2HGob

VERDICT: PASS

1 similar comment
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 1c9d33c75ce7c3d06589ceafea2b291bf91d77ee
Local-runs: none
Scope: packages/spec/src/contracts/approval-service.ts + packages/plugins/plugin-approvals/src/approval-service.ts, packages/plugins/plugin-approvals/src/lifecycle-hooks.ts, packages/rest/src/approvals-routes.ts, packages/rest/src/rest-route-ledger.ts, packages/client/src/index.ts (the contract's implementation, door, ledger row and SDK), widened to the contract's first consumer and the card's first Done-when bullet: ui/packages/plugin-grid/src/hooks/useRowApprovalLocks.ts, ui/packages/plugin-grid/src/hooks/useRecordCrudVerdicts.ts, ui/packages/plugin-grid/src/ObjectGrid.tsx, ui/packages/components/src/renderers/complex/data-table.tsx, ui/packages/components/src/context/gridCellSelection.tsx. The rest of the diff (tests, i18n locales, the two generated spec JSON files, the docs page, the changeset prose) is the lane seat's ACCEPT.

Read: card #35795 with its three comments (two triage notes and the claim 7072869185), the bodies of #35747 (merged), #36135 and #36144 (open), PR #36295's body, file list (34 files) and net diff against main (merge base a5a5312f), and the check-runs on this head at 2026-11-22T05:55:30Z. The PR is a draft. The PR thread was listed only to find an earlier record on this head (there is none); the lane seat's L1-b note 7074900129 was seen there after S1 below had been formed and is not an input to it. Nothing was built or run; every statement below about behaviour is from reading the tree at this head.

① Derived judgments

  • IApprovalService.getRecordLocks? is a new OPTIONAL member. Right: every existing implementer still satisfies the contract, and the door probes for it and answers 501 (approvals-routes.ts, the new handler), never one getRecordLock per id. getRecordLock and its GET door are byte-identical to main. A widening, nothing narrowed.
  • APPROVAL_RECORD_LOCKS_MAX_RECORD_IDS = 200 is a new export of @objectstack/spec/contracts. Right, and the value equals EXPLAIN_BATCH_MAX_RECORD_IDS (packages/spec/src/security/explain.zod.ts:257), as its jsdoc says. api-surface/contracts.json and export-origins/contracts.json carry the one new line each; the generated-surface checks are green.
  • POST /api/v1/approvals/records/:object/locks is a new REST route. Right: it collides with no registered path (the only other approvals/records route is the GET …/:recordId/lock), its query set is closed and empty, its body is closed (readRecordLocksBody refuses a non-object, an unknown key, a non-list, a non-string or blank id, an empty list and more than the cap, each with 400 VALIDATION_ERROR before the service is resolved). The ledger row is sdk → approvals.getRecordLocks, and the two write-route ledgers (no-record-echo, the hook-refusal sentence driver) each carry a row: a read over POST, like POST /security/explain.
  • client.approvals.getRecordLocks(object, recordIds) is a new SDK method. Right: one POST, the object segment encoded, the same fetch and unwrapResponse path as its siblings.
  • GridCellFacts.checking (optional, @object-ui/components) and the i18n key grid.readOnlyReason.checking are additive. A host that sets no checking reads no change (data-table.tsx, both new branches are behind if (checking)).
  • No metadata an author writes changes: the PR's metadata-protocol declaration of none is right.

② Semver level

Clause-②: yes (widening)

The changeset .changeset/35795-batched-record-lock-read.md is patch on the seven packages the diff moves (@objectstack/spec, @objectstack/rest, @objectstack/plugin-approvals, @objectstack/client, @object-ui/plugin-grid, @object-ui/components, @object-ui/i18n), and no moved package is missing. patch is the level AGENTS.md gives a non-protocol widening. The declaration line reads the same in the PR body, the changeset and the claim. The widening arm is right: a new route, a new optional contract member, a new export, a new SDK method, a new optional component fact; no accept set is narrowed. @object-ui/plugin-grid now imports the new constant from @objectstack/spec/contracts; its dependency is workspace:^ and spec is bumped in the same changeset, so the published floor carries the symbol.

One sentence of the changeset is not true on this head, see S1: "a cell whose record's approval lock or edit permission is still being read no longer opens an editor that the server would then refuse on save" holds for the lock and not for a refusing permission verdict.

③ Boundary flags

  • Wait-then-open instead of the claim's premise. The claim 7072869185 took the card's "opens nothing and says the record is being checked" arm and ruled auto-opening out; the PR ships the card's other arm (the edit waits and is asked again). The card's first Done-when bullet allows either, so this is inside the card. The claim comment still states the other premise; the seat owns saying so on the card. Not a contract question.
  • fix(plugin-approvals): a locked record's lines read as locked, and deleting the locked record still lands #36135 (open draft) and "exactly what getRecordLock answers". On this head and on main the single read is the record half only, and the batch equals it. fix(plugin-approvals): a locked record's lines read as locked, and deleting the locked record still lands #36135 makes the single read answer true for a master_detail line of a locked record. Whichever lands second must carry that into getRecordLocks, or the contract sentence "entry i answers with exactly what getRecordLock answers for that id" becomes false on main. Nothing mechanical holds this: the integration case that compares the batch to the single read (record-lock-read.integration.test.ts) uses no line fixture, so it stays green either way. Escalated to the seat: a card or a line on fix(plugin-approvals): a locked record's lines read as locked, and deleting the locked record still lands #36135 before the first of the two lands.
  • Lazy ask, cap 200, unknown body key refused, locked: null and a failed read fall back to the approval_status column. Each read against the code and consistent with the single read's posture on main (fail open in the UI, the server's beforeUpdate hook still refuses). Accepted.
  • No principal key on the lock answers. Unchanged from feat(list): select a cell with a click, edit with a double-click, Enter or typing; no inline-edit toggle (#35684, #35687) #35747: answers live in a ref dropped on any data change of the object and on unmount. Accepted as carried. One consequence read in useRowApprovalLocks.ts: an invalidation while a read is on the wire swaps both maps, so settling(id) answers null and the row is not asked again until the next cell select; an Enter on the still-selected cell in that window does not wait. The column fallback and the server refusal still stand. For the lane seat's ACCEPT, not graded here.
  • SQL push-down. ApprovalService.getRecordLocks materialises the caller-readable ids (id $in, fields: ['id'], at most the ids asked) and then asks sys_approval_request by record_id $in. A reason is given and holds: the first read must go through the engine AS THE CALLER (object read, then row-level access, the 【能力需求】plugin-approvals 审批请求可见性:对业务记录有读权者应可只读查看审批动态(或提供可见性 hook) #8652 anchor), the second as SYSTEM over the bookkeeping, so one joined statement would have to run under one of the two contexts. Bounded at 200 by the door, two reads whatever the page size, and the second read names only the ids the caller could read. No finding.
  • Test Core (3/10). Red on its first attempt, cancelled on its second; see the check-run line at the end of ④.
  • Dev open questions. The PR body lists none ("需要你决定的:无"). The five "small calls" are the bullets above.

④ Design judgment

packages/spec/src/contracts/approval-service.ts (hits), against its implementation, its door and its first consumer. Sentence by sentence:

  • "Entry i answers recordIds[i] with exactly what getRecordLock answers for that id". Holds. getRecordLocks trims as getRecordLock trims, reads the ids as the caller with the same fields: ['id'] anchor, and judges through recordsHeldByLockingApproval, which is lockingRequestsForRecords (the function recordHeldByLockingApproval already calls) plus a set of record_id. A page of one readable id takes the single read's own pendingRequestFor path. A page of several reads record_id $in with limit: PENDING_LOCK_LIMIT + 1; the two forms could only differ on a record with more than one pending request, and approval-service.ts:5064 and the DUPLICATE_REQUEST refusal at :7451 keep one pending request per (object, record). The bookkeeping-object skip and the fail-open on an unreadable sys_approval_request are the same function for both.
  • "null when it cannot or when it does not exist, never an entry that tells the two apart". Holds: one branch (readableIds.has(id)) answers both, and the door maps it to locked: null with no other field. The pending lookup is asked only of readableAsked, so no timing or count of the second read depends on an unreadable id's lock.
  • "A repeated id is answered at each of its positions". Holds: the answer is mapped over the trimmed input list, the reads over its distinct members.
  • "A caller refused the object's read outright is refused the same way for every id". Holds: the caller's find throws before anything is answered, and the door relays it through handleRouteError, as the single door does.
  • "Optional, and its absence is loud … never one getRecordLock per id". Holds in the door.
  • "At most APPROVAL_RECORD_LOCKS_MAX_RECORD_IDS ids per call". Enforced at the door only; see N2.
  • First consumer (useRowApprovalLocks.ts): chunks under the same constant, sends distinct non-blank strings (so it can never draw the door's 400), reads entry i for chunk[i] and checks entry.recordId === id (the door echoes the id as sent), keeps the column fallback for null, latches 501. The contract carries what the list needs, and the answers are read through refs, so the lock half of the wait sees the answer at settle time.

The card's first Done-when bullet, on the widened files.

S1 (should-fix) — a slow record verdict that REFUSES update still opens the editor. ObjectGrid.tsx describeCell reads the verdict through recordVerdict(recordId, 'update'), a lookup memoised over React state (useRecordCrudVerdicts.ts, verdicts), and data-table.tsx waitForChecking stores a run that calls attemptEdit(r, c, seed), a closure of the render in which the edit was asked. When the explain read settles, the hook's own .then clears wireRef and calls setVerdicts; the retry then runs in the same microtask turn, before any re-render, and in any case through the ask-time attemptEdit, whose factsOf and rowMayEdit reach the ask-time describeCell and isRowEditable. That closure still reads the verdict as unknown, recordVerdict.settling() now answers null, so there is no read-only reason and no checking, and startEdit runs. The lock half does not have this hole (its answers are read from a ref). The pin "a slow record verdict holds the editor the same way" answers allowed: true and expects an editor, which it would also get had the answer been a refusal, so it does not tell the two apart. The card asks that an edit on a row whose "lock or record verdict is still being read" not open an editor the answer refuses, and the changeset says so for "edit permission". No data is harmed (the server refuses the save) and main is no better, which is why this is not graded higher on the contract face; the lane seat's own review owns the acceptance grade. Fix shape: the retry must judge with the verdict as it is at settle time (a live read of the verdict cache or a ref the lookup reads), plus a pin with a slow REFUSING verdict that expects the no-permission sentence and no editor. Read, not run.

Nits (no effect on the contract as the door serves it):

  • N1 — getRecordLocks maps the caller-readable rows back to the asked ids by string identity (readableIds.has(id)). An id sent in a spelling the store matches but does not return verbatim (a differently-cased id under a case-insensitive collation, "012" against an integer key) answers null here and { locked } on the single read. The single read is itself unreliable for such an id (its pending lookup is by the asked spelling), and a list only sends ids it read. Accepted deviation.
  • N2 — the constant's jsdoc says a longer list is "refused whole (400 VALIDATION_ERROR)" of one getRecordLocks call as well as of one request. Only the door refuses. The plugin's service answers 201 to 1000 ids, and above PENDING_LOCK_LIMIT readable ids it throws the write hook's RECORD_LOCKED 409 "refusing to authorize an update naming more than 1000 records", a sentence about a write. Unreachable through the door. A follow-up card or a jsdoc word ("the door refuses") settles it.
  • N3 — the door reads a short or malformed service answer (answers[index] missing) as locked: null, the same as unreadable. A third-party implementation that returns fewer entries is masked rather than refused. Accepted deviation.

Check-runs on this head (2026-11-22T05:55:30Z): 59 success, 9 skipped (opt-in and queue-only jobs), and Test Core (3/10) without a green attempt: attempt 1 (137101627773) ended red on one packages/runtime case, app-artifact-handlers.jobs.test.ts, a path this diff does not touch and the seat judged a timing flake (comment 7074851878); attempt 2 (137109453814) was cancelled at 2026-11-22T05:54:32Z, when a new commit was pushed to the PR, before it concluded. So that shard gives no gate verdict on this head, and its verdict has to be read on the head that replaced it. Every gate that derives from the contract face (spec generated surface, api-surface, route ledger, type check, the rest, client and plugin-approvals test shards, lint, the UI shards) is green on this head.

This head is no longer the PR's head. At 2026-11-22T05:54:11Z the PR moved to 37525bf2 (one commit, six files: the changeset, ObjectGrid.tsx, the two grid hooks and two grid test files; no file of the contract, its implementation, door, ledger or SDK). This record covers 1c9d33c7 alone. S1 stays open here and is closed, or not, by a delta read of that commit.

Implemented-by: claude/project-thread-ahwb54
Reviewed-by: session_01L6bhgUkbQqRUUFSiu2HGob

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgUmopshYqDCrYekUj4

席位核对 — delta ACCEPT (L1-b)

Head-sha: 37525bf · read 2026-11-22T06:00Z · prior REWORK 7074900129 @1c9d33c7 · delta 1c9d33c..37525bf, one commit · card #35795 unchanged since 02:22:45Z

维护者速读

上次提的问题已经修好:权限检查晚回来、结果又是「不允许」时,格子不再打开编辑框,而是提示没有编辑这条记录的权限。双击、直接打字、粘贴这几种情况都补了测试,粘贴不会写入任何数据。说明文字也补上了这种结果。其余部分和上次审过的一样。本轮发出时 CI 还在跑,要等全绿才能合。

Must-fix

None. M1 is closed.

Should-fix

None. S1 is closed.

Nits

None. N1 is closed: LockAnswer now says 'unanswered' is not asked again until invalidation.

Checked

  • useRecordCrudVerdicts.ts: publishedRef is written in the same statement as each setVerdicts, in publish() and on the empty path. current(recordId, operation) reads that ref. publish() runs inside the wire's own callback, and Promise.all(reads) settles after that callback, so the re-asked edit reads the answer that settled the wait.
  • A wire cancelled by a re-run effect does not publish. In that case current still answers undefined, settling() returns the new effect's wire (it joins the in-flight batch through pendingVerdicts), and the edit waits again. It never opens on a stale undefined.
  • ObjectGrid.tsx describeCell reads recordVerdict.current(recordId, 'update'). The other readers of the render map are unchanged.
  • New pins:
    • A slow refusing verdict on a double-click opens no editor and shows noRecordPermission.
    • A typed key in the same case opens nothing, shows the reason, and leaves the cell's value as it was.
    • A paste in the same case is never written (ds.update is not called) and the cell says why.
    • The thread reports these go red with the old lookup. Their shape bears that out: each asserts the editor and the write that the stale undefined produced.
  • Changeset "What a list user sees" now names the no-permission outcome beside the lock.
  • Only plugin-grid and the changeset changed. The contract, route and docs are as ACCEPT-checked at 1c9d33c. git merge-tree --write-tree --name-only origin/main 37525bf2: clean.
  • CI on 37525bf at read: 19 queued, 3 skipped, nothing finished. This ACCEPT is final once that run is green on this head with no new commit, including Test Core (3/10).

Owed

  • Green CI on 37525bf (the seat reads it).
  • The Fable contract L2 record covering this head.
  • Fixes #35795 is right: all three Done-when items are delivered.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 1c9d33c75ce7c3d06589ceafea2b291bf91d77ee
Local-runs: none
Scope: packages/spec/src/contracts/approval-service.ts + packages/plugins/plugin-approvals/src/approval-service.ts, packages/plugins/plugin-approvals/src/lifecycle-hooks.ts, packages/rest/src/approvals-routes.ts, packages/rest/src/rest-route-ledger.ts, packages/client/src/index.ts (the contract's implementation, door, ledger row and SDK), widened to the contract's first consumer and the card's first Done-when bullet: ui/packages/plugin-grid/src/hooks/useRowApprovalLocks.ts, ui/packages/plugin-grid/src/hooks/useRecordCrudVerdicts.ts, ui/packages/plugin-grid/src/ObjectGrid.tsx, ui/packages/components/src/renderers/complex/data-table.tsx, ui/packages/components/src/context/gridCellSelection.tsx. The rest of the diff (tests, i18n locales, the two generated spec JSON files, the docs page, the changeset prose) is the lane seat's ACCEPT.

Read: card #35795 with its three comments (two triage notes and the claim 7072869185), the bodies of #35747 (merged), #36135 and #36144 (open), PR #36295's body, file list (34 files) and net diff against main (merge base a5a5312f), and the check-runs on this head at 2026-11-22T05:55:30Z. The PR is a draft. The PR thread was listed only to find an earlier record on this head (there is none); the lane seat's L1-b note 7074900129 was seen there after S1 below had been formed and is not an input to it. Nothing was built or run; every statement below about behaviour is from reading the tree at this head.

① Derived judgments

  • IApprovalService.getRecordLocks? is a new OPTIONAL member. Right: every existing implementer still satisfies the contract, and the door probes for it and answers 501 (approvals-routes.ts, the new handler), never one getRecordLock per id. getRecordLock and its GET door are byte-identical to main. A widening, nothing narrowed.
  • APPROVAL_RECORD_LOCKS_MAX_RECORD_IDS = 200 is a new export of @objectstack/spec/contracts. Right, and the value equals EXPLAIN_BATCH_MAX_RECORD_IDS (packages/spec/src/security/explain.zod.ts:257), as its jsdoc says. api-surface/contracts.json and export-origins/contracts.json carry the one new line each; the generated-surface checks are green.
  • POST /api/v1/approvals/records/:object/locks is a new REST route. Right: it collides with no registered path (the only other approvals/records route is the GET …/:recordId/lock), its query set is closed and empty, its body is closed (readRecordLocksBody refuses a non-object, an unknown key, a non-list, a non-string or blank id, an empty list and more than the cap, each with 400 VALIDATION_ERROR before the service is resolved). The ledger row is sdk → approvals.getRecordLocks, and the two write-route ledgers (no-record-echo, the hook-refusal sentence driver) each carry a row: a read over POST, like POST /security/explain.
  • client.approvals.getRecordLocks(object, recordIds) is a new SDK method. Right: one POST, the object segment encoded, the same fetch and unwrapResponse path as its siblings.
  • GridCellFacts.checking (optional, @object-ui/components) and the i18n key grid.readOnlyReason.checking are additive. A host that sets no checking reads no change (data-table.tsx, both new branches are behind if (checking)).
  • No metadata an author writes changes: the PR's metadata-protocol declaration of none is right.

② Semver level

Clause-②: yes (widening)

The changeset .changeset/35795-batched-record-lock-read.md is patch on the seven packages the diff moves (@objectstack/spec, @objectstack/rest, @objectstack/plugin-approvals, @objectstack/client, @object-ui/plugin-grid, @object-ui/components, @object-ui/i18n), and no moved package is missing. patch is the level AGENTS.md gives a non-protocol widening. The declaration line reads the same in the PR body, the changeset and the claim. The widening arm is right: a new route, a new optional contract member, a new export, a new SDK method, a new optional component fact; no accept set is narrowed. @object-ui/plugin-grid now imports the new constant from @objectstack/spec/contracts; its dependency is workspace:^ and spec is bumped in the same changeset, so the published floor carries the symbol.

One sentence of the changeset is not true on this head, see S1: "a cell whose record's approval lock or edit permission is still being read no longer opens an editor that the server would then refuse on save" holds for the lock and not for a refusing permission verdict.

③ Boundary flags

  • Wait-then-open instead of the claim's premise. The claim 7072869185 took the card's "opens nothing and says the record is being checked" arm and ruled auto-opening out; the PR ships the card's other arm (the edit waits and is asked again). The card's first Done-when bullet allows either, so this is inside the card. The claim comment still states the other premise; the seat owns saying so on the card. Not a contract question.
  • fix(plugin-approvals): a locked record's lines read as locked, and deleting the locked record still lands #36135 (open draft) and "exactly what getRecordLock answers". On this head and on main the single read is the record half only, and the batch equals it. fix(plugin-approvals): a locked record's lines read as locked, and deleting the locked record still lands #36135 makes the single read answer true for a master_detail line of a locked record. Whichever lands second must carry that into getRecordLocks, or the contract sentence "entry i answers with exactly what getRecordLock answers for that id" becomes false on main. Nothing mechanical holds this: the integration case that compares the batch to the single read (record-lock-read.integration.test.ts) uses no line fixture, so it stays green either way. Escalated to the seat: a card or a line on fix(plugin-approvals): a locked record's lines read as locked, and deleting the locked record still lands #36135 before the first of the two lands.
  • Lazy ask, cap 200, unknown body key refused, locked: null and a failed read fall back to the approval_status column. Each read against the code and consistent with the single read's posture on main (fail open in the UI, the server's beforeUpdate hook still refuses). Accepted.
  • No principal key on the lock answers. Unchanged from feat(list): select a cell with a click, edit with a double-click, Enter or typing; no inline-edit toggle (#35684, #35687) #35747: answers live in a ref dropped on any data change of the object and on unmount. Accepted as carried. One consequence read in useRowApprovalLocks.ts: an invalidation while a read is on the wire swaps both maps, so settling(id) answers null and the row is not asked again until the next cell select; an Enter on the still-selected cell in that window does not wait. The column fallback and the server refusal still stand. For the lane seat's ACCEPT, not graded here.
  • SQL push-down. ApprovalService.getRecordLocks materialises the caller-readable ids (id $in, fields: ['id'], at most the ids asked) and then asks sys_approval_request by record_id $in. A reason is given and holds: the first read must go through the engine AS THE CALLER (object read, then row-level access, the 【能力需求】plugin-approvals 审批请求可见性:对业务记录有读权者应可只读查看审批动态(或提供可见性 hook) #8652 anchor), the second as SYSTEM over the bookkeeping, so one joined statement would have to run under one of the two contexts. Bounded at 200 by the door, two reads whatever the page size, and the second read names only the ids the caller could read. No finding.
  • Test Core (3/10). Red on its first attempt, cancelled on its second; see the check-run line at the end of ④.
  • Dev open questions. The PR body lists none ("需要你决定的:无"). The five "small calls" are the bullets above.

④ Design judgment

packages/spec/src/contracts/approval-service.ts (hits), against its implementation, its door and its first consumer. Sentence by sentence:

  • "Entry i answers recordIds[i] with exactly what getRecordLock answers for that id". Holds. getRecordLocks trims as getRecordLock trims, reads the ids as the caller with the same fields: ['id'] anchor, and judges through recordsHeldByLockingApproval, which is lockingRequestsForRecords (the function recordHeldByLockingApproval already calls) plus a set of record_id. A page of one readable id takes the single read's own pendingRequestFor path. A page of several reads record_id $in with limit: PENDING_LOCK_LIMIT + 1; the two forms could only differ on a record with more than one pending request, and approval-service.ts:5064 and the DUPLICATE_REQUEST refusal at :7451 keep one pending request per (object, record). The bookkeeping-object skip and the fail-open on an unreadable sys_approval_request are the same function for both.
  • "null when it cannot or when it does not exist, never an entry that tells the two apart". Holds: one branch (readableIds.has(id)) answers both, and the door maps it to locked: null with no other field. The pending lookup is asked only of readableAsked, so no timing or count of the second read depends on an unreadable id's lock.
  • "A repeated id is answered at each of its positions". Holds: the answer is mapped over the trimmed input list, the reads over its distinct members.
  • "A caller refused the object's read outright is refused the same way for every id". Holds: the caller's find throws before anything is answered, and the door relays it through handleRouteError, as the single door does.
  • "Optional, and its absence is loud … never one getRecordLock per id". Holds in the door.
  • "At most APPROVAL_RECORD_LOCKS_MAX_RECORD_IDS ids per call". Enforced at the door only; see N2.
  • First consumer (useRowApprovalLocks.ts): chunks under the same constant, sends distinct non-blank strings (so it can never draw the door's 400), reads entry i for chunk[i] and checks entry.recordId === id (the door echoes the id as sent), keeps the column fallback for null, latches 501. The contract carries what the list needs, and the answers are read through refs, so the lock half of the wait sees the answer at settle time.

The card's first Done-when bullet, on the widened files.

S1 (should-fix) — a slow record verdict that REFUSES update still opens the editor. ObjectGrid.tsx describeCell reads the verdict through recordVerdict(recordId, 'update'), a lookup memoised over React state (useRecordCrudVerdicts.ts, verdicts), and data-table.tsx waitForChecking stores a run that calls attemptEdit(r, c, seed), a closure of the render in which the edit was asked. When the explain read settles, the hook's own .then clears wireRef and calls setVerdicts; the retry then runs in the same microtask turn, before any re-render, and in any case through the ask-time attemptEdit, whose factsOf and rowMayEdit reach the ask-time describeCell and isRowEditable. That closure still reads the verdict as unknown, recordVerdict.settling() now answers null, so there is no read-only reason and no checking, and startEdit runs. The lock half does not have this hole (its answers are read from a ref). The pin "a slow record verdict holds the editor the same way" answers allowed: true and expects an editor, which it would also get had the answer been a refusal, so it does not tell the two apart. The card asks that an edit on a row whose "lock or record verdict is still being read" not open an editor the answer refuses, and the changeset says so for "edit permission". No data is harmed (the server refuses the save) and main is no better, which is why this is not graded higher on the contract face; the lane seat's own review owns the acceptance grade. Fix shape: the retry must judge with the verdict as it is at settle time (a live read of the verdict cache or a ref the lookup reads), plus a pin with a slow REFUSING verdict that expects the no-permission sentence and no editor. Read, not run.

Nits (no effect on the contract as the door serves it):

  • N1 — getRecordLocks maps the caller-readable rows back to the asked ids by string identity (readableIds.has(id)). An id sent in a spelling the store matches but does not return verbatim (a differently-cased id under a case-insensitive collation, "012" against an integer key) answers null here and { locked } on the single read. The single read is itself unreliable for such an id (its pending lookup is by the asked spelling), and a list only sends ids it read. Accepted deviation.
  • N2 — the constant's jsdoc says a longer list is "refused whole (400 VALIDATION_ERROR)" of one getRecordLocks call as well as of one request. Only the door refuses. The plugin's service answers 201 to 1000 ids, and above PENDING_LOCK_LIMIT readable ids it throws the write hook's RECORD_LOCKED 409 "refusing to authorize an update naming more than 1000 records", a sentence about a write. Unreachable through the door. A follow-up card or a jsdoc word ("the door refuses") settles it.
  • N3 — the door reads a short or malformed service answer (answers[index] missing) as locked: null, the same as unreadable. A third-party implementation that returns fewer entries is masked rather than refused. Accepted deviation.

Check-runs on this head (2026-11-22T05:55:30Z): 59 success, 9 skipped (opt-in and queue-only jobs), and Test Core (3/10) without a green attempt: attempt 1 (137101627773) ended red on one packages/runtime case, app-artifact-handlers.jobs.test.ts, a path this diff does not touch and the seat judged a timing flake (comment 7074851878); attempt 2 (137109453814) was cancelled at 2026-11-22T05:54:32Z, when a new commit was pushed to the PR, before it concluded. So that shard gives no gate verdict on this head, and its verdict has to be read on the head that replaced it. Every gate that derives from the contract face (spec generated surface, api-surface, route ledger, type check, the rest, client and plugin-approvals test shards, lint, the UI shards) is green on this head.

This head is no longer the PR's head. At 2026-11-22T05:54:11Z the PR moved to 37525bf2 (one commit, six files: the changeset, ObjectGrid.tsx, the two grid hooks and two grid test files; no file of the contract, its implementation, door, ledger or SDK). This record covers 1c9d33c7 alone. S1 stays open here and is closed, or not, by a delta read of that commit.

Implemented-by: claude/project-thread-ahwb54
Reviewed-by: session_01L6bhgUkbQqRUUFSiu2HGob

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgUmopshYqDCrYekUj4

席位核对 — delta ACCEPT (L1-b)

Head-sha: 37525bf · read 2026-11-22T06:05Z · prior REWORK 7074900129 @1c9d33c7 · delta 1c9d33c..37525bf, one commit · card #35795 unchanged since 02:22:45Z

维护者速读

上次提的问题已经修好:权限检查晚回来、结果又是「不允许」时,格子不再打开编辑框,而是提示没有编辑这条记录的权限。双击、直接打字、粘贴这几种情况都补了测试,粘贴不会写入任何数据。说明文字也补上了这种结果。其余部分和上次审过的一样。本轮发出时 CI 还在跑,要等全绿才能合。

Must-fix

None. M1 is closed.

Should-fix

None. S1 is closed.

Nits

None. N1 is closed: LockAnswer now says 'unanswered' is not asked again until invalidation.

Checked

  • useRecordCrudVerdicts.ts: publishedRef is written in the same statement as each setVerdicts, in publish() and on the empty path. current(recordId, operation) reads that ref. publish() runs inside the wire's own callback, and Promise.all(reads) settles after that callback, so the re-asked edit reads the answer that settled the wait.
  • A wire cancelled by a re-run effect does not publish. In that case current still answers undefined, settling() returns the new effect's wire (it joins the in-flight batch through pendingVerdicts), and the edit waits again. It never opens on a stale undefined.
  • ObjectGrid.tsx describeCell reads recordVerdict.current(recordId, 'update'). The other readers of the render map are unchanged.
  • New pins:
    • A slow refusing verdict on a double-click opens no editor and shows noRecordPermission.
    • A typed key in the same case opens nothing, shows the reason, and leaves the cell's value as it was.
    • A paste in the same case is never written (ds.update is not called) and the cell says why.
    • The thread reports these go red with the old lookup. Their shape bears that out: each asserts the editor and the write that the stale undefined produced.
  • Changeset "What a list user sees" now names the no-permission outcome beside the lock.
  • Only plugin-grid and the changeset changed. The contract, route and docs are as ACCEPT-checked at 1c9d33c. git merge-tree --write-tree --name-only origin/main 37525bf2: clean.
  • CI on 37525bf at read: 19 queued, 3 skipped, nothing finished. This ACCEPT is final once that run is green on this head with no new commit, including Test Core (3/10).

Owed

  • Green CI on 37525bf (the seat reads it).
  • The Fable contract L2 record covering this head.
  • Fixes #35795 is right: all three Done-when items are delivered.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 37525bf219c3e3d932b6bdcb83f8f431a9c11474
Local-runs: none
Scope: packages/spec/src/contracts/approval-service.ts + packages/plugins/plugin-approvals/src/approval-service.ts, packages/plugins/plugin-approvals/src/lifecycle-hooks.ts, packages/rest/src/approvals-routes.ts, packages/rest/src/rest-route-ledger.ts, packages/client/src/index.ts (all six byte-identical to the head of the first record), widened as before to ui/packages/plugin-grid/src/hooks/useRecordCrudVerdicts.ts, ui/packages/plugin-grid/src/hooks/useRowApprovalLocks.ts, ui/packages/plugin-grid/src/ObjectGrid.tsx, ui/packages/components/src/renderers/complex/data-table.tsx, ui/packages/components/src/context/gridCellSelection.tsx. The rest of the diff is the lane seat's ACCEPT.

A delta record. It reads the one commit between the head of the first record (1c9d33c7, this session's record of this round) and this head, in full: six files, the changeset, ObjectGrid.tsx, the two grid hooks and two grid test files. Everything the first record judged on the contract file, its implementation, door, ledger rows and SDK stands unchanged, because none of those files moved. Nothing was built or run.

① Derived judgments

  • RecordCrudVerdicts.current is a new member of a hook's return value inside @object-ui/plugin-grid: additive, and no published accept set moves. Right.
  • No file of packages/spec, packages/rest, packages/client or packages/plugins/plugin-approvals is in the delta, so the route, the optional contract member, the exported cap and the SDK method are exactly as judged before: a widening, nothing narrowed.

② Semver level

Clause-②: yes (widening)

The changeset keeps its seven patch entries and both declaration lines; only its "What a list user sees" paragraph changed. The sentence the first record called untrue is now true on this head: an edit asked while the lock or the edit permission is read waits, and when the answer arrives the cell "says why it does not: the record is locked while it is in approval, or the reader has no permission to edit it". Both outcomes are what the code does (see S1 below) and both are pinned.

③ Boundary flags

  • Carried unchanged from the first record, and still the seat's to settle: the claim comment states the other premise than the wait-then-open the PR ships (inside the card either way); and fix(plugin-approvals): a locked record's lines read as locked, and deleting the locked record still lands #36135, where whichever of the two lands second must carry the master_detail line half into getRecordLocks, with no test that would notice.
  • The delta adds a doc comment on LockAnswer in useRowApprovalLocks.ts saying an unanswered read is not asked again until the object's data is invalidated. It describes the code as it is. The invalidation window noted before (a read on the wire when the maps are swapped) is unchanged and remains for the lane seat's ACCEPT.
  • SQL push-down: the delta touches no server read. Nothing new to judge.
  • Dev open questions: none raised by the delta.

④ Design judgment

S1: closed

How it closes, read in the tree. useRecordCrudVerdicts.ts keeps publishedRef, assigned in the same statement pair as every setVerdicts (the empty reset and publish), and exposes current, a stable callback that reads that ref. ObjectGrid.tsx describeCell now reads recordVerdict.current(recordId, 'update'). The stale path the first record traced was: the retry runs through the ask-time attemptEdit, whose describeCell closed over the ask-time verdict map. That closure now reaches a stable callback over a ref, so it reads what was published last whichever render it belongs to. Order at settle time: the hook's own .then runs first (it was attached when the wire was made), clears wireRef and calls publish, which writes the ref before the state; the retry, chained later on a promise built from that wire, then reads the refusal and cellReadOnlyKind answers noRecordPermission, so readOnlyReasonOf returns before rowMayEdit (still the render-time lookup) is reached. Tried to break it on the one branch where publish is skipped: an effect re-run sets cancelled on the old wire, so its .then publishes nothing; but the new effect joins the same in-flight answers into a new wire held in wireRef, so a retry that fires before that wire's own .then finds the verdict still unknown AND settling() non-null, and waits again rather than opening. Either order ends on the answer.

The pins now tell the two answers apart: in ObjectGrid.cellSelection-35684.test.tsx, a slow verdict that refuses row 1 shows the checking sentence, then the no-permission sentence and no editor, for a double-click and for a typed key (the cell keeps its value); in ObjectGrid.autosave-35685.test.tsx, a paste under the same slow refusing verdict is never written. The allowing case from before still expects an editor. The card's first Done-when bullet now holds for the verdict half as well as the lock half.

No new finding in the delta.

Nits, none touched by the delta and none blocking; each stays as the first record left it:

  • N1 (nit) — unchanged, left as an accepted deviation (getRecordLocks maps readable rows back by string identity; only a non-canonical id spelling differs from the single read).
  • N2 (nit) — unchanged, left for a follow-up card or a jsdoc word (the cap constant's jsdoc reads as if the service call also refuses over the cap; only the door does).
  • N3 (nit) — unchanged, left as an accepted deviation (the door reads a short service answer as locked: null).

Check-runs on this head (2026-11-22T06:05:54Z): NOT complete. 8 success, 5 skipped, 12 in progress (the Lint and Type Check families and Auto Label) and 1 queued; the test shards, Test Core (3/10) among them, had not yet been created. So no gate verdict exists yet on this head for any test family, and Test Core (3/10) in particular has still never concluded green on this PR (red once on a packages/runtime case outside the diff, then cancelled by this push, both on the previous head). This record judges the contract and the delta; it does not stand in for those runs. The seat lands only on all green on this head, read at landing time, and a second red of Test Core (3/10) is to be treated as real, as the seat's own flake note says.

Implemented-by: claude/project-thread-ahwb54
Reviewed-by: session_01L6bhgUkbQqRUUFSiu2HGob

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

Seat landing · 2026-11-22T06:40Z · #35795: in a list, a cell does not open its editor while the row's approval lock or the record's edit verdict is still being read. Typed text is kept while it waits. A click on another cell cancels the wait. When the answer is locked or not permitted, nothing opens and the cell says why. A paste during the wait is written only once the answer allows it. The list now reads the approval locks of its visible rows in one batched request: a new IApprovalService method, a REST route with its ledger rows, and a client method.

Reviews:

  • L1-b: REWORK 7074900129 (M1: a slow refusing verdict still opened the editor); delta ACCEPT 7075095439 on this head (7075149564 and 7075169801 are relay-queue duplicates of it).
  • Contract L2 (contract face, CONTRACT_REVIEW_TIER): PASS on 1c9d33c with S1, the same defect as M1 (7075101022; 7075132542 and 7075158506 are relay-queue duplicates). Delta PASS 7075183772 on this head closes S1. N1 and N3 are accepted deviations. N2, the cap constant's jsdoc reading as if the service call also refuses over 200 ids, is left as a nit.

Gates on this head (37525bf2):

  • check-governed-merges --pr 36295 reads NOT governed (974 changed lines).
  • K = 21 first-parent commits since the merge base; mergeable clean against current main; no translations/ or skills/ path.
  • All check-runs on their latest runs are success (61) or skipped (9). Test Core (3/10), the shard re-run once as a timing flake on 1c9d33c, is green on this head.
  • Changeset: patch on seven packages, Clause-②: yes (widening), Metadata-protocol: none.

Overlap the queue cannot see: open PR #36135 (a locked record's lines read as locked) changes the single lock read. Whichever of the two lands second must carry its master_detail line half into getRecordLocks. The batch-equals-single integration test has no line fixture, so nothing catches it mechanically.

The seat readies this PR and arms auto-merge in the same step. The PR carries Fixes #35795.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 22, 2026 06:41
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 22, 2026
Merged via the queue into main with commit 40e22f1 Nov 22, 2026
71 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-ahwb54 branch November 22, 2026 07:17
zhuangjianguo pushed a commit that referenced this pull request Nov 22, 2026
…line-edit-a11y

The approval-lock hook moved to one read per page (#36295); the
re-render on an answer is re-applied on its new shape.

Claude-Session: https://claude.ai/code/session_01QsR2jUc3qp6bHKSWijbjds
Co-authored-by: Claude <noreply@anthropic.com>
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 22, 2026
…bjectstack-ai#36306)

<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XP3RHGWUG7UH3fNa4tBa9UC)_
repo:objectstack#4 · os-project-manager ·
session_01FEkQ5okniknzVVR3KTSVr1

Fixes objectstack-ai#36035

Clause-②: no
Metadata-protocol: none

## 维护者速读

-
审批动态里「无人可审」那条系统说明不再显示岗位内部名:中文读者看到岗位的中文名(如「销售经理」),没有翻译时用岗位自己的显示名,都没有才退回内部名;英文审计原文不变。
- 接着上一轮「转交给管理员说明用岗位显示名」的修复,补上它留下的「无人可审」说明,属于控制台核心业务操作体验专题。
- 只改读取时的显示,库里存的审计原文和旧请求的说明都原样保留,转交规则不动;出问题可直接撤回。
- 无。

## What changes

1. **The note stores its literals as a reference.**
`no-approver-note.ts`: a new note stores `slots` (the slate's
`type:value` literals, `noApproverSlots`) in the `__noApproverNote`
snapshot entry instead of the pre-composed `who` string.
`noApproverWho(slate, positionLabel?)` composes `type 'value'`, naming a
position by the label `positionLabel` answers, else by its name.
`noApproverSentence` / `noApproverNoteText` take an optional
`positionLabel` and compose from `slots`; a note that stored `who`
(written before this change) is rendered from that string exactly as
before. `noApproverNoteOf` reads either shape.
2. **The read names the position the way objectstack-ai#36030 does.**
`ApprovalService.localizeRoutingNotes` builds the label map for the
note's positions through the existing `notePositionLabels` (reader's
pack `positions.NAME.label`, else the declared `label` from
`positionLabelSource`, else nothing) and passes it to
`noApproverNoteText`. No second resolver: the position-name extraction
is `slatePositions`, factored out of `adminRescuePositions` in
`admin-rescue-note.ts`, which now delegates to it.
3. **The stored English is unchanged.** The write site
(`approval-service.ts`, one hunk) stores `slots`; the row's `comment` is
still `noApproverNoteText(note)` with no render, which composes the same
`position 'NAME'` English as before. The refusal remedy and the
submitter's notice still compose from the slate with no labels (see
Acceptance notes).
4. **Docs.** `content/docs/automation/approvals.mdx`, the no-approver
paragraph: the note names the position by its label for a reader and by
its name in the stored text.

`approval-service.ts` carries three small hunks (import, the write line,
the read line); the note module could not carry the write and the read
alone. `overlap-check` is clean against objectstack-ai#36295, objectstack-ai#36247, objectstack-ai#36144 and
objectstack-ai#36135, which share that file.

## Tests

<details><summary>Pins: admin-rescue-named-slate.integration.test.ts,
new describe "[objectstack-ai#36035] the no-approver note names its position by its
label"</summary>

The suite's real `ApprovalService` on `ObjectQL` over in-memory SQLite,
an organization with no administrator (so the request opens on the slate
that names no one), the plugin catalog plus an app pack in a real
in-memory `i18n` service, and a `positionLabelSource` declaring
`sales_manager` as "Sales Manager".

- the snapshot stores `{ action_id, slots: ['position:sales_manager']
}`; the row stores the English with `position 'sales_manager'`; a
no-locale read is served that English;
- zh-CN (pack label 销售经理) reads `...担任 position '销售经理' 的成员...` and no
`sales_manager`;
- en and ja-JP (no pack key) read `position 'Sales Manager'`;
- a position no pack and no declaration knows (`treasury`) keeps its
name;
- CONTROL: a note rewritten to the old stored shape (`who: "position
'sales_manager'"`) renders exactly as before in zh-CN, en and with no
locale.

The pin went into the existing harness file as a sibling of the objectstack-ai#35418
describe rather than a new file: it reuses that file's engine,
organizations and `open` helper (AGENTS.md: a new pin for a component
with a shared harness goes into that file).
</details>

<details><summary>Ablations at 8a83eed (scripts/ablation-replace.mjs,
each restored to the HEAD blob with an empty git diff HEAD)</summary>

- A1 read site passes no `positionLabel`: 2 failed (zh-CN pack label,
declared label) / 3 passed.
- A2 write site stores the composed `who` again: 3 failed (snapshot
shape, zh-CN, declared) / 2 passed.
- A3 an unknown position's name dropped: 3 failed (snapshot English,
unlabelled name, legacy row) / 2 passed.
- A4 a stored `who` no longer read: 1 failed (legacy CONTROL) / 4
passed.
</details>

<details><summary>Runs at 8a83eed</summary>

- `pnpm --filter @objectstack/plugin-approvals test`: Test Files 126
passed (126), Tests 1813 passed (1813).
- `pnpm --filter @objectstack/plugin-approvals typecheck`: exit 0 (test
layer held at its ledgered debt).
- eslint over the four changed source files: exit 0.
</details>

## Acceptance notes

- The `__noApproverNote` snapshot entry is internal to
`@objectstack/plugin-approvals` (nothing in `packages/spec`, `ui/` or
the package index reads it); new notes carry `slots`, older ones keep
`who`, and the read accepts both.
- Same family, not in this PR, carried by objectstack-ai#36308 (class a,
user-visible): the decision door's refusal remedy and the submitter's
`approval.comment` notice compose the no-approver sentence from the
slate with no labels, so they still name the machine name (`...holds
position 'legal'...`, pinned in
`exclude-submitter.integration.test.ts`). The notice is rendered per
recipient at delivery, so labelling it needs the recipient's locale, not
the reader's.
- Observation, carried by objectstack-ai#36308 (class a, user-visible): the `{{who}}`
hole carries the approver type's English machine token in every pack, so
a zh-CN reader now reads `担任 position '销售经理' 的成员`, where the
administrators' note translates the type (`岗位「销售经理」`). Translating the
type needs a per-type clause in all eleven catalogs; out of this card's
scope.

## Verification

Read first: `no-approver-note.ts` (`noApproverWho`,
`noApproverSentence`, `noApproverNoteOf` — the old/new shape split), the
`localizeRoutingNotes` hunk in `approval-service.ts`, the write hunk at
`slateSource = 'no_one'`.

Two-minute check: `pnpm --filter @objectstack/plugin-approvals exec
vitest run src/admin-rescue-named-slate.integration.test.ts -t 36035` —
expect 5 passed.

<details><summary>Local gates at 8a83eed</summary>

`node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack
--ran`: 103 derived families accounted for, 103 run, 0 NOT-MEASURED (a
derived zero: every family recorded an exit code, all 0). Four first
answered exit 3 (prerequisite) and were rerun after it was met:
`check-plugin-teardown-shape --self-test` (pinned fixture commit
fetched), `check:skill-examples`, `check:i18n` and
`check:dual-build-cjs-loads` (after the build closure finished).
`overlap-check`: clean against origin/main and 4 open PRs. CI families:
not yet reported at open.
</details>

---
_Generated by [Claude
Code](https://claude.ai/code/session_01FEkQ5okniknzVVR3KTSVr1)_

<!-- signed: repo:objectstack#4 · os-project-manager ·
session_01FEkQ5okniknzVVR3KTSVr1 -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 22, 2026
…he Chinese stream says 动态 (objectstack-ai#36317)

repo:objectstack#4 · os-project-manager ·
session_01FEkQ5oLLK7uoxp33riiBJL
<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XTRdLmK9YYgMSCJ7NH2PuUY)_
Fixes objectstack-ai#36148

Clause-②: no
Metadata-protocol: none
Ruling-ref: 7074372050

## 维护者速读

- 记录页「动态」里的筛选从「全部 · 活动 · 讨论 · 变更」改为「全部 · 事件 · 讨论 · 变更」,英文
Events;中文的空状态改为「暂无动态」,旧标题、无权限、加载失败和筛选读屏标签都改说「动态」。
- 按你 04:45 选的 A(「A 改叫「事件」」)执行;每个筛选装什么不变,「变更」仍只放带前后值的字段变更(objectstack-ai#30074 裁定 C)。
- 出错时最坏是某个语言的筛选或空状态字眼不对,不影响数据;只改语言包的值和一处英文兜底,可直接撤回。
- 无

## What changes

- `detail.streamActivity` (the stream's events chip): zh-Hans and
zh-Hant 「事件」, en `Events`, and each other pack's own word for events: de
`Ereignisse`, es `Eventos`, fr `Événements`, ja `イベント`, ko `이벤트`, pt-BR
`Eventos`, ru `События`, ar `الأحداث`. The row reads 「全部 · 事件 · 讨论 ·
变更」. What the chip holds is unchanged (ruling 6649643659 on objectstack-ai#30074,
option C).
- zh-Hans and zh-Hant only, the rest of the stream takes the tab's word:
`detail.noActivity` 「暂无动态」 / 「暫無動態」 (the panel's one empty state, drawn
under every chip), `detail.activity` 「动态」 / 「動態」 (now equal to
`detail.timeline`, as in the other nine packs),
`detail.activityAccessDenied`, `detail.activityLoadFailed` and
`detail.filterActivity` say 动态. The other packs keep those four values.
- `RecordActivityTimeline.tsx`: the events chip's in-code English
fallback follows the pack (`'Events'`); comments naming the chip row
updated there and in `recordTimelineStream.ts`.
- Values only: no key added, renamed or removed. zh-Hant matches what
`gen:zh-hant` writes (the generator left the pack unchanged after the
edit).

Read first, by risk:
1. `ui/packages/i18n/src/locales/zh-Hans.ts` — the six `detail` values.
2. `ui/packages/i18n/src/locales/en.ts` — `streamActivity: 'Events'`.
3. `ui/packages/i18n/src/__tests__/timelineFilterWording-36148.test.ts`
— the new pins.

Two-minute verification: `pnpm --dir ui exec vitest run
packages/i18n/src/__tests__/timelineFilterWording-36148.test.ts` from
the repo root; expect 16 passed.

## Tests

- New `timelineFilterWording-36148.test.ts` (i18n): in zh-Hans and
zh-Hant no string the stream draws (title, chips, empty, access-denied,
load-failed, filter label) says 活动 / 活動, and the chip, empty state and
title read 事件 / 暂无动态 / 动态; en names the chip Events; in every pack the
events chip differs from the tab word, the stream title and the
field-history chip.
- Old pins updated to the ruled words: `ActivityTimeline.i18n.test.tsx`
(zh empty state), `ActivityTimeline.remainingLiterals.i18n.test.tsx` (zh
card title, whole zh card text, chip group label),
`detail-landmark-aria-i18n-4645.test.tsx` (zh landmark name).
- Ablation (one-off, not kept): zh-Hans `streamActivity` set back to
「活动」 on disk after the commit: 2 failed / 14 passed ("no string the
stream draws says 活动", "the chip reads 事件 …"); restored with `git
checkout HEAD --`, 16 passed.

## Acceptance notes

- Done-when, measured live: hotcrm (18.6.0 server, `pnpm dev` on a fresh
database) with this branch's Console source (Vite, `DEV_PROXY_TARGET` to
the hotcrm server), a zh-CN browser, admin user, a seeded lead. The
record tab row reads 「线索 · 客户 · 活动 · 活动参与者 · 任务 · 营销活动成员 2 · 动态 2」 and
the stream heads 「动态 (2)」. Every 活动 on the page is one of hotcrm's own
labels (the `crm_event` tab and nav entry, 活动参与者, 营销活动成员, 销售活动). On this
page the 动态 tab is a slotted page's `record:chatter`, which since objectstack-ai#36221
lists the system history alone, so no chip row draws there; the chips
and empty state are pinned by the tests above rather than by this page.
- Out of the claim's declared surface (locale packs):
`ui/packages/plugin-detail/src/RecordActivityTimeline.tsx` (the en
fallback, named by the ruling),
`ui/packages/plugin-detail/src/recordTimelineStream.ts` (comments only)
and three plugin-detail pin tests. None is a seat-1 hot file.
- Out of the claim's declared surface, added at `dd26af31`:
`ui/packages/components/src/renderers/layout/containers.tsx`,
`KNOWN_LABEL_DICT` `Activity` 「活动」/「活動」 → 「动态」/「動態」, with
`@object-ui/components` in the changeset. Why: it is the page-tab
strip's own copy of the label, read ahead of the pack, so without it an
authored `Activity` tab kept 活动 and
`page-tabs-builtin-label-i18n-4645.test.tsx` went red on `12a825da`
(Test UI 4/16). Ruling 7074372050 item 3 sets an authored `Activity` tab
to 动态, the same word as `detail.timeline`. Claim amended on objectstack-ai#36148 for
this file and `RecordActivityTimeline.tsx`.
- Residual (stated, not a defect): in zh an `Activity` tab and the
`Activity stream` tab both read 动态. Both draw on one strip only when a
page author writes both labels. Measured: the synthesized record page
writes only `Activity stream` (`buildDefaultPageSchema.ts:1094`); no
authored `Activity` page tab in `examples/**` or hotcrm (the
`'Activity'` hits are an object label and a nav group). The equality is
the ruling's choice (item 3).
- Not changed, measured: `useDetailTranslation.ts` has no
`detail.streamActivity` default, so there is no second English fallback
for the chip.

## Verification

Readings at head `12a825da`, taken under `scripts/pm/os-verify-lock.sh`
(shared box).

<details><summary>Packages (green)</summary>

- `pnpm --dir ui exec vitest run packages/i18n/`: Test Files 106 passed
(106); Tests 1978 passed, 13 skipped.
- `pnpm --dir ui exec vitest run packages/plugin-detail/` before the pin
updates: 4 failed in the two `ActivityTimeline` i18n files (old zh
strings), 405 files passed; after the updates those two files: 20 passed
(20).
- `pnpm --filter @object-ui/i18n run type-check` (both projects): exit
0. `eslint` on the 10 touched TS files: 0 errors (one pre-existing
`react-refresh` warning at `RecordActivityTimeline.tsx:263`, an
untouched line).
- `node ui/packages/i18n/scripts/gen-zh-hant.mjs`: no file changed.

</details>

<details><summary>Derived gates</summary>

- `node scripts/pm/dispatch-gates.mjs --commands` derived 41 commands
for this diff; all 41 ran and exited 0, among them `check:nul-bytes`,
`check:published-files`, `check:cross-package-test-inputs`,
`check:test-source-alias`, `check:type-check-coverage`,
`check:type-check-debt` (0 entries re-measured, none above its number),
`check-sdui-manifest`, `check-adr-0087-registration --base origin/main`,
`check-empty-changeset --base origin/main`, `check-changeset-no-major
--base origin/main` and `pnpm --dir ui exec vitest run scripts/` (Test
Files 172 passed, 2 skipped; Tests 5122 passed, 2 skipped).
- `--ran` reconciliation: 41 derived, 41 run, 0 NOT-MEASURED, 0 UNRUN,
every line carrying its exit code.
- `node scripts/pm/overlap-check.mjs
--branch=claude/project-thread-r2g68m`: VERDICT clean against
origin/main and the three open PRs that share the locale files (objectstack-ai#36295,
objectstack-ai#36288, objectstack-ai#36223).
- Type-check lanes, `check:i18n` (its prerequisite is the CLI build
closure; this diff touches no `translations/*.generated.ts`) and the
repo-wide lint are CI's.

</details>

---
_Generated by [Claude
Code](https://claude.ai/code/session_01FEkQ5oHi42qJhgAop8CaLs)_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01FEkQ5oHi42qJhgAop8CaLs

---------

Co-authored-by: Claude <noreply@anthropic.com>
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 22, 2026
…n one live region, a touch never edits in place (objectstack-ai#35689 slice A) (objectstack-ai#36332)

<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XURgXCZHcjPoyo5g9cMEATi)_

Part of objectstack-ai#35689 — slice A (touch, accessibility, checked rows). Slice B
(a row moving to its new group, group subtotals and the footer total
refreshing after a save) stays on the card for its own PR.

Clause-②: yes (widening)
Metadata-protocol: none

## 维护者速读

-
平板上点列表的一行只会打开记录,不会误进格子编辑;读屏软件移到不能改的格子会读出「只读」(审批锁在选中后才查到时也会立刻读出),格子保存后会读出「已保存:字段名」,失败时读出原因;其余用户无感。
- 列表行内编辑重做专题的收尾(无障碍与触屏部分),分组移动与合计刷新另开一个 PR。
- 出错时最坏是读屏软件少读或多读一句、平板上点到编辑按钮没反应,不影响保存的数据;可以直接撤回。
- 无

## What changes

Measured on `origin/main` before any edit (the dispatch's six mechanism
assumptions):

1. **Touch.** A touch tap on a cell opens the record and never selects
or edits (`isTouchPress`, from objectstack-ai#35684): holds, pinned. One gap measured:
a lookup cell's edit button (the pencil) is drawn at `opacity-0` once
any pointer enters the cell and is still hit-testable, so a tap on the
right edge of an unselected lookup cell landed on the invisible button
and **opened the editor in place**. Fixed in `CellEditButton`: a finger
entering an unselected cell does not draw the button, and a touch click
on one drawn earlier for a mouse does nothing (the row ignores a click
on a button). The press is read by its own click only, then cleared, so
a later click with no pointer of its own (assistive tech) edits as
before. The explicit edit entry on touch is the record page (a tap
beside the button opens it), per the card's 「通过记录页或显式的编辑入口」.
2. **`aria-readonly`.** Absent. Now, only when the table is
`role="grid"`, a data cell that opens no editor carries
`aria-readonly="true"`, and so does the type-catcher input that holds
focus in the selected cell (the element a screen reader lands on). Every
cell reads the table's own facts (`editable`, the column,
`isRowEditable`); the selected cell adds the host's (`describeCell`).
The host's answer is **asked as the cell becomes selected and kept in
state** (`selectedHostReadOnly`), asked again only when the selected row
is re-read or the host hands the table a new `GridCellSelection` value,
so it is not asked per render for a host whose value is stable.
`describeCell`'s TSDoc now says exactly that: asked when the reader acts
on a cell, once as a cell becomes selected, and again when its row is
re-read or the provider's value is a new object; the value's identity is
part of the contract, so a host keeps it stable (memoised) or the
selected cell is asked on every render.
- In the list (`ObjectGrid`), the host value is now memoised on what its
cell facts read (fields, object, permissions, the view's `editable`, the
update verdicts, the approval locks, the page's record ids, the
language), so it is new only when an answer can have changed; the commit
question and the chip opener read the latest render through a ref.
- `useRowApprovalLocks` re-renders its host when a lock read answers
(and when the answers are dropped on an invalidation): `isLocked` and
the hook's value are new exactly then. So a lock answered after the
select-time ask is said on the selected cell at once, without the reader
moving, both ways (locked by the service, or a pending `approval_status`
the service says is not locked).
3. **Live region.** Before: a per-cell `role="status"` span mounted with
its state, its words only in `aria-label`, plus `role="alert"` on
failure. A region that mounts with its content is often not announced,
and a label is not live content. Now one persistent visually hidden
`aria-live="polite"` region per table that saves per cell (`autosaves`),
drawn for the table's whole life; a successful save writes "Saved:
COLUMN" into it (new key `table.cellSavedAnnouncement`, all eleven
packs), each saying in a node of its own so the same words twice are
said twice. Cells saved together are joined with the pack's list
punctuation (`validation.formInvalidJoiner`, the key the form's field
lists use: `、` in ja and zh), and a column with no header is never named
by its key (the region then says `table.cellSaved`, "Saved"). A failure
stays with the existing cell alert, said once; the region drops the
earlier "saved". The per-cell mark becomes `role="img"` with its
existing label: named, never live, so no duplicate announcement.
4. **Focus after a picker panel closes** (`placement="below"`):
measured, it already returns to the cell by Esc and by a pick
(`focusSelectionRef`, objectstack-ai#35688). Pinned, no source change.
5. **Selection frame contrast** (`border-2 border-primary`, WCAG 1.4.11,
3:1 needed): passes everywhere, no change. Token arithmetic (sRGB
relative luminance) on the shipped themes:
- Console light (`--primary` 211 100% 50% on `--background` white):
3.97; on the hover row (muted/40) 3.74; on a checked row (primary/5)
3.73; on a checked hovered or active-record row (primary/10) 3.49; on
full muted 3.40.
- Console dark (211 100% 60% on 240 6% 6%): 6.34; hover 5.83; checked
6.03; checked hover/active 5.67.
- `@object-ui/components` default theme: 17.84 light, 19.09 dark, at
least 14.53 on any row state.
6. **Selection.** `commitCellValue` stages one cell and never reads
`selectedRowIds`; `selectionResetKey` moves only on bulk actions and
refresh: holds, pinned.

### Review round (L1 7076074435, L2 7076070602)

| Item | Resolution | Commit |
|:---|:---|:---|
| S1 (L1, L2): `describeCell` asked per render | Asked at selection,
kept in state; re-asked only on a re-read row or a new host value;
`ObjectGrid`'s value memoised so it is new only when its facts can
change. TSDoc kept as is. | `1733276c`, `6bc85294` |
| S2 (L2): a lock answered after the select-time probe |
`useRowApprovalLocks` re-renders on an answer; re-applied on main's
batched lock read (objectstack-ai#36295) in the merge | `1733276c`, `65b9199f` |
| N1: touch-tap comment, `pressedByRef` never reset | Comment says the
tap does nothing on the button; the press is cleared by the click that
reads it | `1733276c` |
| N2: hard-coded `', '`, raw `accessorKey` |
`validation.formInvalidJoiner`; a header-less column is left unnamed |
`1733276c` |
| N3: claim's file surface | The final file surface is in the dev report
for the seat to amend the claim | report |
| L1-d 7078101760 item 1, L2 R1 (7077725274): TSDoc still said "never
per render" | `describeCell` TSDoc says when the table asks it and that
the provider value's identity matters; the two data-table comments that
echoed it aligned | `69919545` |

## Tests

New card-named describes, each in the component's existing harness file:

- `data-table-select-first-35684.test.tsx`: a touch tap opens the record
and a touch double-tap neither selects nor edits; a tap on an unselected
lookup cell's edit button edits nothing (control: the mouse's click
edits); after such a tap, a click with no pointer of its own edits; the
selected read-only cell carries `aria-readonly` on the cell and its
focus, an editable one none; **the host's facts are asked as the cell is
selected and not again across three re-renders, and a new host value is
asked again and turns `aria-readonly` on where the selection is**; a
table that edits nothing marks every cell; control: outside the grid no
`aria-readonly`.
- `data-table-autosave-35685.test.tsx`: the region is there and silent
before any save, says "Saved: Name" after one, a second saying is a new
node, saving is not said, and the table holds exactly one live element;
cells saved together read `已保存:Stage、Name` in zh; a header-less column
reads "Saved"; a refused save is said by the cell alert alone and the
region empties; control: no region without per-cell save. With two rows
checked, a cell edit sends one update of that one cell and both checks
stay.
- `data-table-keys-35687.test.tsx`: a picker panel under the cell hands
focus back to the cell on Esc and on a pick.
- `ObjectGrid.cellSelection-35684.test.tsx`: with the page's lock read
held open, a row the service says is locked turns `aria-readonly` on
once the read answers, and a row whose `approval_status` stands in as
locked turns it off once the service says it is not, both while the cell
stays selected.

Readings, all through `scripts/pm/os-verify-lock.sh`. Head `69919545`
changes only the TSDoc and two comments over `65b9199f`:

<details><summary>At 6991954 (TSDoc round)</summary>

- Closure build `pnpm --workspace-concurrency=2 --filter
'@object-ui/components^...' build`, then `pnpm --filter
@object-ui/components run type-check`, then the three data-table
harnesses and `ObjectGrid.cellSelection-35684`: Test Files 4 passed (4);
Tests 116 passed (116); VERDICT command-exit 0.
- `dispatch-gates --commands` re-derived: the same 42 families as at
65b9199; `pnpm check:nul-bytes` exit 0. The other families were not
re-run locally for a comment-only delta; CI runs them (below).

</details>

<details><summary>Type-check, the touched harness files and the affected
packages' suites at 65b9199</summary>

- Closure build `pnpm --workspace-concurrency=2 --filter
'@object-ui/plugin-grid^...' build`, then `pnpm --filter
@object-ui/components run type-check`, `pnpm --filter
@object-ui/plugin-grid run type-check`, `pnpm --filter @object-ui/i18n
run type-check`: VERDICT command-exit 0 (each script name echoed in the
log).
- Six harness files (the three table harnesses,
`ObjectGrid.cellSelection-35684`, `ObjectGrid.autosave-35685`,
`ObjectGrid.requiredPrompt-35956`): Test Files 6 passed (6); Tests 154
passed (154).
- `pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-grid/
packages/components/ packages/i18n/`: Test Files 910 passed, 1 skipped
(911); Tests 9532 passed, 37 skipped (9569); VERDICT command-exit 0.
- `pnpm --dir ui exec vitest run --maxWorkers=2 scripts/` (derived
family): Test Files 172 passed, 2 skipped (174); Tests 5127 passed, 2
skipped (5129); exit 0.

</details>

<details><summary>Ablations this round (one each, through
`scripts/ablation-replace.mjs`: anchor hit once, blob changed, restored
to the HEAD blob, `git diff HEAD` empty)</summary>

The suites read `data-table.tsx` and the hook from source (the ui vitest
config aliases `@object-ui/components` to `src`; the grid test imports
the hook relatively), so no rebuild per leg was owed.

- A1, the per-render ask put back (`cellReadOnly` calling
`readOnlyReasonOf` on the selected cell): 1 red, "the host's facts are
asked as the cell becomes selected, never per render" (expected 2 calls,
got 5); the other aria pins stay green, as they should.
- A2, the hook's re-render on an answer removed: 2 red, both lock-answer
pins in `ObjectGrid.cellSelection-35684`.
- A3, the press not cleared by its click: 1 red, "after a tap on the
edit button, a click with no pointer of its own (assistive tech) edits".
- A4, the Latin comma put back: 1 red, the zh list-punctuation pin.
- A5, the key fallback put back: 1 red, "a column with no header is not
named by its key".
- Restore proof after the run: `data-table.tsx` blob b7a0e66 and the
hook blob 271953e, each equal to HEAD; `git diff HEAD` 0 lines.

</details>

<details><summary>Earlier readings (previous dev, heads e276bef and
2c776b4)</summary>

- At e276bef: components and i18n type-check exit 0;
`packages/components/ packages/i18n/` Test Files 608 passed, 1 skipped;
`scripts/` 172 passed, 2 skipped files.
- Ablations then: cell `aria-readonly` removed, 2 red; the region's
success saying removed, 2 red; the touch guard removed, 1 red.

</details>

## Acceptance notes

- Not done here, by the card's split: slice B (a row moving to its new
group after a save, group subtotals and the footer total refreshing)
follows on its own PR.
- `aria-readonly` on cells other than the selected one reads the table's
own facts only (`editable`, the column, `isRowEditable`); the host's
per-cell facts (`describeCell`: field read-only, permission, approval
lock) are asked of the selected cell alone, because the table asks
`describeCell` only at the moments its TSDoc names, never for every
cell. A screen reader moving cell to cell always lands on the selected
cell, so the acceptance line holds; a reader browsing the table in its
virtual mode hears the coarser answer on cells it does not select.
- While the selected row's lock read is on the wire, the selected cell's
`aria-readonly` reads the `approval_status` column (the hook's fail-open
stand-in) and changes when the read answers; Enter or F2 in that window
waits for the read (objectstack-ai#36295) and says the reason.
- The `ObjectGrid` memo is not pinned by a test of its own (its call
count is internal to the host); the table-level pin holds the table to
"never per render" for any host whose value is stable.
- "A touch never edits in place" is a fact of the select-first model
(`cellSelection`): there a click only selects, so `singleClickEdit` is
never read, and the touch pins in
`data-table-select-first-35684.test.tsx` already run with
`singleClickEdit: true`. `ObjectGrid` passes `singleClickEdit:
schema.singleClickEdit ?? true` on main today; objectstack-ai#36357 (read at
`579f99ae`) also edits `ObjectGrid.tsx` (`hostCellSelection =
cellSelectionProp ?? inlineEditable`, `singleClickEdit: true`) and
`ObjectGrid.cellSelection-35684.test.tsx`; it makes every grid that
renders editable select-first, so this behaviour extends to them and no
pin here flips; `node scripts/pm/overlap-check.mjs --pr=36357` on
6991954: merges cleanly, VERDICT clean. The one residual is a host
passing `cellSelection={false}` explicitly (none in-tree). A grid on the
older click-to-edit model (no `cellSelection`, `singleClickEdit` true)
still edits on a touch tap, as it did before this PR; that model is
outside this slice.
- A tap that lands on a lookup cell's edit button drawn earlier for a
mouse (a hybrid device) now does nothing at all rather than editing; the
row's click handler ignores clicks on buttons, so the tap does not open
the record either. A finger alone never draws the button.
- Real screen-reader output (VoiceOver, NVDA) and a real iPad were not
exercised; the pins are jsdom, and the claim about a region that mounts
with its words is the general live-region behaviour, not a measurement
here.
- Selection frame contrast: no change needed; the readings are in What
changes.

## Verification

Read first (risk order):
1. `ui/packages/plugin-grid/src/ObjectGrid.tsx`, the `gridCellSelection`
memo and its dependency list: a missing dependency would leave the
selected cell's `aria-readonly` stale until the reader moves (act-time
reads stay fresh either way).
2. `ui/packages/components/src/renderers/complex/data-table.tsx`, the
`selectedHostReadOnly` layout effect and the `cellReadOnly` line in the
body-cell map.
3. `ui/packages/plugin-grid/src/hooks/useRowApprovalLocks.ts`, the
`answerSeq` bump in the read's `finally` and on the invalidation reset.

Two-minute check: `pnpm --dir ui exec vitest run
packages/plugin-grid/src/__tests__/ObjectGrid.cellSelection-35684.test.tsx`,
expect every test passing, among them the two in "the selected cell says
a lock that answers after it was selected (objectstack#35689)".

<details><summary>Local gates (targeted, derived from the diff) at
65b9199</summary>

`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived 42 families (19 paths vs merge base
c448c61); all run, every one exit 0 (`check:query-options-erasure`
re-run without the loop's 300 s cap after the first try hit it: exit 0,
"ratchet holds"). `pnpm check:type-check-debt`: exit 0, "0 raw tsc
error(s) total". `--ran` reconciliation: 42 derived, 42 run, 0
NOT-MEASURED, 0 UNRUN, exit 0. ui i18n gates: `check:i18n-keys`,
`check:i18n-drift`, `check:i18n-dead-keys` exit 0. `pnpm
check:nul-bytes`: exit 0. `node scripts/pm/overlap-check.mjs` before
each push: VERDICT clean (at 65b9199 after merging origin/main, which
had conflicted on the lock hook and its test; at 6991954 against
origin/main ff60149 and 10 open heads, and with `--pr=36357`).

CI on 6991954: 45 success, 13 skipped, 0 failure (on 65b9199 before
it: 47 success, 15 skipped), among them Lint and Repo Gates, TypeScript
Type Check, Test Core, Governed Surface Queue Guard, Lint UI, Type Check
UI, Test UI (16/16 shards), Build and E2E UI, Live E2E UI, Dogfood
Regression Gate, Check Changeset, PR-body guards.

</details>

---
_Generated by [Claude
Code](https://claude.ai/code/session_01QsR2jUc3qp6bHKSWijbjds)_

<!-- signed: repo:objectstack#7 · zhuangjianguo ·
session_01QsR2jUc3qp6bHKSWijbjds -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
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.

List inline edit: do not open a cell editor while the row's approval lock is still being read, and read locks in one batch

2 participants