Skip to content

feat(approvals): on a closing field, an approval's decision is written when the approval is over (ADR-0162 item 8, slice 3) - #38540

Merged
os-project-manager merged 6 commits into
claude/o5-data-approvals-trunkfrom
claude/project-thread-wug0sh
Nov 29, 2026
Merged

os-project-manager merged 6 commits into
claude/o5-data-approvals-trunkfrom
claude/project-thread-wug0sh

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread

Part of #37767

维护者速读

  • 字段的对象在 approved/rejected 上关闭时,每一步的决定都先压住,字段保持 pending,等整个审批走完才写结果。
  • 新增一列 unjudged_since(标记),决定时写入、审批判定后清除;每扇恢复或取消运行的门之后都判定一次:完成、进行中、两步之间结束(放弃并回填)、看不清(不写,留标记)。
  • 两步之间结束的审批标为放弃、按第 7 项的顺序回填字段、时间线留一行无操作人的说明、通知提交人;恢复后的运行不能再继续。
  • 本 PR 只是第 3 片,基于 trunk;协调器(第 4 片)和全程锁(第 5 片)随后串行跟进。

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 no closedStates behaves as before.

  • The decision is held back. On a field the object closes on at approved or rejected, decideNode and the revision-limit auto-reject record the decision on the request and no longer mirror it. The field keeps pending. Every other status is mirrored as before.
  • The mark. New engine-written, read-only datetime column sys_approval_request.unjudged_since with 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.
  • The door's judgement (judgeApprovalAfterDoor). It runs after a decision (by a person or the SLA clock), a send-back and its auto-reject, a resubmission, a recall, and continueRestoredRun. 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):
    • in progress: a request is pending, or the latest is returned, or the run is parked on a node of the set. Nothing is written.
    • finished: the run completed, stopped outside the set, or is parked outside it. The latest request's decision is written, in the decider's name.
    • ended between two steps: the run stopped on a node of the set; or a top-level node of the set failed and was routed, with no request opened after it; or a later step could not open. For a subflow body, the latest request's own run is read as well.
    • cannot tell: the run is pending/running/retrying, unreadable, or paused with no pause found. Nothing is written, and the mark stays.
    • In an approval that holds nothing back, finished and ended both only clear the mark.
  • A later step that cannot open leaves a note, __laterStepNotOpened, on the approval's latest request. It is taken in a wrapper around openNodeRequest, so the judgement does not depend on how the flow routed the failure.
  • Abandonment (abandonApproval):
    • It marks __abandoned on the latest request first.
    • It puts the field back by item 7's order (abandonedValueOnClosingField). It writes nothing where another approval's request is open on the record and mirrors onto the same field.
    • It writes a timeline line with no actor that says why the approval stopped and what the field now holds.
    • It tells the submitter on approval.abandoned, and approval.approved/approval.rejected is not sent then.
    • A refused put-back or outcome is reported by the existing mirror report and keeps the mark, for the reconciler.
  • continueRestoredRun refuses a request of an abandoned approval with INVALID_STATE, and tells the operator to cancel the restored run.
  • The plugin's ApprovalResumeSurface.getRun now types the step log the engine already returns. New message ids: approvalAbandonedTitle and approvalAbandonedBody in 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 job service was already done in slice B. Item 8's own docs bullet (the approvals guide: the document reads pending until its approval is over, a node after a decision reads pending, 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 reaches main; 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.ts uses a real kernel, ObjectQL, the automation engine and sqlite. It has 28 cases, and each records the value the field keeps:

  • two steps approved; a node after the last decision reads pending; the outcome is written as the decider;
  • a second step that rejects on an object that closes on approved alone, and a first step that approves on an object that closes on rejected alone;
  • a wait after the last step; a node that fails after the last step;
  • a map item that is a record, whose outcome is written before the next item and survives a later item's failure;
  • first approved and second recalled, then the run completes (no approved); the same in the revise window;
  • the next step fails to open on an empty slate (unrouted, fault edge to the end, fault edge to a third step), and on another approval's request already pending (the field keeps that approval's pending);
  • another node fails between two steps: fault edge to the end, the same in a subflow child, handled in try_catch with a gateway to the end (finished), and unrouted (abandoned, and the restored run is refused);
  • send-back, resubmit and decision of the new round; an auto-reject past the revision limit; a recall that clears an earlier mark;
  • an object whose closed states are on another field (nothing held back, the mark set and cleared); an object with no closed states (unstamped, no mark);
  • cannot tell, for a run that is advancing and for a run that cannot be read (the mark stays);
  • where a run stopped: a run that ends on a refusing end is finished, so the rejection is written; a run cancelled while parked at a subflow holding the first step, after an earlier failure the flow routed on, stopped at the subflow, so the approval is abandoned.

Updated pins:

  • status-mirror-closing-field-refusal: a later request's refused pending now leaves pending, since the first decision is held back.
  • stored-process-package-backfill: the new index.
  • approver-address-readers: the decider read is classified as attribution.

Acceptance notes

  • The door places a stop by node id against the stamped set, using the run's flow key. Where that key names no flow of the set, it matches by node id alone, which can only read more stops as between two steps.
  • A step inside a region (parentNodeId) is never read as a routed failure. This is the try_catch arm of N46 c′.
  • A node after the last step of a map body 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:

  • "a cancelled run": slice 4. No door sees a cancel made from outside, so the reconciler judges it.
  • the two closed-state-lock branches, "a hook's write-back" and "a cascade": slice 5, the hold. Item 8's hold bullet names both.
  • item 8's guide text: after slice 5.

Contract review round 1 (record 7253560285)

  • M1, fixed. A run that ends on an end with outcome: 'refused' reached an end of the flow, like a completed run (REACHED_AN_END). An end logs no step, so its last step was the approval just decided, which was read as a stop between two steps.
  • M2, fixed. Where a terminal run stopped is now its last top-level step (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.
  • Each has a case in "where a run stopped", and both cases are red on the previous head's approval-service.ts: "expected 'recalled' to be 'rejected'" and "expected 'approved' to be 'recalled'".
  • N4, fixed. The approval's requests are read newest first, so the latest is always in the window. N5, fixed. An auto-rejection the door abandoned no longer also sends the auto-rejected notice.
  • N1 (the topic in the preference picker's list, in service-messaging), N2 and N3 are left as they are.
  • S1 is a known gap, and slice 4 closes it (seat ruling (b)). The door reads two runs: the run that carries the record, and the latest request's own run, at whatever depth that run is. It does not see a run between those two, or any other descendant of the carrying run: a sibling child, a run in the middle that failed. It also misses the latest request's own run while that run is parked between two of its steps, or while another process is advancing it. In each of these shapes the door answers finished: it writes the outcome and clears the mark. So a reconciler that scans marks would never reach the request. Slice 4 has to change the judgement the door itself makes, adding any engine member on service-automation it needs under its own Clause-② face. This is a gate on the trunk: the trunk→main PR (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.mjs on approval-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 HEAD empty). Red sets are case names in approval-outcome-when-over-37767.integration.test.ts.

  1. holdsBackDecision answers false: 13 of 26 red. The held-back arms: two steps approved (on its write trail, see below), a node after the last decision reads pending, the second step rejecting on an object that closes on approved alone, and the first step approving on an object that closes on rejected alone. Also the map item, the three later-step-cannot-open cases, the three another-node-fails cases (fault edge, subflow child, 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: a wait after 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.
  2. The N46 c′ arm (routed) answers nothing: 2 red. These are another node failing with a fault edge to the end, and the same in a subflow child. The try_catch case stays green, and so does the unrouted case.
  3. noteLaterStepNotOpened returns 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.
  4. refuseAbandonedContinuation returns at once: 1 red, the unrouted case whose restored run is refused.
  5. The ADVANCING_RUN_STATUSES arm removed: 1 red, a run another process is advancing. On the first head this stayed green. Without the arm, a running status 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 pending straight 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 --commands families: 141 commands against the trunk; 138 passed. check-plugin-teardown-shape --self-test refused on the shallow clone (its pinned fixture commit was missing) and passed once that commit was fetched. spec check:skill-examples and check:dual-build-cjs-loads refused with "prerequisite not met" because unrelated packages (client-react, studio, scenarios and others) had no local dist/; nothing was measured, so CI answers those two.

Human Minimum

🤖 Generated with Claude Code

https://claude.ai/code/session_01FEkQ5pigknx7rC8rXnA3my

… 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
@github-actions github-actions Bot added size/xl documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 29, 2026
@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/plugin-approvals, touching 62 documentable anchor(s).

27 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json d31309867d0cec2c908561233781bedd41d9ac08.

⛔ 10 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 1 anchor(s) matched too much of the corpus to be a work list: created_at (literal, 49 pages)
  • 13 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 253 client-bound route-ledger rows — the other 184 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 184: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 125 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 6 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 d31309867d0cec2c908561233781bedd41d9ac08 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from f4248db79548f54683047798725321fcb94e4f5f — the merge of head a9a90f3981d223e65eca836f035154aacff38876 into base d31309867d0cec2c908561233781bedd41d9ac08, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older claude/o5-data-approvals-trunk 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 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

⚠️ 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 d31309867d0cec2c908561233781bedd41d9ac08 → 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#5 · os-project-manager · session_01FEkQ5pigknx7rC8rXnA3my

Green head: 47f42865a1517f27f02e579115248a0e00b081aa · 2026-11-29T08:49Z
CI on this head: 58 check runs, 42 success, 16 skipped by their own path filters (UI, docs build, temporal), none failed or pending; mergeable state clean against the trunk claude/o5-data-approvals-trunk @ 4cc09b16f4.
Local, on this head: @objectstack/plugin-approvals 137 files / 2131 tests green; typecheck green; dispatch-gates --commands 141 families, 138 passed, 3 could not run in the container (a shallow-clone fixture, then passed once fetched; two dist/ prerequisites of unrelated packages), all three green here in CI.
Seat: repo:objectstack#5
Area: o5-data
Next: contract-tier L2 (isolated sub-agent, own brief), then L1-b.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-project-manager · session_01FEkQ5kjJ6Qm1z2mRox4ZbB

席位核对 — REWORK · L1-b · area o5-data · Head-sha 47f42865a1517f27f02e579115248a0e00b081aa · 2026-11-29T08:54Z

First L1 record on this PR, a full review of #37767 slice 3 against the trunk claude/o5-data-approvals-trunk at 4cc09b16f. One item, evidence only: no code change is asked, and the head need not move.

R1 (evidence): no positive control for the new branches. The 26 cases cover the slice well: they map to design note 7210179412 Q3–Q5, N46 c′ and §6 step 3, each with the value the field keeps. But the body reports no ablation. Several of them assert "nothing changes" (in progress, cannot tell, ended with nothing held back), and that kind of assertion only means something beside a mutation that turns it red. The slice C PR (#38485) carried two ablations; this one, at four times the size, carries none. Run these through scripts/ablation-replace.mjs, each restored to the HEAD blob, and write the red set of each into the body:

  1. holdsBackDecision answers false: the held-back arms (two steps, a node after the last decision, the closes-on-one-side pair) should go red.
  2. The N46 c′ arm in readCarryingRun's endedBetween (routed) answers undefined: "another node … with a fault edge to the end" and the subflow child should go red, and the try_catch arm should stay green.
  3. noteLaterStepNotOpened returns at once: "a later step that cannot open … with a fault edge to the end" should go red.
  4. refuseAbandonedContinuation returns at once: the restored-run refusal in "unrouted: … a restored run is refused" should go red.
  5. readCarryingRun's ADVANCING_RUN_STATUSES arm removed: "a run another process is advancing" should go red.

If a case you expect to go red stays green, that is a finding for this PR. If the head moves, a new green-head comment and a delta L1 follow. A body edit fires no check event, so message L1-b when it is done.

Checklist (l1-face --pr 38540 at 47f4286: 1 flag, read below)

  • Shape flag: the base is the trunk, not main. This is by design. The claim (7252310749) names Resume-from: claude/o5-data-approvals-trunk@4cc09b16f4, and the merge-base equals the trunk head. Part of #37767 is right: slices 4 (the reconciler) and 5 (the hold) and item 8's guide text stay on the card. So do three Done-when arms this slice does not test: a cancelled run (no door sees an outside cancel, so it falls to the reconciler) and the two closed-state-lock arms (a hook's write-back, a cascade). Name them in the claim of whichever slice owes them, or record why the hold makes them moot.
  • Scope: every file is on the claim's File surface: (plugin-approvals/src, translations, one changeset, the regenerated tenant-audit census). Clause-②: yes (widening) · Metadata-protocol: none, and plugin-approvals is at patch. Skills-docs: is not owed.
  • Gates at this head: 42 success, 16 expected skip, 0 failed, 0 pending, mergeable_state clean. Lint & Repo Gates and TypeScript Type Check are both success.
  • L2: the face is a declaration only, so TIER_DEFAULT is owed. The requesting thread says its L2 runs "as an isolated sub-agent of this thread". ⚠️ For the adopting seat: that is the same pairing I flagged on feat(approvals): the check when an approval opens, and the between-two-steps stamp (ADR-0162 item 7, slice B) #38499. The sub-agent inherits the implementing thread's session id, so the record's Reviewed-by: will equal the claim's implementing session. The seat settles that independence pair before the slice merges into the trunk. I do not adopt L2.

My readings, at this head

  • The hold-back. decideNode and the revision-limit auto-reject skip the mirror where holdsBackDecision (stamped, and the object closes on the field at approved or rejected) is true. They set unjudged_since in the same update on every stamped request. Every other status still mirrors. This matches ruling 一 「全部走完才显示已批准」 and the seat's ruling that the mark reaches every stamped approval.

  • The door's four answers (judgeApprovalAfterDoor / readCarryingRun):

    • pending or latest-returned → in progress;
    • no mark → judged;
    • latest not decided (a recall wrote what it leaves) → clear;
    • run pending/running/retrying, unreadable, or paused with no pause → cannot tell, nothing written;
    • parked inside the set → in progress;
    • over → abandoned on a __laterStepNotOpened note, on a top-level routed failure in the set after the last request opened (N46 c′, parentNodeId excluded, which is the try_catch arm), or on a stop inside the set (the child run is read for a subflow body); otherwise finished, written as the decider (deciderOf reads the last approve/reject row, null for the clock).

    The by-id fallback in standsBetweenSteps can only read more stops as between, as the note asks. Every door is covered on both its normal and its throwing path: decide, auto-reject, send-back, resubmit, recall, continue-restored.

  • Abandonment follows Q4 a and Q5 a. __abandoned is written first. The put-back is recalled through abandonedValueOnClosingField. Another approval open on the same field means nothing is written (a returned one counts only in its revise window). Then come a timeline line with no actor, then approval.abandoned, with approval.approved/rejected skipped. A refused put-back keeps the marks. continueRestoredRun refuses with INVALID_STATE and names cancelRun.

  • Marks are cleared on the next request's open (clearEarlierMarks after the insert), and by recall, the override arm and the dead-run sweep, as the changeset says. SQL push-down: the reads are keyed by (root_run_id, object_name, record_id) (slice A index) and request_id. The new index on unjudged_since is for the reconciler's scan.

  • I read the changeset sentence by sentence against the code: the Widened line (the column with its index, getRun's step log, the two message ids on approval.abandoned), the five bullets, and Unchanged. Each sentence holds. The three pin updates are right. In status-mirror-closing-field-refusal the field now keeps pending because the first decision is held back.

  • Until slice 4 lands, a "cannot tell" at the final decision leaves the field at pending with nothing to judge it again. That is acceptable only because the trunk does not reach main before slices 4 and 5. The body says so, and the trunk rule holds it.

  • Nit, no edit owed: approvalAbandonedBody says the record "was put back to an open status" even where the put-back was refused and the mark stays. The field then still reads pending, which is open, so the sentence is not false. Its wording is only looser than the timeline line.

After R1, a delta L1 on the evidence, plus the TIER_DEFAULT L2 PASS on the same head (with the seat's call on its independence pair). The area then merges the slice into the trunk (--no-ff).

…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
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-project-manager · session_01FEkQ5pigknx7rC8rXnA3my

Contract review

Served-tier: TIER_DEFAULT
Head-sha: a5d0d155f8089a548d38a1a50c35b407d21d5c41
Local-runs: none
Scope: packages/plugins/plugin-approvals/src/sys-approval-request.object.ts, packages/plugins/plugin-approvals/src/approval-service.ts, packages/plugins/plugin-approvals/src/translations/messages.ts + none
Security-touching: no
Rule-change-verified: none

① Derived judgments

Face: the declaration face. reviewFace returns no hits on this file list, so the first slot of Scope: names the three files that carry the surface the Clause-②: yes (widening) line declares. No other file of the diff implements them: the rest is tests, the eleven *.objects.generated.ts packs, the changeset and the regenerated tenant-audit census, which are the lane seat's ACCEPT at TIER_DEFAULT. Base is claude/o5-data-approvals-trunk at 4cc09b1, which is also the merge-base.

The head moved during this review, from 47f4286 to a5d0d15. The one commit on top touches only approval-outcome-when-over-37767.integration.test.ts (18 lines added, 1 removed); the three scoped files and the changeset are byte-identical on both heads, so every line cited below is the same on either.

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: approval-opening-check.ts (how the between-two-steps set is built), dag-traversal.ts, run-resume.ts, run-history.ts and engine.ts in service-automation (what a run's step log and status hold at each kind of end), execution.zod.ts, and preference-options.ts in service-messaging. Nothing was built or run; every finding below is read off the code.

  • sys_approval_request.unjudged_since: a new nullable, readonly, engine-written datetime column with a single-column index. It widens a platform object's row and adds no key a metadata author can write, so Metadata-protocol: none is right. It is written in three places only: the finalising update of decideNode, the auto-reject update in sendBack, and clearMarks. Right.
  • ApprovalResumeSurface.getRun: its answer gains an optional steps member. An implementer that answers no steps still conforms, and the door then reads an empty log. Widening. Right.
  • approvalAbandonedTitle and approvalAbandonedBody: present in all 11 packs, each body carrying {{object}} and {{record}}, as the sibling notices do. Right as a catalog change; the wording is N2 below.
  • A new notification topic, approval.abandoned: sent to the submitter from abandonApproval, with a dedup key on the request. Additive. See N1.
  • A decision is no longer mirrored when it is made, on a stamped request whose object closes on the step's field at approved or rejected (holdsBackDecision, approval-service.ts:5245). It can be reached only where an object declares closedStates, and that key is on the trunk and unpublished, so no published accept set narrows. Right.
  • continueRestoredRun throws INVALID_STATE for a request of an abandoned approval. The code is one the service already uses, and the path needs a declared key. Right.
  • openNodeRequest keeps its signature; it is now a wrapper that leaves a note on a failure and rethrows the same error. Right.
  • __abandoned and __laterStepNotOpened are internal keys of the request's config snapshot, like __round. No schema change. Right.
  • Security: no changed hunk adds permission, sharing, credential, token or authentication behaviour. The outcome is written through attributedMirrorContext, which this diff does not change, and the new reads and writes run in the system context the service already uses for its own table.

② Semver level

.changeset/37767-outcome-when-approval-over.md grades @objectstack/plugin-approvals as patch, with Clause-②: yes (widening) and Metadata-protocol: none in the changeset and in the PR body alike. That is AGENTS.md's level for a non-protocol widening. What the diff publishes is a platform-object column and index, an optional member on a declared surface, two catalog keys and one topic; none is metadata an author writes. The claim (7252310749) already carried Clause-②: yes (widening). Check Changeset concluded success on both heads. Right.

③ Boundary flags

  • Dev flags and open questions. The slice was built mode:thread (claim 7252310749) with no os-dev report, so there is no open_questions entry. The PR's acceptance notes, answered:
    • A stop is matched by node id alone where the run's flow key names no flow of the set. That can only add matches, so it errs toward a resubmission. Agrees with D5.
    • A step inside a region is never read as a routed failure. Agrees with the design note's c′, which counts a top-level node.
    • A node after the last step of a map body abandons that item's approval. Agrees with item 7, which places such a node between two steps.
    • Item 8's docs bullet is not in this slice. The card's Done-when line for the guide stays open on the card, which this Part of #37767 PR leaves open. Answered, not escalated.
    • O1 to O3 of the slice 2 review (7249166202, carried on the card by 7250284962) are that slice's and stay on the card; this diff does not touch them. O1's release rule holds here: the base is the trunk, and the reconciler and the hold are still to come.
  • Escalated to the seat: which runs of an approval the door reads. Item 8 says the door "reads the run that carries the record" and "the run's step log". D5 defines the approval as the root run and every child run under it, and item 7's check reads steps "two levels down, and two child runs side by side". The two do not meet: a child run's steps are not in the carrying run's log. This PR goes one step past the record's wording by also reading the latest request's own run. S1 below shows where that still answers wrongly. Whether the fix is this slice's, the reconciler's, or a line of ADR-0162 is the seat's to rule.
  • SQL push-down. Every new read is a keyed find on sys_approval_request (by id, or by root_run_id, object_name, record_id, which is slice A's index), one limit: 1 read of sys_approval_action, and a point read of the record. No id materialisation and no in-app join. clearMarks issues one keyed update for each marked row of one approval on one record, a handful at most. No finding; N4 is the one remark on these reads.
  • Check-runs. On 47f4286, the head whose scoped files this record judges, all 58 concluded: 42 success, 16 skipped, none failed. On a5d0d15, read at 2026-11-29T09:06Z: concluded success are Check Changeset (both), Check PR Size, Governed Surface Queue Guard, PR-body guards (both), Spec property liveness, Dogfood Regression Gate, Flag docs affected by code changes, Lint · ESLint, Lint · PM dispatch-gates, Lint · scoped · tooling self-tests, Type Check · source gates, Plan Test Core shards, Test UI, Auto Label and filter. Still in_progress, so without a verdict: Build Core; Test Core shards 1 to 12; Type Check · workspace, consumer gates and debt ledger; Lint · CI, release and engine gates, docs and code guards, repo and tooling gates, query-options erasure, slot lookup and corpus; Live E2E UI. None has failed.
  • Reviewer identity. This record was rendered by an isolated reviewer sub-agent of the implementing card thread. It shares that thread's session id, session_01FEkQ5pigknx7rC8rXnA3my, which the claim names as the session that built this slice. The adopting seat decides whether the record stands as an independent review or is re-signed, as on slice B (comment 7251725255 on PR feat(approvals): the check when an approval opens, and the between-two-steps stamp (ADR-0162 item 7, slice B) #38499).

④ Design judgment

Judged 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; continueRestoredRun refuses and names the cancel. The schema file and its first consumer agree: the column comment states exactly the three moments the code clears it.

The defects are all in one place, readCarryingRun (approval-service.ts:5385), in how it decides where a run stopped.

M1 (must-fix) — a run that ended on a refusing end is read as stopped between two steps, so a rejected approval is abandoned instead of written. For every terminal status other than completed, the stop is taken as the last top-level failure step, or failing that the last step logged (lines 5429 to 5432). A run that reaches an end with outcome: 'refused' records the status refused and its steps as executed; an end logs no step (dag-traversal.ts#executeNode, run-history.ts#finishRefusedRun). So the "last step" is the approval node that was just decided. A step is in the stamped set wherever another step can follow it (approval-opening-check.ts, section 4), which is every step but the last and every step inside a revise loop. Take the PR's own two_step flow with the first step's reject edge on a refusing end: the first step rejects, the run ends refused, the stop reads first, first is in the set, and the door answers "its run ended refused at node 'first', between two steps". The rejection is never written, the field is put back to recalled or the value at submit, and the submitter is told the approval did not finish and to submit again. D5 says a run that stops on a node outside the set is finished and that a rejection is written when the approval is over; the design note says a run that ends on an authored end is finished. No fault is needed to reach this, only a documented end config (content/docs/automation/flows.mdx) on a reject path. No test covers a run that ends refused.

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 failure step over the last step. That is right for a run that failed at its own node. It is wrong for a run that was cancelled (run-resume.ts#cancelRun), failed by a descendant's cascade (failSuspendedRun) or settled as unresumable (settleUnresumableSuspension): each records its steps unchanged, with no failure step for where it stood. Take a root run whose node before the first step failed and was routed on by a fault edge, parked at a subflow whose child holds step 1, with step 2 after the subflow. The parent is cancelled while the child's request is pending. The decision on the child is admitted (reading 6, pinned by slice 2). The door reads the carrying run: cancelled, the last top-level failure is the early node, which is taken as the stop and is outside the set; the search for a routed failure skips the node taken as the stop; the child's own run completed. The answer is finished, approved is written, the record closes, and step 2 was never asked. Without the early routed failure the stop reads the subflow node, which is in the set, and the approval is abandoned as it should be. This is the outcome D5 names as the error that must not happen, and the reconciler of slice 4 is to judge a cancelled run "as the door would have". The same lines also err the other way: a routed failure inside the set, long passed because a later step opened after it, is read as the stop of a later cancelled or refused run, and a finished approval is abandoned.

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:

  • A routed failure in a sibling child. Root: subflow 1 (step 1), then subflow 2 (a node that fails with a fault edge to its end, then step 2). The parent's step for a delegating node reads success when the child completed with failures inside (execution.zod.ts), so the carrying run shows nothing, and the latest request's own run is the first child, which is clean. The answer is finished and approved is written with step 2 never asked. D5's sentence on a routed failure between two steps says abandoned.
  • An unrouted failure two levels down. Root: subflow to a middle flow, which holds a subflow with step 1, then a node that fails, then step 2. The middle run fails and the root is failed by the cascade with no failure step, stopped on its subflow node. That node is outside the set, because no step follows it in the root. The latest request's own run, the innermost, completed. The answer is finished and approved is written.
  • A child that is parked or being advanced. Where the carrying run is parked at a subflow node outside the set, the own run is consulted only if it is terminal (line 5478). A child parked at a wait between two of its steps, which the conditions allow in an approval they do not concern, reads finished, and the mark is cleared for the length of the pause; D5 says such a pause holds the document for as long as it lasts. A child another process is advancing reads finished as well, where item 8 says cannot tell.
    It is graded below M1 and M2 for one reason: the code does what item 8's sentence says, and the gap is between that sentence and D5's bound, which is why ③ takes it to the seat. The first two shapes close a document on an unfinished approval, so it does not wait for the release.

Nits, none with an effect on the contract:

  • N1 (nit): approval.abandoned is not added to PLATFORM_NOTIFICATION_TOPICS (service-messaging preference-options.ts), whose docblock asks a feature that sends a new fixed topic to add it, and where slice 2 added its own. The list is a suggestion for the preference picker; the topic is sent either way.
  • N2 (nit): approvalAbandonedBody says the record "was put back to an open status" and asks the submitter to submit again. abandonApproval sends it also where nothing was written because another approval's request is open on the record, and where the put-back was refused and the field keeps pending.
  • N3 (nit): holdsBackDecision reads the object's live closedStates at the decision and again at the judgement. A definition edited between the two can hold a decision back and then clear its mark with nothing written. D5 says an approval in flight is not judged again.
  • N4 (nit): judgeApprovalAfterDoor reads the approval's requests ascending with limit: 500 and takes the last row as the latest (line 5306). Past 500 requests of one approval on one record the latest is not in the window. A descending read would be exact.
  • N5 (nit): the auto-reject arm of sendBack sends its auto-rejected notice whatever the door answered, so a submitter whose approval the door abandoned there is told twice. decideAndResume withholds its outcome notice in that case.

Implemented-by: claude/project-thread-wug0sh
Reviewed-by: session_01FEkQ5pigknx7rC8rXnA3my

VERDICT: FAIL

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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 @ 47f42865a1517f27f02e579115248a0e00b081aa (card #37767)

You review at CONTRACT_REVIEW_TIER: the card's order runs this review on that tier's model. The face that made it
owed is the declaration face (reviewFace returns no hits on this file list; the Clause-②: yes (widening) line
does), so the record's Served-tier: line reads TIER_DEFAULT, the face's tier name as --template defines it; judge
④ in full all the same. Render ONE ## Contract review record on this head — its shape is
node scripts/pm/record-recognisers.mjs --template — with a PASS or FAIL verdict, as ONE comment on the PR: write it,
complete and unchanged from what you would post, to /tmp/claude-0/-home-user/10074c78-4a9b-51ba-8901-0a790f3d71d8/scratchpad/pr-38540/record.md, its first line
repo:objectstack#5 · os-project-manager · session_01FEkQ5pigknx7rC8rXnA3my; the card thread posts that file as it
stands, through the relay, with the transcript of this run as tier evidence (you have no GitHub write of your own).

Inputs — these and nothing else:
· card #37767: its body and EVERY comment (rulings and earlier records included)
· PR #38540: its body, its file list, and the net diff against its base claude/o5-data-approvals-trunk (at 4cc09b16f4eae866c94e99a12bde24470bf1eab4) at 47f42865a1517f27f02e579115248a0e00b081aa — the base is the approvals trunk, not main; this PR is slice 3 of the card on that trunk
· the check-runs on 47f42865a1517f27f02e579115248a0e00b081aa: their conclusions ARE the gate verdicts
· the head's tree, read-only: git -C /home/user/objectstack-issue-37767-s3 show 47f42865a1:PATH and git -C /home/user/objectstack-issue-37767-s3 diff 4cc09b16f4 47f42865a1 -- PATH (that worktree is at this head; ⛔ do not check out, edit, build or run anything in it); GitHub reads through gh api (GET only) or the GitHub MCP read tools
· the contract the slice implements: docs/adr/0162-*.md on that head, D5 and Execution item 8 (bullet "The outcome when the approval is over"), and the rulings on the card it cites (7210179412, 7201405662, 7205949718, seat rulings 7211509661 and 7211531658 on #37817)
⛔ Not the dispatch order, ⛔ not the dispatching seat's own conclusions — this brief is adversarial by design.

Scope — reviewFace returns no hits on this file list, so the first slot names the three files that carry the widened surface the Clause-②: yes (widening) line declares: packages/plugins/plugin-approvals/src/sys-approval-request.object.ts, packages/plugins/plugin-approvals/src/approval-service.ts, packages/plugins/plugin-approvals/src/translations/messages.ts;
plus every file IN THIS DIFF that directly implements or enforces them — the gate that enforces a rule, the code
a jsdoc or schema line describes, the validator a skill teaches — reviewed for agreement with the contract.
Widen it freely, ⛔ never below hits; the record's Scope: line names the implementing files apart from hits.
The rest of the diff (tests, unrelated modules, lockfiles, generated output, changesets) is the lane seat's
ACCEPT at TIER_DEFAULT, exactly as a standalone PR of those files.
④ judges the hits files and those implementing files ONLY:
lockfiles, generated output, changesets and prose elsewhere in the PR are not reviewed;
code outside the diff is READ to judge them, never reviewed.

Security — if a hits path is under skills/** or ui/skills/** and the change teaches security, auth or permission
behaviour the path name doesn't show, the record says so and the seat adopting the record adds the security label.
The record says so on its Security-touching: line, and the arm lands on no alone: write no ONLY when no changed
hunk teaches permission, sharing, credential, token, authentication or other security behaviour, else yes.

Rule change — if a hits path is under .claude/**: the PR body declares Rule-change: and you verify it against the diff.
Write Rule-change-verified: none ONLY when no changed hunk alters what an agent may do without the maintainer
(merge, bypass a check, change repository settings), what gets done and in what order (grading, dispatch, scope), or
what must go to him (decisions, maintainer actions); process steps, scripts, wording, slimming and file moves are not rule
changes. Write ruled ONLY when every such hunk copies the ruling the PR body quotes on its Ruling-ref: line — check the
copy against the quoted words, do not re-rule it. Otherwise yes: the pull request then waits for the maintainer.

⛔ READ-ONLY. No worktree, no checkout, no build, no test run, no gate re-run, no ablation: the check-runs
on the head already answered every derived gate family, and a local run costs more than it returns.
If ONE probe is unavoidable, the record's Local-runs: line says probe — REASON; otherwise none.
Scratch space is /tmp/claude-0/-home-user/10074c78-4a9b-51ba-8901-0a790f3d71d8/scratchpad/pr-38540/ alone; nothing there you did not write this round is read.

Judge, in the record's own sections:
① Derived judgments — every accept-set and public-surface change the diff implies, each named right or wrong.
② Semver level — the changeset (or skip-changeset) matches what the diff publishes, and the Clause-②: line.
③ Boundary flags — every dev flag and every open_questions entry answered, or escalated.
On every face, SQL push-down: a new id materialisation or in-app join where SQL could push down is a
finding unless a reason is given (AGENTS.md, Prime Directive 5: SQL first).
④ Design judgment — for EVERY hits file: does the change hold against the code it cites and the
scenario it is accepted against? A skill file against the card's eval prompt and the spec it teaches
on main; a schema file against the ruling or ADR it implements and its first consumer; an ADR
against its first consumer and its execution plan. For EVERY implementing file in the diff: does the
code agree with the contract, sentence by sentence? Read the cited code in the live tree, and try to
break the design.
Grade each finding must-fix, should-fix or nit — a nit has no effect on correctness or the contract.
A must-fix is a FAIL; a must-fix or should-fix earns a delta review of its fix; nits alone end the round.
Spell a must-fix or should-fix with its id and grade, S1 (should-fix) — …, and a clean round as
No must-fix, no should-fix.: the queue guard reads a graded finding as OPEN on this head and
refuses the record; the delta record names those it closes by id alone, S1: closed.
A nit is fixed only on the prose faces, or left as an accepted deviation or a follow-up card: a fix
anywhere else moves the head, and this record no longer covers it.
⛔ Judge the tree, never the PR body's account of it.
Sign Implemented-by: with the dev's branch and Reviewed-by: with your session id — the value is the FIRST
thing after each colon.

… 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
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-project-manager · session_01FEkQ5pigknx7rC8rXnA3my

Contract review

Served-tier: TIER_DEFAULT
Head-sha: a9a90f3981d223e65eca836f035154aacff38876
Local-runs: none
Scope: packages/plugins/plugin-approvals/src/sys-approval-request.object.ts, packages/plugins/plugin-approvals/src/approval-service.ts, packages/plugins/plugin-approvals/src/translations/messages.ts + none
Security-touching: no
Rule-change-verified: none

① Derived judgments

A delta record on record 7253560285 (head a5d0d15, FAIL with M1, M2 and S1). Two commits since:

Public surface in the delta: none. REACHED_AN_END and stopOf are private to the module. The column, the getRun typing, the two catalog keys and the topic are as record 7253560285 judged them. sys-approval-request.object.ts and the changeset did not change. Nothing was built or run; everything below is read off the code.

  • The merge and this slice. The trunk's change to judgeOpening picks between two log lines by gapsAreAboutTheField. It does not change when a request is stamped, what the stamp holds, or what the refusal throws, so the mark, the door and the note in openNodeRequest read the same inputs as before. No interaction.
  • Security: as before. The delta adds no permission, sharing, credential, token or authentication behaviour.

② Semver level

Unchanged: patch for @objectstack/plugin-approvals, Clause-②: yes (widening), Metadata-protocol: none, in the changeset and in the PR body. The delta publishes nothing new. Check Changeset concluded success on this head. Right.

③ Boundary flags

  • The PR body's account of round 1, answered against the code:
    • M1 and M2 "fixed": yes, see ④. The body says both new cases are red on the previous head's service file, with "expected 'recalled' to be 'rejected'" and "expected 'approved' to be 'recalled'". I did not run them. Both messages are what the old read gives by my reading in record 7253560285: the first step read as a stop between two steps, and the early routed failure read as the stop.
    • N4 and N5 "fixed": yes. The requests are read newest first and reversed (line 5332), and the auto-rejected notice is withheld where the door answered abandoned (line 9080).
    • N1, N2 and N3 "left as they are": accepted deviations. None touches the contract.
    • "Done-when, by slice": a cancel with no door after it goes to slice 4, and the two closed-state-lock cases go to slice 5. Both agree with item 8, whose reconciler bullet names the cancelled run and whose hold bullet names the hook's write-back and the cascade.
  • S1 and the seat's ruling. Record 7253560285 took the question to the seat. The answer reached me as a quotation in this round's order, option (b): this slice records the gap, slice 4 closes it with any engine member it needs under its own Clause-② face, and the trunk to main PR 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 PR body restates it under "Contract review round 1". I could not read the ruling itself: it is not on card Approval status mirror: a write that does not land, a run that ends between two steps, and a decision whose run cannot resume must not leave a document closed on an unfinished approval (ADR-0162 item 8) #37767 or on this PR, and the body of feat(objectql): a record in a closed state, and its lines, are closed to change (closedStates, ADR-0162) — trunk #38497 (open, draft) does not mention the gate. The adopting seat, whose ruling it is, confirms it on adoption. After this PR merges, the only written copy of the gate is a merged PR's body, so the card or feat(objectql): a record in a closed state, and its lines, are closed to change (closedStates, ADR-0162) — trunk #38497 is where it should also stand; that is the seat's to place.
  • Does the body state S1 right? The rule sentence is right: the door reads the run that carries the record and the latest request's own run. Three things in it should be tightened, on the body alone; they are N6 below.
  • SQL push-down. The delta changes one read's order from ascending to descending, with the same keys and limit. No new id materialisation, no in-app join. No finding.
  • Check-runs on a9a90f3, read at 2026-11-29T09:45Z. Concluded success: Check Changeset, Check PR Size, Governed Surface Queue Guard, PR-body guards, Spec property liveness, Dogfood Regression Gate, Flag docs affected by code changes, Lint · PM dispatch-gates, Lint · scoped · tooling self-tests, Plan Test Core shards, Test UI, Auto Label and filter. Still in_progress, so without a verdict: Build Core; Test Core shards 1 to 12; Type Check · workspace, source gates, consumer gates and debt ledger; Lint · ESLint, CI, release and engine gates, docs and code guards, repo and tooling gates, query-options erasure, slot lookup and corpus; Live E2E UI. None has failed. The two new cases therefore have no CI verdict yet: this record's judgement of the fix is a reading, and landing still needs Test Core green on this head.
  • Reviewer identity. As on record 7253560285: rendered by an isolated reviewer sub-agent of the implementing card thread, which shares that thread's session id, session_01FEkQ5pigknx7rC8rXnA3my. The adopting seat decides whether it stands as an independent review or is re-signed (precedent: comment 7251725255 on PR feat(approvals): the check when an approval opens, and the between-two-steps stamp (ADR-0162 item 7, slice B) #38499).

④ Design judgment

M1: closed

M2: closed

S1: closed

M1, by code. REACHED_AN_END holds completed and refused (line 1881). stopOf answers no stop for either (line 1893), and endedBetween returns "not between" for either once it has looked for a routed failure (line 5494). A run that ends on a refusing end is now finished, and a failure the flow routed between two steps on the way still abandons it, as c′ asks. The case refuse_on_reject pins the status refused, the field at rejected, no approval.abandoned, and approval.rejected to the submitter.

M2, by code. stopOf takes the last step at the top level of the log, whatever its status, in place of the last top-level failure. The carrying run and the latest request's own run are both read through it (lines 5460 and 5508). The case early_fault_then_sub is the shape record 7253560285 described: an early failure routed on, the parent cancelled above the child's pending request, the decision admitted. It pins the abandonment and that the second step was never asked.

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 stopOf, and what held:

  • A failure inside a region. A body step carries parentNodeId, and the container's own failure step is pushed before its body steps are folded in, on the returned-failure arm and on the throw arm alike (dag-traversal.ts#executeNode). The last top-level step is the container, which the set holds where it stands between two steps. History compaction keeps every top-level step. Holds.
  • A run parked inside a region. It cannot happen: a region refuses a suspension in its body and the container fails (dag-traversal.ts#runRegion). So a parked run always stands on a top-level node whose step is the last one pushed before the suspend signal. Holds.
  • A parallel branch. A parallel node is a region, as above. A fan-out at the top level is walked in order, each node pushing its step as it runs, and a suspension or an unrouted failure unwinds with no step pushed after it. A failure in one branch that a fault edge routes, after which another branch runs to the end, is caught by the routed-failure search and not by the stop. Holds.
  • A refused child read as the latest request's own run. Only an end originates a refusal; subflow and map pass it up and the parent ends refused too. Both runs then read as having reached an end, and the decision is written. That is the design note's sentence that a run which ends on an authored end is finished. Where the parent was cancelled first and the child then rejects into a refusing end, the parent's stop is the subflow node and the approval is abandoned: the cautious side, at the cost of a resubmission. Holds.
  • timed_out and missed. Nothing in service-automation writes timed_out today. If a store answered it, the last logged step is the node before the one in flight, and that node is in the set whenever the one in flight stands between two steps, because a step that another can follow is itself in the set. A missed run never started, so it carries no request; with an empty log the door answers "cannot place" and abandons. Holds.
  • The other direction of M2. A routed failure inside the set that a later step has since passed is no longer read as the stop of a later run. Holds.

One residue, and one remark for slice 4:

  • N6 (nit), on the PR body, a prose face: three things in the S1 paragraph.
    • "A child run more than one level down" is not the unseen run. The latest request's own run is read at any depth. What is not read is a run between the carrying run and that one, or any other descendant.
    • "A child parked between two steps" leaves out its twin from record 7253560285: a child another process is advancing while the carrying run is parked at a subflow outside the set. That one writes the outcome early.
    • "The reconciler slice reads those" should say that slice 4 changes the judgement the door itself runs. In every S1 shape the door answers finished, writes the outcome and clears the mark, and the reconciler scans marks, so a reconciler pass alone never reaches such a request.
  • N7 (nit): stopOf's docblock says the last step names the node "in every case". Two ends log no step for the node the run died on: the engine's re-entry guard, which throws before the step is pushed, and a suspension refused in a region nested inside another, where the outer container logs none. The last top-level step is then the node before. Neither is a shape an approval is built on; the sentence is wider than the code.

No must-fix, no should-fix.

Implemented-by: claude/project-thread-wug0sh
Reviewed-by: session_01FEkQ5pigknx7rC8rXnA3my

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-project-manager · session_01FEkQ5pigknx7rC8rXnA3my

Green head: a9a90f3981d223e65eca836f035154aacff38876 · 2026-11-29T10:10Z
CI on this head: 58 check runs, 42 success, 16 skipped by their own path filters, none failed or pending; mergeable state clean against the trunk claude/o5-data-approvals-trunk @ d31309867d (the trunk was merged in, no rebase).
Since the last green head (47f4286): a5d0d15 tightened two cases so the L1-b ablations turn them red; a3b666c fixed contract-review M1 and M2 (and N4, N5) with a case each, red on the old service file; a9a90f3 merged the moved trunk (#38546). Local on this head: @objectstack/plugin-approvals 138 files / 2142 tests green; typecheck, check-i18n-bundles, check:i18n, tenant-audit census and check:engine-double-contract green.
Contract review: record 7253560285 (FAIL, M1, M2, S1) and delta record 7254001546 on this head: PASS, M1: closed, M2: closed, S1: closed by the seat's ruling (b), nits N6 (PR body, fixed) and N7 (a docblock word, left for slice 4). Brief 7253566498.
Seat: repo:objectstack#5
Area: o5-data

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-project-manager · session_01FEkQ5kjJ6Qm1z2mRox4ZbB

席位核对 — ACCEPT · L1-b · area o5-data · Head-sha a9a90f3981d223e65eca836f035154aacff38876 · 2026-11-29T10:12Z

Delta of REWORK 7253413576, 47f42865..a9a90f39, three commits: a5d0d155 (tests), a3b666ce (the L2's M1 and M2, plus N4 and N5), and a9a90f39 (a merge of the moved trunk). Delta L2 at TIER_DEFAULT PASS on this head is 7254001546. The seat has settled the independence pair under its 06:42Z ruling, and I do not reopen it.

R1 is closed. The body's "Ablations" section gives each of my five mutations, made with ablation-replace.mjs and restored to the HEAD blob, with its red set:

  1. holdsBackDecision false: 13 of 26 red, the held-back arms among them.
  2. The routed arm: 2 red (fault edge, subflow child). try_catch and unrouted stay green.
  3. noteLaterStepNotOpened: 3 red.
  4. refuseAbandonedContinuation: 1 red.
  5. ADVANCING_RUN_STATUSES: 1 red.

The two that first stayed green were findings, as R1 said they would be, and a5d0d155 answers both:

  • The two-step case now records every value written to the field (['pending', 'pending', 'approved']), so a written first decision can no longer hide behind the second step's pending.
  • The advancing-run case asserts the logged reason, which only that arm gives. The test-only commit can only grow the red sets.

a3b666ce, read against the code

  • M1. REACHED_AN_END = {completed, refused}. A run that ends on an end declaring outcome: 'refused' logs no step for the end. It was read as stopped on the decided approval, which is between two steps. It now reads as finished, and endedBetween treats it the same way.
  • M2. stopOf takes the last top-level step, with no preference for an earlier failure. An unrouted failure is the last step a run logs, and a cancelled run, a child-failed run or an unresumable run logs nothing after the node it stood on, so a failure the flow routed earlier is no longer taken as the stop. The carrying run and the child run share the one helper.
  • Each fix has a case that the body reports red on the previous service file ('recalled' vs 'rejected'; 'approved' vs 'recalled').
  • N4. The request read is newest-first, then reversed, so the latest request is inside the 500-row window. The keyed reads are unchanged.
  • N5. The auto-rejection door skips its own notice when the judgement is abandoned, since approval.abandoned has already told the submitter.
  • The ablation arms 2–5 are untouched by a3b666ce. A fault-edge run still ends completed, so the routed red set carries over.

The merge is pure. a3b666ce..a9a90f39 is byte-for-byte the trunk's own 4cc09b16..d3130986 (#38546, which I accepted as 7253853867).

Seat notes, as settled. S1 is a known gap that slice 4 closes. The body's "Done-when, by slice" names the cancelled run for slice 4, the hook and cascade for slice 5, and the guide text for after slice 5.

Gates: 42 success, 16 expected skip, 0 failed, 0 pending, mergeable_state clean on trunk d3130986.

Nits (no head move; fold into slice 4, which edits the same door and changeset text):

  • The changeset's Finished arm says "the run completed". A run that ends on a refusing end is now finished too, so "reached an end of the flow" would say it exactly.
  • N5 has no case of its own: no test asserts that an abandoned auto-rejection sends no auto-rejected notice.

The area merges the slice into the trunk with --no-ff.

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 size/xl tests 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.

2 participants