Repository navigation
fix(approvals): a reject carries its reason at the approvals route, decide, the SDK and the inbox - #35741
Conversation
…the SDK Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
…in and changesets Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
…g rejects carry a reason Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
…edger Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
📓 Docs Drift CheckThis PR changes 2 package(s): 29 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 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): 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 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
|
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
|
repo:objectstack#4 · os-elon-musk · session_016WV4cxk4f4T7at3YeFruhZ L1 verdict (L1-a): ACCEPT at head Gates on this head: 73 check-runs: 61 success, 12 skipped, 0 failed, 0 pending. What I checked (holds):
Notes (non-blocking):
This is a narrowing: the seat runs the CONTRACT_REVIEW_TIER read, then a4-W lands it. Not governed. Generated by Claude Code |
|
repo:objectstack#4 · os-elon-musk · session_016WV4d1PJ4isQ3eD7Fk1fnF Served-tier: Contract review — PASS at a8f6d0bHead-sha: Isolated, read-only sub-agent record, written 2026-11-20T06:18Z. Face: narrowing. The PR body and all three changesets carry 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.
① Derived judgments
② Semver levelThree ③ Boundary flags
④ Design judgment
Notes:
Implemented-by: VERDICT: PASS |
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
…area param, so a non-string comment is refused Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
…rows Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
|
repo:objectstack#4 · os-elon-musk · session_016WV4czsTwiYB5WxgWqEVcu L1 delta verdict (L1-a): ACCEPT at head Gates on this head: 61 success, 12 expected skip, 0 unexpected skip, 0 failed, 0 pending. 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, Generated by Claude Code |
|
repo:objectstack#4 · os-elon-musk · session_016WV4d1PJ4isQ3eD7Fk1fnF Served-tier: Contract review — PASS at 9f0c3e9 (delta over a8f6d0b)Head-sha: 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 What moved since a8f6d0b, by first parent: 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
② Semver levelUnchanged: three ③ Boundary flags
④ Design judgment
Notes:
Implemented-by: VERDICT: PASS |
|
repo:objectstack#4 · os-elon-musk · session_016WV4d1PJ4isQ3eD7Fk1fnF 席位核对 — ACCEPT · repo:objectstack#4 · head
|
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
维护者速读
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 makesapproval_reject'scommentparam required at the REST action door, MCPrun_actionand the console param dialog.@objectstack/plugin-approvals).ApprovalService.decide()refuses a reject whosecommentis 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 sametextareaparam (validateActionParamsfrom@objectstack/spec/ui):400 VALIDATION_ERRORwithInvalid 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(orboolean,array,object), the action door'sinvalid_shape. Every human door reachesdecide():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 declaresstatus+codeat its own status, in the nested ADR-0112 envelope. An approve keeps its comment optional.auto_rejectcalls the privatedecideAndResumewithcomment: 'SLA escalation'. The revision-limit auto-reject inrevisewrites its own reject row. Neither passes throughdecide(). The email action link (redeemActionToken) does pass through, with its fixed text'Via action link', so it keeps working.@objectstack/client).client.approvals.reject(requestId, decision)now requiresdecisionand itscomment: stringat the type level.approveis unchanged.@object-ui/console,@object-ui/i18n). The row Reject confirmation, the bulk Reject confirmation and therkey (which opens the row confirmation) keep Reject disabled until the reason is non-blank. The box is no longer labelled optional:approvalsInbox.commentdrops "(optional)" in all eleven locale packs. Approve takes no reason, as before.'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-approvalspatch and@objectstack/clientpatch, each with a BREAKING banner, the ADR-0087not-required (no-migration-prescription)marker and a caller fix line;@object-ui/console+@object-ui/i18npatch inui/.changeset/.Tests
Unit and UI pins (new or rewritten)
plugin-approvals/src/approval-service.test.ts:decidewith a reject whose comment isundefined/''/ whitespace /nullthrowsstatus 400,code VALIDATION_ERRORand 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 stayspending, no reject row is written and no resume happens. CONTROL: a reject with a reason finalizesrejectedand 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 andnulleach answer[400, 'VALIDATION_ERROR']and the body namescomment;0,false,[]and{}each answer[400, 'VALIDATION_ERROR']withAction 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 carriescomment. Two@ts-expect-errorlines prove the type refusesreject(id)andreject(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, therkey 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.decide()with no comment (20 call sites in 13 files) now passcomment: '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.tsanchorif (issues.length > 0) {changed toif (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 fromsrc, so there is no dist leg.approval-service.tstype 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.tsxrowdisabled={!rejectComment.trim()}changed todisabled={false}: the row pin goes red (1 failed, 6 passed). The bulkdisabled={!bulkRejectComment.trim()}changed todisabled={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 '{}'answers400withVALIDATION_ERRORandAction param "comment" is required.Local readings at head
9f0c3e9e6e(objectstack, with main merged, #35716 included): plugin-approvalsvitest run124 files / 1775 tests passed; plugin-approvals and clienttypecheckexit 0 (test-typecheck ledgers held); clientclient.test.ts222 passed; the two dogfood approval files 9 passed; showcaseexpense-approval-write-back6 passed; console inbox files 18 / 95 passed; uivitest 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 at9f0c3e9e6e: 482 passed / 3 skipped files, 4096 passed / 68 skipped tests, no failures. The consoletype-checkis NOT MEASURED locally (the unbuilt@object-ui/*closure gives only module-resolution errors);Type Check UIruns it.Acceptance notes
approval_rejectaction requires a reason #35716 has merged (03bce5c2), and these files stay outside this PR's File surface. 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 widens fix(approvals)!: rejecting through theapproval_rejectaction requires a reason #35716's action-scoped sentence ("A reject throughapproval_rejectalways carries its reason") insys-approval-request.object.ts,approvals.mdxandapprovals.jsonto cover the approvals route and the SDK. It also makes the spec contract docblock onIApprovalService.decide/ApprovalDecisionInput.comment(packages/spec/src/contracts/approval-service.ts) say that a reject requires a non-blank string comment, and updatesskills/objectstack-automation/references/state-machines-and-approvals.md.ui/e2e/approvals-inbox-phone.spec.tsbuilds a hand-written static markup fixture for a layout measurement, and that fixture still says "Comment (optional)". It does not render the component, so the measurement is unaffected. It is left for the inbox's lane.f75dc2fa1d, found one more stale fixture outside the claim amendment's list:approval-pending-approver-record-read.dogfood.test.ts. Itsdecidehelper posted{}to the reject route and now got400 VALIDATION_ERROR. Its reject now sends{ comment: 'Over budget.' }, and its assertions are unchanged. This is the os-dev rule for a red caused by this change: the stale fixture is fixed in the same PR. That run's wire body confirmed the envelope as{"success":false,"error":{"code":"VALIDATION_ERROR","message":"Invalid action params: Action param \"comment\" is required"}}.examples/app-showcase/test/expense-approval-write-back.test.ts: itsdecidehelper now sends a reason on reject (CI Test Core 9/10 red at117828962don the reasonless reject, green ata8f6d0bf37). No assertion changed.approval-override-composite-pin), which is the claim amendment's dogfood file. It is twoitcases in that harness's routesdescribe, not a new boot.🤖 Generated with Claude Code