Skip to content

Commit 8ddadc1

Browse files
docs(spec,adr): the action-page contract and ADR-0043 name the reject link's required reason (#37153)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} --> _Requested by **Yibo Wang** · [project thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBEaJzgBWzjWCNjBjkVoeRto)_ Fixes #36709 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:用户无感;只改审批"邮件一键处理链接"的接口说明和对应架构决策记录的补充说明,让它们写明驳回时必须填写理由、不填会被退回确认页。 - 为什么做:属于"审批流程"这一块;上一轮已让邮件链接驳回必须填写理由,但对外发布的接口说明和决策记录还停留在旧说法,会误导读这些文字的开发者和 AI。 - 出错会怎样:只是文字,不改任何行为;写错最多是说明不准,可以直接撤回。 - 要你做什么:本次含一条架构决策记录的补充说明,而该记录没有"决策/状态"小节,自动判定只能归为需要审批人合并的一档,请按该档处理。 ## What changes Text only, no behaviour change. PR #36695 made the email action-link reject require a typed reason; contract review 7101851923 on it (nit N1) found two texts still describing the old POST. - `packages/spec/src/contracts/approval-service.ts`, the `IApprovalService.handleActionPage` docblock only: - `GET`: a reject link's confirm form also carries a required reason field, named `comment`. - `POST`: reads `token` and, for a reject link, `comment` (the last of each when a field repeats); a reject records that reason as its comment; an approve reads no `comment` and records the fixed "Via action link". - New bullet: a reject whose `comment` is missing, blank or not a string is refused before the token is consumed and answered the same confirm page again, carrying the refusal, with status `400` (redemption outcome `reason_required`). A dead link is judged first and still gets its `200` result page. The existing "never as an error status" sentence gains "The `400` above refuses the input, not the link." - `@param` / `@returns` say the same. Each statement is read off the implementation on `origin/main` 517e415 (`ApprovalService.handleActionPage`, `redeemActionToken`, `actionRedemptionPage` in `packages/plugins/plugin-approvals/src/approval-service.ts`), not off the card. - `docs/adr/0043-actionable-approval-links.md`: one ADD-ONLY paragraph after the Non-goals list. No existing line edited or removed; the first Non-goals bullet stands as written for v1. - `.changeset/36709-action-page-contract-reject-reason.md`: `@objectstack/spec` patch. Measured, not assumed: the docblock ships. After `pnpm --filter @objectstack/spec build`, the new sentence "refuses the input, not the link" is found in `dist/contracts/index.d.ts` and `.d.mts`, both inside `files[]` (`dist`). Positive control: the existing "The token is the only credential" sentence is found in the same two files. So `skip-changeset` would be wrong, and `Check Changeset` needs either a changeset or that label. Read first (by risk): (1) the new `400` bullet in the docblock, since it is the contract sentence an AI caller reads; (2) the ADR paragraph, for add-only shape; (3) the changeset. ## Tests No behaviour moved, so no test was added and no ablation applies (docblock and ADR text). <details><summary>Local runs on 5d4cdbc</summary> - `pnpm --filter @objectstack/spec build`: lock VERDICT command-exit 0. - `pnpm --filter @objectstack/spec typecheck`: lock VERDICT command-exit 0; `check:test-typecheck: OK`. - `pnpm --filter @objectstack/spec test`: lock VERDICT command-exit 0; `Test Files 889 passed (889)`, `Tests 28273 passed | 1 todo (28274)`. </details> ## Acceptance notes - **Landing tier.** The ADR row's add-only arm cannot apply to this ADR, whatever the note says. `addOnlyNoteReasons` from `scripts/pm/check-governed-merges.mjs`, run on this diff at full context, returns exactly one reason: "`docs/adr/0043-actionable-approval-links.md` names no decision or status heading, so where a note sits cannot be judged". ADR-0043's headings are TL;DR, Mechanics, Non-goals (v1) and Consequences, and its Status is a bold line, not a heading. An add-only diff cannot add such a heading to the base side, so this PR reads Tier H. The note's own lines pass every other test the reader applies (no removed line, plain-prose allowlist, no status line, no header-block line). - Contract review N2 to N5 on PR #36695 stay outside this card, as that review placed them. ## Verification <details><summary>Derived gate families (dispatch-gates, tree a48e05f then 5d4cdbc)</summary> `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derived 85 commands with the changeset present. 82 exited 0. Three exited 3 (PREREQUISITE NOT MET), left to CI and recorded as NOT MEASURED: - `node scripts/check-plugin-teardown-shape.mjs --self-test`: the fixture is pinned to a commit a shallow checkout cannot reach. - `pnpm check:dual-build-cjs-loads`: needs the whole workspace built. - `pnpm check:lean-entry-closure`: needs `@objectstack/objectql` built. `pnpm --filter @objectstack/lint run check:doc-formula-expressions` first exited 3 (unbuilt `@objectstack/formula`); after building formula and lint it exited 0. `--ran` reconciliation: "85 derived, 82 run, 3 NOT-MEASURED, 0 UNRUN" (3 derived from a recorded exit 3). Overlap: `node scripts/pm/overlap-check.mjs --branch=claude/issue-36709-approval-action-page-docs` reported `VERDICT clean exit 0` before each push. The in-flight branch `claude/issue-37041-batch-lock-detail-lines` (a770353) does not touch `packages/spec/src/contracts/approval-service.ts`, and this diff stays inside the `handleActionPage` docblock. </details> Two-minute check: `git diff origin/main...HEAD -- docs/adr/0043-actionable-approval-links.md` shows only `+` lines (ten of them). `grep -n "reason_required" packages/spec/src/contracts/approval-service.ts` hits the docblock once. --- _Generated by [Claude Code](https://claude.ai/code/session_01WGufzg3KqwSpt61Y8ovKK7)_ <!-- signed: repo:objectstack#3 · os-support-ai · session_01WGufzg3KqwSpt61Y8ovKK7 --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 6161010 commit 8ddadc1

3 files changed

Lines changed: 45 additions & 9 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@objectstack/spec': patch
3+
---
4+
5+
docs(spec): the `IApprovalService.handleActionPage` contract names the reason a reject link's POST now carries
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
Documentation only; no type, schema or export changes. The docblock shipped in `@objectstack/spec`'s contract types now matches what the ADR-0043 action page does since the reject-reason change in `@objectstack/plugin-approvals`:
11+
12+
- The confirm page for a reject link carries a required reason field, and the `POST` reads it from the form's `comment` field beside `token` (the last of each when a field repeats).
13+
- A reject whose `comment` is missing, blank or not a string is answered the same confirm page again with status `400` (redemption outcome `reason_required`): nothing is decided and the token is not consumed. A dead link is still told on its result page with `200`.
14+
- An approve link reads no `comment` and records the fixed comment "Via action link".

‎docs/adr/0043-actionable-approval-links.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ GET-executes design gets requests approved by robots.
6666
brute force is not the threat — leaked links are, and those die on
6767
first use / decision / reassign / expiry).
6868

69+
Note (2026-11-24): comment capture on the confirm page has shipped for
70+
reject, in PR #36695. A reject link's confirm page carries a required
71+
reason field, posted as `comment` beside the token, and the decision
72+
records that text as its comment. A POST whose `comment` is missing, blank
73+
or not a string is answered the same confirm page again with status `400`:
74+
nothing is decided and the token is not consumed, so the approver can type
75+
a reason and send the same link again. An approve link is unchanged: its
76+
page has no comment field and the decision records the fixed comment "Via
77+
action link". The first Non-goals bullet above stands as written for v1.
78+
6979
## Consequences
7080

7181
- The remind nudge becomes genuinely actionable — one tap from the

‎packages/spec/src/contracts/approval-service.ts‎

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,18 +1391,29 @@ export interface IApprovalService {
13911391
* What it serves, exactly as the plugin's self-hosted pages serve it today:
13921392
* - `GET` renders. It reads the raw token from the `token` query parameter
13931393
* and answers the confirm page — the request summary and a form that
1394-
* `POST`s the token back — or, for a token that is invalid, expired,
1395-
* consumed or no longer live, the explanatory result page. ⛔ A `GET`
1394+
* `POST`s the token back (a reject link's form also carries a required
1395+
* reason field, named `comment`) — or, for a token that is invalid,
1396+
* expired, consumed or no longer live, the explanatory result page. ⛔ A `GET`
13961397
* never decides: mail gateways prefetch every link in a message, and a
13971398
* `GET` that executes gets requests approved by robots.
13981399
* - `POST` redeems. It reads the token from the `token` field of the form
1399-
* body, runs ADR-0043's whole redemption chain (hash lookup, not
1400-
* consumed, not expired, request still `pending`, approver still holding
1401-
* the slot, consume, then decide AS that approver), and answers the
1402-
* result page.
1400+
* body and, for a reject link, the reason from its `comment` field (the
1401+
* last of each when a field repeats). It runs ADR-0043's whole redemption
1402+
* chain (hash lookup, not consumed, not expired, request still `pending`,
1403+
* approver still holding the slot, consume, then decide AS that approver,
1404+
* a reject recording that reason as its comment), and answers the result
1405+
* page. An approve link reads no `comment` and records the fixed comment
1406+
* "Via action link".
1407+
* - A reject whose `comment` is missing, blank or not a string — judged by
1408+
* the same rule every reject door applies — is refused before the token
1409+
* is consumed: it answers the same confirm page again, carrying the
1410+
* refusal, with status `400` (the redemption outcome `reason_required`).
1411+
* Nothing is decided and the link stays live, so the approver can type a
1412+
* reason and send the same link again. A dead link is judged first and
1413+
* is still told on its result page.
14031414
* - Both answer an HTML page. A dead link is told on the page, never as an
14041415
* error status: ADR-0043 answers "this link is no longer valid", not an
1405-
* error code.
1416+
* error code. The `400` above refuses the input, not the link.
14061417
*
14071418
* **The token is the only credential.** This member takes no
14081419
* {@link ExecutionContext} and reads no session, cookie or `Authorization`
@@ -1433,8 +1444,9 @@ export interface IApprovalService {
14331444
* behind it.
14341445
*
14351446
* @param request - The forwarded request: on `GET` the token is in its query
1436-
* string, on `POST` in its form body
1437-
* @returns The page to show the approver
1447+
* string, on `POST` in its form body, beside a reject's `comment`
1448+
* @returns The page to show the approver: on `POST`, the result page, or
1449+
* for a reject with no reason the confirm page again with status `400`
14381450
*/
14391451
handleActionPage?(request: Request): Promise<Response>;
14401452
}

0 commit comments

Comments
 (0)