diff --git a/docs/adr/0162-an-object-declares-its-closed-states-the-record-and-its-lines-are-closed-to-change.md b/docs/adr/0162-an-object-declares-its-closed-states-the-record-and-its-lines-are-closed-to-change.md index 8664adec081..7396a76ce26 100644 --- a/docs/adr/0162-an-object-declares-its-closed-states-the-record-and-its-lines-are-closed-to-change.md +++ b/docs/adr/0162-an-object-declares-its-closed-states-the-record-and-its-lines-are-closed-to-change.md @@ -1,6 +1,6 @@ # ADR-0162: An object declares its closed states — in them the record and its master-detail lines are closed to change for every caller, a closed record is not deleted, and one lock read answers for pending approvals and for closed states -**Status**: Proposed — 2026-11-26, written for objectstack#36253 on the maintainer's ruling of 2026-11-22 (ruling record [`7073676422`](https://github.com/objectstack-ai/objectstack/issues/32004#issuecomment-7073676422), item ② = C). `docs/adr/**` is Tier H (Prime Directive #14): this record becomes **Accepted** by an authorized approval or the maintainer's merge of the PR that carries it, and is in force from that merge. **This record declares; it implements nothing** — no schema key, no engine code, no route, no changeset; every mechanism below lands through a build card ([Execution](#execution-after-acceptance)). **Five points go past the ruling's words**; each is marked ▲ where it stands and all five are listed in [Points the ruling does not settle](#points-the-ruling-does-not-settle). The maintainer ruled on four of them on 2026-11-26 (ruling record [`7200732942`](https://github.com/objectstack-ai/objectstack/issues/36253#issuecomment-7200732942)): each stands as written, and item ③ of the same batch is scoped to `readonlyWhen`. A second ruling the same day (ruling record [`7201405662`](https://github.com/objectstack-ai/objectstack/issues/36253#issuecomment-7201405662)) adds one platform rule: an abandoned approval never writes a closed value ([D5](#d5--who-is-bound-every-caller-a-system-context-is-not)). A third ruling the same day (ruling record [`7205949718`](https://github.com/objectstack-ai/objectstack/issues/36253#issuecomment-7205949718)) settles the fifth point, in [D5](#d5--who-is-bound-every-caller-a-system-context-is-not): the platform refuses the configuration that would leave a document reading a decision its approval did not finish. **Revised 2026-11-27** on two further rulings of the maintainer, made that day on the design of [Execution](#execution-after-acceptance) item 8 (ruling record [`7210179412`](https://github.com/objectstack-ai/objectstack/issues/37767#issuecomment-7210179412)): on a field the object closes on at an approval's outcome, each step's decision is written only when the approval is over for the record, and on an object that declares `closedStates` a document is held through every approval ([D5](#d5--who-is-bound-every-caller-a-system-context-is-not)). After the contract review of the revision the seat read both rulings by their words (seat rulings [`7211509661`](https://github.com/objectstack-ai/objectstack/issues/37817#issuecomment-7211509661) and [`7211531658`](https://github.com/objectstack-ai/objectstack/issues/37817#issuecomment-7211531658)). The revision implements nothing either. · **Amended** (2026-11-29, option D on [#37766](https://github.com/objectstack-ai/objectstack/issues/37766), ruling record [`7253749311`](https://github.com/objectstack-ai/objectstack/issues/37766#issuecomment-7253749311), maintainer 「D 统一校验,各入口都拒绝」): where a flow or an object is authored, the conditions an approval opens on are refused at every authoring door, and no longer only reported. One dated note under [D5](#d5--who-is-bound-every-caller-a-system-context-is-not) says how four passages of this record read after that ruling, and marks what in the note is not in the ruling's words. The refusal at the first request stays the rule, and the four passages are left as written. +**Status**: Proposed — 2026-11-26, written for objectstack#36253 on the maintainer's ruling of 2026-11-22 (ruling record [`7073676422`](https://github.com/objectstack-ai/objectstack/issues/32004#issuecomment-7073676422), item ② = C). `docs/adr/**` is Tier H (Prime Directive #14): this record becomes **Accepted** by an authorized approval or the maintainer's merge of the PR that carries it, and is in force from that merge. **This record declares; it implements nothing** — no schema key, no engine code, no route, no changeset; every mechanism below lands through a build card ([Execution](#execution-after-acceptance)). **Five points go past the ruling's words**; each is marked ▲ where it stands and all five are listed in [Points the ruling does not settle](#points-the-ruling-does-not-settle). The maintainer ruled on four of them on 2026-11-26 (ruling record [`7200732942`](https://github.com/objectstack-ai/objectstack/issues/36253#issuecomment-7200732942)): each stands as written, and item ③ of the same batch is scoped to `readonlyWhen`. A second ruling the same day (ruling record [`7201405662`](https://github.com/objectstack-ai/objectstack/issues/36253#issuecomment-7201405662)) adds one platform rule: an abandoned approval never writes a closed value ([D5](#d5--who-is-bound-every-caller-a-system-context-is-not)). A third ruling the same day (ruling record [`7205949718`](https://github.com/objectstack-ai/objectstack/issues/36253#issuecomment-7205949718)) settles the fifth point, in [D5](#d5--who-is-bound-every-caller-a-system-context-is-not): the platform refuses the configuration that would leave a document reading a decision its approval did not finish. **Revised 2026-11-27** on two further rulings of the maintainer, made that day on the design of [Execution](#execution-after-acceptance) item 8 (ruling record [`7210179412`](https://github.com/objectstack-ai/objectstack/issues/37767#issuecomment-7210179412)): on a field the object closes on at an approval's outcome, each step's decision is written only when the approval is over for the record, and on an object that declares `closedStates` a document is held through every approval ([D5](#d5--who-is-bound-every-caller-a-system-context-is-not)). After the contract review of the revision the seat read both rulings by their words (seat rulings [`7211509661`](https://github.com/objectstack-ai/objectstack/issues/37817#issuecomment-7211509661) and [`7211531658`](https://github.com/objectstack-ai/objectstack/issues/37817#issuecomment-7211531658)). The revision implements nothing either. · **Amended** (2026-11-29, option D on [#37766](https://github.com/objectstack-ai/objectstack/issues/37766), ruling record [`7253749311`](https://github.com/objectstack-ai/objectstack/issues/37766#issuecomment-7253749311), maintainer 「D 统一校验,各入口都拒绝」): where a flow or an object is authored, the conditions an approval opens on are refused at every authoring door, and no longer only reported. One dated note under [D5](#d5--who-is-bound-every-caller-a-system-context-is-not) says how four passages of this record read after that ruling, and marks what in the note is not in the ruling's words. The refusal at the first request stays the rule, and the four passages are left as written. · **Revised again** (2026-11-29, on three rulings the maintainer made that day on the build of [Execution](#execution-after-acceptance) item 8, ruling records [`7256254988`](https://github.com/objectstack-ai/objectstack/issues/37767#issuecomment-7256254988) and [`7257388557`](https://github.com/objectstack-ai/objectstack/issues/37767#issuecomment-7257388557), 「审批插件自己记下结论」, 「一小时后退回重提并通知」 and 「满一小时后结果通知一起写」): the approvals plugin keeps on the approval's own rows what it read of the approval's runs, and past an age bound a run that can no longer be read, or that never went on from the last decision, has stopped at the step last decided. Within the bound nothing is written for such a run, at the approval's last step as at every other. The revision was completed on 2026-11-30, when the build of item 8 had been reviewed. It adds one ruling of that day (ruling record [`7268216330`](https://github.com/objectstack-ai/objectstack/issues/37767#issuecomment-7268216330), 「A 维持现状,只写进文档」), by which a step log that has lost whole steps is read as it was kept, and the seat's readings that the build was reviewed on, each named as the seat's where it stands: which runs with no row are placed, two more states that are read as a run that cannot be read, and that a run is read as stopped only once two judgements in a row read it so, which makes the hour an hour and one pass of the reconciler more where no judgement read the approval within it. The reconciler's part of item 8, one passage of [D5](#d5--who-is-bound-every-caller-a-system-context-is-not) and one sentence of [Consequences](#consequences) are revised where they stand, and nothing else is. One sentence of item 8 was false and is replaced: a process that dies while it advances a run leaves no row of that run behind, and not a history that says paused. - **Date**: 2026-11-26 - **Card**: [#36253](https://github.com/objectstack-ai/objectstack/issues/36253) (p2, `area:data`). Its rule, as the card carries it: @@ -202,7 +202,7 @@ The rule concerns a mirror field on which the object closes on `approved` or on A document under an approval of three steps therefore reads `pending` from its submission until the last step is decided and the flow behind that decision has run, and then reads `approved`, and is closed where the object closes on that value. On `main` it reads `approved` after each step. Where its second step rejects it, it reads `pending` until the flow behind the rejection has run, and then `rejected`. -**How the plugin learns that an approval is over.** At the decision it cannot know whether another step follows, which is why this record first turned the rule down. After it has resumed the run it can find out: it reads the run that carries the record, and asks its own table for a request of the approval on the record. It does so at every door that resumes or cancels a run of an approval: a decision, by a person or by the platform's own clock, a send-back, a resubmission, a recall, and the continuation of a restored run. It does not take the resume's own answer for it. That answer is for the request's own run. A child run that completes resumes its parent inside the same call, and the door is told of the parent's failure only where the parent's resume answered `stranded`; a parent that was cancelled, a store that could not be read and a resume that another process holds each end in a line of the log (`packages/services/service-automation/src/engine.ts#bubbleToParent`). Where the door cannot tell, because another process is advancing the run or the run cannot be read, it writes nothing. A decision leaves a mark on its request, a field the store can filter on, and a reconciler judges every marked request the door did not: after a process that died, after a run that was cancelled, after a parent run that is gone. The mark says that what follows the decision has not been judged yet. Every decision of an approval on an object that declares `closedStates` leaves it, also where the decision is written at once, because the hold, below, is read off it. [Execution](#execution-after-acceptance) item 8 has the means. The reconciler is what ends an approval that nobody is at the door for, so an approval on an object that declares `closedStates` opens only on a host that runs one, below. +**How the plugin learns that an approval is over.** At the decision it cannot know whether another step follows, which is why this record first turned the rule down. After it has resumed the run it can find out: it reads the run that carries the record, and asks its own table for a request of the approval on the record. It does so at every door that resumes or cancels a run of an approval: a decision, by a person or by the platform's own clock, a send-back, a resubmission, a recall, and the continuation of a restored run. It does not take the resume's own answer for it. That answer is for the request's own run. A child run that completes resumes its parent inside the same call, and the door is told of the parent's failure only where the parent's resume answered `stranded`; a parent that was cancelled, a store that could not be read and a resume that another process holds each end in a line of the log (`packages/services/service-automation/src/engine.ts#bubbleToParent`). Where the door cannot tell, because another process is advancing the run or the run cannot be read, it writes nothing. A decision leaves a mark on its request, a field the store can filter on, and a reconciler judges every marked request the door did not: after a process that died, after a run that was cancelled, after a parent run that is gone, after a run whose history is gone or does not name every run it started, after a decision whose run never went on, and after a tree of more runs than it can read in full. For a run it can no longer follow, three rulings of 2026-11-29 give the rule. The first two are in ruling record [`7256254988`](https://github.com/objectstack-ai/objectstack/issues/37767#issuecomment-7256254988). The maintainer chose on two decision cards, verbatim and untranslated. On 「审批的流程运行记录被清理或读不到时,单据怎么判?」, how a document is judged when the run records of its approval were cleaned up or cannot be read: 「审批插件自己记下结论」, the approvals plugin records the conclusion itself. On 「决定已记下但流程没接着走(服务中断),单据怎么处理?」, what becomes of a document whose decision is recorded while its flow did not go on, in an outage: 「一小时后退回重提并通知」, after one hour it is put back to be submitted again, and a notice is sent. As the ruling record states them: the plugin keeps what it read. At each door, and as each request opens, it records on the approval's own rows what the runs it could read showed, which is whether the approval has, so far, a failure between two steps that no later request answered. A later judgement does not read those runs again, so a history that was trimmed and a process that died do not leave a document on `pending`. A run the plugin never read is placed by the step last decided, and that placement and the second ruling are one rule: past an age bound, with no request of the approval open on the record, a run that cannot be read, or that is still parked at the node of the request last decided, has stopped at that step. Where a step can follow the step it stopped at, the approval ended between two steps and is abandoned, as the bullet on a run that ends between two steps has it, below, and a run that is still parked is cancelled. Where none can, the approval has finished, and where the run never went on from that last decision the administrators are told. The third ruling is in ruling record [`7257388557`](https://github.com/objectstack-ai/objectstack/issues/37767#issuecomment-7257388557), and it settles what the first two leave open at the approval's last step: when the outcome is written, and whether the administrators are told where the run cannot be read. The maintainer chose on one decision card, verbatim and untranslated. On 「最后一步已批准但流程没接着走时,审批结果什么时候写到单据上?」, when the outcome of the approval is written to the document where the last step was approved and the flow did not go on: 「满一小时后结果通知一起写」, once the full hour has passed the outcome and the notice are written together. As that record states it: nothing is written for such a run within the bound, at the last step as at every other. Once the bound has passed, the outcome and the administrators' notice are written in one stroke, and the notice also covers a last step whose run has no row. It is one rule, with no special case for the last step. For this record that means: a run that has not left the node of a decided request has not gone on from the decision, and within the bound it is not read as parked at a pause that no step can follow, above. Four things stand beside the three rulings, and [Execution](#execution-after-acceptance) item 8 carries each where it applies. One is a ruling of 2026-11-30, in ruling record [`7268216330`](https://github.com/objectstack-ai/objectstack/issues/37767#issuecomment-7268216330). The maintainer chose, verbatim and untranslated, 「A 维持现状,只写进文档」, A, keep what is built and only write it into the documentation: a step log that has lost whole steps carries no mark of it, the plugin reads what the log kept, and that is a stated limit of this release. The other three are the seat's, and none is a ruling. The seat reads "a run the plugin never read", in the first ruling, as a run that no run the plugin read speaks for: a run with no row counts as passed where a run the plugin read went on past the step that names it, and going on along a failure route is not going on past the step (seat reading [`7257555103`](https://github.com/objectstack-ai/objectstack/issues/37767#issuecomment-7257555103), which ruling record [`7257604888`](https://github.com/objectstack-ai/objectstack/issues/37767#issuecomment-7257604888) lists for the rebuild). The seat reads as runs that cannot be read a run whose step log does not name every child run it started (seat ruling [`7258590209`](https://github.com/objectstack-ai/objectstack/issues/37767#issuecomment-7258590209)) and a tree of more runs than the judgements can read in full (the seat's note [`7269166540`](https://github.com/objectstack-ai/objectstack/pull/38634#issuecomment-7269166540) on the review of item 8's build). And the seat has a run read as stopped, past the bound, only once two judgements in a row read it in the same state, because the hour runs from the mark and a run that is being resumed reads as a run that stopped does (the same note, on a finding of review [`7269135624`](https://github.com/objectstack-ai/objectstack/pull/38634#issuecomment-7269135624)). The order changes when an end the rulings give comes, and not which end it is. The option the maintainer chose in the third ruling read 「一条规则、不分最后一步;这种少见情况单据最多显示审批中一小时,之后结果和管理员通知一起落。读不到运行记录的最后一步也通知。」: one rule, with no special case for the last step; in this rare case the document shows in approval for at most one hour, and after it the outcome and the administrators' notice land together; a last step whose run records cannot be read is notified as well. The hour holds wherever a judgement read the approval's state within it. Where none did, it is the hour and one pass of the reconciler more, which is one sweep interval, five minutes by default, and more only in the cases item 8 names. That holds for every marked approval, one that holds a decision back included, and nothing is written early. The reading is the seat's and asks no new ruling (seat note [`7270603869`](https://github.com/objectstack-ai/objectstack/issues/37767#issuecomment-7270603869), whose third line the seat's correction [`7272498941`](https://github.com/objectstack-ai/objectstack/issues/37767#issuecomment-7272498941) replaces: the note first gave the pass more only to approvals that hold nothing back). The mark says that what follows the decision has not been judged yet. Every decision of an approval on an object that declares `closedStates` leaves it, also where the decision is written at once, because the hold, below, is read off it. [Execution](#execution-after-acceptance) item 8 has the means. The reconciler is what ends an approval that nobody is at the door for, so an approval on an object that declares `closedStates` opens only on a host that runs one, below. **On an object that declares `closedStates`, a document under approval is held for the whole of the approval.** Ruled 2026-11-27 at 04:50Z (the same ruling record): 「随新能力一起全程锁」, locked the whole way, and shipped with the new capability. The ruling record states the rule: 「只对声明了 `closedStates` 的对象,从提交到审批结束都锁住,随键一起发布。」, only on objects that declare `closedStates`: held from the submission to the end of the approval, and shipped with the key. The option the maintainer read says 「只对声明了关闭状态的对象,从提交到审批结束别人都改不了」: only on objects that declare closed states, from the submission to the end of the approval nobody else can change the document. The seat reads those words as they stand (seat ruling [`7211509661`](https://github.com/objectstack-ai/objectstack/issues/37817#issuecomment-7211509661)), and the hold below is that reading. @@ -420,7 +420,7 @@ Nothing below starts before this record is Accepted. The seat files the cards; t 8. **The status mirror on a closing field: the outcome when the approval is over, an approval that does not finish, and the hold.** The child card the recommendations adopted on 2026-11-26 give the mirror's failed write ([`7202242844`](https://github.com/objectstack-ai/objectstack/issues/36253#issuecomment-7202242844)), filed as [#37767](https://github.com/objectstack-ai/objectstack/issues/37767). When this record was merged, [D5](#d5--who-is-bound-every-caller-a-system-context-is-not) fixed what the card delivers and left it the means: on a field the object closes on, nothing leaves a record closed on a value its own approval wrote and did not finish. The card's design note set the means out, the maintainer ruled its two questions on 2026-11-27, and the seat ruled the rest (ruling record [`7210179412`](https://github.com/objectstack-ai/objectstack/issues/37767#issuecomment-7210179412)). [D5](#d5--who-is-bound-every-caller-a-system-context-is-not) now states the rules, and the parts below are their scope. The parts on a refused write and on the outcome are kept to an approval the conditions concern. The mark, the reconciler and the hold reach every approval on an object that declares `closedStates` (seat ruling [`7211531658`](https://github.com/objectstack-ai/objectstack/issues/37817#issuecomment-7211531658)). An object that declares no closed value behaves as it does today. Item 1 waits for all of them, the hold included: the key is not released before this item is built. The seat files it as one card or as several. - **No refused write is swallowed.** On a field the object closes on at `approved` or `rejected`, a write of the mirror that a rule or a hook of the app refuses, or a `visibleWhen` on an option, is reported: an `error` line in the log, a line with no actor on the request's timeline, and a notice to the organization's administrators. A refused `pending` at an approval's first request refuses the opening. The request's row is written first and the `pending` second, and on a refusal the row is voided as `cancelled`; the other order could leave a decided document on `pending` with no request. Its tests pin, for each transition of a request, the value the field keeps when the write is refused. - **The outcome when the approval is over.** On a field the object closes on at `approved` or `rejected`, every step's decision is held back, whichever of the two the object closes on. A decided request carries a mark: one new field of the request, which the store can filter on, set in the update that records the decision and cleared when the approval has been judged (`Clause-②: yes`). The mark is set at every decision of an approval on an object that declares `closedStates`, also where nothing is held back, because the hold is read off it. After every resume, and after the resume or the cancel a recall makes, the door reads the run that carries the record and asks its own table for a request of the approval on the record. It has four answers. Finished: it writes the decision of the approval's latest request on the record, where that request was decided. In progress: it writes nothing. Ended between two steps: it abandons the approval as [D5](#d5--who-is-bound-every-caller-a-system-context-is-not) says, puts the field back by item 7's order, marks the approval abandoned on the request, and leaves a line with no actor. Cannot tell yet, for a run another process is advancing or one it cannot read: it writes nothing and leaves the mark. In an approval that holds nothing back, the first and the third answer both end the hold: the mark is cleared and nothing is written. The door places a stop or a pause against the set item 7 stamps. It reads the run's step log for a failure the flow routed, and keeps a durable note on the approval's latest request where a later step could not open, so that the judgement does not depend on how that failure was routed. The door that continues a restored run refuses an approval marked abandoned, and tells the operator to cancel the restored run. A recall, an override and the dead-run sweep clear the mark on the approval's earlier requests. Its tests include: a first step approved, a second recalled, and a run that then completes, after which no `approved` is written; the same for a returned request that is recalled in its revise window; 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, in each of which the field keeps `pending` until the approval is over; a `wait` after the last step, where the outcome is written as the run parks; a node that fails after the last step, where the outcome stands; an item of a `map` that is a record, whose outcome does not wait for the later items and is not undone by a later item's failure; a next step that fails to open, on an empty slate and on a request of another approval already pending on the record, where the field keeps that approval's `pending`; a later step that fails to open with a `fault` edge to an end, which is abandoned, and with a `fault` edge to a second step that opens, which is in progress; another node that fails between two steps with a `fault` edge to an end, which is abandoned; and that node's failure handled in a `try_catch` region, after which a gateway ends the flow, which is finished. - - **The reconciler.** For an approval on an object that declares `closedStates` it takes the place of the reader of stranded requests (`packages/plugins/plugin-approvals/src/approval-service.ts#inspectStrandedRequests`). It scans the mark, oldest first, so that its scan is bounded, and judges each marked request as the door would have. It places three states that reader skips today: a cancelled run; a run whose history says paused while its pause is gone, which a process that died in a passage leaves for good; and a run still parked at a `subflow` or a `map` whose child has ended, which nothing will resume. The last two need an age bound, which the build chooses and states. It writes in the name of the request's recorded decider, as the door would have: a write with no actor would leave a flow that reacts to the change, and runs as the user, without an identity. It tries a refused outcome or put-back again while the mark stands, and sends the administrators' notice. Where nothing was held back it clears the mark and writes nothing. For a record that was deleted it clears the mark and writes nothing, and it neither tries again nor notifies. On a host with no `job` service the first request of every approval on an object that declares `closedStates` is refused, with an error that says what is missing, also where the approval's field closes on nothing. Its tests include a parent run that is cancelled while its child's request is pending; a process that dies between a decision and the write of its outcome; an approval whose field the object does not close on, whose hold the reconciler ends; a host with no `job` service, on which such an approval is refused as well; and a record deleted in a passage, whose mark is cleared once. + - **The reconciler.** For an approval on an object that declares `closedStates` it takes the place of the reader of stranded requests (`packages/plugins/plugin-approvals/src/approval-service.ts#inspectStrandedRequests`). It scans the mark, oldest first, so that its scan is bounded, and judges each marked request as the door would have. It places seven states. That reader places none of them: it reports a run that has no row and changes nothing, and it passes over a run that was cancelled or is paused. The seven are a cancelled run; a run whose history says paused while its pause is gone; a run that has no row at all, where no run the plugin read speaks for it; a run still parked at a `subflow` or a `map` on a child run that will not resume it; a run still parked at the node of the request last decided, whose decision is recorded and which never went on; a run whose step log is cut, so that it does not name every child run the run started; and a tree of more runs than the judgements can read in full. The list was revised on 2026-11-29, on the maintainer's three rulings of that day (ruling records [`7256254988`](https://github.com/objectstack-ai/objectstack/issues/37767#issuecomment-7256254988) and [`7257388557`](https://github.com/objectstack-ai/objectstack/issues/37767#issuecomment-7257388557), stated in [D5](#d5--who-is-bound-every-caller-a-system-context-is-not)). It had three states, the first, the second and the fourth, and it said of the second that a process that died in a passage leaves it for good. That is not so. A resume takes the pause away before it runs anything behind it (`packages/services/service-automation/src/run-resume.ts#resumeInternal`), and the history keeps a lasting row only for a run that has ended (`packages/services/service-automation/src/run-history.ts#recordLog`). Only a process whose own memory still holds the run's paused entry reads the second state. After a restart, and in a process that never held the run, a run that a process died advancing has no row at all (`#getRun`), which is the third state, and a run that ended is in it too once the history has trimmed its row (`packages/services/service-automation/src/suspended-run-store.ts#DEFAULT_MAX_TERMINAL_RUNS_PER_FLOW`). Both were read on the trunk at `37e97a8366`. The sixth and the seventh state were added on 2026-11-30, when the build of this item had been reviewed, with the readings of the other states that follow. Each is given to the record it comes from, and those that are the seat's are not rulings. A run with no row is in the third state only where no run the plugin read speaks for it. Where a run the plugin read went on past the step that names such a run, the run counts as passed at that step and is not placed: it is kept as ended, and the approval is judged by its other runs, at the door or within the bound, with no notice. A run went on past a step where the step succeeded and the run then reached an end of its flow, or logged a later step and is not parked at that step. A step that failed is never passed, also where the flow routed its failure and went on. A run whose step log is cut speaks for no run, and a run the plugin had read to its end over a child run it had not read is not passed once its own row is gone, because nothing names that child any more. That a run the plugin read speaks for the child runs it went on past is the seat's reading of the first ruling, and not a ruling (seat reading [`7257555103`](https://github.com/objectstack-ai/objectstack/issues/37767#issuecomment-7257555103), its second point), and that going on along a failure route is not going on past the step is the pin with which ruling record [`7257604888`](https://github.com/objectstack-ai/objectstack/issues/37767#issuecomment-7257604888) lists the reading for the rebuild. What going on past a step means in a run's log, and the two bounds on a cut log and on a run whose own row is gone, are the build's, and each narrows the reading toward the ruling's own rule. [D5](#d5--who-is-bound-every-caller-a-system-context-is-not) keeps the ruling record's sentence on a run the plugin never read, and the reading says which runs those are. The fourth state is a run parked on a child run that has ended, that has no row, or that has itself stopped in the second or the fourth state. It covers a `map` whose items are records. An item run of such a `map` carries another record, and its steps are that record's own approval, so the plugin reads none of them: it reads only whether the item run has ended, which it has once it is in a terminal status. [D5](#d5--who-is-bound-every-caller-a-system-context-is-not) leaves no `map` with an approval step in its body in an approval the conditions concern, unless none of its items is a record, and no other pause between two steps of one. So a run parked at a `map` on an item run that carries another record belongs to an approval that holds nothing back. The sixth state is a run whose step log is cut. Two logs are read so. One has a step that carries the engine's mark `childRunIdsTruncated`: the step started more child runs than the 200 a step names, or the history row shed the step's list to fit its size. The other is the log of a run that has ended whose history row cannot be shown to keep every step the run logged: it keeps fewer than the run's summary counts, or the summary gives nothing to compare. The child runs such a log does name are still read, and it speaks for none of them. The seat ruled the state (seat ruling [`7258590209`](https://github.com/objectstack-ai/objectstack/issues/37767#issuecomment-7258590209)): within the bound the plugin cannot tell, and past it the approval is placed by the step last decided, with the notice at a last step. One limit stands beside it, by the maintainer's ruling of 2026-11-30 (ruling record [`7268216330`](https://github.com/objectstack-ai/objectstack/issues/37767#issuecomment-7268216330), stated in [D5](#d5--who-is-bound-every-caller-a-system-context-is-not)): a log that loses whole steps carries no mark. The engine keeps 200 steps of a longer log, and nothing tells the plugin which steps that compaction dropped, so it reads what the log kept, and a child run named only by a dropped step reads as one the run went past. A failure between two steps in such a child run is then not seen, and the approval can be written as finished with no notice. That is a stated limit of this release, and no engine change follows from the ruling. A history row that was halved over its size cap, or stored as null, is still told from the run's summary and is read as cut (the seat's line on that ruling, in its note [`7269166540`](https://github.com/objectstack-ai/objectstack/pull/38634#issuecomment-7269166540) on the review of the build). The seventh state is a tree of more runs than the judgements can read in full. One judgement reads at most 200 runs beside those the plugin keeps as read to their end, and the next judgement reads on from what was kept. Within the bound the plugin cannot tell of a tree it has not read to its end. Past the bound a judgement reads on only while it keeps a run the approval had not kept, and the kept list holds 200 runs, so at most 200 judgements read on. The one that keeps no further run cannot finish the tree, and the approval is placed by the step last decided, as one whose run the plugin never read. The seat accepted that rule with its two costs (the same note, under seat ruling `7258590209`). A tree the judgements cannot finish is placed without having been read in full, and a tree of about 399 runs can already be one, because a judgement reads the runs it starts from before the runs below them. And the placement follows from the shape of the flow, so an approval submitted again on the same flow can meet the same end. The last six states need an age bound. The build chooses it and states it, and it chose one hour from the mark, the hour the maintainer's choices name: every mark the approval carries has stood that long. Within the bound the reconciler writes nothing for them and leaves the mark, as the door does, because the run may still be going on in another process. That holds at the approval's last step as at every other, which the third ruling settles. The read tells a run with no row from a store that did not answer, and where the store did not answer nothing is written at any age. Past the bound, with no request of the approval open on the record, each of the six is read as a run that has stopped once two judgements in a row have read it in the same state: the same state of the same run, and for a run parked on a child run, the same child. One reading does not show it. The hour is counted from the mark and not from the run's last movement. A run the engine is resuming reads as the second state or as the third, for the reason given above, and a run whose child run has just ended reads as the fourth until the engine resumes it. An approval whose flow waits between two steps for longer than the hour, as its author meant it to, would be read as stopped in the first instant of its next resume. The state a resume leaves is gone when the resume is done, and the state a dead process left reads the same again. So every judgement keeps the states it read on the approval's own rows, in place of those kept before, a door's judgement and one within the bound included; a door that leaves a request open keeps none, because a run parked at the step of an open request has not stopped; and the judgement that reads a state for the first time writes nothing on the record. This is the seat's order on the review of the build, and not a ruling (review [`7269135624`](https://github.com/objectstack-ai/objectstack/pull/38634#issuecomment-7269135624) raised it, the seat's note [`7269166540`](https://github.com/objectstack-ai/objectstack/pull/38634#issuecomment-7269166540) ordered it, and review [`7270552441`](https://github.com/objectstack-ai/objectstack/pull/38634#issuecomment-7270552441) read it as built). Only an approval that holds nothing back can wait so: [D5](#d5--who-is-bound-every-caller-a-system-context-is-not)'s condition that no flow of the approval pauses between two steps refuses a `wait`, a `map` over records that are approved one by one, and a child run that pauses there, in every approval the conditions concern. A placement in an approval that holds nothing back ends the hold and writes nothing. What the rule leaves is two judgements in a row that each fall inside a resume of the same run, one resume or two, and that is the engine's to end, by reporting a run it is advancing (card [#38708](https://github.com/objectstack-ai/objectstack/issues/38708)). A reading that could not be kept leaves on the request the reading kept before it, and the next judgement stands on that one; where none was kept nothing is placed, so an approval whose reading is never kept is held with no end, as one whose store does not answer is. The hour of the maintainer's choices therefore holds wherever a judgement, a door's or the reconciler's, read the state within it: the first pass after the hour places the run. Where none did, that pass reads the state and keeps it, and the pass after it places the run, which is one pass of the reconciler more. A pass comes once in each sweep interval, which is five minutes by default (`packages/plugins/plugin-approvals/src/approval-service.ts#ESCALATION_SCAN_INTERVAL_MS`), and where more requests are marked than one pass reads, the oldest marks are still read on every pass and the others once in each turn of the scan. A reading ends at a run that reports paused with its pause gone and keeps only what it read by then, so each run of a tree in the second state can cost a pass more; the other states of a tree are read in one reading, kept together, and stand together. The seventh state takes the passes that read on. The seat states this against the option text of the third ruling, which named one hour and which [D5](#d5--who-is-bound-every-caller-a-system-context-is-not) quotes, and asks no new ruling (seat note [`7270603869`](https://github.com/objectstack-ai/objectstack/issues/37767#issuecomment-7270603869), with the seat's correction [`7272498941`](https://github.com/objectstack-ai/objectstack/issues/37767#issuecomment-7272498941) of its third line: the pass more can fall on any marked approval, one that holds a decision back included). The second has stopped where its own log ends, and the fourth where it is parked, as before. The other four are placed by the one rule of the rulings, at the step last decided: the third and the fifth as the rulings state it, and the sixth and the seventh as runs that cannot be read, by the seat's ruling and acceptance above. Whether a step can follow the step last decided is asked in the request's own flow: the flow of the run still parked at that step, and otherwise the flow the request records. Where the set of nodes the request carries ([D5](#d5--who-is-bound-every-caller-a-system-context-is-not)) names that flow, a node of another flow of the approval that carries the step's id does not answer for it. Where the set names no such flow, or the request records none, the id alone decides, which can only cost a resubmission. What came before that step the reconciler does not read again, because the plugin keeps it: at each door, also one that leaves a request open (the first point of the seat's reading), and as each request opens, it records on the approval's own rows whether the approval has, so far, a failure between two steps that no later request answered. It keeps there, too, which runs it has read to their end, so that a judgement reads on from the one before it. Where a step can follow the step last decided, the approval ended between two steps and is abandoned as [D5](#d5--who-is-bound-every-caller-a-system-context-is-not) says. Where the approval holds a decision back, the run still parked in the fifth state is then cancelled, and with it every run above it that waits on it, up to the run that carries the record, through a `map` as through a `subflow`, so that nothing resumes the approval on a record that was put back. A `map` in that chain has items that are not records, so its items are steps of this one approval, and the batch is cancelled with its item and does not go on to the next. The cancel is not tried again once the put-back has landed: where it fails, the run stays parked, the approval stays abandoned, and the door that continues a restored run refuses it, as [D5](#d5--who-is-bound-every-caller-a-system-context-is-not) has it. Where the approval holds nothing back, nothing is written, told or cancelled: the mark is cleared and the run stays parked. Where none can, the approval has finished: its outcome is written and the administrators are told in one stroke, in the third state as in the fifth, as the third ruling has it, and in the sixth and the seventh as well. The notice goes only on the pass whose write of the outcome landed: a refused write sends no such notice, and the pass on which the write lands sends it. It goes out on the topic `approval.flow_not_continued` and says that the flow could not be seen through to its end after its last step, because the flow's nodes behind that last decision did not run, or cannot be shown to have run. In the sixth and the seventh state the flow may have gone on where the plugin could not read it, so the notice asks for a check and states no failure. In the fifth state the pause is left, so that an operator can still continue the run (`packages/plugins/plugin-approvals/src/approval-service.ts#continueRestoredRun`). It writes in the name of the request's recorded decider, as the door would have: a write with no actor would leave a flow that reacts to the change, and runs as the user, without an identity. It tries a refused outcome or put-back again while the mark stands, and sends the administrators' notice. Where nothing was held back it clears the mark and writes nothing: no outcome, no put-back, no notice and no cancel, also where it placed a run, and a line in the log says what it concluded. For a record that was deleted it clears the mark and writes nothing, and it neither tries again nor notifies. On a host with no `job` service the first request of every approval on an object that declares `closedStates` is refused, with an error that says what is missing, also where the approval's field closes on nothing. Its tests include a parent run that is cancelled while its child's request is pending; a process that dies between a decision and the write of its outcome; a run that has no row, past the bound, where a step can follow the step last decided, which is abandoned, and where none can, whose outcome is written and whose administrators are told; a run that has no row under a run that went on past its step, which is passed, so that the approval finishes at the door and nobody is told, and the same under a run that went on along a failure route, which is held and then placed; a decision whose run never went on, before the last step, where the approval is abandoned and the parked run cancelled, with the batch above it where it is an item run of a `map` whose items are not records, and at the last step, where the outcome is written once the bound has passed, the administrators are told and the pause is left; a step that started more child runs than it names, which is held to the bound and then placed; a tree of more runs than the judgements can read in full, which is placed once a judgement keeps no further run; a run parked at a `map` whose items are records, on an item run that has ended and on one that has not; a run the engine is resuming past the bound, which is not placed, and a state that two judgements in a row read, which is; a judgement whose reading cannot be kept, which places nothing; a step last decided whose id a node of another flow carries; an approval that holds nothing back in which a run is placed, where nothing is written, told or cancelled; an approval whose field the object does not close on, whose hold the reconciler ends; a host with no `job` service, on which such an approval is refused as well; and a record deleted in a passage, whose mark is cleared once. - **The hold.** On an object that declares `closedStates` the pending lock's reads honour the mark, so that the record and its lines are held through every passage of every approval, with the passes and the limits [D5](#d5--who-is-bound-every-caller-a-system-context-is-not) gives: the revise window, a caller's delete of the record, a system context, a write that carries only the mirror field, and the approval's own runs, known by their root run. In a passage those reads do not ask the node's `lockRecord`. The one lock read of item 2 answers `approval` in a passage. The approvals-family read is not touched and answers as published. This part settles two things the design note left open. The first is how the lock reads a writer's root run, and with it which indirect writes carry a run of the approval: a hook of the app that writes back to the record, and a cascade from another object. One that carries none is refused, and the build pins each case. The second is how the approval of a record that is deleted in a passage ends, where `main` cancels a pending request and no other (`packages/plugins/plugin-approvals/src/approval-service.ts#cancelForDeletedRecord`): the approval is marked abandoned, its marks are cleared and nothing is written, so that no mark of a deleted record stands for good and the reconciler has nothing to try again or to notify for. Its tests include a caller's write between two steps and after the last decision, each of which is refused; the same on an approval whose field the object does not close on, and on an object that closes only on values of its own; a write by a node of a parent run after its child's step is decided, which lands; a line write in a passage; a node that declares `lockRecord: false`, under which a caller's write lands while its request is pending and is refused after its decision; a revise window that follows an earlier step's decision, which is open to every caller who may edit; a caller's delete in a passage, which lands and ends the approval; a hook's write-back and a cascade in a passage, each with the approval's run and without it; the approvals-family read in a passage, which answers as on `main`; an approval that opened before the object declared the key, which is not held; and a process that dies in a passage, after which the reconciler ends the hold. - **The docs.** The approvals guide says what an author and an administrator see in each case: that the document reads `pending` until its approval is over; that a flow which fires on `approved` fires once on such an object, when the approval is over; that a node after a decision reads `pending`; what a refused write and an abandoned approval look like on the request; that on an object that declares `closedStates` every approval holds the document between its steps, whatever its field and whatever a node's `lockRecord` says, and that a pause there holds it for as long as it lasts; that a client which asks only the approvals-family lock read is not told of that hold; and that every approval on such an object needs a host with a `job` service. @@ -556,7 +556,7 @@ Left open on purpose, each a later decision if it is ever wanted: - An approval on an object that closes on `approved` or `rejected` is refused when it opens until five things hold: `pending` is declared and open and `returned` is open, a `state_machine` rule on the field lets the closed outcome move to `pending`, the field carries no `readonlyWhen` and its options for a request's statuses no `visibleWhen`, every step that can act on the object names the one field, and no flow pauses between two steps. An object that closes on `pending` or on `returned` runs no approval onto that field, and an approval the platform cannot read whole is refused ([D5](#d5--who-is-bound-every-caller-a-system-context-is-not)). - Every approval on an object that declares `closedStates` needs a host that runs a `job` service, also one whose field closes on nothing (seat ruling [`7211531658`](https://github.com/objectstack-ai/objectstack/issues/37817#issuecomment-7211531658)). With none, nothing would end an approval, or its hold, that nobody is at the door for, and the approval is refused when it opens. An object that runs approvals on a host without that service cannot declare the key until the host has one. - A fault between two approval steps costs a resubmission, and every step already decided is decided again: a fault at step four of five costs four approvals. The platform abandons the approval at once and does not wait for an administrator ([D5](#d5--who-is-bound-every-caller-a-system-context-is-not)). -- A document reads `pending` for longer than it does on `main`. Its outcome waits for the flow behind the last decision, and, where the door cannot tell that the run has ended, for the reconciler's next pass. One status mirror has two timings: on a field the object closes on at `approved` or `rejected` every decision waits for the end of its approval, and every other status is written at once. That includes a decision the object does not close on. Where an object closes on `rejected` alone, an approved step shows only when the approval is over, and a view or a flow that reads the field between two steps reads `pending`. +- A document reads `pending` for longer than it does on `main`. Its outcome waits for the flow behind the last decision, and, where the door cannot tell that the run has ended, for the reconciler: for its next pass where the run can then be read, and, in the six states [Execution](#execution-after-acceptance) item 8 holds to its age bound, for that bound, which is an hour from the mark, and for one pass more where no judgement read the approval's state within that hour. What ends the wait there is the outcome, or the put-back where the approval ended between two steps. One status mirror has two timings: on a field the object closes on at `approved` or `rejected` every decision waits for the end of its approval, and every other status is written at once. That includes a decision the object does not close on. Where an object closes on `rejected` alone, an approved step shows only when the approval is over, and a view or a flow that reads the field between two steps reads `pending`. - A caller who can edit a document between two approval steps on `main` cannot on an object that declares `closedStates`: the hold keeps it, in every approval on the object, whether or not the approval closes anything and whatever its nodes' `lockRecord` says. An author who declares a closed value of the object's own, `paid`, changes how an approval that has nothing to do with that value behaves between its steps. A node that follows the last step after a pause, in a flow that runs as the user, meets a closed document. - A pause between two steps of an approval the conditions do not concern holds its document for as long as the pause lasts, where on `main` the document is open through it. Nobody is asked meanwhile, and the way to end it sooner is to cancel the run. - The request gains one field, the mark, and the approvals plugin gains a reconciler that correctness depends on, where `main` has a report. Every approval on an object that declares `closedStates` carries the mark at each decision and is reconciled, also one that holds nothing back.