Skip to content

feat(plugin-approvals): the record lock reads say whether a row is held by its own approval or by its master's - #37191

Merged
objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/issue-37151-lock-source-field
Nov 25, 2026
Merged

objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/issue-37151-lock-source-field

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

repo:objectstack#3 · os-support-ai · session_01WGufzeiHatzB4rRx1t4Php

Requested by Yibo Wang · project thread

Fixes #37151
Clause-②: yes (widening: both lock doors' published entry gains a field)
Metadata-protocol: none
Ruling-ref: 7148480184 (maintainer, option A, 2026-11-25T00:22Z; seat record 7148474531). Execution, not a decision.

维护者速读

  • 列表页和单条记录的“查锁”接口现在多回答一项:被锁的记录是自己的审批锁住的,还是所属主记录的审批锁住的;页面上暂时无变化,表格据此隐藏删除按钮由另一张卡(表格行菜单)接着做。
  • 按你选定的方案 A 落地,替审批中报销单、订单的明细行使用者解决“列表给了删除、点了却被拒”的问题。
  • 出错时最坏情况是某行的锁类型标错,表格多藏或少藏一个删除按钮,不会写错任何数据;可直接撤回。
  • 无

What changes

  • Both lock doors answer the kind. IApprovalService.getRecordLock and getRecordLocks (and their REST doors GET /api/v1/approvals/records/:object/:recordId/lock, POST /api/v1/approvals/records/:object/locks) answer a locked readable row { locked: true, lockSource: 'record' | 'master' }, an unlocked one { locked: false }; null (404 / locked: null) still means unreadable-or-missing, never told apart.
    • 'record': a pending request on the row itself under a locking node. Its delete is accepted and cancels the request.
    • 'master': the row is a master_detail line of a held record (bindDetailRowLockHook refuses insert, update and delete). It wins when both hold (a self-held line under a held master), because that is the delete the server refuses.
  • One spelling of the answer: recordLockAnswer(heldByMaster, heldItself) in approval-service.ts builds it for both doors. The single door asks the master's lock first (so a self-held line under a held master answers 'master'); the page door now asks the detail-row lock of every readable row, not only of the rows its record lookup left unlocked. Read counts per page are unchanged (the two existing read-count pins hold byte for byte).
  • Spec contract (packages/spec/src/contracts/approval-service.ts): both return types gain the optional lockSource?: 'record' | 'master' (optional, so an implementation answering { locked } alone still conforms — a pure widening; no exported type or const is added, as with the original member). The console: a non-participant reader is offered inline edit on a record whose pending approval locks it (lockRecord: true), and the save answers 409 RECORD_LOCKED #25934 ruling A sentence "What is answered: locked only." is revised to state the new answer and cites ruling 7148480184; the batch docblock's "exactly what getRecordLock answers for that id" now says "spelled as the engine spells it" and names the anchor difference.
  • REST (approvals-routes.ts): both doors serve the answer through one projection, recordLockPayload, field by field — locked, and lockSource only on a locked answer and only when it is 'record' or 'master'. Anything else an implementation hands back (a request id, pending, an unknown kind) is not served; a locked answer naming no kind is served { locked: true }. The route comment's parity sentence ("Each entry is exactly the single-record door's answer for that id") now adds "as the engine spells it" and names the anchor difference.
  • Readability anchors, unchanged at both doors (item 7148285178; Round 2 below). The two doors keep different readability anchors on purpose: the single door counts any returned row, the batch door only the row whose id is the asked id; aligning them would narrow a published answer (seat ruling on PR feat(plugin-approvals): the record lock reads say whether a row is held by its own approval or by its master's #37191). Pinned both ways: the single door answers the lock for a loosely spelled id, the batch door answers it null, and the two agree for every id spelled as the engine spells it.
  • Docs: content/docs/automation/approvals.mdx states lockSource where it states the lock answer, and the exact-spelling rule.
  • Changeset: spec, plugin-approvals, rest at patch (Metadata-protocol: none ⇒ patch under the changeset-level ruling; the widening is declared on the Clause-② line).

Disclosure bound (#8652 ruling 5299823744). The field adds one kind bit to an answer already served only to a caller who can read the row: no request id, node, participants, approver identity, pending flag or request content. A caller who can write the line already learns the kind from the RECORD_LOCKED sentence; a read-only line reader learns which of the row and its master holds it, where before they learned that one of the two does.

Field name, measured. lockSource, as claimed: spec api/protocol.zod.ts lockSource ("Which layer asserted the lock", an enum beside the lock flag, kernel/metadata-protection.zod.ts MetadataLockSourceSchema). Other lock* keys measured in packages/spec/src: lockedBy (a user id, ui/view.zod.ts), lockScope (automation/execution.zod.ts: global / per_record / per_user, the scope a concurrency lock covers, not its origin), lockState, lockReason; heldBy in packages/cli names holder packages (a principal). None is closer.

Read these first

  1. packages/plugins/plugin-approvals/src/approval-service.ts — getRecordLock (master asked first) and getRecordLocks (detail lock over every readable row). Riskiest hunk: the master-first order in getRecordLock.
  2. packages/rest/src/approvals-routes.ts — recordLockPayload, the disclosure projection.
  3. packages/spec/src/contracts/approval-service.ts — the revised ruled sentence.

Two-minute verification

pnpm --filter @objectstack/plugin-approvals exec vitest run --maxWorkers=2 src/record-lock-read.integration.test.ts — expect 20 tests passed, including the lockSource describe (self-held record 'record', line of a held master 'master', self-held line under a held master 'master' and its delete refused RECORD_LOCKED, self-held line under an unheld master 'record' and its delete accepted) and the describe pinning each door's own readability anchor for a loosely spelled id.

Tests

  • record-lock-read.integration.test.ts (real ObjectQL + better-sqlite3 + ApprovalsServicePlugin.start()): existing pins re-expressed with the kind; new top-level describes — lockSource single/batch parity for a self-held record, a line of a held master, a self-held line under a held master, an unheld record and line, a self-held line under an unheld master, the decided state; each kind tied to the delete the server refuses or accepts; and the readability anchor: a case-insensitive-collation stand-in (a read middleware folding id predicates), with a CONTROL that the engine does hand the row back under the loose spelling; the single door answers the lock for it, the batch door null; parity for every caller on ids the engine echoes; and a read-count pin for a page with a missing id.
  • client.test.ts: both SDK answers carry and type lockSource (a typed assignment the test program compiles).
  • rest-approvals-record-lock-route.test.ts: both doors serve lockSource on a locked answer, drop it on an unlocked one, drop an unknown kind and extra fields.
  • approval-record-lock-read.dogfood.test.ts: the fixture's LOCKED body gains lockSource: 'record' (stale-fixture consequence of this change).
Run readings (head 00e32ec)

Union of the derived local families at a453d12; the two ratchet families re-run at the final head 00e32ec (its only change types two test-call option bags).

  • pnpm --filter @objectstack/plugin-approvals test (a453d12): Test Files 128 passed (128), Tests 1928 passed (1928), lock VERDICT command-exit 0.
  • pnpm --filter @objectstack/plugin-approvals typecheck + vitest run src/record-lock-read.integration.test.ts (00e32ec): check:test-typecheck: OK ... 8 file(s) / 321 error(s) (unchanged debt), Tests 20 passed (20), VERDICT command-exit 0.
  • pnpm --filter @objectstack/rest test (a453d12): Test Files 429 passed (429), Tests 8819 passed | 351 skipped (9170), VERDICT command-exit 0; pnpm --filter @objectstack/rest typecheck: exit 0.
  • pnpm --filter @objectstack/spec build && pnpm --filter @objectstack/spec check:generated: All 14 generated artifacts are up to date, exit 0.
  • Dogfood, this file only (pnpm --filter '@objectstack/dogfood^...' build, then vitest run test/approval-record-lock-read.dogfood.test.ts): Tests 1 passed (1), VERDICT command-exit 0. Full battery not owed (no !, widening arm).
  • dispatch-gates --ran: 119 derived famil(ies) accounted for — 116 run, 3 NOT-MEASURED. NOT MEASURED (exit 3, PREREQUISITE NOT MET, all in CI): check-plugin-teardown-shape --self-test (shallow clone cannot reach its pinned fixture commit), spec check:skill-examples (client-react not built in this worktree), check:dual-build-cjs-loads (unbuilt packages). check:query-options-erasure was red at a453d12 (test surface 236 to 237, two new as any option bags) and green at 00e32ec (ratchet holds, test surface: 236). check:nul-bytes at 00e32ec: OK.
  • overlap-check: VERDICT clean exit 0 (origin/main and feat(approvals): a decided request's step line says where the record's approval went next #37148).

Round 2 (seat ruling on PR #37191), head e99cf2c

  • Anchor: not narrowed. The single door's readability anchor is restored byte for byte to origin/main (any returned row counts as readable); the batch door keeps its strict anchor. The two doors keep different readability anchors on purpose: the single door counts any returned row, the batch door only the row whose id is the asked id; aligning them would narrow a published answer (seat ruling on PR feat(plugin-approvals): the record lock reads say whether a row is held by its own approval or by its master's #37191). I found no reason the single door cannot keep its anchor: the lockSource master check reads the row through the engine (detailRowHeldByLockingApproval, whose existing pin answers from the row it found, not from the engine's spelling), so a loosely spelled line of a held master answers 'master' at the single door. The round-1 anchor-parity pin is replaced by pins for the two kept behaviours. Changeset, approvals.mdx, both docblocks, the plugin docblocks and the batch route comment now state the two anchors instead of an alignment.
  • Client SDK: client.approvals.getRecordLock and getRecordLocks (packages/client/src/index.ts) type the answer with the optional lockSource?: 'record' | 'master'; pinned in client.test.ts with a typed assignment. @objectstack/client patch added to the changeset. Still a widening under the declared Clause-②.
  • Not touched: record-page-routes.ts and the skills sentence (routed to triage by the seat).
Round 2 run readings (head e99cf2c)
  • pnpm --filter @objectstack/plugin-approvals test: Test Files 128 passed (128), Tests 1928 passed (1928); rest vitest run src/rest-approvals-record-lock-route.test.ts src/rest-write-response-internal-fields.tripwire.test.ts: Tests 36 passed (36); pnpm --filter @objectstack/client test: Test Files 59 passed (59), Tests 820 passed (820); one lock run, VERDICT command-exit 0.
  • Typecheck plugin-approvals (test-layer debt unchanged at 321), rest and client (test layer 0 errors): exit 0. spec build && check:generated: All 14 generated artifacts are up to date.
  • Reverse checks (fix committed, worktree-only restores, both files restored with git checkout HEAD, hashes equal to HEAD's): approval-service.ts from 00e32ec (the strict single-door anchor) makes the kept-anchor pin red (1 failed | 19 passed); packages/client/src/index.ts from origin/main makes the client test-layer typecheck red (src/client.test.ts: 2 type error(s)).
  • dispatch-gates --ran: 120 derived famil(ies) accounted for — 116 run, 4 NOT-MEASURED. NOT MEASURED (exit 3, PREREQUISITE NOT MET; all run in CI): check-plugin-teardown-shape --self-test (shallow clone), spec check:skill-examples (client-react not built), check:dual-build-cjs-loads and check:i18n (workspace packages and the CLI not built in this fresh worktree). check:query-options-erasure and check:nul-bytes: exit 0.
  • overlap-check: VERDICT clean exit 0 (origin/main 893eac8 and feat(approvals): a decided request's step line says where the record's approval went next #37148).

Round 3 (L1 7152634100, L2 PASS with S1 7152618670), head 030cd91

Wording only; no behaviour change.

Round 3 run readings (head 030cd91)
  • overlap-check: VERDICT clean exit 0 (origin/main bc3ec37, feat(approvals): a decided request's step line says where the record's approval went next #37148), run before the push.
  • One lock run (VERDICT command-exit 0): closure build of client and plugin-approvals (spec rebuilt), spec check:generated All 14 generated artifacts are up to date, typecheck client / plugin-approvals (test debt 321, unchanged) / rest exit 0, record-lock-read.integration.test.ts Tests 20 passed (20) (test header text changed).
  • Text gates, exit 0: check:doc-authoring, check:issue-citations, check:docs-transcript-drift, check:nul-bytes, spec check:docs, check-affected-docs, check-empty-changeset, check-changeset-no-major, check:spec-docblock-symbol-anchors.

Acceptance notes

Verification

  • Reverse verification (fix committed first): approval-service.ts restored from origin/main (a10345a) into the worktree only, record-lock-read.integration.test.ts run: 11 failed / 9 passed (round 1, at db800fe: every new and kind-bearing pin red); restored with git checkout HEAD --, blob hash equal to HEAD's, git diff HEAD empty.
  • Cross-package type check: the plugin's getRecordLock return type widened to admit a third kind ⇒ tsc --noEmit red TS2416 Property 'getRecordLock' in type 'ApprovalService' is not assignable to the same property in base type 'IApprovalService' against the rebuilt spec dist; restored, hash verified.
  • overlap-check --branch=claude/issue-37151-lock-source-field: VERDICT clean exit 0 — merges cleanly with origin/main and with feat(approvals): a decided request's step line says where the record's approval went next #37148 (shares both approval-service.ts files, different regions).

Generated by Claude Code

…s a row (lockSource)

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzeiHatzB4rRx1t4Php
… the read echoes the asked id

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzeiHatzB4rRx1t4Php
@github-actions github-actions Bot added size/m 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 25, 2026
@github-actions

github-actions Bot commented Nov 25, 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 13 documentable anchor(s).

3 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/ai/actions-as-tools.mdx (via IApprovalService (symbol, a top-level interface))
  • content/docs/automation/approvals.mdx (via ApprovalService (symbol, a top-level class), IApprovalService (symbol, a top-level interface), approvals.getRecordLock (sdk, the route ledger binds it to GET /api/v1/approvals/records/:object/:recordId/lock, selected by route anchor /approvals/records/:object/:recordId/lock), approvals.getRecordLocks (sdk, the route ledger binds it to POST /api/v1/approvals/records/:object/locks, selected by route anchor /approvals/records/:object/locks), getRecordLock (sdk, the bare tail of client method approvals.getRecordLock, bound to GET /api/v1/approvals/records/:object/:recordId/lock), getRecordLocks (sdk, the bare tail of client method approvals.getRecordLocks, bound to POST /api/v1/approvals/records/:object/locks), /approvals/records/:object/:recordId/lock (route, bridged from symbol getRecordLock — its route source's handler names it; bridged from symbol recordLockPayload — its route source's handler names it), /approvals/records/:object/locks (route, bridged from symbol getRecordLocks — its route source's handler names it; bridged from symbol recordLockPayload — its route source's handler names it))
  • content/docs/automation/flows.mdx (via ApprovalService (symbol, a top-level class))

⛔ 3 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-6.mdx (via ApprovalService (symbol, a top-level class))
  • content/docs/releases/v18/18-1.mdx (via ApprovalService (symbol, a top-level class))
  • content/docs/releases/v18/18-2.mdx (via /approvals/records/:object/:recordId/lock (route, bridged from symbol getRecordLock — its route source's handler names it; bridged from symbol recordLockPayload — its route source's handler names it))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 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; 124 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 — 182 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 bc3ec37a669f1b80c393e31393caea49fb4f7b09 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from a9e4e9a765f715fa249a3e25a404904ca1dd552a — the merge of head 030cd914ca876896bf487e2a01efaf24aeba3b37 into base bc3ec37a669f1b80c393e31393caea49fb4f7b09, 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 a9e4e9a765f715fa249a3e25a404904ca1dd552a && git checkout a9e4e9a765f715fa249a3e25a404904ca1dd552a
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin bc3ec37a669f1b80c393e31393caea49fb4f7b09 030cd914ca876896bf487e2a01efaf24aeba3b37 && git checkout -B drift-repro bc3ec37a669f1b80c393e31393caea49fb4f7b09 && git merge --no-ff 030cd914ca876896bf487e2a01efaf24aeba3b37

node scripts/docs-audit/affected-docs.mjs --json bc3ec37a669f1b80c393e31393caea49fb4f7b09

⚠️ 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 bc3ec37a669f1b80c393e31393caea49fb4f7b09 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…; type lockSource in the client SDK

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs

Contract-review-claim: session_01WGufzgv2LZN1W2qSYTZvYs · head e99cf2c · 2026-11-25T04:05Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: e99cf2cfdea67ae14b2d5218f32618df96a10293
Local-runs: none
Scope: packages/spec/src/contracts/approval-service.ts + packages/plugins/plugin-approvals/src/approval-service.ts, packages/rest/src/approvals-routes.ts, packages/client/src/index.ts

Inputs read: card #37151 body and all eight comments (triage 7146843018, anchor item 7148285178, rulings 7148474531 and 7148480184, triage 7148580286, claim 7150121798, dev reports 7151644818 and 7152480071); PR #37191 body, file list and net diff against main (merge base a10345a); the check-runs on the head. Code outside the diff was read, not reviewed: lifecycle-hooks.ts (recordHeldByLockingApproval, detailRowsHeldByLockingApproval, lockingRequestsForRecords, pendingRequestFor, bindDetailRowLockHook), record-page-routes.ts, rest-route-ledger.ts.

① Derived judgments

  • IApprovalService.getRecordLock / getRecordLocks return types gain lockSource?: 'record' | 'master'. Right, and a pure widening: the field is optional, no export is added, an implementation answering { locked } alone still type-checks, and every in-tree caller outside the diff reads locked alone (record-page-routes.ts, service-storage/record-file-access.ts).
  • REST wire, both doors. Right. A locked entry gains one field; an unlocked entry, the 404 and the batch locked: null entry are byte-for-byte what main serves. recordLockPayload keeps locked: lock.locked === true semantics and serves lockSource only from the closed pair, so nothing an implementation adds reaches the wire. No request accept-set moves: the closed query sets and the recordIds body key are untouched. No published response schema names these routes (the route ledger rows carry no shape), so nothing else is owed.
  • Client SDK types. Right: both answers widen with the same optional field (see ④).
  • locked itself is unchanged at both doors. Right. Batch: held.has(id) || heldByMaster.has(id) became recordLockAnswer(heldByMaster.has(id), held.has(id)), the same truth value; the detail check now runs over every readable id instead of the unheld ones, same number of reads. Single: the two judgements run in the other order, same truth value.
  • Readability anchors. Right as built: the single door's anchor is the main text unchanged (any returned row), the batch door's is unchanged (the row whose id is the asked id). No published answer narrows, so no (narrowing) arm is owed.
  • Metadata-protocol: none. Right: nothing a metadata author can write changes.
  • Gates. Every check-run on the head concluded success or skipped; none failed, none pending. Check Changeset, Governed Surface Queue Guard, PR-body guards, the Type Check families, Test Core 1 to 10 and the Dogfood Regression Gate are among the successes.

② Semver level

Clause-②: yes (widening: both lock doors' published entry gains a field) is the right line and the right arm: a published return type and two wire answers gain an optional field, nothing is taken away. Metadata-protocol: none is right. Under AGENTS.md (changeset rule 3: the level follows the kind alone; none takes patch; a non-protocol change, widening or breaking, ships patch) patch is the correct level, not minor. The changeset names all four packages the diff publishes from (@objectstack/spec, @objectstack/plugin-approvals, @objectstack/rest, @objectstack/client) and carries both declaration lines line-initial, as the PR body does. Check Changeset is green on the head.

③ Boundary flags

  • Round-1 open question 1 (client type, record-page composite, skill sentence). Answered. The client type is in this diff. The composite is carried by card approvals: the record page composite lock still answers { locked } only, without the lockSource that #37151 adds to the lock doors #37195. The skill sentence ("locked and nothing else") is routed to triage per the PR body; I found no card naming it, so the seat confirms its carrier before merge. Neither is in this diff, and neither is made wrong on the wire by it (the composite keeps serving { locked }).
  • Round-1 open question 2 (is a narrowing arm owed for the anchor alignment). Answered by removal: head e99cf2c restores the single door's anchor, so nothing narrows and the widening arm stands alone.
  • Anchor item 7148285178, escalated to the seat (record, not code). Ruling record 7148480184 and triage 7148580286 both say the anchor is aligned in this change with a parity pin. The head does the opposite, on a "seat ruling on PR feat(plugin-approvals): the record lock reads say whether a row is held by its own approval or by its master's #37191" that the spec docblock, the plugin docblocks, the route comment and the changeset all cite, and that exists nowhere as a comment with an id: its only trace is the edited footer of claim 7150121798. Not aligning is the right call on the merits (the only alignment one $in read allows is the strict one, which turns a served answer into a 404, a narrowing nobody ruled). But Fixes #37151 closes the card with that row unticked. Owed before merge, on the card: the seat's ruling as a comment of its own, and the row either ticked as "kept different, on purpose" or moved to a carrier.
  • Dev's unfiled inference (write hook keyed on the writer's spelling of the id), corroborated by reading, escalated. pendingRequestFor matches sys_approval_request.record_id against the id exactly as asked, at the write hook and at both reads. On a driver that matches a row under a looser spelling than that text column does, a by-id update could miss the lock. Outside this diff and not changed by it; it is a lock-bypass shape, so it deserves a card and a measured probe rather than "noted, not filed". Finding S1 below is the read-side face of the same fact.
  • SQL push-down. No finding. The diff adds no read and no id materialisation: the batch door's detail check takes readableAsked where it took the unheld subset, still 1 + edges bounded reads under the 200-id cap, and the in-app judgement has its stated reason (node_config_json snapshot, the write hook's own judgement) in detailRowsHeldByLockingApproval's docblock.

④ Design judgment

packages/spec/src/contracts/approval-service.ts (hits), against ruling 7148480184 and its first consumer (the grid row menu, #36911). The revised "What is answered" bullet states the ruling exactly: locked, lockSource only on a locked answer, 'record' and 'master' defined by the two existing judgements, master wins when both hold, { locked: false } with no kind, null unchanged, no request id, node, participants or pending. The revision of the #25934 sentence is cited to the ruling that made it. The field name follows the claim's measured precedent (lockSource in api/protocol.zod.ts). The consumer's need (hide Delete where the server refuses it) is met by 'master' winning: the detail-row hook refuses a line's delete whenever a master is held, whatever the line's own request.

Cases, both doors, read against approval-service.ts and lifecycle-hooks.ts at the head:

Case Single door Batch door Agrees with the docblock
readable, held by its own request only { locked: true, lockSource: 'record' } same yes
readable line, master held only { locked: true, lockSource: 'master' } same yes
readable line, both held 'master' (master asked first) 'master' (recordLockAnswer tests master first) yes
readable, own request on a non-locking node, master unheld { locked: false } same yes
readable, unlocked { locked: false }, no lockSource same yes
unreadable null, returned before any lock read null; the id never reaches a lock read yes
missing, blank id, object read refused null null at each position yes
repeated id n/a answered at each position yes
loose spelling, line of a held master 'master' null yes
loose spelling, held by its own request { locked: false } (see S1) null no

S1 (should-fix) — the batch docblock's new sentence "an id the engine matches under another spelling answers null here and the lock there" is not what the single door does for a record held by its own request. getRecordLock passes the id as asked to recordHeldByLockingApproval, which matches sys_approval_request.record_id against that exact string (pendingRequestFor); only the master half is judged off the row the engine found. So a self-held record asked as '07' for a numeric 7 (one of the two examples the docblock itself names), or in another letter case on a store whose bookkeeping column compares exactly, is readable, is held, and answers { locked: false }. In the PR's own rig (ids folded on the business objects only) a self-held held_sheet asked in upper case would answer unlocked; the new pin covers the master-held line alone. The behaviour is main's and this diff does not change it, which is why it is not a must-fix; the sentence is new, sits in the published contract, and promises the wrong direction for a lock read (unlocked for a held record). Fix, either: (a) say what is true: at the single door a loosely spelled id is judged for its master's lock off the row found and for its own lock off the id as asked, so a self-held record may answer { locked: false }, and callers send ids as the server spelled them; the changeset and approvals.mdx ("answers its lock") follow; or (b) judge the row's own lock off the id the caller's read handed back, with a pin for the self-held loose case. (b) changes a served answer from false to true and belongs with the write-hook card in ③; (a) is the fix that fits this PR. Read from code, not run; no public entry was shown to send such an id.

packages/plugins/plugin-approvals/src/approval-service.ts. Agrees with the contract in every row above but the last. recordLockAnswer is the one spelling both doors use, so they cannot order the two kinds differently. The single door asks the master first and skips the own-request lookup when the master holds; the batch door now asks the detail lock of every readable id, which is what makes "both held" answer 'master' there too. Disclosure: heldByMaster and held are consulted only for ids in readableIds, and the single door returns null before any SYSTEM read, so an unreadable or missing row learns nothing, and the two nulls stay indistinguishable in shape and in reads issued. The docblocks' statements about readability (any returned row at the single door, the row whose id is the asked id at the batch door) are true of the code.

packages/rest/src/approvals-routes.ts. Agrees. Both doors serve through recordLockPayload: locked !== true gives { locked: false } with no kind even if an implementation supplies one; a locked answer carries lockSource only when it is exactly 'record' or 'master'; anything else is dropped, never guessed. The batch door spreads that payload beside recordId and keeps { recordId, locked: null } for a null answer; the single door keeps the one 404 for both nulls, and 501 without the member. The route comments say this.

packages/client/src/index.ts. Agrees with the wire. Single: { locked: boolean; lockSource?: 'record' | 'master' }. Batch entry: { recordId: string; locked: boolean | null; lockSource?: 'record' | 'master' }, which admits all three served shapes (locked with kind, locked without kind from an older implementation, locked: null with none). Optional on both, matching a server that may omit it.

Disclosure against #8652 ruling 5299823744 and ruling 7148480184. Within the bound. The answer is served only to a caller who has just read the row as themselves. What is new is one bit on a locked row. 'master' tells a line reader that some record the line belongs to is under a locking approval: before, locked: true on a line said that or "its own request", so the new bit removes that ambiguity and nothing more; this is the disclosure the maintainer ruled in ("the only extra disclosure is the lock's origin", master wins when both hold). It does not say which master (a line with several master_detail edges answers the same), which request, which node or who decides. 'record' on a line implies its masters are unheld, which { locked: false } on a sibling line already said. No path serves the bit for an unreadable row.

Nits (no effect on correctness or the contract):

  • nit — the contract docblock says lockSource is answered on a locked record but never that a conforming implementation may omit it; only the optional type, the REST comment and the changeset say so. One clause ("an implementation may answer a locked record without it; read an absent kind as unknown") would tell the first consumer what to do. Left as an accepted deviation or folded into the S1 edit.
  • nit — both docblocks cite "seat ruling on PR feat(plugin-approvals): the record lock reads say whether a row is held by its own approval or by its master's #37191" with no comment id, unlike every other ruling they cite. Fixed on the record side by the comment ③ asks for.
  • nit — client.approvals.getRecordLock's docblock breaks its sentence as "— and / nothing else" after the inserted clause; it reads, but awkwardly.

S1 (should-fix) is open on this head. No must-fix.

Implemented-by: claude/issue-37151-lock-source-field
Reviewed-by: session_01WGufzgv2LZN1W2qSYTZvYs

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs

席位核对 — REWORK · repo:objectstack#3 · head e99cf2c · 2026-11-25T04:12Z

L1: REWORK (L1-w, zone wf-B)
Head-sha: e99cf2cfdea67ae14b2d5218f32618df96a10293

The L2 at CONTRACT_REVIEW_TIER on this head is PASS, with one should-fix open: comment 7152618670, claim 7152536669. I add one should-fix of my own. Under the merge standard, both are fixed and re-read before landing, so this head is REWORK. This is Tier S: no governed path, 528 changed lines. wf-B lands it after ACCEPT.

Should-fix

  • L2 S1 (adopted). The new batch docblock sentence says the single door answers "the lock there" for a loosely spelled id. That is false for a record held by its own request. I checked it on the tree. getRecordLock reads the row with where: { id }, then judges the master half with detailRowHeldByLockingApproval(…, id), and its own half with recordHeldByLockingApproval(…, id), keyed on the id as asked. So a readable, self-held record asked as '07' for 7 answers { locked: false }. The behaviour is main's, but the sentence is new and published. The same claim is in the changeset ("answers its lock at the single-record door") and in approvals.mdx. Fix it the L2's way (a): state the truth in all three texts. The behaviour change (b) belongs with a separate card.
  • L1 S2. Fixes #37151 closes the card while its anchor row is not disposed on the card. Row 7148285178 asked for the two doors' readability anchors to be aligned, and ruling record 7148480184 and triage 7148580286 read it that way. The head keeps the anchors different, on the seat's 03:12Z ruling, and that is right on the merits: aligning them would narrow a served answer. But the ruling exists only as an edited footer on claim 7150121798, and the texts cite it as "seat ruling on PR feat(plugin-approvals): the record lock reads say whether a row is held by its own approval or by its master's #37191" with no comment id. Before landing:

Nits (in the L2 record)

  • The docblock never says an implementation may omit lockSource on a locked answer. The changeset says it, and recordLockPayload serves { locked: true } alone.
  • The ruling citation has no comment id (folded into S2 above).
  • One sentence break in the client docblock.

Fix them in the same push, or each needs a follow-up card.

Read and found right (head e99cf2c)

Path to ACCEPT

  1. Card thread: one push for S1's wording and S2's citation, plus any nits.
  2. Seat: post the anchor ruling as its own comment, and tick or carry row 7148285178.
  3. L1-w: a new claim, the same L2 reviewer reads the delta, and I read the L1 delta.

…led id; cite the anchor ruling

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs

Contract-review-claim: session_01WGufzgv2LZN1W2qSYTZvYs · head 030cd91 · 2026-11-25T04:28Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 030cd914ca876896bf487e2a01efaf24aeba3b37
Local-runs: none
Scope: packages/spec/src/contracts/approval-service.ts + packages/plugins/plugin-approvals/src/approval-service.ts, packages/rest/src/approvals-routes.ts, packages/client/src/index.ts

Delta record. It follows record 7152618670 on head e99cf2c (PASS, S1 open) under claim 7152879550, and reads the one push e99cf2c..030cd91 (7 files, 28 added, 15 removed). Inputs read this round: that delta; the card comments new since the first record (seat ruling 7152650156, triage 7152712740, dev report round 3 7152850913) and the mailbox request 7152670747 on #36743; the PR body; the check-runs on the new head. Everything the first record judged on e99cf2c and this delta does not touch stands as judged there.

① Derived judgments

  • No behaviour moved. Right. In the four scoped files every changed line is a docblock or comment line; no statement, signature or type changed. The other three files are the changeset body, approvals.mdx and two comments in the integration test. So every accept-set and public-surface judgement of record 7152618670 holds on this head unchanged: the two IApprovalService return types and the two client types widen by the optional lockSource, the REST doors serve it through recordLockPayload, locked is what main answers, and neither door's readability anchor moves.
  • Gates. At the time of reading, the check-runs on this head stood at 29 success, 12 skipped, 30 in progress, none failed. The runs still in progress are Build Core, Type Check workspace, Type Check UI, Test Core 1 to 10, Test UI 1 to 16 and Build and E2E UI. A comment-only delta gives them nothing new to judge against e99cf2c, where all of them were green, but their conclusions on this head are the gate verdicts and this record does not stand in for them: the merge waits for them.

② Semver level

Unchanged and right. The delta leaves the changeset's front matter (four packages at patch) and both declaration lines untouched: Clause-②: yes (widening: both lock doors' published entry gains a field) and Metadata-protocol: none. Under AGENTS.md changeset rule 3 a non-protocol widening ships patch. The two reworded changeset paragraphs describe behaviour the tree has and publish nothing new.

③ Boundary flags

④ Design judgment

S1: closed

Read sentence by sentence against the tree at this head (getRecordLock in the plugin, and detailRowsHeldByLockingApproval, recordHeldByLockingApproval, pendingRequestFor in lifecycle-hooks.ts, read, not reviewed):

  • Spec batch docblock, "getRecordLock counts any row its read hands back, so an id the engine matches under another spelling answers null here and is judged there". True: the single door returns null only when its caller-read is empty; the batch door admits only ids present in readableIds.
  • "but not wholly on the row found: the line-of-a-held-master half reads the row the engine found, so such a line answers 'master'". True: the master half reads the row by the asked id through the engine, takes the master ids off that row's FK columns, and never compares the row's id spelling.
  • "while the row's own request is looked up by the id as asked, so a record held by its own request may answer { locked: false } there". True: recordHeldByLockingApproval receives the asked id and pendingRequestFor matches record_id on that string. "May" is the right strength, since a store whose bookkeeping column folds the same way still answers 'record'.
  • Plugin getRecordLock docblock, the four added lines. Same two statements, same code, true.
  • Changeset and approvals.mdx no longer say the single door "answers its lock"; both now state the master and own-request halves as above and tell clients to send ids as the server spelled them. They agree with the contract.

The case table of record 7152618670 therefore has no disagreeing row left: its last row (loose spelling, held by its own request, { locked: false } at the single door, null at the batch door) is now what the contract says.

Nits of the first record:

  • the docblock not saying an implementation may omit lockSource: fixed. The spec now says "An implementation may omit lockSource on a locked answer; the REST doors then serve { locked: true } alone, never a guessed kind", which is what recordLockPayload does.
  • the ruling cited without a comment id: fixed, see ③.
  • the broken sentence in client.approvals.getRecordLock's docblock: fixed.

Design judgement of the four files is otherwise as in record 7152618670: both doors answer what the contract says for every case, the client types admit every served shape, and the disclosure stays within ruling 7148480184 and #8652 ruling 5299823744.

No must-fix, no should-fix.

Implemented-by: claude/issue-37151-lock-source-field
Reviewed-by: session_01WGufzgv2LZN1W2qSYTZvYs

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs

席位核对 — ACCEPT · repo:objectstack#3 · head 030cd91 · 2026-11-25T04:31Z

L1: ACCEPT (L1-w, delta read, zone wf-B)
Head-sha: 030cd914ca876896bf487e2a01efaf24aeba3b37

There is no must-fix and no should-fix. The L2 at CONTRACT_REVIEW_TIER on this head is PASS with nothing open: comment 7152908694, claim 7152879550. It closes S1 of 7152618670. This is Tier S: no governed path, and the card has a single PR. needs:contract-review is not owed, because a same-head PASS is on record.

Landing condition. At my read, 29 check-runs were still pending on this head (Build Core, Type Check workspace and UI, Test Core 1–10, Test UI 1–16, Build & E2E UI). There were 30 success, 12 expected skips and 0 failed, and l1-face reads the face INCOMPLETE until they answer. They were all green on e99cf2cf, and this delta is comment and docs only. wf-B lands only once every check on this head is green.

Delta e99cf2cf..030cd914 (7 files, +28/−15, wording only)

  • L2 S1 closed. I read the spec batch docblock, the plugin getRecordLock docblock, the changeset and approvals.mdx sentence by sentence against getRecordLock:
    • The single door counts any row it finds as readable.
    • Its master half (detailRowHeldByLockingApproval) reads the row found, so a loosely spelled line of a held master answers 'master'.
    • Its own half (recordHeldByLockingApproval) looks the request up by the id as sent, so a self-held record may answer { locked: false } under another spelling.
    • The batch door answers null.
    • "A client asking with the ids the server gave it gets the same answer from both doors" holds.
  • L1 S2 closed. Every text cites "seat ruling 7152650156 on approvals: the record lock reads cannot say whether a row is held by its own approval or by its master's, so a list cannot tell which locked rows may still be deleted #37151", a real comment on the card that keeps each door's anchor and withdraws the parity-pin line of 7148480184. Row 7148285178 is disposed off the card: triage 7152712740 carries it to approvals: the record page composite lock still answers { locked } only, without the lockSource that #37151 adds to the lock doors #37195. So Fixes #37151 no longer closes an open row silently.
  • Nits closed:
    • The changeset now says an implementation "may omit it on a locked answer".
    • The client docblock's sentence break is fixed.
    • The citation now has its id.
  • No behaviour moved: every changed line in the four code files is a docblock or comment line. The integration test's edits are pin names and wording. Round 1's findings on surface, semver (patch × 4, Clause-②: yes (widening), Metadata-protocol: none) and disclosure stand.

Landing to-do

Fixes #37151 closes the card on merge. The skills sentence is carried on #35769 (triage 7151747767), and the record-page composite on #37195.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzeiHatzB4rRx1t4Php

Landing · 2026-11-25T04:49Z · head 030cd91

Probe Reading at head 030cd914ca876896bf487e2a01efaf24aeba3b37
check-governed-merges.mjs --pr 37191 NOT governed — 0 of 11 paths hit the register; 543 changed lines (+445 / -98) ≤ 3000
landing-k.mjs --pr 37191 OK — K = 1 < 15, no new locale pack under a label PR, no shared book moved

Verdicts on this head: L1 ACCEPT 7152927922, L2 (CONTRACT_REVIEW_TIER) PASS 7152908694, nothing open. 74 check-runs, 62 success and 12 expected skips, none failed; mergeable_state clean. Single PR on the card, Tier S.

State change: ready for review + auto-merge (merge queue). On merge, Fixes #37151 closes the card and wf-B removes pm:dispatched with the close-out. Carried elsewhere: the grid row-menu half (seat 4, #36911); the record-page composite and the anchor row 7148285178 (#37195); the skills sentence (row on #35769); the write-hook id-spelling finding (filing request on #36743, 7152943318).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 25, 2026 04:49
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 25, 2026
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

2 participants