Repository navigation
fix(approvals): an abandoned approval never writes a closed value on its status mirror (ADR-0162 item 7, slice C) - #38485
Conversation
…ts status mirror Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5phEgfPTCgvPqh4ER2
…s writers Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5phEgfPTCgvPqh4ER2
…n its status mirror Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5phEgfPTCgvPqh4ER2
…o request can hold Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5phEgfPTCgvPqh4ER2
📓 Docs Drift CheckThis PR changes 1 package(s): 9 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 4 release-owned page(s) also name something this change touched. These are read-only:
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 ac3d98cf53ee68f056e3cd47a854909a748fa9a9 && git checkout ac3d98cf53ee68f056e3cd47a854909a748fa9a9
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin bfe2df88b98a725c13166a98b3a2b6b382ca5ba1 a0ddf0cbedff9632b9c0ff07a9282a347b3e69e6 && git checkout -B drift-repro bfe2df88b98a725c13166a98b3a2b6b382ca5ba1 && git merge --no-ff a0ddf0cbedff9632b9c0ff07a9282a347b3e69e6
node scripts/docs-audit/affected-docs.mjs --json bfe2df88b98a725c13166a98b3a2b6b382ca5ba1
|
|
repo:objectstack#5 · os-project-manager · session_01FEkQ5phEgfPTCgvPqh4ER2 Final green head · 2026-11-29T05:52Z —
|
|
repo:objectstack#5 · os-project-manager · session_01FEkQ5kjJ6Qm1z2mRox4ZbB 席位核对 — ACCEPT · L1-b · area o5-data · Head-sha
|
|
repo:objectstack#5 · os-project-manager · session_01FEkQ5phEgfPTCgvPqh4ER2 Landed in the trunk · 2026-11-29T06:01Z — head |
Requested by Leehom · project thread
Part of #37766
Clause-②: no
Metadata-protocol: none
维护者速读
Slice C of #37766 only (the mirror on an abandoned request). Base is the closed-state trunk
claude/project-thread-yxhepsatbfe2df88b; this PR targets that branch, nevermain, and takes no auto-merge. Slice B (the opening check) and slice D (the guide) stay on the card.What changes
packages/plugins/plugin-approvals/src/approval-service.ts, insidemirrorStatusFieldonly. On a transition that abandons a request, where the object'sclosedStateslists any value for the mirror field, the value comes from a newabandonedValueOnClosingFieldinstead ofmirroredStatusValue:approvalWroteHeldValueasks the request table in one probe:object_name+record_id+status= the held value, and eitherroot_run_id= the abandoned request's root run, orroot_run_idnull withcreated_atat or after itsroot_run_started_at(the index slice A declared onroot_run_id, object_name, record_idserves it). No hit: nothing is written. A hit on the same root run: the approval wrote it. A hit on a request with no root run, a request that records no root run itself, or a failed probe: it cannot tell. In the last two cases the mirror goes down the order.recalled, where the field declares it and the object does not close on it. A declaredrecalledthe object closes on is withheld (warn, N21).info, N21); an empty value at submit on arequiredfield is passed over for the default; on a field that is not required it is put back.Every other write of the mirror, and every write on an object that closes on no value of the field, takes the old path unchanged (the
CONTROLtests). No export, error code, platform-object field, translation or spec change.The writers, read on the trunk before coding. Two code paths abandon a request, both through
mirrorStatusFieldwith the value at submit:recall(the submitter onpending, the submitter in the revise window onreturned, and the override arm, which admits an administrator and a system context, onpending) andabandonForDeadRun, reached fromreleaseDeadRunRequests. The "administrator override" is the override arm ofrecall, not a third method. #37767 piece 2 (on the trunk) changed only how a refused write on a closing field is reported;mirroredStatusValueis untouched by it.Tests
New file
packages/plugins/plugin-approvals/src/status-mirror-abandoned-closed-value.integration.test.ts, 52 tests on the real ObjectQL engine and validator (SQLite throughSqlDriver, the plugin's own objects synced) and the real automation engine with the approval node. Every test records the value the field keeps.recalledclosed and withheld; closed value not written by the approval left alone; the control on an object with no closed value) each run on all five transitions: submitter recall, recall in the revise window, administrator override, system-context override, dead-run sweep.recalledopen / closed / not declared; value at submit closed / open / empty on a required field / empty on a field that is not required / not carried; field holding an open value (the request's own status, another, with and without a value at submit); a closed value the approval did not write; a closed status another approval on the record had; an object that closes only on values of its own; an earlier step's outcome with that step in the same run, in a child run and in the parent; amapin which only another item's request had the value; an abandoned request with no root run; a request with no root run opened since the approval started, and its control opened before; a default usable, closed or absent.requiredkeepspending(the validator refuses the empty write and, the object closing onapproved, the refusal is reported as anerror);readonlyrequired ends empty;systemrequired ends empty; required only when shown endspendingwhile shown and empty while hidden.warnfor a withheldrecalled, and theinfolines for a passed-over closed value and a value left alone, are asserted in the tests above.Readings at a0ddf0c
Tests 52 passed (52)(os-verify-lockVERDICT command-exit 0).pnpm --filter @objectstack/plugin-approvals exec vitest run --maxWorkers=2:Test Files 134 passed (134),Tests 2052 passed (2052)(run at3e7932ca; the later commit adds two tests to the new file only, re-run green above).pnpm --filter @objectstack/plugin-approvals typecheck(tsc, scripts tsconfig,check:test-typecheck): exit 0.node scripts/ablation-replace.mjs, anchor hit x1 to x0, restored to the HEAD blob): the closing-field branch disabled, 31 failed / 19 passed. The 19 green are the controls and arms where the old choice agrees.git diff HEADempty.Readings
warnfor a withheld declaredrecalled,infofor the two left-alone cases. Implementation detail inside N21, per the seat.Acceptance notes
pending(every request opens on it) and the status it held when abandoned (returnedfor a recall in the revise window), since the abandoning write has already replaced its status withrecalledwhen the mirror runs. So a closedpendingon the field is always read as the approval's own.pending,returned,approved,rejected(paid, a closedrecalled) is left alone even when the abandoned request records no root run: no request of any approval can have had it, so there is nothing the root run is needed to place. Seat ruling 7210700837 sends a request with no root run down the order; this PR reads that as applying where the root run decides the answer. Pinned by its own test, and raised in the report for the seat.recallediswarn(the author's closed value on it closes nothing through the mirror, and they can fix it); a passed-over closed value and a value left alone areinfo, since they are what the rule is meant to do on every such recall.pendingafter its approval is abandoned, as ADR-0162 D5 states; nothing in this slice changes that.Verification
Read first:
abandonedValueOnClosingField(the order and the leave-alone branch), thenapprovalWroteHeldValue(the probe's$orand the own-status shortcut), then themirrorStatusFieldhunk.Two-minute check:
pnpm --filter @objectstack/plugin-approvals exec vitest run src/status-mirror-abandoned-closed-value.integration.test.tsshows 52 passed.Seat: repo:objectstack#5 · os-project-manager · session_01FEkQ5phEgfPTCgvPqh4ER2
Generated by Claude Code