Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .changeset/36709-action-page-contract-reject-reason.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
'@objectstack/spec': patch
---

docs(spec): the `IApprovalService.handleActionPage` contract names the reason a reject link's POST now carries

Clause-②: no
Metadata-protocol: none

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`:

- 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).
- 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`.
- An approve link reads no `comment` and records the fixed comment "Via action link".
10 changes: 10 additions & 0 deletions docs/adr/0043-actionable-approval-links.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ GET-executes design gets requests approved by robots.
brute force is not the threat — leaked links are, and those die on
first use / decision / reassign / expiry).

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

## Consequences

- The remind nudge becomes genuinely actionable — one tap from the
Expand Down
30 changes: 21 additions & 9 deletions packages/spec/src/contracts/approval-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1391,18 +1391,29 @@ export interface IApprovalService {
* What it serves, exactly as the plugin's self-hosted pages serve it today:
* - `GET` renders. It reads the raw token from the `token` query parameter
* and answers the confirm page — the request summary and a form that
* `POST`s the token back — or, for a token that is invalid, expired,
* consumed or no longer live, the explanatory result page. ⛔ A `GET`
* `POST`s the token back (a reject link's form also carries a required
* reason field, named `comment`) — or, for a token that is invalid,
* expired, consumed or no longer live, the explanatory result page. ⛔ A `GET`
* never decides: mail gateways prefetch every link in a message, and a
* `GET` that executes gets requests approved by robots.
* - `POST` redeems. It reads the token from the `token` field of the form
* body, runs ADR-0043's whole redemption chain (hash lookup, not
* consumed, not expired, request still `pending`, approver still holding
* the slot, consume, then decide AS that approver), and answers the
* result page.
* body and, for a reject link, the reason from its `comment` field (the
* last of each when a field repeats). It runs ADR-0043's whole redemption
* chain (hash lookup, not consumed, not expired, request still `pending`,
* approver still holding the slot, consume, then decide AS that approver,
* a reject recording that reason as its comment), and answers the result
* page. An approve link reads no `comment` and records the fixed comment
* "Via action link".
* - A reject whose `comment` is missing, blank or not a string — judged by
* the same rule every reject door applies — is refused before the token
* is consumed: it answers the same confirm page again, carrying the
* refusal, with status `400` (the redemption outcome `reason_required`).
* Nothing is decided and the link stays live, so the approver can type a
* reason and send the same link again. A dead link is judged first and
* is still told on its result page.
* - Both answer an HTML page. A dead link is told on the page, never as an
* error status: ADR-0043 answers "this link is no longer valid", not an
* error code.
* error code. The `400` above refuses the input, not the link.
*
* **The token is the only credential.** This member takes no
* {@link ExecutionContext} and reads no session, cookie or `Authorization`
Expand Down Expand Up @@ -1433,8 +1444,9 @@ export interface IApprovalService {
* behind it.
*
* @param request - The forwarded request: on `GET` the token is in its query
* string, on `POST` in its form body
* @returns The page to show the approver
* string, on `POST` in its form body, beside a reject's `comment`
* @returns The page to show the approver: on `POST`, the result page, or
* for a reject with no reason the confirm page again with status `400`
*/
handleActionPage?(request: Request): Promise<Response>;
}
Loading