Repository navigation
Commit 471add3
docs(approvals): say how a request with no submitter leaves the returned state (#30137)
<!-- claude-projects-attribution: {"github_login":"marchtian"} -->
_Requested by **田騏** · [project
thread](https://claude.ai/code/project/chan_01VmuUhXU9SSUzqJYyXSmYSi?thread=cmsg_01VmuUhXU9SSUzqJYyXSmYSiNjyvCdXYygFqntMNR7S2dW)_
Fixes #29910
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:审批指南和 `IApprovalService` 的 `recall` / `sendBack` / `resubmit`
注释写明「没有提交人的审批单」被退回后怎么走出来:退回后谁也撤不回,唯一出路是服务端代码以系统上下文 `resubmit`,新一轮
`pending` 仍无提交人,系统或管理员覆盖可撤回。指南还告诉作者:由无用户触发器启动的流程,只有在服务端代码会做这次重提时才声明
`revise` 边,否则不声明,让审批人改用驳回。
- 为什么改:维护者在「第三批 同意」中选了 D(行为不变,把出路写清楚);此前文档没有说过这种审批单退回后的去向。
- 风险与回滚:只改注释和文档,外加一个 `@objectstack/spec` patch changeset;非注释的 token
前后完全一致(见 Verification),行为不变。回滚即 revert。
- 先看:`packages/spec/src/contracts/approval-service.ts` 的 `recall` 与
`sendBack` 注释;`content/docs/automation/approvals.mdx` 的「A request with
no submitter」段。
- 两分钟验证:`git diff origin/main --
packages/spec/src/contracts/approval-service.ts`,应只看到 `*` 开头的注释行变化。
- 需要你做的:无,席位落地(spec 包改动,落地前席位做一次独立复审)。
## What changes
- `content/docs/automation/approvals.mdx`, under **Send-back →
resubmit**: a new paragraph, **A request with no submitter**. It says
that a run whose trigger resolved no user opens its request with no
submitter; that an approver can still send it back, but nobody can
recall it once it is `returned` and no viewer sees Resubmit or Recall;
that its one way out is a system-context `resubmit` from server-side
code, which opens the next round `pending`, again with no submitter,
where the system or the admin override can recall it. It also says what
an author should do on such a flow: keep the `revise` edge into its
`approval_revise` node only when server-side code will make that
resubmit, and otherwise leave the edge off, so send-back is refused and
approvers reject instead. `content/docs/capabilities/approvals.mdx` only
names send-back in one line and does not teach recall or resubmit, so it
is unchanged.
- `packages/spec/src/contracts/approval-service.ts`, comments only:
- `recall`: a closing paragraph saying the `returned` arm has no one for
a request with no submitter, and stating the way out above.
- `sendBack`: a closing paragraph saying such a request is sent back the
same way, that only a system-context `resubmit` moves it on, and that a
flow whose trigger resolves no user declares `revise` only when
server-side code will make that call.
- `resubmit`: "submitter-only" now reads "by the submitter or a system
context (the system context alone on a request with no submitter)". The
code already admits the system context, and
`ApprovalResubmitInput.actorId` already said so.
- `.changeset/29910-no-submitter-returned-docs.md`:
`'@objectstack/spec': patch`. The docblock text ships: after a build it
is in `packages/spec/dist/contracts/index.d.ts` and `index.d.mts`
(positive control: the existing sentence "refused there exactly as any
other non-submitter" is found in the same two files). So this is a
published, comment-only change, which takes a patch changeset rather
than `skip-changeset`.
### The documented path, read from code at `987ff33b`
- No submitter:
`packages/plugins/plugin-approvals/src/approval-node.ts:107-111`
(`runTriggerUser`, `null` when the trigger resolved no user) feeds
`submitterId` at `approval-node.ts:199`.
- Send-back is allowed and lands on the window:
`approval-service.ts:6041` (pending approver or system, no submitter
test) and `assertReviseEdge` at `approval-service.ts:6278-6312` (the
`revise` edge must exist and must target an `approval_revise` node).
`approval-revise-node.ts:89-98`: the window arms nothing, and only
`resubmit` or a recall ends it.
- Nobody recalls it on `returned`: `approval-service.ts:5613-5618`
(`overrideAdmits` requires `status === 'pending'`; `actsAsSubmitter` at
`approval-service.ts:1114-1117` answers false for every actor when
`submitter_id` is null).
- A system-context resubmit is admitted: `approval-service.ts:6202` (`if
(!context.isSystem && !actsAsSubmitter(raw, actorId))`), pinned at
`approval-service.test.ts:6418-6423`. Its resume carries no `resumedBy`
(`approval-service.ts:6241-6248`), so the run context is not switched
(`service-automation/src/run-resume.ts:326-328`). The re-entered
approval node opens round N+1 through `approval-node.ts:199` again, with
no submitter (also pinned for a later step by
`later-step-original-submitter.integration.test.ts:322`).
- The new `pending` round is recalled by the system or the override
actor: `approval-service.ts:5613-5614` with `isOverrideActor` at
`approval-service.ts:2111-2113` (`context.isSystem` always passes).
Pinned at `approval-service.test.ts:6403-6416`.
- No console door: `sys-approval-request.object.ts:766-778` shows
Resubmit only to `viewer.is_submitter`, and Recall on `returned` only to
the submitter (`can_override` is pending-only). The REST `/resubmit`
route (`packages/rest/src/approvals-routes.ts:518-523`) passes the
caller's own resolved context.
## Tests
No test was added: nothing a test can pin changed. The behaviour
documented here is already pinned by the `approval-service.test.ts`
battery cited above.
## Acceptance notes
- A system-context `resubmit` is reachable only from server-side code.
The console offers no button for it, and the REST route acts as its
caller. The guide says "server-side code in a system context" and does
not name any other door.
- Comments-only proof: `packages/spec/src/contracts/approval-service.ts`
was tokenised with the TypeScript scanner (comments skipped) at
`987ff33b` and at this branch. Both give 1420 tokens and the streams are
identical. Control: changing one `actorId: string` to `number` makes the
comparison report `false`. So no `.d.ts` statement other than a comment
can move. `api-surface/contracts.json` records only the interface names,
and the spec build regenerated nothing (clean `git status` afterwards).
## Verification
Head `74870830` (`630966a2`, then one merge of `origin/main` at
`a52761fd`). The diff is 3 files, +37 / -1.
<details><summary>Local gates on 7487083: 95 derived, 95 run, all exit
0, 0 NOT MEASURED (`dispatch-gates --ran`, exit codes
recorded)</summary>
- `pnpm install --frozen-lockfile` (exit 0), then `pnpm --filter
@objectstack/spec build` under the verify lock (`VERDICT command-exit
0`). After that, every command from `node scripts/pm/dispatch-gates.mjs
--commands --repo objectstack-ai/objectstack`, each with its exit code
captured before any pipe.
- On the first pass 88 commands exited 0 and 7 exited 3 (PREREQUISITE
NOT MET): `check-plugin-teardown-shape --self-test` (shallow clone),
`check:doc-formula-expressions`, `check:doc-security-posture`,
`check:skill-examples`, `check:docs-transcript-drift`,
`check:dual-build-cjs-loads` and `check:lean-entry-closure` (unbuilt
workspace packages). I unshallowed the clone and ran `turbo run build
--concurrency=2 --filter='!@objectstack/docs'` under the lock (`VERDICT
command-exit 0`, 119/119 tasks). All 7 then exited 0.
- `--ran` with `COMMAND :: exit N` records: `95 derived famil(ies)
accounted for — 95 run, 0 NOT-MEASURED (a DERIVED zero — all 95 recorded
an exit code and none of them is 3)`.
- `NODE_OPTIONS=--max-old-space-size=4096 pnpm --filter
@objectstack/spec check:generated`: exit 0, `All 14 generated artifacts
are up to date`. A first run at the default heap went red only because
`check:test-typecheck`'s `tsc` ran out of memory ("failed without
diagnostics", heap OOM), not because an artifact was stale.
- `pnpm --filter @objectstack/spec typecheck`: exit 0. `node
scripts/check-dev-prereqs.mjs`: exit 0. `node
scripts/check-commit-card-trailers.mjs --range origin/main..HEAD`: exit
0.
- Not run locally: `@objectstack/spec`'s vitest suite. Every non-comment
token is unchanged (see Acceptance notes), so it is left to CI's `Test
Core`.
- Writes: `git push` (empty branch, `630966a2`, `74870830`); one relay
`pr_create`; no GitHub MCP call.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_017ihL2ebbZkr2QAEG1x7UC8)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent dcb5fb3 commit 471add3
3 files changed
Lines changed: 50 additions & 4 deletions
File tree
- .changeset
- content/docs/automation
- packages/spec/src/contracts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
773 | 773 | | |
774 | 774 | | |
775 | 775 | | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
776 | 796 | | |
777 | 797 | | |
778 | 798 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1035 | 1035 | | |
1036 | 1036 | | |
1037 | 1037 | | |
1038 | | - | |
| 1038 | + | |
| 1039 | + | |
1039 | 1040 | | |
1040 | 1041 | | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
1041 | 1048 | | |
1042 | 1049 | | |
1043 | 1050 | | |
| |||
1048 | 1055 | | |
1049 | 1056 | | |
1050 | 1057 | | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
1051 | 1066 | | |
1052 | 1067 | | |
1053 | 1068 | | |
| |||
1057 | 1072 | | |
1058 | 1073 | | |
1059 | 1074 | | |
1060 | | - | |
| 1075 | + | |
| 1076 | + | |
1061 | 1077 | | |
1062 | 1078 | | |
1063 | 1079 | | |
| |||
1132 | 1148 | | |
1133 | 1149 | | |
1134 | 1150 | | |
1135 | | - | |
1136 | | - | |
| 1151 | + | |
| 1152 | + | |
1137 | 1153 | | |
1138 | 1154 | | |
1139 | 1155 | | |
| |||
0 commit comments