Skip to content

fix(approvals)!: an approver reassigns only their own slot - #36144

Merged
os-zhuang merged 5 commits into
mainfrom
claude/sec2-48g2
Nov 22, 2026
Merged

os-zhuang merged 5 commits into
mainfrom
claude/sec2-48g2

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — no published skill teaches the reassign door's from; the approvals guide already lists reassign as the pending approver handing over a slot, which is now the enforced rule

维护者速读

  • 审批人在多审批人的审批步骤上改派时,只能把自己的那一席交给别人;管理员和系统的改派不变,普通用户在界面上看不到差别。
  • 为审批流程的职责分离加固,由安全席位派发。
  • 出错的话,某位审批人改派自己那一席会被拒绝;改动只有一处判断,可以直接撤回。
  • 无。

What changes

An approver reassigns only their own slot. On POST /api/v1/approvals/requests/:id/reassign (and IApprovalService.reassign), a caller that is neither the system nor an administrator acting through the approval override may name as from only a slot it acts under: its user id, its account's email, or a position it holds — the same address set the slot test already reads. Any other from is refused with the existing refusal shape, 403 FORBIDDEN, and nothing moves. Omitting from still hands over the caller's own slot. The administrator override, the administrator rescue of a slate that names no one, and the system are unchanged.

  • packages/plugins/plugin-approvals/src/approval-service.ts — reassign(): one guard in the hand-off branch, after the platform-slot check.
  • .changeset/sec2-48g2.md — patch on @objectstack/plugin-approvals, BREAKING for the narrowed caller, ADR-0087 disposition not-required (no-migration-prescription).

Read first (by risk):

  1. approval-service.ts, the new guard in reassign() — the hand-off branch's authorization.
  2. packages/qa/dogfood/test/approval-reassign-own-slot.dogfood.test.ts — the door pins.
  3. approval-service.test.ts, describe reassign: an approver hands over only their own slot — the system leg, which has no HTTP door.

Tests

  • Door (real boot, bootStack, the console's route): another approver's slot refused 403 with code: 'FORBIDDEN', slate unchanged, no reassign action recorded; CONTROL own slot admitted; administrator override admitted.
  • Service: the same three legs plus the system leg.
  • Red on the base, green after; guard ablated red, restored green (counts in Verification).

Acceptance notes

  • L2 owed: the contract-tier review is the security seat's.
  • The console and the approval_reassign action never send from; they are unaffected.

Verification

Two-minute check: pnpm --filter @objectstack/dogfood exec vitest run test/approval-reassign-own-slot.dogfood.test.ts (after building the dogfood closure) — expect Tests 1 passed (1).

Red on base, green after, ablation
  • Base (pins committed, guard not yet): service pins Tests 1 failed | 3 passed; door pin Tests 1 failed (1).
  • With the guard (plugin rebuilt, guard text present in dist/): service Tests 4 passed; door Tests 1 passed (1).
  • Ablation via scripts/ablation-replace.mjs (anchor 1 → 0, blob changed), plugin rebuilt, run at 17932d305 and again at the final head ec011e0a5 with the same readings: service 1 failed | 3 passed, door 1 failed (1). Restored: blob == HEAD, git diff HEAD empty; rebuilt, ablation-dist-preflight --absent marker absent from all 6 built files; service 4 passed, door 1 passed (1).
  • pnpm --filter @objectstack/plugin-approvals exec vitest run: Test Files 126 passed (126), Tests 1812 passed (1812).
  • typecheck: @objectstack/plugin-approvals and @objectstack/dogfood exit 0.
Local gate subset (derived by dispatch-gates.mjs --commands, 76 families)
  • 73 of 76 exit 0; check:system-context-census re-run green after the guard's final spelling (head ec011e0a5).
  • NOT MEASURED, 3: check-plugin-teardown-shape.mjs --self-test (its positive control is a pinned commit this shallow checkout cannot reach); check:dual-build-cjs-loads (PREREQUISITE NOT MET: reads every package's dist/, and this order forbids a full-repo build); check:type-check-debt (builds every package; stopped for the same reason). CI's runs are the readings.
  • Full dogfood battery (owed by the (narrowing) arm): reported in the report comment on this PR.

Generated by Claude Code

@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 21, 2026
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

1 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

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

Coarse fallback — 6 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 146b6f9b6018b8144690338cf1cf0374407a4187 → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 146b6f9b6018b8144690338cf1cf0374407a4187

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

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov
os-dev-report

{
  "issue": null,
  "status": "done",
  "branch": "claude/sec2-48g2",
  "pr": "https://github.com/objectstack-ai/objectstack/pull/36144",
  "session": "session_017xRBcW9L8Noz9BxEwjwiov",
  "premise_still_valid": true,
  "summary": "An approver reassigns only their own slot: in the reassign hand-off branch, a caller the override does not admit (isOverride, which admits the system) is refused 403 FORBIDDEN unless `from` is one of the addresses it acts under (actorAddresses, the set the slot test reads). Pins at the HTTP door (new dogfood test on a purpose-built unanimous two-approver fixture: another approver's slot refused 403 FORBIDDEN with slate unchanged and no reassign action; own slot admitted; administrator override admitted) and at the service (same legs plus the system leg, which has no HTTP door). Patch changeset, BREAKING narrowing with an ADR-0087 not-required (no-migration-prescription) marker. Premise verified on origin/main db9e34ad3 before writing.",
  "tests": "Base (pins at a473b894d, guard absent; dist grep 0): service `-t 'only their own slot'` Tests 1 failed | 3 passed; door `approval-reassign-own-slot.dogfood.test.ts` Tests 1 failed (1). After the guard (rebuilt, guard text in dist/index.mjs x1): service 4 passed; door 1 passed (1). Ablation via scripts/ablation-replace.mjs (anchor 1->0, blob changed), plugin rebuilt: service 1 failed | 3 passed, door 1 failed (1); restore blob == HEAD, git diff HEAD empty, rebuilt, ablation-dist-preflight --absent: marker absent from all 6 built files; service 4 passed, door 1 passed. Ablation run at 17932d305 and again at final head ec011e0a5, same readings. At ec011e0a5: plugin-approvals vitest Test Files 126 passed (126), Tests 1812 passed (1812); typecheck plugin-approvals (incl. check:test-typecheck) and dogfood exit 0.",
  "gates": "dispatch-gates --commands at the change set (5 paths): 76 families; 73 exit 0 (check:system-context-census first exit 1 on a register drift from a new isSystem read in the guard; the guard was respelled to read isOverride alone, which already admits the system, and the census re-ran exit 0 on that content, committed as ec011e0a5). --ran reconciliation: 76 derived, 73 run, 3 UNRUN, each NOT MEASURED: check-plugin-teardown-shape.mjs --self-test exit 3 (positive control is a pinned commit unreachable in this shallow checkout); check:dual-build-cjs-loads exit 3 PREREQUISITE NOT MET (needs every package's dist/, full-repo build forbidden by this order); check:type-check-debt stopped by me (it builds every package under the lock; same reason). CI check-runs on PR 36144 at head ec011e0a5, all completed: Lint & Repo Gates success (Lint · CI, release & engine gates / ESLint / PM dispatch-gates / docs & code guards / repo & tooling gates / scoped x3 all success), TypeScript Type Check success (Type Check · debt ledger success — covers check:type-check-debt; consumer gates / source gates / workspace success), Test Core success (10/10 shards success), Build Core success, Governed Surface Queue Guard success, Dogfood Regression Gate success, Live E2E UI success, Test UI success, Check Changeset success, Check PR Size success, Spec property liveness success, PR-body guards success; Lint UI / Type Check UI / Build & E2E UI skipped by path selector; dogfood shards and queue verdicts skipped on PR runs (queue-only).",
  "dogfood_battery": "ec011e0a5 · os-verify-lock: VERDICT command-exit 0 · held the lock 3234s (53m54s) · Test Files 484 passed | 3 skipped (487) · Tests 4102 passed | 68 skipped (4170) · no failure. Same log file also holds a SECOND summary (Test Files 1 failed | 483 passed, wall-package-refusal.dogfood.test.ts) written by an earlier battery I started at 17932d305 and believed stopped: its wrapper died but its vitest survived as an orphan and kept its fd on the log; it ran concurrently with my ablation rebuilds of plugin-approvals' dist, so it is not a reading of any head. It printed no lock VERDICT. No process from this worktree remains.",
  "mcp_calls": "0",
  "api_writes": "2 — relay pr_create (POST pulls, objectstack-ai/objectstack#36144, draft, assignee sunhaolin, read-back identical 4426 bytes); post-stamped report comment (POST issues/36144/comments). Relay also ran one advisory_read (a read, not a write). git push x4 (not REST).",
  "open_questions": [],
  "security_findings": "withheld",
  "out_of_scope_findings": [],
  "files_changed": [
    ".changeset/sec2-48g2.md",
    "packages/plugins/plugin-approvals/src/approval-service.ts",
    "packages/plugins/plugin-approvals/src/approval-service.test.ts",
    "packages/qa/dogfood/test/approval-reassign-own-slot.dogfood.test.ts",
    "packages/qa/dogfood/test/fixtures/reassign-own-slot-fixture.ts"
  ],
  "line_budget": "+288 / -0 over 5 files (src +12, tests +156, fixture +103, changeset +17); no skills/** touched",
  "deviations": "1) The door pin lives in packages/qa/dogfood (the real HTTP composition), not in plugin-approvals, because that package has no HTTP door harness; the system leg is pinned at the service only, as there is no HTTP door for a system caller. 2) Three derived families NOT MEASURED locally (see gates). 3) The dogfood closure was built once via turbo (70 tasks) to drive the door pin; no full-repo build. 4) The PR body footer follows AGENTS.md's session-URL form, not the harness reminder's form. 5) The PR title carries `!` and the changeset BREAKING banner because the change is Clause-② no (narrowing). L2 contract-tier review is owed to the security seat; no mailbox knocked."
}

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov

Contract-tier review (L2) — PASS with should-fix · head ec011e0a5b7355e39520e44bafc04ef2575f2d43. Reviewed by an isolated CONTRACT_REVIEW_TIER thread, read-only.

  • Runs from a git archive export of the head: service pins 4/4, door pin 1/1, four sibling approval door files 17/17, wall-package-refusal.dogfood.test.ts 19/19.
  • Guard ablation: red at both the service and the door, green again on restore.
  • CI: all 54 check-runs are success or skipped.
  • The PR merges cleanly into origin/main.

Holds

  • The refusal is the existing FORBIDDEN (403) answer of the branch.
  • The own-slot set is the same set the slot test reads. User id, account email, held position, named position and named email are admitted. Out-of-office delegates sit on the slate under their own id.
  • Another approver's slot is refused under unanimous, quorum, per_group and first_response, with nothing changed.
  • The rescue branch is reachable only through the override. Override and system are unchanged.
  • reassign has one production door (REST). The console action and MCP forward to it.
  • The declarations and the BREAKING banner are true. Public text is rule-level.

Should-fix before the delta read

  1. The changeset sentence and the refusal text should state what is enforced: the call may move only a slot held by the actor it names. The seat accepts that behaviour: it fails closed, and omitting actorId judges the caller.
  2. The approver-address reader census (approver-address.ts READERS, and its test): register reassign as a reader of actorAddresses, and fix the why.
  3. Resolve actingCaller once.
  4. Add a position-slot leg to the service pins.
  5. content/docs/automation/approvals.mdx (~877): the prose now says "their own slot".

…er once, pin a position slot

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

Copy link
Copy Markdown
Contributor Author

security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov
os-dev-report

Delta report for the L2 should-fix round (record 7066503681), head c6322e1.

{
  "issue": null,
  "status": "done",
  "branch": "claude/sec2-48g2",
  "pr": "https://github.com/objectstack-ai/objectstack/pull/36144",
  "session": "session_017xRBcW9L8Noz9BxEwjwiov",
  "premise_still_valid": true,
  "summary": "Patch round for the L2 should-fix (comment 7066503681), all five items closed in commit c6322e104 on top of ec011e0a5. (1) The refusal text and the changeset now state what is enforced: the call may move only a slot held by the actor it names, and an omitted actorId names the caller. The refusal text reads: FORBIDDEN: actor 'X' may move only a slot it holds, and does not hold 'Y': that slot moves only for its holder, an administrator, or the system. Behaviour is unchanged. (2) approver-address-readers.test.ts READERS registers reassign as a reader of actorAddresses, and the SLOT_SITES why for reassign's pending.includes(from) now names that reader. READERS lives in the test file; approver-address.ts carries no READERS list, so it is untouched. (3) reassign resolves actingCaller once and hands it to takenSlot through a new optional caller parameter, so the census row 'reassign reads takenSlot' stays true. (4) The service pins gain a position-slot leg on a unanimous slate ['position:finance', 'u2']: a finance holder moves position:finance (admitted) and cannot move u2 (refused, nothing moves). (5) content/docs/automation/approvals.mdx: the reassign row now says 'Hands their own slot' and names the refusal and the override/system exception.",
  "tests": "At c6322e104: plugin-approvals vitest Test Files 126 passed (126), Tests 1814 passed (1814), which includes approver-address-readers.test.ts with the new READERS row. Own-slot service pins: Tests 6 passed (4 earlier legs plus the 2 position legs). Door pin approval-reassign-own-slot.dogfood.test.ts: 1 passed (1), on a rebuilt dist that carries the new refusal text x1. Typecheck of plugin-approvals (including check:test-typecheck) exits 0. Guard ablation at c6322e104 through scripts/ablation-replace.mjs (anchor 1->0, blob changed), service pins: 2 failed | 4 passed (the user-slot refusal and the position-slot refusal go red; all 4 controls stay green); restore: blob == HEAD, git diff HEAD empty. The door ablation was not repeated this round: the door test is unchanged and was ablated red/green at ec011e0a5.",
  "gates": "Re-derived on the round's change set (7 paths: the docs page adds the doc families): 103 families. 100 run, all exit 0. check:system-context-census exit 0. pnpm --filter @objectstack/spec run check:skill-examples first exited 3 (PREREQUISITE NOT MET: client-react had no dist in the fresh worktree); after pnpm --filter @objectstack/client-react build it exits 0 with 347 prose examples type-checked. --ran reconciliation: 103 derived, 100 run, 3 UNRUN and NOT MEASURED, the same three as round one with the same reasons (check-plugin-teardown-shape --self-test needs a commit unreachable in this shallow clone; check:dual-build-cjs-loads and check:type-check-debt need a full-repo build, which this order forbids). The container rebooted mid-run; the gate run resumed from family 64, and families 1-63 had already been recorded. CI on PR 36144 head c6322e104: 55 check-runs, 40 success and 15 skipped, none failed or pending.",
  "dogfood_battery": "Run because src logic changed this round: reassign's caller resolution moved (actingCaller resolved once, takenSlot takes an optional caller) and the refusal text changed. c6322e104 · os-verify-lock: VERDICT command-exit 0 · held the lock 2288s (38m08s) · Test Files 484 passed | 3 skipped (487) · Tests 4102 passed | 68 skipped (4170) · no failure. A first attempt at the same head was killed by a container reboot and gave no verdict; this run is the one restarted after it.",
  "mcp_calls": "0",
  "api_writes": "This round: 1 write, the post-stamped delta report comment on PR 36144 (POST issues/36144/comments, through the relay). git push x1, not REST. Reads: gh api for the L2 comment and the check-runs. Cumulative across both rounds: 3 writes (pr_create, report comment, delta report comment).",
  "open_questions": [],
  "security_findings": "withheld",
  "out_of_scope_findings": [],
  "files_changed": [
    ".changeset/sec2-48g2.md",
    "content/docs/automation/approvals.mdx",
    "packages/plugins/plugin-approvals/src/approval-service.ts",
    "packages/plugins/plugin-approvals/src/approval-service.test.ts",
    "packages/plugins/plugin-approvals/src/approver-address-readers.test.ts",
    "packages/qa/dogfood/test/approval-reassign-own-slot.dogfood.test.ts",
    "packages/qa/dogfood/test/fixtures/reassign-own-slot-fixture.ts"
  ],
  "line_budget": "Round delta: +50 / -14 over 5 files (approval-service.ts +17/-9, approval-service.test.ts +30/-1, approver-address-readers.test.ts +2/-1, changeset +1/-1, approvals.mdx +1/-1). PR total: 7 files. No skills/** touched.",
  "deviations": "1) The PR body was written once at pr_create and not PATCHed, per os-dev (the seat writes later body edits). Its What changes sentence ('may name as from only a slot it acts under') and its Verification counts are from round one; the seat may update them to the new wording and counts above. 2) Item 2 named approver-address.ts READERS, but the READERS list lives only in approver-address-readers.test.ts; I edited it there. 3) Three gate families are NOT MEASURED locally, as in round one; CI's Type Check · debt ledger and Lint & Repo Gates carry them. 4) The container rebooted mid-round: the gate run was resumed and the dogfood battery restarted; both are reported from the completed runs. 5) The worktree is kept for now and can be removed on request (the branch tip c6322e104 is pushed and the tree is clean)."
}

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov

Contract review

Head-sha: c6322e104c9382fda20c7690f0db469c2e377e0a

PASS at CONTRACT_REVIEW_TIER, on the narrowing face (Clause-②: no (narrowing)). Served-tier: CONTRACT_REVIEW_TIER. Local-runs: probe — from git archive exports of the heads.

  • The full review is comment 7066503681, at ec011e0a5: PASS with five should-fix items.
  • The delta read at this head (ec011e0a5..c6322e104, 5 files, +50/−14) closes all five.
  • The refusal text and changeset state the enforced rule: a call may move only a slot held by the actor it names.
  • The reader census registers reassign.
  • The caller is resolved once, with no behaviour change at the other four call sites. A client cannot supply it.
  • Position-slot legs are pinned.
  • The docs row is exact.
  • plugin-approvals: 126 files / 1814 tests pass. Guard ablation is red, then restored byte-identical.
  • The PR merges cleanly into origin/main c30ce97cd. 55 check-runs: 40 success, 15 skipped.
  • Nits, not blocking: the changeset could name the platform-administrators slot among the default actor's holdings, and a named-position actor's claim has no pin of its own.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov

席位记录 · ACCEPT · head c6322e104c9382fda20c7690f0db469c2e377e0a

维护者速读

  • 改了什么:多人审批里,审批人只能转交自己的那一格;管理员覆盖与系统操作照旧。
  • 为什么:加固会签与职责分离(安全席位无卡派单)。
  • 若出错:只会多拒(403),不会多放;可直接撤回。
  • 要你做什么:请以授权账号批准当前 head c6322e104(契约审核 PASS 记录:评论 7073892823);批准后由席位翻 ready、入队落地。

席位意见:ACCEPT。规则窄而准;修前红、修后绿与守卫消融齐备;返工五项全部关闭。

席位核对

  1. 形态: draft PR,以 main 为基。改动 7 个文件:plugin-approvals 包及其测试、dogfood 门测试、一个文档页、一个 changeset。无卡派单,没有 Fixes #。
  2. 前提实测: 门测试在基座上红,修后绿。服务层置钉修前 1 失败,修后 6/6。守卫消融后变红,复原后与 head 逐字节一致。
  3. 门禁: head 上 55 个 check-run:40 成功、15 跳过、0 失败。本地派生 103 个门禁族,跑了 100 个,全部 exit 0;另 3 个因浅克隆或需全仓构建未测,由 CI 覆盖。dogfood 套件在 c6322e104 上 VERDICT exit 0,4102 通过、0 失败。
  4. 接受的偏差:
    • 守卫按「调用点名的执行人」判断,不按调用方。这样只会更严。
    • 门测试放在 packages/qa/dogfood,因为 plugin-approvals 包内没有 HTTP 门测试框架。
  5. 范围外去向,Skills-docs:: 范围外事项已由安全席位另行记录。未触及 skills/**。
  6. 落地条款:
    • 申报为收窄,合并队列需两半在案:授权账号对当前 head 的批准,以及本 head 上的契约审核 PASS(7073892823)。
    • 批准后,席位做落地前检,再执行 pr_ready 与 automerge_enable。
    • 合并后,经中继把公告置为 closed,并记入台账。

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 22, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 22, 2026 05:02
@os-zhuang
os-zhuang enabled auto-merge November 22, 2026 05:03
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 22, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 22, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: c6322e104c9382fda20c7690f0db469c2e377e0a
Local-runs: probe — the guard ablation and the position-slot pins, run from a git archive export of the head
Scope: packages/plugins/plugin-approvals/src/approval-service.test.ts, packages/plugins/plugin-approvals/src/approval-service.ts, packages/plugins/plugin-approvals/src/approver-address-readers.test.ts, packages/qa/dogfood/test/approval-reassign-own-slot.dogfood.test.ts, packages/qa/dogfood/test/fixtures/reassign-own-slot-fixture.ts + none

① Derived judgments

A reassign that neither the system nor the override admits moves only a slot held by the actor it names; the refusal reuses the branch's FORBIDDEN/403; the caller resolution is unchanged at every other call site. Full review 7066503681 at ec011e0; the delta at this head closes all five should-fix items. Prior record: comment 7073892823.

② Semver level

patch with the BREAKING banner and ! title, as declared (Clause-②: no (narrowing), Metadata-protocol: none).

③ Boundary flags

No open questions. SQL push-down: none added.

④ Design judgment

The narrowing holds against the published spec on main: it makes an existing refusal real and takes no declared capability away. No must-fix or should-fix is open at this head; nits only, recorded in the prior record.

Implemented-by: claude/sec2-48g2
Reviewed-by: session_017xRBcW9L8Noz9BxEwjwiov

VERDICT: PASS

@os-zhuang
os-zhuang added this pull request to the merge queue Nov 22, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 22, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: c6322e104c9382fda20c7690f0db469c2e377e0a
Local-runs: probe — the guard ablation and the position-slot pins, run from a git archive export of the head
Scope: packages/plugins/plugin-approvals/src/approval-service.test.ts, packages/plugins/plugin-approvals/src/approval-service.ts, packages/plugins/plugin-approvals/src/approver-address-readers.test.ts, packages/qa/dogfood/test/approval-reassign-own-slot.dogfood.test.ts, packages/qa/dogfood/test/fixtures/reassign-own-slot-fixture.ts + none

① Derived judgments

A reassign that neither the system nor the override admits moves only a slot held by the actor it names; the refusal reuses the branch's FORBIDDEN/403; the caller resolution is unchanged at every other call site. Full review 7066503681 at ec011e0; the delta at this head closes all five items it raised. Prior record: comment 7073892823.

② Semver level

patch with the BREAKING banner and ! title, as declared (Clause-②: no (narrowing), Metadata-protocol: none).

③ Boundary flags

No open questions. SQL push-down: none added.

④ Design judgment

The narrowing holds against the published spec on main: it makes an existing refusal real and takes no declared capability away. No must-fix, no should-fix. Nits only, recorded in the prior record.

Implemented-by: claude/sec2-48g2
Reviewed-by: session_017xRBcW9L8Noz9BxEwjwiov

VERDICT: PASS

@os-zhuang
os-zhuang added this pull request to the merge queue Nov 22, 2026
Merged via the queue into main with commit 8e415bd Nov 22, 2026
61 checks passed
@os-zhuang
os-zhuang deleted the claude/sec2-48g2 branch November 22, 2026 08:47
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 22, 2026
…bjectstack-ai#36306)

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

Fixes objectstack-ai#36035

Clause-②: no
Metadata-protocol: none

## 维护者速读

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

## What changes

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

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

## Tests

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

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

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

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

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

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

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

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

## Acceptance notes

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

## Verification

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

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

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

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

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

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 22, 2026
…k before it edits, and a page's locks are read in one request (objectstack-ai#35795) (objectstack-ai#36295)

<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4Uu3ktGWQBYiYJq1ThpuDKTbF)_

repo:objectstack#1 · os-sales · session_01L6bhgXSK9qt8je9QbZvhKb

Fixes objectstack-ai#35795

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

## 维护者速读

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

## What changes

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

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

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

## Why

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

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

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

- **Wait, then open** (the card's first arm) rather than "open nothing,
say checking": the premise proposed the latter; building it showed that
a real double-click on a fresh page (and every Playwright `dblclick`)
would then always need a second double-click. The waiting edit is
dropped by selecting another cell, so nothing opens elsewhere.
- The lock and verdict of a page are asked on the first cell select
(lazy, the objectstack-ai#34208 posture), not on first paint.
- The same cap as explain (200); a body with any other key is refused,
like an unknown query name.
- A row the caller cannot read (`locked: null`) and a failed read fall
back to the `approval_status` column (fail open, as before; the server
still refuses a locked write).
- No principal key on the lock answers (unchanged from objectstack-ai#35747): they are
dropped on any data change of the object and on unmount.

## Verification

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

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

**Local runs** (merged tree, main `a5a5312f` + this branch, after `pnpm
install --frozen-lockfile && pnpm build`):
- `@objectstack/plugin-approvals` test: 126 files / 1,812 passed.
`@objectstack/client`: 59 / 820 passed. `@objectstack/spec`: 869 files /
27,877 passed. `@objectstack/rest`: first run 2 red (the two write-route
ledgers had no row for the new POST route); rows added (`no-record-echo`
in the objectstack-ai#8497 tripwire, a driven `approvals.getRecordLocks` row in the
hook-refusal ledger), both files now 737 / 737.
- Typecheck clean: rest, plugin-approvals, client, spec, ui plugin-grid,
components, i18n.
- UI (`packages/plugin-grid/ components/ plugin-list/ plugin-detail/
i18n/`): first run 18 red in 4 files: a paste / toggle / digit was
dropped while checking (fixed: those writes now wait too, as the edit
does), and `zh-Hant.ts` was not regenerated (fixed with `gen:zh-hant`).
The six affected files then 102 / 102. A second full run of these
packages is in progress; its result goes on this PR.
- `spec check:generated`: `api-surface` and `export-origins` regenerated
(one line each). `overlap-check.mjs`: clean against main and every open
PR sharing a file (objectstack-ai#36135, objectstack-ai#36144, objectstack-ai#36208).
- Added after the seat's ask: `ObjectGrid.autosave-35685.test.tsx`, new
top-level `describe` (2 cases, fake timers): a paste is not written for
1999 ms of a slow lock read and is written when it answers unlocked; on
a locked answer it is never written and the cell says why. Ablating the
wait in `writeCell`: both red, restored.

## Acceptance notes

- **objectstack-ai#36135** (draft) makes `getRecordLock` also answer `true` for a
`master_detail` line of a locked record. This PR's batch answers the
record half only. Whichever lands second carries the other half into
`getRecordLocks` (the line half batched: one FK read of the page, one
lookup per master object). `overlap-check.mjs` reads this branch clean
against objectstack-ai#36135 (it was moved off the lines objectstack-ai#36135 edits).
- The notice text stays on the cell until the answer arrives or the
reader moves; it is not a toast.

## Human Minimum

- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(a contract interface member and a constant)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English (the 维护者速读 block is the
maintainer's summary, in the maintainer's language).
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.

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

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

https://claude.ai/code/session_01L6bhgXSK9qt8je9QbZvhKb
<!-- signed: repo:objectstack#1 · os-sales ·
session_01L6bhgXSK9qt8je9QbZvhKb -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants