Repository navigation
fix(plugin-approvals): the batch lock read answers a line of a held master as locked - #37145
Conversation
…aster as the single read does getRecordLocks asked only whether each row was held by a request of its own; getRecordLock also asks the detail-row lock. Add the batch form detailRowsHeldByLockingApproval (one FK read plus one lookup per master_detail edge, never one per row), make the one-row form delegate to it, and pin single/batch parity for a record held itself, a line of a held master and an unheld record. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzeiHatzB4rRx1t4Php
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzeiHatzB4rRx1t4Php
📓 Docs Drift CheckThis PR changes 2 package(s): 4 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 2 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 175 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 4b7b18b4f8409867bb356901a474d9c1c01df1a3 && git checkout 4b7b18b4f8409867bb356901a474d9c1c01df1a3
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 49c8e0f069ac5e21b11ba40d8bbbbfd8cd2eced2 584c26a0f89855639167544f105793bb35245fe1 && git checkout -B drift-repro 49c8e0f069ac5e21b11ba40d8bbbbfd8cd2eced2 && git merge --no-ff 584c26a0f89855639167544f105793bb35245fe1
node scripts/docs-audit/affected-docs.mjs --json 49c8e0f069ac5e21b11ba40d8bbbbfd8cd2eced2
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs 席位核对 — REWORK · repo:objectstack#3 · head 9b5bdcd · 2026-11-24T23:07ZL1: REWORK (L1-w, zone wf-B) The code is right. Two paper findings stand between it and ACCEPT, one of which moves a published docblock and so brings an L2. Must-fixM1. The published
Should-fixS1. The PR body's 维护者速读 still asks the maintainer to rule here. Its last bullet, "要你做的:裁定行菜单"删除"按钮的取舍…", predates the seat's routing call. That question now lives on #37151, and this PR lands the parity fix alone. As written, the maintainer reads this PR as waiting on them. Fix: point the bullet at #37151 (or say nothing is asked of the maintainer here). It is a body patch by the card thread through relay Read and found right (head 9b5bdcd)
Note (not a finding)
Path to ACCEPT
|
…master The getRecordLock and getRecordLocks docblocks named only the record-lock hook's judgement; both reads also answer a master-detail line true while its master is held (the detail-row lock). One clause in each; the answer shape and the rest of the What-is-answered text are unchanged. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzeiHatzB4rRx1t4Php
|
repo:objectstack#3 · os-support-ai · session_01WGufzeiHatzB4rRx1t4Php Test UI (10/16) red at 88b76bf: judged a flake this PR did not cause; one re-run of the failed jobs follows.
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs Contract-review-claim: session_01WGufzgv2LZN1W2qSYTZvYs · head 88b76bf · 2026-11-25T00:06Z |
…ct docblocks Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzeiHatzB4rRx1t4Php
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs Contract reviewServed-tier: ① Derived judgmentsRead from the net diff
② Semver level
Check-runs on ③ Boundary flags
④ Design judgmentSpec docblocks against the code and against ruling A.
Disclosure (the reason for Findings. S1 (should-fix) — S2 (should-fix) — N1 (nit) — N2 (nit) — No must-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs 席位核对 — REWORK · repo:objectstack#3 · head 88b76bf · 2026-11-25T00:11ZL1: REWORK (L1-w, delta read, zone wf-B) Round 1 (7147044772): M1 closed. Both spec docblocks now say a master-detail line answers The L2 at Must-fixM2. The changeset does not name Should-fix (from the L2, adopted)
Nit (fold into the same round, since S1 moves the head anyway)
Path to ACCEPTOne push covering M2, S1, S2 (and N1). Then the L2 reviewer reads the delta on that head under a new claim, and I read the L1 delta on the same head. |
…row it found The one-row form asked exactly one id, so a non-empty answer is that row's; it no longer depends on the engine spelling the id back as asked. The batch form's docblock says why the join stays in-app, and the spec contract docblocks say "a record the line belongs to". Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzeiHatzB4rRx1t4Php
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs Contract-review-claim: session_01WGufzgv2LZN1W2qSYTZvYs · head 584c26a · 2026-11-25T01:13Z |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs Contract reviewServed-tier: Delta review. The previous record is on head ① Derived judgments
② Semver level
Check-runs on ③ Boundary flags
④ Design judgmentThe delta, hunk by hunk.
Does the delta introduce anything new. No. No code path other than the one-row return expression changed. The spec text change narrows nothing and discloses nothing new. The reads, their order and their contexts are as they were at Standing judgments from the previous record, re-read on this head and unchanged.
Disclosure (the reason for Findings. S1: closed No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs 席位核对 — ACCEPT · repo:objectstack#3 · head 584c26a · 2026-11-25T01:15ZL1: ACCEPT (L1-w, delta read, zone wf-B) No must-fix, no should-fix. The L2 at Delta
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzeiHatzB4rRx1t4Php Landing · 2026-11-25T01:17Z · head 584c26a
Verdicts on this head: L1 ACCEPT 7149373728, L2 ( State change: ready for review + auto-merge (merge queue). On merge, |
…s approval went next (objectstack-ai#37148) <!-- claude-projects-attribution: {"github_login":"os-support-ai"} --> _Requested by **Yibo Wang** · [project thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBCKqH7woNZCA4ZVP1id8Jp7)_ Fixes objectstack-ai#35863 repo:objectstack#3 · os-support-ai · session_01WGufzg3ayWUHg9nLoybejn Clause-②: yes Metadata-protocol: none ## 维护者速读 - 审批人打开自己已经审过的审批单时,「审批进度」里在已决步骤下多出一行:审批已流转到哪一步并在等谁决定,或者整条审批已经结束、结果是什么。 - 属于审批流程体验:解决审过的人看不到「后来怎么样了」的问题。 - 出错时这一行不显示或说法不准,不影响审批本身,撤回这个改动即可恢复原样。 - 无。 ## What changes **Served shape (`@objectstack/spec/contracts`, `ApprovalRequestRow.flow_route`).** One optional member, `outcome`, served only beside `ahead: 'decided'`: - `step?: { id, label }`: the run's latest request when it is a later one than this request (same `flow_run_id`, opened after it, on any node, a later round of the same node included; a pending one wins over a decided one). Absent when no later request was opened. - `status: ApprovalStatus`: that latest request's status, or this request's own when `step` is absent. `pending` with a `step` = the approval went on to that step and waits on its decision. - `ended: boolean`: the record's approval is known to have stopped: a root run, whose own flow body starts no child run (`subflow` / `map`), that has stopped for good. `false` = not known (rounds 1 to 3 below). `outcome` is absent when nothing past the request is known (no later request in the run and the approval not known to have ended, or several later requests are pending at once), so nothing is guessed. A pending request's route never carries it. **Server (`@objectstack/plugin-approvals`).** `routeOutcome` in `approval-route.ts` is the rule, a pure function over the run's own request rows (the same rows `passedSteps` already reads) and whether the run has ended. `flowRoute` calls it for decided rows only. `ApprovalService.attachFlowRoute` reads "ended" off the run itself through `automation.getRun`, judged by the dead-run sweep's own `TERMINAL_RUN_STATUSES` (derived from the total `RUN_STATUS_LIVENESS` map), in the new `runHasEnded`. An unreadable run reads as "not known to have ended", never as a failed read: the field is display-only like the rest of the route. **Docs.** `content/docs/automation/approvals.mdx` gains the decided route's `outcome`, beside the existing `flow_route` example (the docs drift check named that page). **UI (`@object-ui/app-shell`, `@object-ui/i18n`, `@object-ui/console`).** `ApprovalStepLine` takes an `outcome` prop and, with `decided`, draws one line under the decided step, outside the ordered list so assistive tech never counts it as a step: "Went on to STEP, waiting for a decision", "Went on to STEP: DECISION", "Went on to STEP, then ended: DECISION", or "The approval ended here". The approval request page's decision panel hands it the served outcome on a decided route only. Four new `approvalsInbox` rows in all eleven built-in locales. The console's `ApprovalRequest` type and app-shell's `ApprovalRequestLite` mirror the member. ### Why this shape (card option 2, one outcome) and not option 1 (the steps after) - Option 1 needs a `rejected` step state: a widening of the `state` enum every step-line consumer switches on, and it still needs a separate marker for "ended". - The card asks the UI for one line under the decided step; one outcome is exactly that line's data. - Reading the run's latest request (rather than walking the graph) keeps the route's existing rule: history, never the graph, and nothing guessed. ### Read first (by risk) 1. `routeOutcome` in `packages/plugins/plugin-approvals/src/approval-route.ts`: which later row is "the latest", the parallel-pending refusal, and the ended-at-this-request arm. 2. The `outcome` doc on `flow_route` in `packages/spec/src/contracts/approval-service.ts`: the contract text the L2 read judges. 3. `outcomeText` in `ui/packages/app-shell/src/views/approval-progress/ApprovalStepLine.tsx`: which status draws which sentence, and when it draws nothing. ### Two-minute verification `pnpm --filter @objectstack/plugin-approvals exec vitest run --maxWorkers=2 src/flow-route.integration.test.ts`: expect 14 passed, including "a request decided at step 1 of a two-step route: the outcome says step 2 is pending, then that the approval ended there". ## Tests - `approval-route.test.ts`: a new `routeOutcome` describe (9 cases): later pending, ended at a later step (approved and rejected), ended at this request (approved, rejected, recalled, cancelled), not ended and nothing later (no outcome), a later round of the same node, pending wins over decided, parallel pending (no outcome), rows that are not later requests, and `flowRoute` carrying it on decided rows only. - `flow-route.integration.test.ts` (real ObjectQL over SQLite, real AutomationEngine and approval node): the existing decided pin now asserts `outcome: { status: 'approved', ended: true }` at the last step; new pins for the card's two cases (decided at step 1 of a two-step route shows step 2 `pending`, then `rejected, ended` once step 2 is rejected), a first-step rejection ending the approval, and a pending request carrying no outcome. - `ApprovalDecisionPanel.stepLine-12491.test.tsx` (the existing harness, a new top-level describe, 7 cases): each sentence, no line without an outcome or with nothing to say, no line on a pending route, and every locale pack carrying the four rows. ## Acceptance notes - Size: 850 added / 18 removed lines over 24 files at 6080e34, under the 3,000-line human-merge threshold. - The line does not say who holds the later step. The card mentions it in passing; the approver names of a later step are information this request's reader was never served, so naming them is a read-access question, not a display one. Not filed: no defect, and the card's own ask (step N / ended approved / rejected / recalled) is met. - `ended: true` with `status: 'approved'` reports the last decision; a root run that failed after that approval also reads "ended". The run's own status is not served here; that would be a second widening for a rare case. - Claim file surface: the diff also touches `ui/packages/i18n/src/locales/*.ts` (the four rows the line needs), `ui/apps/console/src/services/approvalsApi.ts` (the console's type mirror of `flow_route`) and `content/docs/automation/approvals.mdx` (the page that documents `flow_route`). - The shape reported to the zone named `{ status, step? }`; the landed shape adds `ended`, because "the approval ended" is a fact about the run, not about any one request's status. ## Round 1 (L2 FAIL 7147867236, L1 REWORK 7147881964), head 99ab892 - **M1, a child run's end.** The approval node now records on each new request whether its run is a root run or a child (`subflow` body, `map` item: the engine links those upward by `$parentRunId`), as `__runRoot` on the config snapshot (precedent `__round`; no schema change). `attachFlowRoute` asks the run for "ended" only when the snapshot says root; a child run's request, a request opened before the stamp, or an unreadable run is never served `ended: true`. New pin in `flow-route.integration.test.ts`: an approval inside a `subflow` whose child run completed while the root run went on to the general manager serves no outcome, and the root run's last request then served `{ status: 'approved', ended: true }` (round 2 withdraws that: its flow hosts a `subflow`); a second pin removes the stamp from a decided last-step request and the outcome disappears. Ablations: root-run read forced `true` gives 2 failed / 9 passed; executor stamp forced `true` gives 1 failed / 10 passed; both restored. - **S1, audience.** The `outcome` contract doc and the `attachFlowRoute` docblock state the disclosure: every reader of the request gets the later step's node id and label and that request's status, never its id, approvers, comments or field values, within the request-visibility bound of ruling record 5299823744 as the seat ruled for this card. - **S2, an unreadable run (option a).** `ended` is now defined as "known to have stopped" (`false` = not known, including an unreadable run), and the contract, the changeset and `approvals.mdx` say an outcome with a later request is served even when the run cannot be read. **N1**: the contract says `status` is the last decision only when it is not `pending`. - Checks: `@objectstack/plugin-approvals` full suite Test Files 128 passed (128), Tests 1934 passed (1934); plugin-approvals and spec typecheck exit 0; spec rebuilt and `check:generated` all 14 up to date; overlap-check clean against main and the open PR heads, objectstack-ai#37145 included. CI at 99ab892: 70 check-runs, 61 success, 9 skipped, 0 failed, every required context green; mergeable clean. The local re-run of the derived gate list at this head stopped at 9 of 121 (all exit 0) when the container restarted; CI ran the families. ## Round 2 (L2 FAIL 7150840780, L1 REWORK 7150863825), head e264c10 - **M2, a later step in a child run.** Chosen: the second of the two named ways. "Ended" is never claimed for a run whose flow can start a child run; child runs' rows are not read. `flowHostsChildRuns` (`approval-route.ts`) says whether the flow holds a `subflow` or `map` node anywhere, regions included (`loop` body, `parallel` branch, `try_catch`, every graph `collectFlowGraphs` walks), and `attachFlowRoute` asks the run for "ended" only when it does not. Two choices inside it, stated so they can be judged: - It is read off the flow definition (the same body the route's steps are read off), not off the run's step log: the persisted step log is compacted to a bounded number of steps, so "the run never ran a child-run node" cannot be proven from it, while "the flow has none" can. The cost is that a flow with a `subflow` on a branch the run never took also never says "ended"; the line is then left out, never wrong. - It covers the case with a `step` too, not only "ended with no later step": with manager → general manager → subflow legal → end, the manager's outcome would otherwise read `{ step: gm, status: 'approved', ended: true }` and name the general manager's decision as the last one while legal came after. With this rule it reads `{ step: gm, status: 'approved', ended: false }`, which is true. - Not chosen, reading child runs' rows: a request does not record its root run id (only `__runRoot`, a yes/no), the engine serves no "children of a run" read, and walking `$parentRunId` chains from the read side would need a new engine member, outside the claimed surface. - Served shape for the review's setup (manager in the root run, then a subflow holding legal, then the end; legal rejects, the root run completes): the manager's request is served `flow_route: { steps: [manager done], ahead: 'decided' }` with no `outcome`. Pinned exactly in `flow-route.integration.test.ts` ("a later step in a child run: the root run's end is not served as \"ended here\" for the request before it"). The round-1 hosted pin now asserts that the root run's own last request also gets no outcome, its flow hosting a `subflow`. - Contract, changeset and `approvals.mdx`: "known to have stopped" now names "runs a flow that can start a child run" among the `false` cases, and `step` says a request a child run opened is not among the run's requests. - **N4**: the `attachFlowRoute` docblock reads "as the seat ruled on PR objectstack-ai#37148". - Unit: a `flowHostsChildRuns` describe (3 cases): `subflow` and `map` at the top level; inside a `loop` body, a `parallel` branch, a `try_catch` catch, and nested two deep; none anywhere (approvals, gateways, a `loop` of approvals, an empty flow). - Ablations (through `scripts/ablation-replace.mjs`, restored to blob == HEAD each time): the gate in `attachFlowRoute` forced off gives Tests 2 failed / 10 passed (the new pin and the hosted pin); `map` removed from the child-run node types gives 2 failed / 26 passed; the region walk replaced by the top-level nodes gives 1 failed / 27 passed. - Checks: targeted `approval-route.test.ts` + `flow-route.integration.test.ts` Test Files 2 passed (2), Tests 40 passed (40); `@objectstack/plugin-approvals` full suite Test Files 128 passed (128), Tests 1938 passed (1938); plugin-approvals and spec typecheck exit 0; spec rebuilt and `check:generated` all 14 up to date; overlap-check clean against origin/main and PR heads objectstack-ai#37185, objectstack-ai#37173, objectstack-ai#37166. CI at e264c10: 70 check-runs, 61 success, 9 skipped, 0 failed, every required context green; mergeable clean. ## Round 3 (L2 PASS with S3 7151818256, L1 REWORK 7151830517), head 6080e34 - **S3, which flow body is judged.** Chosen: refuse "ended" unless the run provably ran the body armed now; no new engine member. `ranArmedBody` (`approval-service.ts`) holds when the armed body is the flow's newest registration in the engine's version history (`getFlowVersionHistory`, compared as the very object) and was registered strictly before the run started (the run log's `startedAt`, which a resume carries over unchanged). A run starts on the body armed at its start and resumes pinned to it, so with nothing registered since, that body is the one it ran. `runHasEnded` now requires it beside the terminal status. - Not the run's `flowVersion`: it is the author's number and an edit need not change it (the edit pin re-registers under the same version). - Not judging the run's own version out of the history: the history is the engine's in-memory list since boot and a version number can repeat, so it can name the wrong body; the run log carries no body checksum to match. - `getFlowVersionHistory` and `startedAt` are declared on the plugin's automation surface as members `AutomationEngine` already implements and returns publicly, the existing precedent for that interface. - Cost, stated: a flow registered again after a run started (an edit, a rollback, the re-registration every restart makes) leaves that run's requests without "ended", so after a restart older decided requests drop the line until a new run. Omitted, never wrong. - **Pins** (`flow-route.integration.test.ts`): a run that started a `subflow` (legal rejects, the root completes), then its flow re-registered under the same version without the subflow: the manager's request still serves no `outcome`; a run started on the edited body then ends at the manager, `{ status: 'approved', ended: true }`. A rollback: version 2 (with the subflow) runs, `rollbackFlow` re-arms version 1 (without): no `outcome`. - **Wording**: the contract, the changeset and `approvals.mdx` now say "the flow body the run ran" and when that body is known, and list "ran a body that is not known (its flow was registered again since it started)" among the `false` cases. - **N5**: the `CHILD_RUN_NODE_TYPES` docblock names the only two executors that set `$parentRunId` (`builtin/subflow-node.ts`, `builtin/map-node.ts`), says `loop`, `parallel` and `try_catch` stay in-run, and that a new child-run starter joins the set in the same change. A pin would have to read `service-automation` sources from this package's tests, which the cross-package test-input gate refuses, so it is a comment. - **Left, with reasons.** N2 (later is measured against `created_at`, not the decision): a run opens its requests one after another, so the order they were opened in is the order the approval moved in; the only same-run overlap is parallel branches, which `routeOutcome` already refuses to pick from. No reachable wrong case, so no change and no card needed in my view. **N3, fixed after all**: both UI mirrors now type `outcome.status` as the row's own `status` (`ApprovalRequestRow['status']` in the console, `ApprovalRequestLite['status']` in app-shell), the open union each already uses, rather than a bare `string`. - Ablations (through `scripts/ablation-replace.mjs`, restored to blob == HEAD each time): `ranArmedBody` dropped from `runHasEnded` gives Tests 1 failed / 12 passed (the edit pin); the time test forced true gives 1 failed / 12 passed (the edit pin); the identity test dropped gives 1 failed / 13 passed (the rollback pin). - Checks: targeted `approval-route.test.ts` + `flow-route.integration.test.ts` Tests 42 passed; `@objectstack/plugin-approvals` full suite Test Files 128 passed (128), Tests 1940 passed (1940) at bfff5d1 (6080e34 adds only the two UI type lines); `ApprovalDecisionPanel.stepLine-12491.test.tsx` Tests 20 passed (20) at 6080e34; plugin-approvals and spec typecheck exit 0; spec rebuilt and `check:generated` all 14 up to date; overlap-check clean against origin/main and the open PR heads before each push. Three pushes this round, not one: 30ec243 (S3), bfff5d1 (the rollback pin, once the identity ablation showed that branch unpinned), 6080e34 (N3); CI on the first two was cancelled by the next push. CI at 6080e34: 70 check-runs, 61 success, 9 skipped, 0 failed, every required context green; merges cleanly with main. ## Verification <details><summary>Targeted tests (code at 19f57ef; later commits touch only the changeset, the docs page and one test import)</summary> - `pnpm --filter @objectstack/plugin-approvals exec vitest run --maxWorkers=2 src/approval-route.test.ts src/flow-route.integration.test.ts`: VERDICT command-exit 0, Test Files 2 passed (2), Tests 34 passed (34). - `pnpm --dir ui exec vitest run packages/app-shell/src/views/approval-decision/ApprovalDecisionPanel.stepLine-12491.test.tsx packages/app-shell/src/views/RecordApprovalsPanel.stepProgressVertical.test.tsx packages/app-shell/src/views/RecordApprovalsPanel.servedRoute-26668.test.tsx`: VERDICT command-exit 0, Test Files 3 passed (3), Tests 29 passed (29). - `pnpm --filter @objectstack/plugin-approvals typecheck && pnpm --filter @objectstack/spec typecheck`: VERDICT command-exit 0. - `pnpm --filter @objectstack/spec check:generated`: all 14 generated artifacts up to date (spec dist built after the contract edit). </details> <details><summary>Ablations (each through scripts/ablation-replace.mjs, mutation proven on disk, restored, tree clean after)</summary> - `flowRoute` outcome replaced by `undefined`: Tests 4 failed / 30 passed (the `flowRoute` unit case and the three integration outcome pins). - `runHasEnded` forced `false`: Tests 3 failed / 6 passed in the integration file (every `ended: true` pin). - The decision panel's `outcome` hand-off deleted: Tests 4 failed / 16 passed (every drawn-line case). All three suites import source, not `dist/`, so no rebuild leg applies. </details> <details><summary>Local gates (dispatch-gates, derived at 19f57ef and again at 1f6480a)</summary> Derived by `node scripts/pm/dispatch-gates.mjs --commands` (120 families once the docs page joined the diff); `--ran` reconciliation: 120 of 120 accounted for. 117 exit 0. Exit 3 (prerequisite not met in this container, nothing measured; CI ran them green): - `node scripts/check-plugin-teardown-shape.mjs --self-test`: exit 3 (shallow clone cannot reach the pinned positive control) - `pnpm check:dual-build-cjs-loads`: exit 3 (reads built output of the whole workspace) - `pnpm check:i18n`: exit 3 (needs its package build closure; nothing compared) Exit 0: - `node scripts/check-adr-0087-registration.mjs --base origin/main` - `node scripts/check-adr-0087-registration.mjs --self-test` - `node scripts/check-changeset-no-major.mjs --base origin/main` - `node scripts/check-closing-keyword-parity.mjs` - `node scripts/check-closing-keyword-parity.mjs --self-test` - `node scripts/check-comment-mask-adoption.mjs` - `node scripts/check-comment-mask-adoption.mjs --self-test` - `node scripts/check-comment-mask-corpus.mjs` - `node scripts/check-dev-prereqs.mjs --self-test` - `node scripts/check-dts-emitted.mjs --self-test` - `node scripts/check-empty-changeset.mjs --base origin/main` - `node scripts/check-empty-changeset.mjs --self-test` - `node scripts/check-issue-citations.mjs` - `node scripts/check-plugin-teardown-shape.mjs` - `node scripts/check-sdui-manifest.mjs` - `node scripts/check-sdui-manifest.mjs --self-test` - `node scripts/check-tenant-audit-census.mjs` - `node scripts/check-tenant-audit-census.mjs --self-test` - `node scripts/ci/assert-turbo-remote-cache.mjs --self-test` - `node scripts/ci/plan-test-core-shards.mjs --self-test` - `node scripts/ci/prune-turbo-cache.mjs --self-test` - `node scripts/ci/snapshot-next.mjs --self-test` - `node scripts/docs-audit/check-affected-docs.mjs` - `node scripts/docs-audit/check-drift-comment.mjs` - `node scripts/pm/check-governed-queue-guard.mjs --self-test` - `node scripts/pm/release-rehearsal-clone.mjs --self-test` - `node scripts/release-pending-publish.mjs --self-test` - `pnpm --dir ui exec vitest run scripts/` - `pnpm --filter @objectstack/lint run check:doc-formula-expressions` - `pnpm --filter @objectstack/spec run check:api-surface` - `pnpm --filter @objectstack/spec run check:authorable-surface` - `pnpm --filter @objectstack/spec run check:browser-reachable-entries` - `pnpm --filter @objectstack/spec run check:docs` - `pnpm --filter @objectstack/spec run check:dual-source-exports` - `pnpm --filter @objectstack/spec run check:duration-unit-keys` - `pnpm --filter @objectstack/spec run check:empty-state` - `pnpm --filter @objectstack/spec run check:entry-nameability` - `pnpm --filter @objectstack/spec run check:error-code-provenance` - `pnpm --filter @objectstack/spec run check:export-origins` - `pnpm --filter @objectstack/spec run check:exported-any` - `pnpm --filter @objectstack/spec run check:liveness` - `pnpm --filter @objectstack/spec run check:llms-txt` - `pnpm --filter @objectstack/spec run check:skill-refs` - `pnpm --filter @objectstack/spec run check:strictness-ledger` - `pnpm --filter @objectstack/spec run check:variant-docs` - `pnpm --filter @objectstack/spec run check:yaml-examples` - `pnpm check:adr-anchors` - `pnpm check:adr-symbol-anchors` - `pnpm check:changeset-gate-self-tests` - `pnpm check:ci-filter-parity` - `pnpm check:cli-command-ids` - `pnpm check:closed-ceremony-text` - `pnpm check:cross-package-test-inputs` - `pnpm check:dispatcher-error-vocabulary` - `pnpm check:doc-authoring` - `pnpm check:driver-memory-census` - `pnpm check:dts-closure` - `pnpm check:engine-double-contract` - `pnpm check:error-status-conformance` - `pnpm check:gitlink-declared` - `pnpm check:i18n-stale-fill` - `pnpm check:issue-citations` - `pnpm check:keyed-text-bounds` - `pnpm check:lean-entry-closure` - `pnpm check:logger-receiver-detach` - `pnpm check:merge-driver` - `pnpm check:nul-bytes` - `pnpm check:object-def-param-keys` - `pnpm check:objectql-double-limit` - `pnpm check:optional-error-sink` - `pnpm check:org-identifier` - `pnpm check:page-declaration-shape` - `pnpm check:platform-object-tenancy-census` - `pnpm check:pm-expected-skips` - `pnpm check:pm-prior-rulings` - `pnpm check:published-files` - `pnpm check:query-options-erasure` - `pnpm check:refd-timer-probe` - `pnpm check:registry-log-declared` - `pnpm check:rest-log-spy-declared` - `pnpm check:role-word` - `pnpm check:settings-bind-window` - `pnpm check:skill-identifier-liveness` - `pnpm check:slot-lookup` - `pnpm check:sourcemap-no-sources-content` - `pnpm check:spec-docblock-symbol-anchors` - `pnpm check:spec-parsed-alias` - `pnpm check:system-context-census` - `pnpm check:test-source-alias` - `pnpm check:tier-file-adoption` - `pnpm check:type-check-coverage` - `pnpm check:type-check-debt` - `pnpm check:undeclared-dep-imports` - `pnpm check:vouch-for-reference-callers` - `pnpm check:watch-hint-literal` - `pnpm check:where-matcher` - `node scripts/check-adr-links.mjs` - `node scripts/check-adr-links.mjs --self-test` - `node scripts/check-doc-route-spelling.mjs --advisory` - `node scripts/check-doc-route-spelling.mjs --self-test` - `node scripts/check-docs-section-name.mjs` - `node scripts/check-docs-section-name.mjs --self-test` - `node scripts/check-section-landing-index.mjs` - `node scripts/check-section-landing-index.mjs --self-test` - `pnpm --filter @objectstack/lint run check:doc-security-posture` - `pnpm --filter @objectstack/spec run check:skill-examples` - `pnpm check:corpus-claim-drift` - `pnpm check:doc-anchors` - `pnpm check:doc-frontmatter` - `pnpm check:docs-audit-scope` - `pnpm check:docs-redirects` - `pnpm check:docs-single-h1` - `pnpm check:docs-spec-enumerations` - `pnpm check:docs-transcript-drift` - `pnpm check:published-readme-links` - `pnpm check:react-page-adapter-contract` - `pnpm check:vendor-version-stamps` </details> - After the docs page and the test import landed: `pnpm check:test-source-alias` exit 0 at 1f6480a (CI had flagged the decision panel harness reaching the lazy `@object-ui/plugin-detail` load without a module-top import; the harness now imports it at collection); the edited harness file re-run, Test Files 1 passed (1), Tests 20 passed (20). CI at head 1f6480a: 61 success, 9 skipped, 0 failed of 70 check-runs; every required context green (Lint & Repo Gates, TypeScript Type Check, Test Core, Build Core, Governed Surface Queue Guard, Lint UI, Type Check UI, Test UI, Build & E2E UI, Live E2E UI, Dogfood Regression Gate) and Check Changeset green. Mergeable: clean. NOT MEASURED locally: `Type Check UI` (`@object-ui/app-shell type-check` needs the UI package closure built; the local run stopped on missing-module errors only, none in a touched line). CI's `Type Check UI` is the reading. --- _Generated by [Claude Code](https://claude.ai/code/session_01WGufzg3ayWUHg9nLoybejn)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01WGufzg3ayWUHg9nLoybejn <!-- signed: repo:objectstack#3 · os-support-ai · session_01WGufzg3ayWUHg9nLoybejn --> --------- Co-authored-by: Claude <noreply@anthropic.com>
…am as approval feed items (objectstack-ai#37188) <!-- claude-projects-attribution: {"github_login":"os-support-ai"} --> _Requested by **Yibo Wang** · [project thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBEaJzgBWzjWCNjBjkVoeRto)_ Fixes objectstack-ai#35723 repo:objectstack#3 · os-support-ai · session_01WGufzg3KqwSpt61Y8ovKK7 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:在走审批的记录详情页「动态」里,每个审批步骤(提交、通过、驳回、退回修改、重新提交、撤回、取消)都显示为一行,按读者的语言显示(中文读者看到「已批准 · 经理审批」),点「看审批」直接打开该记录的「审批」页签;以前这里看不到任何审批。 - 为什么做:记录详情页专题里「动态流审批一行」那一半——上一张卡只画了这一行的样子,但没有任何地方产出审批条目,这张卡补上产出方。 - 出错会怎样:最坏情况是动态里少了或多了审批行,或某行显示成英文;审批本身、审批页签和锁定都不受影响。撤回本 PR 后,已写入的审批行仍在动态表里保留最多 14 天,且失去本 PR 的可见性限制,会以普通系统行的样子展示给所有能看该记录的人。 - 要你做什么:无 ## What changes - **Producer (plugin-approvals, new module `approval-activity-feed.ts`).** An `afterInsert` hook on the decision log `sys_approval_action` appends one `sys_activity` row per step of kind `submit`, `approve`, `reject`, `revise` (sent back for revision), `resubmit`, `recall` and `cancel`, about the record the request governs. Other kinds (reminder, reassign, thread comment, ...) write none, and no decision comment rides on the row. An object with `enable.activities: false` gets no entry, as the CRUD mirror writes none for it. Shape follows ADR-0052 section 5, so no published vocabulary moves: `type: 'system'` (platform-only; the app activity door refuses it), `metadata.kind: 'approval'` plus the step's action, its stored label and the two machine names its label is translated by (`flow_name`, `step_name`), `source_object: 'sys_approval_request'` / `source_id` naming the request. - **In the reader's language (route b, round 2).** `summary` stores the English sentence from plugin-approvals' own catalog (`approvalActivity*` in `translations/messages.ts`, ten ids added to all eleven shipped packs); a new `sys_activity` middleware (`bindApprovalActivityLocale`) re-composes it on `find` / `findOne` for a non-system read that carries a locale, with the approvals door's own lookup (`readerLabelsFor`): the sentence is `messages.approvalActivity*` in the reader's locale, and the step label is `flows.FLOW.approvals.NODE.label` read the way the approvals tab reads it, else the stored label. A list that projects `summary` alone borrows the recognition columns and hands back only what it asked for. A system read, a read with no locale or no `i18n` service, or a key the pack misses serves the stored line. No `sys_activity` on the deployment (no plugin-audit) means no write; a failed append never fails the step and is logged once at `error` with consequence and fix. `approval-service.ts` is untouched (overlap with PR objectstack-ai#37145 and branch `claude/project-thread-x90m5y` avoided). - **Read gate (same module).** A `sys_activity` middleware narrows `find` / `findOne` / `count` / `aggregate` so an approval row is served only when the approvals service would serve the caller its request (`RequestVisibilitySource`, the same source the request-table gates read). A read pinning `object_name` + `record_id` asks with that record, so an object that opts into `enable.approvalsVisibleToReaders` serves its readers too. Every non-approval row passes untouched; plugin-audit's parent-record gate still applies on top; failure to resolve fails closed for approval rows only. Count and rows agree. - **Console (plugin-detail).** `activityRowToFeedItem` reads the triple `type: 'system'` + `metadata.kind: 'approval'` + `source_object: 'sys_approval_request'` as the `approval` feed kind (`APPROVAL_ACTIVITY_FEED_TYPE`), so `PRODUCED_FEED_TYPES` now contains `approval` and the unproduced-kind diagnostic no longer names it. New `RecordViewApprovalsContext` carries the stream's 「看审批」 callback into `RecordActivityRenderer` and `RecordChatterPanel`. - **Host (app-shell `RecordDetailView`).** The approval tag's opener is extracted as `openRecordApprovals` (approvals panel if drawn, else the 审批 tab) and supplied through `RecordViewApprovalsContext` only when the reader is served approvals; otherwise the line has no link. - **Docs.** `content/docs/frontend/plugins/plugin-detail.mdx`: `approval` joins the produced-kinds table (six produced, seven not); the unproduced example becomes `call`. - **Ledgers.** `approver-address-readers.test.ts` classifies the two new `actor_id` reads as `display`; the tenant-audit write census for plugin-approvals is regenerated (one new elevated `sys_activity` insert); `content/docs/permissions/system-context.mdx` row 17 owns the new middleware's `isSystem` read (its register regenerated with `--write`). ## Round 2 (L1 REWORK on dc76347) - **S1, route (b): the server re-composes on read.** It is the objectstack-ai#26167 precedent's own shape: plugin-audit's `activity-summary-message.ts` stores the sentence plus its code and re-composes it per reader in a `sys_activity` middleware, and this row's code is already on it (`metadata.action`, now with `flow_name` / `step_name`). The step label must be translated through the app's flows pack, which lives in the server's `i18n` service and is read by the approvals door's `reader-locale-labels` lookup; the console holds no such pack. Server-side, every reader of the column (the record page, the API, an export) gets the same line, and no console locale pack moves. Pinned for a zh-CN reader: `已批准 · 经理审批` and `已提交审批`, with the step label from an app flows pack. - **S2:** handled by the zone (claim amended). - **N1:** done in the same code path: `revise`, `resubmit` and `cancel` write entries (`Sent back for revision · STEP`, `Resubmitted for approval`, `Approval request cancelled`, the last attributed to no one), each pinned. - **N2:** the flag is honored, as the CRUD mirror honors it (`audit-writers.ts` writes no activity row for an object with `enable.activities: false`); pinned. - **N3:** the step half is pinned exactly (`Approved · Manager review`, `Rejected · Manager review`), plus the stored metadata. - **N4:** the 维护者速读 revert sentence now says rows already written stay up to 14 days and, without the read gate, are served to every record reader as generic system lines. ## Tests <details><summary>Readings, round 2 (head 06a3c76)</summary> All local runs went through `scripts/pm/os-verify-lock.sh`; verdict lines quoted. Round-2 head `06a3c7640b` (after merging `origin/main` at `93bd45957b`). - `pnpm --filter @objectstack/plugin-approvals exec vitest run` + `typecheck` (head `06a3c764` minus the cancel pin): `Test Files 129 passed (129)`, `Tests 1929 passed (1929)`, `check:test-typecheck: OK`, `VERDICT command-exit 0`. - `src/approval-activity-feed-35723.integration.test.ts` at `06a3c7640b`: `Tests 7 passed (7)` (approve/reject/recall, send back + resubmit, cancel on record delete, muted timeline, zh-CN reader, reader without approval access, record-reader opt-in). - Ablation (S1): `node scripts/ablation-replace.mjs` replaced the `bindApprovalActivityLocale(...)` call in `approvals-plugin.ts` with a no-op (anchor 1 to 0, blob changed); the zh-CN pin went red (`Tests 1 failed | 6 passed (7)`, the six others green), restore verified (`blob == HEAD`, `git diff HEAD` empty). - Local gate subset: `dispatch-gates --ran` reconciles `106 derived, 104 run, 2 UNRUN`; 101 exit 0. `check:i18n` first exit 3 (PREREQUISITE NOT MET), then its own one-command prerequisite build and re-run: `check-i18n-bundles: OK (10 package(s) — all bundles in sync, no undeclared authoring keys)`, `VERDICT command-exit 0`. `check:system-context-census` (red in CI on `05d82f29`) fixed in `f0b51c92`: `OK — 202 elevation read sites ... the generated register (178 symbol(s)) matches the tree`, self-test all cases passed. NOT MEASURED locally, CI runs them: `check:dual-build-cjs-loads`, `spec check:skill-examples` (exit 3, unbuilt dist outside the closure); `pnpm --dir ui exec vitest run scripts/` and `check:type-check-debt` (declared narrowing: the first was OOM-killed in round 1, the second needs a whole-workspace build; no `ui/` file and no package's type-check set changed this round). - `overlap-check --branch=claude/issue-35723-approval-feed-items`: `VERDICT clean exit 0`. - Round 1 readings (UI suites, record-page ablation) stand for the unchanged `ui/` files: `RecordDetailView.*` 100 files / 858 tests, plugin-detail 417 files, both `type-check` exit 0. - Full dogfood: not owed (no `!` in the title, no `(narrowing)` arm). </details> ## Acceptance notes - `sys_activity` keeps its own lifecycle (rows reaped after 14 days); the 审批 tab keeps the full history. Steps taken before this lands write no backfilled rows. - The console restates the three writer values (`recordActivityFeed.ts`) because plugin-detail cannot depend on the server plugin; both sides are pinned by tests. - The producer reads the decision log rather than calling in from each decision method, so a step the service learns to record elsewhere reaches the stream with no second call site. - New UI pin for the mapper and stream lives in a card-named file `recordActivityFeed.approvalStep-35723.test.tsx` (it renders React; the shared `recordActivityFeed.test.ts` is a non-JSX file). The record-page pin joined the shared `RecordDetailView.harness.test.tsx` as its own top-level block. ## Verification First read (by risk): 1. `packages/plugins/plugin-approvals/src/approval-activity-feed.ts` — `bindApprovalActivityReadGate` (who sees an approval row), `bindApprovalActivityLocale` (the system-read pass-through and the borrowed columns), and the producer hook's transaction and tenant context. 2. `ui/packages/plugin-detail/src/renderers/recordActivityFeed.ts` — `isApprovalStepRow`, the mapping branch. 3. `ui/packages/app-shell/src/views/RecordDetailView.tsx` — `openRecordApprovals` / `viewApprovals`, a plain function below the page's early returns (a hook there breaks hook order). Two-minute check: `pnpm --filter @objectstack/plugin-approvals exec vitest run --maxWorkers=2 src/approval-activity-feed-35723.integration.test.ts` — expect 7 passed: one entry per step (approve / reject / recall, send back and resubmit, cancel on record delete), none on a muted timeline, a zh-CN reader served `已批准 · 经理审批`, none served to a reader without approval access while other entries stay, and served under the record-reader opt-in. --- _Generated by [Claude Code](https://claude.ai/code/session_01WGufzg3KqwSpt61Y8ovKK7)_ https://claude.ai/code/session_01WGufzg3KqwSpt61Y8ovKK7 <!-- signed: repo:objectstack#3 · os-support-ai · session_01WGufzg3KqwSpt61Y8ovKK7 --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Yibo Wang · project thread
repo:objectstack#3 · os-support-ai · session_01WGufzeiHatzB4rRx1t4Php
Fixes #37041
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
getRecordLocks(the batch doorPOST /api/v1/approvals/records/:object/locks) now asks the detail-row lock as well as the record lock, so a master-detail line whose master is held by a locking approval answerslocked: true, exactly asgetRecordLockalready does and as the route doc promises ("Each entry is exactly the single-record door's answer for that id").detailRowsHeldByLockingApprovalinlifecycle-hooks.ts: one SYSTEM read of the rows'master_detailFK columns for the whole page, then one locking-request lookup permaster_detailedge for every master those rows name. That is1 + edgesreads whatever the page size, never one per row; an object with nomaster_detailedge reads nothing extra. The one-rowdetailRowHeldByLockingApprovalnow delegates to it, so the single and batch reads share one judgement. With one id, the FK read keeps the by-id shape the one-row read always sent.{ locked }ornull); unreadable-vs-missing stays indistinguishable (the caller's anchor read is untouched and runs first).packages/spec/src/contracts/approval-service.ts: one clause in each of thegetRecordLockandgetRecordLocksdocblocks saying that a master-detail line also answerstruewhile the record it belongs to is held (the detail-row lock's judgement). The text "lockedonly", the rest of 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 text and the answer shape are untouched;check:generatedreports all 14 spec artefacts up to date at 88b76bf.Seat 4's consumer constraint (comment 7145422785): answered by #37151
Seat ruling (repo:objectstack#3, 2026-11-24 22:53Z): this PR lands the parity fix alone with
Fixes #37041; the lock-kind question moved to #37151, which carries route A, route B and keep to the maintainer. The measurements below are kept as that card's evidence.The constraint asks this PR to say which of (A) the batch entry and the single door say which kind of lock holds the row, or (B) the grid hides Delete on master-held lines. Measured at 517e415:
Route A: the ruled text it would change. The
getRecordLockdocblock inpackages/spec/src/contracts/approval-service.tscarries the #25934 ruling A: "What is answered:lockedonly. ... ⛔ No request id, node, participants orpendingflag". A kind field (for exampleheldBy: 'record' | 'master', master winning when both hold, since a held master refuses the line's delete either way) rewrites "lockedonly" there, the same sentence in the plugin'sgetRecordLockdocblock ("{ locked }only"), the REST door comment ("the payload is{ locked }alone") and the return type of both optional contract members (a published shape, so Clause-② would becomeyes (widening)). Because that is ruled text, this PR stops here and the shape question goes to the seat.Route A: what the field would tell a caller who can read the line but not the master. With parity alone,
locked: trueon a line already says "this line or its master is held", and the single door has said that since it shipped. The kind field adds one bit: which of the two. A caller who may update the line can already learn that bit without a destructive act: an edit is refusedRECORD_LOCKEDwith the record lock's sentence (record_locked: the line's own object label and title) when the line is held itself, and with the detail-row lock's sentence (record_locked_untitled: the MASTER object's label, no title) when its master is held (lifecycle-hooks.ts,recordLockRefusalcalled from the two hooks). Delete is offered only to callers who can write, and for them A discloses nothing new. A read-only line reader with no request visibility learns the bit only through A. Nothing about the request (id, node, participants, pending) is disclosed in either case.Route B: what the grid can tell without a server field. The grid has the object schema (it already branches on
master_detailfield types inObjectGrid.tsx). So it can know the object is a detail object, but not why a given row is locked. The only server-free rule is to hide Delete on every locked row of an object that has amaster_detailfield. That over-hides Delete on a line held by a request of its own whose master is not held, which the server would accept (the detail-row hook judges only the master; the record lock is update-only, and the delete-cancel linkage cancels the request). It also copies the server's "which hook refuses delete" rule into the client. Asking the batch door a second time for the masters' ids would need the FK column on the page and a readable master (an unreadable master answersnull), so it does not close the gap. Collision: PR #37128 (#36911, seat 4, open draft at d4f56f4) editsui/packages/plugin-grid/src/objectGridActionsColumn.tsxandObjectGrid.tsx, so route B can only start after it merges.No regression from landing parity alone. Today the batch door answers master-held lines
locked: false, so the grid offers both Edit and Delete, and the server refuses both. After this PR (and #37128) it offers Delete only, which the server still refuses. That is one refused offer instead of two. The Delete gap exists already and is not created here.Tests
plugin-approvals: targeted file, full suite, typecheck (head 9b5bdcd)
pnpm --filter @objectstack/plugin-approvals exec vitest run --maxWorkers=2 src/record-lock-read.integration.test.ts:Test Files 1 passed (1),Tests 14 passed (14)(12 existing + 2 new).pnpm --filter @objectstack/plugin-approvals test:Test Files 128 passed (128),Tests 1922 passed (1922).pnpm --filter @objectstack/plugin-approvals typecheck: exit 0;check:test-typecheck: OK.record-lock-read.integration.test.ts:held_sheet_a), a line of a held master (held_sheet_line_a), unheld records and lines (_b), a missing id and a repeated id. It also covers a line held by its own request, and the unlock once the master's request is decided.[line, sys_approval_request, line, sys_approval_request], never one read per row.Ablation (one, on the tested behaviour)
The test imports
./approval-service.jsfromsrc(no dist hop).node scripts/ablation-replace.mjsreplaced{ locked: held.has(id) || heldByMaster.has(id) }with{ locked: held.has(id) }: anchor x1 -> x0, blob 50e23203 -> da6d398c. Result:Tests 2 failed | 12 passed (14), and the two failures are exactly the two new pins. Restored: blob == HEAD (50e23203),git diff HEADempty.Acceptance notes
Fixes #37041stays, per the seat's ruling.Verification
Read first, by risk:
packages/plugins/plugin-approvals/src/lifecycle-hooks.ts,detailRowsHeldByLockingApproval: the batch FK read (SYSTEM) and the per-edge master lookup.packages/plugins/plugin-approvals/src/approval-service.ts,getRecordLocks: the second half runs only on readable ids the record lock left unlocked.packages/plugins/plugin-approvals/src/record-lock-read.integration.test.ts: the two new pins.Two-minute check:
pnpm --filter @objectstack/plugin-approvals exec vitest run src/record-lock-read.integration.test.tsshould report 14 passed.🤖 Generated with Claude Code
https://claude.ai/code/session_01WGufzeiHatzB4rRx1t4Php
Generated by Claude Code