Skip to content

fix(approvals): a reject carries its reason at the approvals route, decide, the SDK and the inbox - #35741

Merged
os-zhuang merged 11 commits into
mainfrom
claude/area-a4W-35719
Nov 20, 2026
Merged

os-zhuang merged 11 commits into
mainfrom
claude/area-a4W-35719

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread
Fixes #35719
Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: follow-up #35772 — packages/spec/src/contracts/approval-service.ts, packages/plugins/plugin-approvals/src/sys-approval-request.object.ts, content/docs/automation/approvals.mdx, docs/qa/platform-checklist/areas/approvals.json, skills/objectstack-automation/references/state-machines-and-approvals.md

维护者速读

  • 用户能看到什么变化:审批人在审批收件箱驳回(单条、批量、快捷键)时必须填写理由,理由为空时驳回按钮不可点;通过 SDK 或审批接口驳回而不带理由(或理由不是文字),会被拒绝。
  • 为什么做:落实"驳回必须附理由"的要求。动作入口那一半已由另一个 PR 完成并已合入(审批驳回动作的理由改为必填),本 PR 补上审批接口、SDK 和收件箱。
  • 出错会怎样:不带理由的驳回会被拒绝并提示缺少理由,审批单保持待处理;系统自动驳回(超时升级、退回次数超限)不受影响;可直接撤回本 PR。
  • 要你做什么:这次收窄按新规则需要维护者批准后才能合并(由席位请审)。

What changes

A reject now always carries its reason on the doors that #35716 left open. #35716 (merged as 03bce5c2) is the action-door half: it makes approval_reject's comment param required at the REST action door, MCP run_action and the console param dialog.

  • Service (@objectstack/plugin-approvals). ApprovalService.decide() refuses a reject whose comment is missing, null, empty or whitespace-only, or is not a string, before anything is read or written. The refusal is the action-param refusal, judged by the same rules over the same textarea param (validateActionParams from @objectstack/spec/ui): 400 VALIDATION_ERROR with Invalid action params: Action param "comment" is required, or, for a number, boolean, array or object, Invalid action params: Action param "comment" (textarea): Invalid input: expected string, received number (or boolean, array, object), the action door's invalid_shape. Every human door reaches decide(): POST /api/v1/approvals/requests/:id/reject, the SDK, and the action door, which forwards to that route. The route needs no edit. Its error handler answers a thrown refusal that declares status + code at its own status, in the nested ADR-0112 envelope. An approve keeps its comment optional.
  • System rejects keep working. The SLA sweep's auto_reject calls the private decideAndResume with comment: 'SLA escalation'. The revision-limit auto-reject in revise writes its own reject row. Neither passes through decide(). The email action link (redeemActionToken) does pass through, with its fixed text 'Via action link', so it keeps working.
  • SDK (@objectstack/client). client.approvals.reject(requestId, decision) now requires decision and its comment: string at the type level. approve is unchanged.
  • Console inbox (@object-ui/console, @object-ui/i18n). The row Reject confirmation, the bulk Reject confirmation and the r key (which opens the row confirmation) keep Reject disabled until the reason is non-blank. The box is no longer labelled optional: approvalsInbox.comment drops "(optional)" in all eleven locale packs. Approve takes no reason, as before.
  • Remaining leg: the email action-link reject records the fixed text 'Via action link', and its confirm page has no reason field. That is follow-up approvals: the email action-link reject (ADR-0043 confirm page) records "Via action link" instead of a reason the approver typed — add a required reason field (remaining leg of #35593's "reject carries a reason") #35722.

Changesets: @objectstack/plugin-approvals patch and @objectstack/client patch, each with a BREAKING banner, the ADR-0087 not-required (no-migration-prescription) marker and a caller fix line; @object-ui/console + @object-ui/i18n patch in ui/.changeset/.

Tests

Unit and UI pins (new or rewritten)
  • plugin-approvals/src/approval-service.test.ts: decide with a reject whose comment is undefined / '' / whitespace / null throws status 400, code VALIDATION_ERROR and the action door's sentence; 0 / false / [] / {} throw the same code and status with the exact (textarea): Invalid input: expected string, received … sentence. The request stays pending, no reject row is written and no resume happens. CONTROL: a reject with a reason finalizes rejected and records the comment. Approve without a comment is already pinned by the resume test above it.
  • qa/dogfood/test/approval-override-composite-pin.dogfood.test.ts (real boot, real route): {}, '', whitespace and null each answer [400, 'VALIDATION_ERROR'] and the body names comment; 0, false, [] and {} each answer [400, 'VALIDATION_ERROR'] with Action param "comment" (textarea): ; and the request stays pending with no decision row. CONTROL: a reject with 'Over budget.' answers 200, rejected, and its decision row carries the comment. The fixture's existing reject (line 359) now sends a reason. Its assertions are unchanged.
  • client/src/client.test.ts: the reject body carries comment. Two @ts-expect-error lines prove the type refuses reject(id) and reject(id, { actorId }). The test-typecheck ledger holds 0 errors, so both directives bite.
  • ApprovalsInboxPage.rejectReasonSelfSubmitted-27520.test.tsx: the old "left empty, the reject carries no comment" case is replaced by its opposite. Reject is disabled when the box is empty or whitespace, enabled once it has text, the r key opens the same empty, disabled confirmation, and no reject call is made. The bulk case asserts the confirmation is disabled for empty and whitespace before it sends the reason. The phone-width test reads the new label.
  • Existing plugin-approvals tests that rejected through decide() with no comment (20 call sites in 13 files) now pass comment: 'Over budget.'. No assertion was loosened.
Ablation (fix committed first; `scripts/ablation-replace.mjs`, restore proven blob == HEAD and git diff HEAD empty)
  • approval-service.ts anchor if (issues.length > 0) { changed to if (false && issues.length > 0) { (x1 to x0; blob e28c59b86c80 to cf6d72bc66f4): the decide refusal pin goes red (expected [ undefined, undefined ] to deeply equal [ 400, 'VALIDATION_ERROR' ]), and the CONTROL pin stays green. plugin-approvals tests import the service from src, so there is no dist leg.
  • approval-service.ts type key: [{ name: 'comment', required: true, type: 'textarea' }] changed to [{ name: 'comment', required: true }] (x1 to x0; blob 4c675f1e3515 to f1b91d352beb): the decide refusal pin goes red at its first non-string row (0: expected [ undefined, undefined ] to deeply equal [ 400, 'VALIDATION_ERROR' ]), and the CONTROL stays green. Restored to the HEAD blob 4c675f1e3515.
  • ApprovalsInboxPage.tsx row disabled={!rejectComment.trim()} changed to disabled={false}: the row pin goes red (1 failed, 6 passed). The bulk disabled={!bulkRejectComment.trim()} changed to disabled={false}: the bulk pin goes red (1 failed, 6 passed). Both were restored to the HEAD blob 52f03970d580.

Verification

Two-minute check: open the Console approvals inbox as an approver and press Reject on a pending row. The Reject button in the dialog stays disabled until you type a reason. Then curl -X POST .../api/v1/approvals/requests/ID/reject -d '{}' answers 400 with VALIDATION_ERROR and Action param "comment" is required.

Local readings at head 9f0c3e9e6e (objectstack, with main merged, #35716 included): plugin-approvals vitest run 124 files / 1775 tests passed; plugin-approvals and client typecheck exit 0 (test-typecheck ledgers held); client client.test.ts 222 passed; the two dogfood approval files 9 passed; showcase expense-approval-write-back 6 passed; console inbox files 18 / 95 passed; ui vitest run scripts/ 171 files / 5092 passed. dispatch-gates --commands: 87 derived, 87 run, all exit 0 (--ran: 0 NOT-MEASURED, 0 UNRUN). overlap-check: VERDICT clean. Full dogfood battery at 9f0c3e9e6e: 482 passed / 3 skipped files, 4096 passed / 68 skipped tests, no failures. The console type-check is NOT MEASURED locally (the unbuilt @object-ui/* closure gives only module-resolution errors); Type Check UI runs it.

Acceptance notes

🤖 Generated with 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 20, 2026
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/client, @objectstack/plugin-approvals, touching 2 documentable anchor(s).

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

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

What this run could not see

Coarse fallback — 25 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 0e2de25149ec81ecb00094300ad2f1e506ddc1fd → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 0e2de25149ec81ecb00094300ad2f1e506ddc1fd

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

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

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4cxk4f4T7at3YeFruhZ

L1 verdict (L1-a): ACCEPT at head a8f6d0bf374f3162ae95f608993813db881e3f57 (requested via the area; Fixes #35719, the route/SDK/inbox leg recorded on #35716).

Gates on this head: 73 check-runs: 61 success, 12 skipped, 0 failed, 0 pending. Lint & Repo Gates and TypeScript Type Check both passed. Mergeable: clean. The dogfood battery is pinned to this head (482/485 files, 0 failed), per the os-dev report 7031763429.

What I checked (holds):

  • One check, at the right seam. ApprovalService.decide (~6498) refuses a reject whose comment fails validateActionParams([{ name: 'comment', required: true }]). That is the same presence rule the approval_reject door uses (absent, null, '' and whitespace all count as missing). It throws 400 VALIDATION_ERROR with the door's own Invalid action params: … prefix (action-execution.ts enforceActionParams). Approve is untouched.

  • Every caller of decide in the repo's non-test source:

    The SLA auto_reject and the revision-limit reject go through decideAndResume or their own row write, not through decide, so platform rejects keep working, as the changeset says.

  • SDK. client.approvals.reject(id, { comment: string, … }): the decision and its comment are now required at the type level. The changeset says BREAKING for TypeScript callers and gives the fix. approve is unchanged.

  • Console inbox.

    • The row confirmation and the bulk confirmation have disabled={!…trim()} on the Reject action, and the box carries required.
    • The r key goes through openReject, which is the same row dialog, so it is covered.
    • approvalsInbox.comment is used only by the two reject boxes in this file, so dropping "(optional)" in 11 locales does not touch an optional approve field.
    • approvalsApi.reject passes through what the dialog collected.
  • Tests.

    • The dogfood route pin (approval-override-composite-pin) sends {}, '', whitespace and null, gets 400 VALIDATION_ERROR naming comment, and then checks the request is still pending with no decision row. Its CONTROL reject with a reason records ['reject','Over budget.'].
    • The decide unit pins and the inbox test are updated.
    • Existing rejects in about 14 fixtures now send a reason. Each is a one-line comment: addition, not a loosened assertion. The two outside the claim (dogfood pending-approver read, showcase expense write-back) are declared.
    • The body has the ablation.
  • Changesets. Three: plugin-approvals, client and ui console/i18n, all patch. Each is Clause-②: no (narrowing) and Metadata-protocol: none. The two server-side ones carry the BREAKING paragraph and the ADR-0087 not-required marker. Fixes #35719 is right: the card's route, SDK and inbox are all delivered, and the email-link leg is approvals: the email action-link reject (ADR-0043 confirm page) records "Via action link" instead of a reason the approver typed — add a required reason field (remaining leg of #35593's "reject carries a reason") #35722.

Notes (non-blocking):

  1. The check runs before the request is read, so a reasonless reject of a request that does not exist, or that the caller may not decide, now answers 400 rather than 404 or 403. That order is harmless, since it leaks nothing, and matches the action door, which judges params first. The changeset could say "refused before the request is looked up" if precision matters.
  2. Now that the inbox box is required, it is still labelled "Comment" / 「审批意见」. "Reason" / 「驳回理由」 would tell the approver what is wanted. This is cosmetic.

This is a narrowing: the seat runs the CONTRACT_REVIEW_TIER read, then a4-W lands it. Not governed.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4d1PJ4isQ3eD7Fk1fnF

Served-tier: CONTRACT_REVIEW_TIER

Contract review — PASS at a8f6d0b

Head-sha: a8f6d0bf374f3162ae95f608993813db881e3f57
Local-runs: none
Scope: examples/app-showcase/test/expense-approval-write-back.test.ts, packages/client/src/index.ts, packages/client/src/client.test.ts, packages/plugins/plugin-approvals/src/approval-service.ts, the 13 changed packages/plugins/plugin-approvals/src/*.test.ts files (approval-decision-outcome-notification.integration, approval-node, approval-service, approval-tenant-positions-name-authority, batch-item-recall-resumes-batch, decision-strand-envelope, exclude-submitter.integration, platform-admin-approver-34218, record-reader-opt-in.integration, record-reader-visibility, restored-approval-continuation, status-mirror-envelope.integration, stranded-run-repairability), packages/qa/dogfood/test/approval-override-composite-pin.dogfood.test.ts, packages/qa/dogfood/test/approval-pending-approver-record-read.dogfood.test.ts, ui/apps/console/src/pages/system/ApprovalsInboxPage.tsx, ui/apps/console/src/pages/system/ApprovalsInboxPage.phoneWidth-29070.test.tsx, ui/apps/console/src/pages/system/ApprovalsInboxPage.rejectReasonSelfSubmitted-27520.test.tsx, the eleven ui/packages/i18n/src/locales/*.ts packs (ar, de, en, es, fr, ja, ko, pt-BR, ru, zh-Hans, zh-Hant) + read, not reviewed: packages/rest/src/approvals-routes.ts, packages/spec/src/ui/action-params.zod.ts, packages/spec/src/data/field-value.zod.ts, packages/spec/src/contracts/approval-service.ts, packages/spec/src/api/errors.zod.ts, packages/runtime/src/action-execution.ts, packages/plugins/plugin-approvals/src/sys-approval-request.object.ts (as on main after #35716), ui/apps/console/src/services/approvalsApi.ts

Isolated, read-only sub-agent record, written 2026-11-20T06:18Z. Face: narrowing. The PR body and all three changesets carry Clause-②: no (narrowing) at a line start, and no path of the diff is a published schema or a governed path. Inputs: card #35719 and its thread, #35593 item 6, #35722, the PR body, the net diff against main, and the check-runs on the head: 73 runs, 61 success, 12 skipped, none red, all eleven required contexts green. The dogfood shards are skipped on a PR run, so the route pin's reading on this head is the dev report's full battery (comment 7031763429: 482 of 485 files passed, 3 skipped).

F: none. No must-fix. S1 to S3 below each owe a delta read; S2 and S3 move no head. N1 to N4 are notes.

  • S1 (should-fix) — the reason gate judges presence, not shape: a non-string comment passes at the route and at decide(), and the action door refuses it. approval-service.ts calls validateActionParams([{ name: 'comment', required: true }], …) with no type, and an untyped param's value schema is open (valueSchemaFor ends at z.unknown()). So POST …/reject with {"comment": 0}, false, [] or {} is recorded as a reject that has a reason. The same body through approval_reject, whose param is a textarea and therefore a string, answers 400 invalid_shape. "The refusal the action door gives" holds for a missing or blank value only, and a reject can still be recorded with no reason text. It is not a regression, since the route never judged the shape, but it is what is left of this PR's own guarantee; the value then reaches notifyDecisionOutcome's comment?.trim() after the decision is durable. Read in the tree, not run. Close: give the inline declaration type: 'textarea' and add one non-string row to the two refusal pins, or file it as a follow-up and scope the changeset sentence to string values.

  • S2 (should-fix) — the PR body owes its Skills-docs: line, and the texts it defers have no card. A (narrowing) arm owes the third declaration line (the claim template in SKILL.md; l1-review-checklist.md reads a missing one as rework). The body carries two. Its Acceptance notes leave three files alone "while fix(approvals)!: rejecting through the approval_reject action requires a reason #35716 is open" and say a docs follow-up "can" widen them. fix(approvals)!: rejecting through the approval_reject action requires a reason #35716 merged at 2026-11-20T04:37Z as 03bce5c, this branch's merge base predates it, and the dev report lists the follow-up as "noted, not filed". Once this PR lands, main reads:

    • packages/spec/src/contracts/approval-service.ts: ApprovalDecisionInput.comment? and the IApprovalService.decide docblock say nothing of the reject rule, while the outputs member beside it states its own approve-only rule there. This is the contract-bearing one. The rule lives in one implementation, and packages/rest forwards the body without judging it.
    • sys-approval-request.object.ts (from fix(approvals)!: rejecting through the approval_reject action requires a reason #35716), above approval_reject.params: "The target route itself does not judge the reason." That sentence is false after this PR.
    • content/docs/automation/approvals.mdx: line 774, body: { actorId?, comment? } for reject, is false; the decision-surface table row and the approval_reject paragraph stay action-scoped.
    • docs/qa/platform-checklist/areas/approvals.json: the quorum step that posts /reject with no body, and the r-key step and its clause, which confirm with nothing typed.
    • skills/objectstack-automation/references/state-machines-and-approvals.md, "Recording a decision": teaches decide() and POST …/reject without the reason.

    Close: file the card, write Skills-docs: follow-up #N — FILES at a line start of the body, and name that card where the notes say "can".

  • S3 (should-fix) — the landing path named for this PR is not the rule on main. L1 comment 7031835233 ends "the seat runs the CONTRACT_REVIEW_TIER read, then a4-W lands it", and the body's 速读 says nothing is asked of the maintainer. Since chore(governance): the guard scripts join the governed register, .claude/** lands by declared rule-change, a declared narrowing waits for the maintainer #35610 (509289c, on main at 2026-11-20T05:13Z) a declared narrowing lands like Tier H. SKILL.md's path-fork section says so (「申报收窄同换终局四件套含③请审,⛔ 无 Tier S 例外」), and the queue guard's narrowed leg refuses a pull whose body or changeset carries the arm until an authorized APPROVED review and a standing PASS record are both on its head. fix(approvals)!: rejecting through the approval_reject action requires a reason #35716 landed before that leg existed and is no precedent for this PR. Close, in the seat's hands: the seat record, pm:awaiting-merge, pr_request_reviewers, and a 速读 line that asks for the approval by this record's id and its Head-sha. No ready, no arm and no queue before that approval.

① Derived judgments

  1. IApprovalService.decide as ApprovalService implements it: a reject whose comment is absent, null, empty or whitespace-only was accepted and is now refused with 400 VALIDATION_ERROR before any read or write. A narrowing, and declared. An approve keeps its comment optional. Right.
  2. POST /api/v1/approvals/requests/:id/reject: the same narrowing, through the stock service. packages/rest is untouched and judges nothing itself (its own tests still drive this route with {} against a fake service). The wire answer is the nested ADR-0112 envelope from classifiedRefusalAnswer, pinned on a real boot. Right as declared.
  3. Error vocabulary: VALIDATION_ERROR is a StandardErrorCode member (packages/spec/src/api/errors.zod.ts). No new code and no ledger row, so nothing here turns the clause line to yes. Right.
  4. client.approvals.reject(requestId, decision): the second parameter goes from optional to required and comment?: string becomes comment: string. A type-surface narrowing that matches the route; approve is unchanged; the emitted request is unchanged. Right.
  5. System rejects, read in the tree: the SLA auto_reject calls the private decideAndResume with 'SLA escalation'; the revision-limit reject in sendBack writes its own rows; recall is its own member. None passes through decide(). The only non-test callers of decide are approvals-routes.ts and redeemActionToken. Right.
  6. Email action link, stated as asked: its reject is ACCEPTED, and it clears the gate on the constant 'Via action link', not on anything the approver typed. It is neither refused nor reasonless by omission. The body ("Remaining leg") and the plugin changeset both say so, and approvals: the email action-link reject (ADR-0043 confirm page) records "Via action link" instead of a reason the approver typed — add a required reason field (remaining leg of #35593's "reject carries a reason") #35722 is open for the reason field. Right, and declared.
  7. Console inbox: the row button, the bulk button and the r key all reach one of two dialogs whose action is disabled while the box is blank, and approvalsApi.reject has no other caller. approvalsInbox.comment loses "(optional)" in all eleven packs and only these two boxes read it. Right.
  8. Nothing widens: no new export, param, key, route or code. Clause-②: no (narrowing) is right, and so is Metadata-protocol: none, because nothing a metadata author writes changes.

② Semver level

Three patch changesets. @objectstack/plugin-approvals and @objectstack/client each carry both declaration lines at a line start, the BREAKING paragraph, the caller fix and the ADR-0087 not-required (no-migration-prescription) marker. That is the level AGENTS.md Post-Task step 3 gives a non-protocol breaking change, and the kind none keeps that exemption; Check Changeset and Lint & Repo Gates are green. ui/.changeset bumps @object-ui/console and @object-ui/i18n at patch with both lines. @objectstack/rest and @objectstack/spec change nothing they publish. Right.

③ Boundary flags

④ Design judgment

  • The narrowing itself: it takes away a capability the published contract type still spells (comment? on a reject). It is not a declared-but-undelivered gap covered up at a consumer. The capability was delivered and is withdrawn on the maintainer's requirement, declared with the arm and a BREAKING paragraph. What is missing is the spec side saying so (S2, first bullet).
  • Placement at decide() and not in the route handler is right: one seam that every human door reaches, with the system paths outside it by construction and not by a test of the actor.
  • Reusing validateActionParams gives one presence rule and the door's own sentence. The untyped declaration is S1.
  • Pins: the service (four blank shapes; still pending; no reject row; no resume; a control), the route on a real boot (four bodies; still pending; no decision row; a control), the SDK type (two expect-error lines under a zero-error ledger), the inbox (row, bulk, r). The body records ablations for the service gate and both inbox gates. Enough for the narrowing as declared; the gaps are S1's non-string row and N1's same-answer row.

Notes:

  • N1 (nit) — ordering, L1 note 1: no oracle. The 400 is a function of the body alone. A missing id, a request the caller may not read, a caller with no slot and a forged actorId all get the same bytes, so the answer says nothing about the request or the caller's standing. refuseUnreadableRequest's contract sentence ("before any refusal that depends on it (its status, its slate, its submitter)") still holds, because this refusal depends on nothing in the row; decideNode already answered requestId is required, decision must be approve|reject and the forged-actor refusal before the row read. Authentication is unchanged: the route's enforceAuth still runs first. No audit is skipped, because no refusal on this path writes a row, before or after. What changes is which refusal a reasonless, unauthorized reject sees: 400 where it was 403 or 404. The two authorization pins that had to gain a reason (record-reader-opt-in, record-reader-visibility) show exactly that. No contract text on main puts authorization ahead of body validation on these doors. One optional row would pin the property: the same 400 body for an id that names no request.
  • N2 (nit) — wording and dialect. Invalid action params: Action param "comment" is required is the action door's sentence spoken about a REST body field. It is a second copy of the prefix enforceActionParams owns, in the nested envelope, beside this route family's flat VALIDATION_FAILED: comment is required on request-info and comment. The card asked for the door's wording and handleApprovalError says a new arm takes the nested form, so it is accepted as built.
  • N3 (nit) — inbox, L1 note 2. The box is still labelled Comment / 审批意见, and the disabled Reject states no reason, although the row buttons in this file give a disabled button its reason as its title (审批收件箱:行内「通过」「驳回」默认可见,不要悬停才出现 #34587). approvalsApi.reject still types comment?. ui/e2e/approvals-inbox-phone.spec.ts keeps "Comment (optional)" in its static markup, as the body says. For the UI lane.
  • N4 (nit) — the body's 速读 still calls fix(approvals)!: rejecting through the approval_reject action requires a reason #35716 an in-flight PR; it has merged. The ui changeset carries the arm with no BREAKING paragraph and no ADR-0087 marker; the root gate reads .changeset only and nothing in the @object-ui accept set narrows, so nothing is owed there.

Implemented-by: claude/area-a4W-35719
Reviewed-by: session_016WV4d1PJ4isQ3eD7Fk1fnF

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4czsTwiYB5WxgWqEVcu

L1 delta verdict (L1-a): ACCEPT at head 9f0c3e9e6ec7b8f145645ac64159af3f44308e6e. The previous L1 ACCEPT was 7031835233 at a8f6d0bf. This delta covers the seat contract review's S1, S2 and N4 (7032134627) and the main merge. Os-dev report: 7033372699.

Gates on this head: 61 success, 12 expected skip, 0 unexpected skip, 0 failed, 0 pending. Lint & Repo Gates and TypeScript Type Check both passed. Mergeable: clean. Dogfood battery pinned to this head, per the report's dogfood_battery: 9f0c3e9e6e, full run with no shard and no path, 482 passed / 3 skipped files, 0 failed. l1-face.mjs --pr 35741 flags changeset for @object-ui/console / @object-ui/i18n. That is a false read: their entry is ui/.changeset/35719-inbox-reject-requires-reason.md, which l1-face does not scan. It is the same entry the seat read under ②.

What I checked (holds):

Carried from 7031835233, unchanged: notes 1 (400 before 404/403, no oracle: seat N1) and 2 (the inbox label: seat N3).

Landing: a declared narrowing, so it lands like Tier H (#35610). Back to the seat for its record on this head, pm:awaiting-merge and the maintainer's approval. No ready, no arm and no queue before that.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4d1PJ4isQ3eD7Fk1fnF

Served-tier: CONTRACT_REVIEW_TIER

Contract review — PASS at 9f0c3e9 (delta over a8f6d0b)

Head-sha: 9f0c3e9e6ec7b8f145645ac64159af3f44308e6e
Local-runs: none
Scope: packages/plugins/plugin-approvals/src/approval-service.ts, packages/plugins/plugin-approvals/src/approval-service.test.ts, packages/qa/dogfood/test/approval-override-composite-pin.dogfood.test.ts (the three the delta moves), and, carried from 7032134627 with every PR hunk unchanged: examples/app-showcase/test/expense-approval-write-back.test.ts, packages/client/src/index.ts, packages/client/src/client.test.ts, the 12 other changed packages/plugins/plugin-approvals/src/*.test.ts files (approval-decision-outcome-notification.integration, approval-node, approval-tenant-positions-name-authority, batch-item-recall-resumes-batch, decision-strand-envelope, exclude-submitter.integration, platform-admin-approver-34218, record-reader-opt-in.integration, record-reader-visibility, restored-approval-continuation, status-mirror-envelope.integration, stranded-run-repairability), packages/qa/dogfood/test/approval-pending-approver-record-read.dogfood.test.ts, ui/apps/console/src/pages/system/ApprovalsInboxPage.tsx, ui/apps/console/src/pages/system/ApprovalsInboxPage.phoneWidth-29070.test.tsx, ui/apps/console/src/pages/system/ApprovalsInboxPage.rejectReasonSelfSubmitted-27520.test.tsx, the eleven ui/packages/i18n/src/locales/*.ts packs (ar, de, en, es, fr, ja, ko, pt-BR, ru, zh-Hans, zh-Hant) + read, not reviewed: packages/spec/src/ui/action-params.zod.ts, packages/spec/src/data/field-value.zod.ts, packages/spec/src/api/errors.zod.ts, packages/spec/src/contracts/approval-service.ts, packages/rest/src/approvals-routes.ts, packages/runtime/src/action-execution.ts, packages/runtime/src/action-dispatch.ts, packages/plugins/plugin-approvals/src/sys-approval-request.object.ts, packages/plugins/plugin-approvals/src/sys-approval-request.object.test.ts, packages/qa/dogfood/test/approval-decide-over-mcp.dogfood.test.ts

Isolated, read-only sub-agent DELTA record, written 2026-11-20T07:47Z, by the reviewer of record 7032134627 (PASS at a8f6d0b with S1 to S3). Face: narrowing. The body and all three changesets still carry Clause-②: no (narrowing) at a line start. Inputs: that record, the L1 delta ACCEPT 7033517868, the dev report 7033372699, card #35719 and its thread, #35772, the PR body, the first-parent delta a8f6d0b to this head, the net diff against main, and the check-runs on this head: 73 runs, 61 success, 12 skipped, none red. The dogfood shards are skipped on a PR run, so the route pin's reading on this head is the dev report's full battery (482 of 485 files passed, 3 skipped, at this head).

What moved since a8f6d0b, by first parent: 81b516fe (merge of main at 0e2de25, which holds #35716 as 03bce5c), then b84f90a0, 1afa2c67, 9f0c3e9e. Of the 36 paths the PR touches, 21 are blob-identical to a8f6d0b, the 11 locale packs differ only by main's own removal of an unrelated rowNumbers key (the PR hunk has the same patch id), and 4 carry the delta: the service, its unit test, the dogfood route pin and the plugin changeset (26 lines added, 10 removed).

F: none. No must-fix. S: none open on this head. S1 and S2 are closed. S3's body leg is closed and what remains is the landing sequence itself. N1 to N3 carry over unchanged, N4 is closed, N5 and N6 are new notes.

① Derived judgments

  1. IApprovalService.decide as ApprovalService implements it: after the gate a reject's comment is a non-blank string. Absent, null, empty and whitespace-only values are required (presence, unchanged from a8f6d0b); a number, boolean, array or object is invalid_shape (new in the delta). Both are the declared narrowing, and the published type already spells comment?: string, so the shape leg withdraws nothing the contract declared. An approve is not judged. Right.

  2. Error vocabulary: VALIDATION_ERROR is an existing StandardErrorCode member (packages/spec/src/api/errors.zod.ts, and the 400 default of the status map). That file is blob-identical at a8f6d0b, at this head and on main, and the net diff touches no path under packages/spec. invalid_shape and required are issue codes inside the validator; decide() surfaces only the joined message, under the one code. No new code, no ledger row, nothing that turns the clause line to yes. Right.

  3. Blank and empty reasons, door by door, all read in the tree:

    • decide(), POST …/reject and the SDK: one predicate, isActionParamValuePresent (undefined, null, or a string whose trim() is empty), answers Action param "comment" is required. The route forwards body.comment untouched and judges nothing itself. The SDK type takes comment: string; a blank string compiles and gets the route's 400.
    • the approval_reject action door and MCP run_action: enforceActionParams runs the same validator over the action's own declaration (type: 'textarea', required: true) and answers the same status, code and sentence; pinned on main by fix(approvals)!: rejecting through the approval_reject action requires a reason #35716 for {}, '' and a whitespace-only value.
    • the console inbox: both Reject confirmations are disabled while trim() is empty, and the call sends the trimmed text.
    • the email action link: the constant 'Via action link'.

    Server and console use the same String.prototype.trim reading of blank, so no door accepts a value another refuses. Right.

  4. OS_ALLOW_LAX_ACTION_PARAMS: the flag makes the action door admit a param violation with a warning; decide() does not read it. A reasonless approval_reject under the flag passes the door and is refused by the route it forwards to. The reason rule has no lax escape, which is what "every human door reaches decide()" promises. Read, not run. Right.

  5. System rejects still pass, unchanged by the delta and by the merge: the SLA auto_reject calls the private decideAndResume with 'SLA escalation', and the revision-limit reject writes its own rows in the send-back path. Neither calls decide(). The only non-test callers of decide at this head are approvals-routes.ts and redeemActionToken. Both system texts are non-blank strings in any case. Right.

  6. The main merge: git show --remerge-diff 81b516fe is empty, so nothing was resolved by hand. What fix(approvals)!: rejecting through the approval_reject action requires a reason #35716 brought into the branch is approval_reject.params with comment as textarea, required: true, the same two keys the inline declaration carries. Its pins (sys-approval-request.object.test.ts, approval-decide-over-mcp.dogfood.test.ts) assert the door's refusal and a reject-with-reason control; none asserts that the route accepts a reasonless reject, and the control's 'Over budget.' clears the route's gate. No conflict with the action-door check. Main is three commits past this head's merge base; none touches a PR path or a cited file, and a trial merge is clean.

② Semver level

Unchanged: three patch changesets. Only the plugin changeset moved. Its BREAKING paragraph now lists a comment "that is not a string", the refusal paragraph gives both sentences (the (textarea): … one with an ellipsis, so it does not bind the validator's detail text), and the ADR-0087 marker reads "non-blank string comment". Both declaration lines are still at a line start. Check Changeset and Lint & Repo Gates are green on this head. The client and ui changesets are blob-identical to a8f6d0b. Right.

③ Boundary flags

④ Design judgment

  • The shape leg completes the narrowing's own guarantee. At a8f6d0b a reject could be recorded with a reason that was not text; now the value that reaches the audit row and the submitter's notice is a non-blank string on every door that reaches decide(). It makes the contract's own string real at the consumer and takes no declared capability away.
  • One validator, one sentence: the non-string refusal is the action door's invalid_shape wording, as the changeset says. N2's dialect note (an action-param sentence about a REST body field, now with (textarea) in it) stands as accepted.
  • Pins: enough for the narrowing as declared. The unit pin binds the exact third-party detail text (Invalid input: expected string, received …); a validator upgrade that rewords it turns the pin red, never silently green, and the changeset does not promise that text.

Notes:

  • N1 to N3 (nits, carried from 7032134627, unchanged): the 400 is a function of the body alone, so it comes before the 403 or 404 and is no oracle; the action-param dialect on a REST field; the inbox label, the disabled button's missing title, approvalsApi.reject still typing comment?, and the static e2e fixture.
  • N5 (nit) — the inline declaration is a second copy of approval_reject's comment param, which lives in the same package (sys-approval-request.object.ts). The docblock's "the textarea param that action declares" holds today by copy, and no pin ties the two: if the action's param changes type, the service keeps textarea and both pin sets stay green. No effect on this head. A one-line addition to approvals: after the reject-requires-reason change (#35716, #35741), the contract docblock, object comment, docs, checklist and skill reference still say a reject reason is optional — bring them in line #35772, or leave it.
  • N6 (note, outside the diff, not owed here) — the approve side keeps the asymmetry S1 named. approval_approve declares its comment as textarea, so the action door refuses a non-string approve comment, while POST …/approve and decide() do not judge it, and notifyDecisionOutcome calls comment?.trim() after the decision is durable. Read in the tree, not run; whether the action row's insert refuses the value first on a real engine is not established. It is outside the declared narrowing (an approve keeps its comment optional) and judging it would be a narrowing of its own. A candidate card through the filing gate.

Implemented-by: claude/area-a4W-35719
Reviewed-by: session_016WV4d1PJ4isQ3eD7Fk1fnF

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4d1PJ4isQ3eD7Fk1fnF

席位核对 — ACCEPT · repo:objectstack#4 · head 9f0c3e9e6ec7b8f145645ac64159af3f44308e6e

  1. 形态:审批路由、service decide()、client.approvals.reject、收件箱页(单条/批量/快捷键)、dogfood 用例;三个 patch changeset(含 @object-ui)。
  2. 前提实测:非字符串理由(0/false/[]/{})在 decide() 与路由均返回已有的 400 VALIDATION_ERROR,无新错误码;空白理由各入口一致;系统驳回不经 decide();400 先于 404/403 不构成存在性探测,不跳过审计。
  3. 门禁:现 head check-run:skipped 12, success 61;完整 dogfood 电池钉在此 head。
  4. 接受的偏差:N5(内联声明与动作参数重复,无 pin 绑定)、N6(approve 路径非字符串 comment 未判,超出本 diff)记为候选卡;收件箱字段标签 "Comment" 未改为 "Reason"(L1 非阻塞)。
  5. 范围外去向:approvals: after the reject-requires-reason change (#35716, #35741), the contract docblock, object comment, docs, checklist and skill reference still say a reject reason is optional — bring them in line #35772(规格文档注释、对象注释、approvals.mdx、approvals.json、自动化技能参考五处文字,Blocked-by 本 PR);approvals: the email action-link reject (ADR-0043 confirm page) records "Via action link" instead of a reason the approver typed — add a required reason field (remaining leg of #35593's "reject carries a reason") #35722(邮件动作链接的理由字段)。
  6. 落地条款:维护者(os-zhuang / hotlong / Elon)APPROVED 后由批准人入队,或 Elon 在席位线程写落地话;pm:awaiting-merge 同笔挂上。

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

3 participants