Skip to content

docs(spec,adr): the action-page contract and ADR-0043 name the reject link's required reason - #37153

Merged
os-zhuang merged 2 commits into
mainfrom
claude/issue-36709-approval-action-page-docs
Nov 25, 2026
Merged

os-zhuang merged 2 commits into
mainfrom
claude/issue-36709-approval-action-page-docs

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Yibo Wang · project thread

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).

Local runs on 5d4cdbc
  • 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).

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 fix(plugin-approvals)!: the email action-link reject records the reason the approver types #36695 stay outside this card, as that review placed them.

Verification

Derived gate families (dispatch-gates, tree a48e05f then 5d4cdbc)

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.

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

… link's required reason

IApprovalService.handleActionPage's docblock now says the POST also reads a
reject's reason from the form's `comment` field, and that a reject with no
reason is answered the confirm page again with status 400 (outcome
`reason_required`), the token unconsumed. ADR-0043 gains an add-only note
under its Non-goals: comment capture shipped for reject in #36695.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzg3KqwSpt61Y8ovKK7
@github-actions github-actions Bot added size/s documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/spec, touching 1 documentable anchor(s).

2 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/ai/actions-as-tools.mdx (via IApprovalService (symbol, a top-level interface))
  • content/docs/automation/approvals.mdx (via IApprovalService (symbol, a top-level interface))
What this run could not see

Coarse fallback — 175 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 1f3e9f68e703c13e013185132f0e62ddc977f069 → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 1f3e9f68e703c13e013185132f0e62ddc977f069

⚠️ 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 1f3e9f68e703c13e013185132f0e62ddc977f069 → 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#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs

Contract-review-claim: session_01WGufzgv2LZN1W2qSYTZvYs · head 5d4cdbc · 2026-11-24T23:31Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs

席位核对 — ACCEPT · repo:objectstack#3 · head 5d4cdbc · 2026-11-24T23:34Z

L1: ACCEPT (L1-w, zone wf-A)
Head-sha: 5d4cdbc23f2f43ad74b6132f90221e9e5bdd52ed

No must-fix, no should-fix. Tier H (docs/adr/**, governed; the add-only arm cannot read ADR-0043, which has no Decision/Status heading), so this goes to the seat for the approver. It must not be readied, queued or armed here. It also owes an L2 at CONTRACT_REVIEW_TIER (non-test packages/spec/src/** plus a governed ADR). The claim is 7147522801, and the record follows on this head.

Read and found right

  • l1-face.mjs --pr 37153: 13 items clean. Draft, base main, Fixes #36709 binds only this card, Clause-②: no / Metadata-protocol: none match claim 7146025258. The changeset names @objectstack/spec. Floors and all checks are green: 59 success, 11 expected skips, 0 failed. mergeable_state clean (read through the API).
  • Scope = claim surface. The handleActionPage docblock is the only hunk in packages/spec/src/contracts/approval-service.ts. ADR-0043 gets ten + lines and no - lines. The changeset was allowed by the claim, and the measured dist/contracts/index.d.ts shipment makes skip-changeset wrong. A changeset is right.
  • Fixes is right. Both "done when" lines are met. The docblock names comment and the 400 / reason_required confirm-page answer, and the ADR gets an add-only note that comment capture shipped for reject in fix(plugin-approvals)!: the email action-link reject records the reason the approver types #36695 (merged, the reject-reason change).
  • Docblock, sentence by sentence, against plugin-approvals at this head:
    • "a reject link's form also carries a required reason field, named comment": renderConfirmPage in action-link-pages.ts.
    • The POST reads token and comment, "the last of each when a field repeats". In handleActionPage, form.getAll(...) takes the last entry. The self-hosted mount uses Hono parseBody(), where the last value wins. Both doors agree.
    • The reject records that reason, and an approve reads no comment and records "Via action link": redeemActionToken (comment: rejecting ? input.comment : 'Via action link').
    • "Missing, blank or not a string … judged by the same rule every reject door applies": rejectReasonIssues (validateActionParams, required textarea), shared with decide.
    • "Refused before the token is consumed … the same confirm page again … 400 (reason_required)": the check sits before the consumed_at update, and actionRedemptionPage returns { status: 400, renderConfirmPage(refusal) }.
    • "A dead link is judged first and still told on its result page": resolveActionToken runs first, and dead outcomes get a 200 result page.
    • @param / @returns: match.
  • ADR note. It sits after Non-goals and states the same facts. "The first Non-goals bullet above stands as written for v1" keeps the v1 record unedited, which is the add-only intent.
  • Changeset, sentence by sentence. "Documentation only; no type, schema or export changes": true, the hunk is comment text only. The three bullets (reason field with last-of-each parsing; missing, blank or non-string answered with the confirm page, 400, reason_required, token not consumed, a dead link still 200; approve records "Via action link"): each matches the code read above.
  • Tests. The spec build, typecheck and test suite ran with real output. There is a positive control for the .d.ts shipment ("The token is the only credential" is found beside the new sentence). No ablation applies (text only).

Notes (not findings)

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 5d4cdbc23f2f43ad74b6132f90221e9e5bdd52ed
Local-runs: none
Scope: packages/spec/src/contracts/approval-service.ts, docs/adr/0043-actionable-approval-links.md + none
Security-touching: yes

Security-touching is yes because the changed hunks teach credential behaviour: when the action-link token is and is not consumed, that a refused reject leaves the link live and reusable, and what the token-authenticated POST reads. The path names do not show this; the adopting seat adds the security label.

The code these texts describe is outside the diff (packages/plugins/plugin-approvals/src/approval-service.ts, approvals-plugin.ts, action-link-pages.ts). It was read at this head to judge them and is not reviewed. The diff holds no implementing file, hence + none.

① Derived judgments

  • Accept-set: unchanged. The diff to packages/spec/src/contracts/approval-service.ts is confined to the docblock of IApprovalService.handleActionPage; the member signature (a Request in, a promise of a Response out) is untouched, and no type, schema, export or zod shape moves. Right.
  • Public surface: the docblock text ships in the @objectstack/spec declaration output, so the published text changes while the published types do not. Right, and it is what the changeset declares.
  • Metadata protocol: nothing a metadata author can write changes. Metadata-protocol: none is right.
  • ADR-0043: ten added lines, no removed or edited line, placed after the Non-goals list. Add-only, right. The Status line and every decision row are untouched.
  • Behaviour: none moves. No test is added and none is owed for a text-only change; the behaviour the text describes is already pinned on main by action-page-member.integration.test.ts (blank reason answers 400 on both doors, the token survives, the last repeated field wins).
  • Gate verdicts on this head, read from the 70 check-runs: 59 success, 11 skipped, no failure. Check Changeset, Governed Surface Queue Guard, Lint & Repo Gates, TypeScript Type Check, Test Core, Build Core, Spec property liveness and Check Documentation Links are all success. The skipped runs are opt-in or path-filtered jobs (Lint UI, Build Docs, Dogfood Verify CLI, the queue verdicts, the temporal and upgrade harnesses), none of them a gate this diff owes.

② Semver level

.changeset/36709-action-page-contract-reject-reason.md releases '@objectstack/spec': patch. That matches what the diff publishes: documentation text inside a released package's declaration output, with no type change. skip-changeset would be wrong, because the label is for a diff that publishes nothing, and this one publishes changed docblock text. patch is the level AGENTS.md assigns to Metadata-protocol: none.

Clause-②: no — stated in both the PR body and the changeset body, line-initial, with no arm. Right: no accept-set is widened or narrowed. The reject-reason narrowing itself landed with PR #36695 and is not re-published here.

③ Boundary flags

  • Deviation, changeset added although the order said "only if a gate asks": answered, correct. Check Changeset needs a changeset or the skip label, and the skip label does not fit a diff that publishes.
  • Deviations on the PR body footer and signature placement: PR-body prose, outside this record's scope; no contract effect.
  • open_questions, landing route A (one Tier H PR) or B (split spec half from ADR half): answered from the contract side, escalated for the route. The two texts describe one behaviour and agree with each other and with the code, so nothing in the contract asks for a split, and a split changes no text. The dev's reading of the tier is consistent with the diff: the spec path and the @objectstack/spec changeset are outside the low-risk arm, and ADR-0043 has no Decision or Status heading. Whether to hand one PR to the approver or split it is a landing decision for the owning seat and the approver; this record covers the head as it stands and would not cover a split head.
  • Out-of-scope note, ADR-0043 has no Decision or Status heading so the add-only arm can never accept a note to it: a property of the record and the arm, correctly not fixed here. It is a candidate follow-up card for the seat, not a finding on this PR.
  • SQL push-down: not applicable. The diff adds no query, no id materialisation and no in-app join.

④ Design judgment

No must-fix, no should-fix.

packages/spec/src/contracts/approval-service.ts, judged sentence by sentence against the code at this head:

  • "a reject link's form also carries a required reason field, named comment": holds. renderConfirmPage renders a textarea with name="comment" and required for a reject, and no such field for an approve.
  • "POST ... reads the token from the token field ... and, for a reject link, the reason from its comment field (the last of each when a field repeats)": holds on both doors. handleActionPage takes the last entry of form.getAll('token') and of form.getAll('comment'); the self-hosted mount uses Hono's parseBody without all, which keeps the last value of a repeated key. The parity test pins this.
  • The redemption chain order, with "a reject recording that reason as its comment": holds. redeemActionToken resolves the token, consumes it, then calls decide with comment set to the posted text for a reject.
  • "An approve link reads no comment and records the fixed comment "Via action link"": holds as observable behaviour. The door parses the field on every POST, but redeemActionToken ignores it unless the token's action is reject, and an approve records the fixed text.
  • "missing, blank or not a string — judged by the same rule every reject door applies": holds. rejectReasonIssues is the one judge, called by both decide and redeemActionToken; it runs validateActionParams against a required textarea param, which refuses an absent value, a blank one and a non-string one (a file part, for example).
  • "refused before the token is consumed ... status 400 (the redemption outcome reason_required) ... the link stays live": holds. The reason_required return precedes the sys_approval_token update, and actionRedemptionPage maps it to the confirm page with refusal: 'reason_required' and status 400 for both doors.
  • "A dead link is judged first and is still told on its result page": holds. resolveActionToken runs before the reason check, so an invalid, consumed, expired, decided or reassigned link answers its 200 result page whether or not a reason came with it.
  • "The 400 above refuses the input, not the link", and the @param / @returns lines: consistent with the above and with the unchanged "never as an error status" sentence.

Attempts to break it: a reject link that is dead and also has no reason (200 result page, as the text says); a repeated comment whose last value is blank (400, as the text says); a whitespace-only reason (400, pinned by the test); a non-form body (no token, told invalid, 200, already described on the plugin side and not contradicted here); an approve link posted with a comment (ignored, fixed comment recorded). None contradicts a sentence. Leaving the token unconsumed after a refused reject does not weaken ADR-0043's axes: nothing is decided, the token stays bound to one request, one action and one approver, and the TTL, the single use on a real decision and the slot re-check all still apply.

docs/adr/0043-actionable-approval-links.md, against its first consumer (@objectstack/plugin-approvals) and the card: the note states what the plugin does, names PR #36695 as the card asks, leaves the first Non-goals bullet standing as the v1 record, and says approve is unchanged. It agrees with the docblock on every shared point (field name, the three refusal cases, status 400, token not consumed, fixed approve comment). Both "Done when" lines of the card are met.

Nits:

  • N1 (nit) — the ADR note says a POST whose comment is missing, blank or not a string is answered the confirm page with 400, without the docblock's qualifier that a dead link is judged first and still gets its result page. The surrounding sentences scope it to a live reject link, and the Redeem bullet above already orders the checks, so no reader is misled. Left as an accepted deviation.
  • N2 (nit) — one reflowed docblock line ("expired, consumed or no longer live, the explanatory result page. ⛔ A GET") now runs past the wrap width of its neighbours. Cosmetic; left as an accepted deviation.

Implemented-by: claude/issue-36709-approval-action-page-docs
Reviewed-by: session_01WGufzgv2LZN1W2qSYTZvYs

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzi4PechTRCTBrfxV8W

维护者速读

  • 审批的「动作页」(邮件里点链接进入审批)的文档已经过时:契约说明和 ADR-0043 还写着旧的邮件链接用法。这张卡只改文字,共 54 行,没有代码行为变化。
  • 需要您审,是因为它在 ADR-0043 里加了一段补充说明,ADR 文件属于受管路径(不是因为改动大)。
  • 评审:L1 通过,没有问题;契约评审通过,没有必须改或建议改的项,两个小瑕疵接受不改。检查全绿。
  • 批准后由维护者入队。

Request: approval · Tier H by governed path (docs/adr/** ×1; ADR-0043 has no Decision/Status heading, so the add-only arm cannot accept a note there) · 2026-11-24T23:36Z

Seat's view: land. A docs-only correction of #36709. One reviewer pass covers both halves, so it stays one PR (no split to move the spec docblock out of review).

@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 24, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 25, 2026 00:14
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit 8ddadc1 Nov 25, 2026
76 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-36709-approval-action-page-docs branch November 25, 2026 00:49
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/s 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.

approvals: the action-page contract docblock and ADR-0043 still describe the email-link reject without its required reason

3 participants