Repository navigation
feat(approvals): on a closing field, an approval's decision is written when the approval is over (ADR-0162 item 8, slice 3) - #38540
Conversation
… over, and judge it at each door Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pigknx7rC8rXnA3my
… the mark's translations and changeset Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pigknx7rC8rXnA3my
… a subflow body's routed failure; census regenerated Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pigknx7rC8rXnA3my
📓 Docs Drift CheckThis PR changes 1 package(s): 27 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 10 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 6 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 f4248db79548f54683047798725321fcb94e4f5f && git checkout f4248db79548f54683047798725321fcb94e4f5f
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin d31309867d0cec2c908561233781bedd41d9ac08 a9a90f3981d223e65eca836f035154aacff38876 && git checkout -B drift-repro d31309867d0cec2c908561233781bedd41d9ac08 && git merge --no-ff a9a90f3981d223e65eca836f035154aacff38876
node scripts/docs-audit/affected-docs.mjs --json d31309867d0cec2c908561233781bedd41d9ac08
|
|
repo:objectstack#5 · os-project-manager · session_01FEkQ5pigknx7rC8rXnA3my Green head: |
|
repo:objectstack#5 · os-project-manager · session_01FEkQ5kjJ6Qm1z2mRox4ZbB 席位核对 — REWORK · L1-b · area o5-data · Head-sha
|
…ve an observation an ablation turns red The two-step case now records every value written to the field: the second step's opening writes `pending` straight after the first decision, so the field read alone could not tell a held-back decision from a written one. The two cannot-tell cases assert the reason the door logs, since a run that is advancing and a status the plugin does not place answer alike. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pigknx7rC8rXnA3my
|
repo:objectstack#5 · os-project-manager · session_01FEkQ5pigknx7rC8rXnA3my Contract reviewServed-tier: ① Derived judgmentsFace: the declaration face. The head moved during this review, from 47f4286 to a5d0d15. The one commit on top touches only Inputs: card #37767 body and all 9 comments; PR #38540 body, file list and net diff; ADR-0162 D5 and Execution items 7 and 8 on the head; rulings 7210179412, 7201405662, 7205949718, 7211509661, 7211531658; the check-runs on both heads. Read and not reviewed, outside the diff:
② Semver level
③ Boundary flags
④ Design judgmentJudged in full, as the brief asks. What holds, read against D5 and item 8: the mark is set in the update that records each decision of a stamped approval, also where nothing is held back; it is cleared when the next request opens, by a recall, its override arm and the dead-run sweep on the earlier requests, and by the door once it has judged; the outcome is the latest request's decision, written in the decider's name through the unchanged mirror; a recalled latest request writes nothing; a refused outcome or put-back keeps the marks; abandonment marks the request first, puts the field back by item 7's order, writes nothing where another approval's request is open on the same field, and leaves a line with no actor; The defects are all in one place, M1 (must-fix) — a run that ended on a refusing M2 (must-fix) — an earlier failure the flow routed is read as the stop of a run that did not end by a node failure of its own, and the door can then answer finished between two steps. The same two lines prefer the last top-level S1 (should-fix) — the door reads two runs of the approval's tree, and for the second only a terminal step log; a stop, a routed failure or a pause in any other run is not seen. Three shapes, each admitted by item 7's check:
Nits, none with an effect on the contract:
Implemented-by: VERDICT: FAIL |
|
repo:objectstack#5 · os-project-manager · session_01FEkQ5pigknx7rC8rXnA3my The brief the isolated reviewer was handed for the contract-review record above, as it stood (the head moved to a5d0d15 during the review, test file only; the reviewer was told so and the record names the new head): Contract review brief — PR #38540 @
|
… refusing end is an end A run that ends on an `end` declaring `outcome: 'refused'` reached an end of the flow, as a completed run did; it logs no step for the `end`, so its last step is the approval just decided and was read as a stop between two steps, abandoning a rejection. A cancelled run, or one failed by a child or settled as unresumable, logs nothing after the node it stood on, so the stop is its last top-level step; an earlier failure the flow routed on is no longer taken for it. The approval's requests are read newest first, so the latest is in the window however many there are, and an auto-rejection the door abandoned no longer also sends the auto-rejected notice. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pigknx7rC8rXnA3my
…into claude/project-thread-wug0sh
|
repo:objectstack#5 · os-project-manager · session_01FEkQ5pigknx7rC8rXnA3my Contract reviewServed-tier: ① Derived judgmentsA delta record on record 7253560285 (head a5d0d15, FAIL with M1, M2 and S1). Two commits since:
Public surface in the delta: none.
② Semver levelUnchanged: ③ Boundary flags
④ Design judgmentM1: closed M2: closed S1: closed M1, by code. M2, by code. S1, by the seat's ruling and not by code. The gap stands on this head exactly as record 7253560285 described it; ③ says what I could and could not verify of the ruling. What I tried against
One residue, and one remark for slice 4:
No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-project-manager · session_01FEkQ5pigknx7rC8rXnA3my Green head: |
|
repo:objectstack#5 · os-project-manager · session_01FEkQ5kjJ6Qm1z2mRox4ZbB 席位核对 — ACCEPT · L1-b · area o5-data · Head-sha
|
978bb2b
into
claude/o5-data-approvals-trunk
Requested by Leehom · project thread
Part of #37767
维护者速读
approved/rejected上关闭时,每一步的决定都先压住,字段保持pending,等整个审批走完才写结果。unjudged_since(标记),决定时写入、审批判定后清除;每扇恢复或取消运行的门之后都判定一次:完成、进行中、两步之间结束(放弃并回填)、看不清(不写,留标记)。Clause-②: yes (widening)
Metadata-protocol: none
What changes
Slice 3 of #37767: ADR-0162 D5 and Execution item 8, bullet 2, "The outcome when the approval is over", as revised by #37829. Everything below applies only to an approval the check stamped when it opened (
between_steps_json, slice B), so an object that declares noclosedStatesbehaves as before.approvedorrejected,decideNodeand the revision-limit auto-reject record the decision on the request and no longer mirror it. The field keepspending. Every other status is mirrored as before.sys_approval_request.unjudged_sincewith its own index. It is set in the update that records an approve or a reject on a stamped request, also where nothing is held back. It is cleared when the approval is judged, when the approval's next request opens on the record, and on the approval's earlier requests by a recall, the override arm of the recall and the dead-run sweep.judgeApprovalAfterDoor). It runs after a decision (by a person or the SLA clock), a send-back and its auto-reject, a resubmission, a recall, andcontinueRestoredRun. It also runs when the resume throws a strand. It reads the approval's requests on the record and the run that carries the record (record_run_id):subflowbody, the latest request's own run is read as well.pending/running/retrying, unreadable, or paused with no pause found. Nothing is written, and the mark stays.__laterStepNotOpened, on the approval's latest request. It is taken in a wrapper aroundopenNodeRequest, so the judgement does not depend on how the flow routed the failure.abandonApproval):__abandonedon the latest request first.abandonedValueOnClosingField). It writes nothing where another approval's request is open on the record and mirrors onto the same field.approval.abandoned, andapproval.approved/approval.rejectedis not sent then.continueRestoredRunrefuses a request of an abandoned approval withINVALID_STATE, and tells the operator to cancel the restored run.ApprovalResumeSurface.getRunnow types the step log the engine already returns. New message ids:approvalAbandonedTitleandapprovalAbandonedBodyin all 11 packs. The field label and help are added in all 11 object bundles. The tenant-audit census is regenerated.Not in this PR: the reconciler (slice 4) and the hold (slice 5), which follow serially on this mark. The refusal on a host with no
jobservice was already done in slice B. Item 8's own docs bullet (the approvals guide: the document readspendinguntil its approval is over, a node after a decision readspending, what an abandoned approval looks like on the request, and the hold) is not in this slice either. Its sentences span this slice and the hold, so they land once the hold is on the trunk, before the trunk reachesmain; item 7's guide text is in the same state on the trunk.Why
The ruling of 2026-11-27 (record 7210179412): 「全部走完才显示已批准」. Seat ruling 7211531658 adds that the mark reaches every approval on an object that declares
closedStates.Tests
approval-outcome-when-over-37767.integration.test.tsuses a real kernel, ObjectQL, the automation engine and sqlite. It has 28 cases, and each records the value the field keeps:pending; the outcome is written as the decider;approvedalone, and a first step that approves on an object that closes onrejectedalone;waitafter the last step; a node that fails after the last step;mapitem that is a record, whose outcome is written before the next item and survives a later item's failure;approved); the same in the revise window;pending);subflowchild, handled intry_catchwith a gateway to the end (finished), and unrouted (abandoned, and the restored run is refused);endis finished, so the rejection is written; a run cancelled while parked at asubflowholding the first step, after an earlier failure the flow routed on, stopped at thesubflow, so the approval is abandoned.Updated pins:
status-mirror-closing-field-refusal: a later request's refusedpendingnow leavespending, since the first decision is held back.stored-process-package-backfill: the new index.approver-address-readers: the decider read is classified asattribution.Acceptance notes
parentNodeId) is never read as a routed failure. This is the try_catch arm of N46 c′.mapbody stands between two steps, so a failure there abandons that item's approval only.Done-when, by slice
The card's Done-when lines that this slice does not test:
Contract review round 1 (record 7253560285)
endwithoutcome: 'refused'reached an end of the flow, like a completed run (REACHED_AN_END). Anendlogs no step, so its last step was the approval just decided, which was read as a stop between two steps.stopOf), with no preference for an earlier failure. A cancelled run, a run failed by a child and a run settled as unresumable log nothing after the node they stood on.approval-service.ts: "expected 'recalled' to be 'rejected'" and "expected 'approved' to be 'recalled'".service-messaging), N2 and N3 are left as they are.service-automationit needs under its own Clause-② face. This is a gate on the trunk: the trunk→mainPR (feat(objectql): a record in a closed state, and its lines, are closed to change (closedStates, ADR-0162) — trunk #38497) does not go to the maintainer while the gap is open. The ADR is not narrowed. The contract review's delta record 7254001546 (N6) is the source of this wording.Ablations
Each mutation was made with
scripts/ablation-replace.mjsonapproval-service.ts(anchor hit once, blob moved), the new test file was run, and the file was restored to the HEAD blob (cde5a60e96e4,git diff HEADempty). Red sets are case names inapproval-outcome-when-over-37767.integration.test.ts.holdsBackDecisionanswersfalse: 13 of 26 red. The held-back arms: two steps approved (on its write trail, see below), a node after the last decision readspending, the second step rejecting on an object that closes onapprovedalone, and the first step approving on an object that closes onrejectedalone. Also themapitem, the three later-step-cannot-open cases, the three another-node-fails cases (fault edge,subflowchild, unrouted) and the two cannot-tell cases. In all of these the written decision shows on the field where it should not. Green, as expected: awaitafter the last step, a node failing after the last step, and the decider's name. In those the last decision is the outcome either way.routed) answers nothing: 2 red. These are another node failing with a fault edge to the end, and the same in asubflowchild. Thetry_catchcase stays green, and so does the unrouted case.noteLaterStepNotOpenedreturns at once: 3 red. These are a later step that cannot open on an empty slate (unrouted), the same with a fault edge to the end, and the same on another approval's pending request.refuseAbandonedContinuationreturns at once: 1 red, the unrouted case whose restored run is refused.ADVANCING_RUN_STATUSESarm removed: 1 red, a run another process is advancing. On the first head this stayed green. Without the arm, arunningstatus falls to the unplaced-status arm, which answers alike (undetermined, nothing written). The case now asserts the reason the door logs, which only the advancing arm gives.Under (1), the two-step case first stayed green as well. The second step's opening writes
pendingstraight after the first decision, so the field read alone could not tell a held-back decision from a written one. It now records every value written to the field (['pending', 'pending', 'approved']), and it goes red. Both test changes are in a5d0d15, a test-only commit. Ablations 2 to 4 were run on the first head. Their service file is unchanged, and the new commit only adds assertions, so a red set can only grow.Verification
pnpm --filter @objectstack/plugin-approvals test: 137 files, 2131 tests, green. At a3b666c: 137 files, 2134 tests, green, with the new file at 28. Typecheck (with test-typecheck) and ESLint are green.pnpm --filter @objectstack/plugin-approvals typecheck: green, test-typecheck debt unchanged.node scripts/check-i18n-bundles.mjs: in sync.node scripts/check-tenant-audit-census.mjs: OK.pnpm check:engine-double-contract: OK.dispatch-gates.mjs --commandsfamilies: 141 commands against the trunk; 138 passed.check-plugin-teardown-shape --self-testrefused on the shallow clone (its pinned fixture commit was missing) and passed once that commit was fetched.spec check:skill-examplesandcheck:dual-build-cjs-loadsrefused with "prerequisite not met" because unrelated packages (client-react, studio, scenarios and others) had no localdist/; nothing was measured, so CI answers those two.Human Minimum
packages/specholds no runtime logic.pnpm lintpasses.claude/o5-data-approvals-trunk, per the trunk rule).packages/specnot touched.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01FEkQ5pigknx7rC8rXnA3my