Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
11ee69a
feat(spec): closedStates key on the object with its authoring refusal…
claude Nov 28, 2026
1e9782f
feat(spec): closedStates form row, liveness row, FLS classification a…
claude Nov 28, 2026
b7893db
feat(platform-objects): closedStates form row translated in every loc…
claude Nov 28, 2026
649f344
chore(platform-objects): regenerate the en metadata-forms bundle for …
claude Nov 29, 2026
31da54b
test(spec): the composeStacks collection-refusal pins carry closedSta…
claude Nov 29, 2026
5d8b45b
test(metadata-protocol): the object type serves one more top-level pr…
claude Nov 29, 2026
cfde547
test(approvals): pin what a multi-step approval that does not finish …
claude Nov 29, 2026
2953b1b
fix(approvals): a refused status-mirror write on a field the object c…
claude Nov 29, 2026
bda8482
chore(approvals): regenerate the tenant-audit census and the engine-d…
claude Nov 29, 2026
0c234ab
feat(objectql): a record in a closed state, and its lines, are closed…
claude Nov 29, 2026
2cca4a6
feat(objectql): the registry fold keeps a package's closedStates hone…
claude Nov 29, 2026
1f399d9
chore(spec): closedStates is live; RECORD_LOCKED is registered for ob…
claude Nov 29, 2026
d34e153
Merge commit 'refs/os37767/trunk' into claude/project-thread-75nte3
claude Nov 29, 2026
a0d9493
docs(permissions): the closed-state lock is a system-context behaviou…
claude Nov 29, 2026
8e95b36
fix(objectql): the closed-state lock asks the store whether a record …
claude Nov 29, 2026
bfe2df8
Merge the approval status-mirror slice into the closed-state trunk (A…
claude Nov 29, 2026
cc6d5f6
wip(approvals): an abandoned request never writes a closed value on i…
claude Nov 29, 2026
6e9bed5
test(approvals): the status mirror on an abandoned request, across it…
claude Nov 29, 2026
3e7932c
chore(changeset): an abandoned approval never writes a closed value o…
claude Nov 29, 2026
a0ddf0c
test(approvals): pin the hidden required-when-shown arm and a value n…
claude Nov 29, 2026
07f0923
Merge the abandoned-request status-mirror slice into the closed-state…
claude Nov 29, 2026
1a9fee5
feat(approvals): the check when an approval opens, and the between-tw…
claude Nov 29, 2026
5dbc4f4
Merge branch 'claude/o5-data-approvals-trunk' of https://github.com/o…
claude Nov 29, 2026
c84dfff
test(approvals): the abandoned-mirror arms meet the opening check; th…
claude Nov 29, 2026
a075079
chore(changeset): the opening check's release text matches the tree
claude Nov 29, 2026
4cc09b1
Merge the approval opening-check slice into the closed-state trunk (A…
claude Nov 29, 2026
8749c18
wip(approvals): hold a closing field's decision until the approval is…
claude Nov 29, 2026
9cd8adc
test(approvals): the outcome when the approval is over, case by case;…
claude Nov 29, 2026
47f4286
fix(approvals): the door also reads the latest request's own run, for…
claude Nov 29, 2026
1ada3a4
fix(approvals): say the object closes on its approval field only wher…
claude Nov 29, 2026
cf61012
test(approvals): name the test that holds every locale to the same id…
claude Nov 29, 2026
2668361
fix(approvals): the opening refusal's log line says the object closes…
claude Nov 29, 2026
a5d0d15
test(approvals): the held-back decision and the advancing run each ha…
claude Nov 29, 2026
a3b666c
fix(approvals): where a run stopped is its last top-level step, and a…
claude Nov 29, 2026
aae6cb0
docs(approvals): approvals on an object that declares closedStates
claude Nov 29, 2026
d313098
Merge the opening refusal's closedStates lead into the closed-state t…
claude Nov 29, 2026
a9a90f3
Merge remote-tracking branch 'origin/claude/o5-data-approvals-trunk' …
claude Nov 29, 2026
dc3081f
Merge the closed-state trunk into the approvals guide
claude Nov 29, 2026
978bb2b
Merge the closing outcome on an approval that is over into the closed…
claude Nov 29, 2026
97f9f1f
Merge the approvals guide's closed-states section into the closed-sta…
claude Nov 29, 2026
1b5824c
feat(lint): an approval's closed-state gap is refused at every author…
objectstack-fleet[bot] Nov 29, 2026
37e97a8
feat(spec,objectql): the closed-state refusal's own sentences, in eve…
objectstack-fleet[bot] Nov 29, 2026
99a6524
feat(approvals): piece 4 — a step records the child runs it started, …
objectstack-fleet[bot] Nov 30, 2026
45b2fac
docs(adr): ADR-0162 revised on three rulings of 2026-11-29: the recon…
objectstack-fleet[bot] Nov 30, 2026
6e17a6a
feat(approvals)!: on an object that declares closedStates, the docume…
objectstack-fleet[bot] Nov 30, 2026
a11638b
Merge origin/main (59faf74c6f) into the approvals trunk (#38497 refresh)
claude Nov 30, 2026
ba57382
chore: regenerate the outputs the merged tree moves (#38497 refresh)
claude Nov 30, 2026
134a682
Merge origin/main (fc198b2847) into the approvals trunk (#38497 refresh)
claude Nov 30, 2026
25c63f5
chore: regenerate the outputs the merged tree moves (#38497 refresh)
claude Nov 30, 2026
fe50943
chore(approvals): merge main into the approvals trunk (#38497 refresh…
objectstack-fleet[bot] Nov 30, 2026
8ff2442
Merge the gated main refresh onto the squashed approvals trunk (#3849…
claude Nov 30, 2026
a5f3362
chore(approvals): merge main into the approvals trunk again (#38497 r…
objectstack-fleet[bot] Nov 30, 2026
77e9486
Reconnect the squashed approvals trunk to main's history (#38497 refr…
claude Nov 30, 2026
2f344f7
Merge origin/main (2fba83493b) into the approvals trunk (#38497 refresh)
claude Nov 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .changeset/37766-abandoned-mirror.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
'@objectstack/plugin-approvals': patch
---

fix(approvals): an abandoned approval never writes a closed value on its status mirror (ADR-0162 D5, Execution item 7)

Clause-②: no
Metadata-protocol: none

A request is abandoned by its submitter's recall (while it is pending, or in the revise window after a send-back), by the override arm of a recall (an administrator, or a system context), and by the sweep that releases a record held by a dead run. Each puts a value back on the field the approval mirrors its status onto. Where the object's `closedStates` lists any value for that field (ADR-0162 D1), the mirror now chooses that value so that it never closes the document again:

- **`recalled`** is written where the field declares it and the object does not close on it, as before. A declared `recalled` the object closes on is withheld, and a `warn` line says so: listing `recalled` among the closed values closes nothing through the mirror.
- **Otherwise the order**: the value held at submit, the field's declared default, empty. A closed value is passed over at each step, and on a required field an empty value at submit is passed over for the default. A pass is logged at `info`.
- **A closed value the approval did not write is left alone.** Where the field holds a closed value, the mirror asks the request table once, by the request's root run and record, whether a request of the same approval on the same record had that value as its status. Where none did, it writes nothing and logs it at `info`. A request of the approval on another record (another item of a `map`) does not count. Where it cannot tell (the request records no root run, or a request on the record that records none was opened since the approval's run started), it goes down the order.

Every other write of the mirror is unchanged, and so is every write on an object that closes on no value of the mirror field.
14 changes: 14 additions & 0 deletions .changeset/37766-approval-closed-states-authoring-rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
'@objectstack/lint': patch
---

feat(lint): an approval that cannot show itself in progress on a field its object closes on is refused where it is authored (ADR-0162 D5)

Clause-②: yes (widening)
Metadata-protocol: none

Widened: `@objectstack/lint` exports `validateApprovalClosedStates`, `approvalRootObjectsOf`, `APPROVAL_CLOSED_STATE_GAP` and the type `ApprovalClosedStateFinding`; the rule's sentences are registered in all 11 platform locales.

A new member of the reference-integrity suite, `validateApprovalClosedStates` (finding `approval-closed-state-gap`, at error), judges each flow of a stack as the root of an approval, on each object it can start on a record of, through the one judge the approvals plugin's first request asks (`judgeApprovalOpeningSync`, `@objectstack/metadata-core`). `os validate`, `os build` and `os lint` refuse the gap on a project's stack, and the runtime publish door (Studio, REST `/meta`, MCP) refuses it with `INVALID_METADATA` (422) on a `flow` or an `object` write: an active save, a draft's promotion, a restore and a package publish (a draft save is not refused). An `object` write judges the written package's live flows and is charged only with a gap it adds. In a package publish each draft is judged against the batch's objects, and a flow the batch redrafts is judged as its draft, so a package that declares `closedStates` and repairs its flow in the same publish passes. The rule refuses only what it has in view: a call to a flow the stack does not hold, a node type the spec does not ship and a host with no `job` service are not refused here, and are judged at the approval's first request, which stays the rule. An object that declares no `closedStates` is judged nowhere.

Why the protocol line reads none: the rule reads only `closedStates`, which this release adds. No object a released version accepts declares it, so nothing that could be published before is refused now.
19 changes: 19 additions & 0 deletions .changeset/37766-opening-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
'@objectstack/plugin-approvals': patch
---

feat(approvals): an approval that cannot show itself in progress on a field its object closes on does not open (ADR-0162 Execution item 7, the check)

Clause-②: yes (widening)
Metadata-protocol: none

Widened: `sys_approval_request` gains the engine-written, read-only column `between_steps_json`; `ApprovalService` gains `noteSweepClockScheduled()`, and the input of `ApprovalService.openNodeRequest` gains the optional member `locale` (the run's locale, for the refusal's wording); the plugin's message catalog gains twelve `approvalOpening*` sentences in all 11 locale packs.

At an approval's first request the plugin now reads the approval whole: the flow its root run was started on and every flow a `subflow` or a `map` in it names, to any depth. Where a step can act on an object that declares `closedStates`:

- **The between-two-steps set is stamped** on the request, and every later request of the same approval carries the same set. It lists the nodes after which a step of the approval can still follow, so that a run that stops there can later be told from one that stopped after the last step.
- **The approval does not open** where a step mirrors onto a field the object closes on at `pending`, `returned`, `approved` or `rejected`, and one of these is missing: the field declares `pending` and the object closes on neither `pending` nor `returned`; a `state_machine` rule on the field that declares the moves out of a closed `approved` or `rejected` includes `pending` among them; the field has no `readonlyWhen` and no request-status option has a `visibleWhen`; every step that can act on the object mirrors onto the same field; no node that can pause the run (a `wait`, a `screen`, a node type with no descriptor) stands between two steps, and no `map` runs an approval step for items it does not show are not records. An approval one of whose flows cannot be read does not open either, and neither does one on a host that runs no `job` service.

A refused approval fails its run at the step with `VALIDATION_FAILED` and one sentence per gap naming the flow, the step, the object, the field and what is missing, in the run's locale. No request row is written.

Not judged, and unchanged: an application in which no object declares `closedStates`; an approval whose objects declare none, once it has been read whole (in an application where some object declares the key, an approval one of whose flows cannot be read is refused, whatever objects the parts that were read act on, since its objects cannot be known); a request whose run hands no root run; a later request of an approval already open (also one opened before the object declared the key); a request that cannot be placed because an earlier request on the record since its root run started records no root run. A writing node between two steps of a flow that runs as the user is not refused.
10 changes: 10 additions & 0 deletions .changeset/37766-opening-judge-metadata-core.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@objectstack/metadata-core': patch
---

feat(metadata-core): the judge of an approval's opening conditions on a closing field lives here, so every door asks one copy (ADR-0162 D5)

Clause-②: yes (widening)
Metadata-protocol: none

Widened: `@objectstack/metadata-core` exports the judge the approvals plugin's first-request check used to hold, `judgeApprovalOpening` (it awaits each flow it reads), with `judgeApprovalOpeningSync` (over a stack in hand: a flow read that answers a promise counts as a flow it cannot read), the walk both drive, `approvalFlowWalk`, and the helper and types they read (`closedValuesOf`, `OpeningCheckSource`, `OpeningFlow`, `OpeningFlowBody`, `OpeningGap`, `OpeningJudgement` and the rest). `OpeningCheckSource.calleeFlow` may answer a flow or a promise of one. The verdict and its gaps are unchanged; nothing an author writes changes.
10 changes: 10 additions & 0 deletions .changeset/37766-opening-judge-plugin-approvals.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@objectstack/plugin-approvals': patch
---

refactor(approvals): the first-request check asks the opening judge in `@objectstack/metadata-core` (ADR-0162 D5)

Clause-②: no
Metadata-protocol: none

The check an approval's first request makes on a field its object closes on now calls `judgeApprovalOpening` from `@objectstack/metadata-core`, the same judge the authoring rule `validateApprovalClosedStates` asks. `approval-opening-check.ts` re-exports it and its types under the names it exported before. Which approvals open, the refusal and its sentences are unchanged.
12 changes: 12 additions & 0 deletions .changeset/37766-opening-lead.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'@objectstack/plugin-approvals': patch
---

fix(approvals): the opening refusal no longer says the object closes on its approval field when its only gaps are the host's or an unreadable flow

Clause-②: yes (widening)
Metadata-protocol: none

Widened: the plugin's message catalog gains the sentence `approvalOpeningRefusedClosedStatesLead` in all 11 locale packs.

An approval's first request is refused when an object it can act on declares `closedStates` and the host runs no job service, or when a flow it runs cannot be read. Those gaps are raised whatever field the object closes on. The refusal's lead used to say "the object closes on its approval field" in every case, which is false for an object that closes on another field. Where every gap is one of those two, the lead now says only what is true: the approval can act on an object that declares `closedStates`. The sentences per gap are unchanged.
10 changes: 10 additions & 0 deletions .changeset/37767-hold-root-run-spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@objectstack/spec': patch
---

feat(spec): a run's writes name the root run of its tree (`ExecutionContext.flowRootRunId`, `HookContext.provenance.flowRootRunId`, ADR-0162 D5)

Clause-②: yes (widening)
Metadata-protocol: none

Widened: `ExecutionContextSchema` and the `provenance` of `HookContextSchema` gain the optional string `flowRootRunId`, beside `flowRunId`: the run id of the root of the run tree the writing run belongs to (the run itself for a root run). The automation engine stamps it on every write a run makes; it is never read from a request. Nothing an author writes changes.
13 changes: 13 additions & 0 deletions .changeset/37767-hold-root-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@objectstack/core': patch
'@objectstack/objectql': patch
'@objectstack/service-automation': patch
'@objectstack/runtime': patch
---

feat(automation): every write of a run carries the root run of its tree (`flowRootRunId`, ADR-0162 D5)

Clause-②: yes (widening)
Metadata-protocol: none

Widened: a data write a run makes (`resolveRunDataContext`, the run identity of `@objectstack/service-automation`) carries `flowRootRunId`, the run id of the root of its run tree, beside `flowRunId`; the engine carries it onto the write's `HookContext.provenance` (`@objectstack/objectql`), the platform system api strips it with the other run marks, a sandboxed body and script see it among the declared provenance members (`@objectstack/runtime`), and it is one of the fields an entry point may not set on an `ExecutionContext` (`assembleExecutionContext`, `@objectstack/core`). The approvals plugin reads it to let every run of an approval through the hold. Absent on a write that is not a run's.
23 changes: 23 additions & 0 deletions .changeset/37767-hold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
'@objectstack/plugin-approvals': minor
---

feat(approvals)!: on an object that declares `closedStates`, the document is held for the whole approval (ADR-0162 D5, Execution item 8, the hold)

Clause-②: yes (narrowing)
Metadata-protocol: semantic
Skills-docs: none — `skills/` names no `closedStates` (git grep, 0 hits); its `lockRecord` rows describe the lock while a request is pending, which this does not change, and `content/docs/automation/approvals.mdx` teaches the hold

**BREAKING** for a caller that edits a record of an object that declares `closedStates` while its approval is between two steps, or after its last decision until the approval is over: FROM the edit landing (the record was locked only while a request was pending, and only under a node whose `lockRecord` is not `false`) TO the edit refused `409 RECORD_LOCKED`. The same holds for an automation that runs as a user outside the approval's own flow, such as a record-change flow with `runAs: 'user'` that a decision sets off. The one-line fix: make the edit before submitting or after the approval is over, or make it from the approval's own flow, whose every run passes; for such an automation, run it with `runAs: 'system'`. No metadata changes and no stored metadata is refused.

What the hold is. Every decision on such an approval leaves a mark on its request (`unjudged_since`), cleared once the approval is judged or its next request opens. While a mark stands, the pending lock holds the record and its direct `master_detail` lines as a pending request under a locking node does, whatever field the object closes on and whatever the node's `lockRecord` says. It passes:

- a system context, the approval status mirror among them;
- a write that carries only the mirror field;
- a write by any run of the approval, the record's run or a `subflow` or `map` run under it at any depth, known by the root run (`flowRootRunId`) the automation engine now carries on every write of a run; a hook's write through its own `ctx.api` carries it, a write a hook makes as another caller does not;
- the revise window of a returned request;
- the record's own delete, which lands and ends the approval: it is marked abandoned on its latest request, its marks are cleared, and nothing is written (the reconciler does the same for a record deleted another way).

An approval that opened before its object declared `closedStates` left no marks and is not held. The approvals-family lock read (`getRecordLock`, the `/lock` and `/locks` routes) answers for a pending request only, as published: in a passage it answers `{ "locked": false }`.

<!-- adr-0087: not-required (no-migration-prescription) no key, value or metadata type is removed or renamed: what changes is when a caller's edit of such a record is refused, which no metadata rewrite can migrate -->
20 changes: 20 additions & 0 deletions .changeset/37767-outcome-when-approval-over.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
'@objectstack/plugin-approvals': patch
---

feat(approvals): on a field its object closes on, an approval's decision is written when the approval is over (ADR-0162 Execution item 8, the outcome)

Clause-②: yes (widening)
Metadata-protocol: none

Widened: `sys_approval_request` gains the engine-written, read-only datetime column `unjudged_since` (the mark) and an index on it; the `getRun` member of the automation surface the plugin declares (`ApprovalResumeSurface`) now also types the step log the engine already returns; the plugin's message catalog gains `approvalAbandonedTitle` and `approvalAbandonedBody` in all 11 locale packs, sent on the topic `approval.abandoned`.

What changes, only for an approval the check stamped when it opened (one with a step that can act on an object that declares `closedStates`):

- **The decision is held back.** Where the object closes on the step's mirror field at `approved` or `rejected`, neither decision is written onto the record when it is made. The request records it as before, and the field keeps `pending`. Every other status (`pending` as a request opens, `returned` at a send-back, what a recall leaves) is written as before.
- **The mark.** Every decision on a request of such an approval sets `unjudged_since` in the update that records it, also where nothing is held back. It is cleared when the approval is judged, and when the approval's next request opens on the record. A recall, an administrator's override and the dead-run sweep clear it on the approval's earlier requests.
- **The door judges the approval.** After a decision (by a person or the SLA clock), a send-back (and its auto-rejection), a resubmission, a recall and the continuation of a restored run, the plugin reads the run that carries the record and the approval's requests on it. Finished (the run completed, stopped after the last step, or is parked at a pause no step can follow): it writes the latest request's decision, as the person who decided it. In progress (a request is open, or the run is parked at a pause a step can follow): nothing. Ended between two steps (the run stopped on a node a step could still follow, a failure the flow routed at the top level ended it, or a later step could not open, whatever the flow did with that): the approval is abandoned. Cannot tell (the run is being advanced or cannot be read): nothing, and the mark stays.
- **An abandoned approval.** The latest request is marked abandoned, the field is put back by item 7's order (never a closed value, and nothing where another approval's request is open on the record on the same field), a timeline line with no actor says why and what the record was put back to, and the submitter is told on `approval.abandoned` instead of `approval.approved` or `approval.rejected`. The decisions already made stay on their requests.
- **A restored run is refused.** `continueRestoredRun` refuses a request of an abandoned approval with `INVALID_STATE` and tells the operator to cancel the restored run.

Unchanged: an object that declares no `closedStates`; an approval that opened before its object declared the key, or whose requests could not be placed. An approval on an object that declares the key on another field than the approval's holds nothing back: its decisions are written at once, as before, and the door only clears the mark.
Loading
Loading