Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 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
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.
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.
16 changes: 16 additions & 0 deletions .changeset/37767-status-mirror-closing-field-refusal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
'@objectstack/plugin-approvals': patch
'@objectstack/service-messaging': patch
---

fix(approvals): on a field the object closes on, a refused write of the approval status mirror is no longer swallowed (ADR-0162 Execution item 8)

Clause-②: no
Metadata-protocol: none

A validation rule, an option's `visibleWhen` or a hook of the app can refuse the write that mirrors an approval's status onto the record. The mirror used to log every such refusal at `warn` and go on. On a field the object closes on at `approved` or `rejected` (`closedStates`, ADR-0162 D1):

- **The `pending` of an approval's first request.** The approval does not open. The request's row is voided as `cancelled`, nobody's inbox lists it, no lock is taken, and the run fails at that step with the refusal's own message. The record keeps the value it held, a closed one included.
- **Every other write** (a decision, a send-back, a recall's put-back, a later request's `pending`, the dead-run sweep's put-back). The field keeps the value it held, and the refusal is reported three ways: an `error` line naming the write and the fix, a line with no actor on the request's timeline carrying the refusal's message, and a notice to the organization's administrators under the new topic `approval.status_mirror_refused`, which the notification preference options now list.

An object that declares no closed state is unchanged: its mirror still logs a refused write at `warn`, and its approval still opens.
10 changes: 10 additions & 0 deletions .changeset/37768-closed-states-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 field-level-security scrub serves an object's closed states without the fields a caller cannot read

Clause-②: yes (widening: one new optional authorable key, `ObjectSchema.closedStates`)
Metadata-protocol: added

`closedStates` (ADR-0162 D1) is classified in the object-schema FLS reference table as a map keyed by this object's fields: an entry whose field is denied to the caller is left out of the served definition, and a map left empty is deleted. The listed values are option codes, never field references, so a value spelled like a denied field is served as written. The stored declaration is untouched.
17 changes: 17 additions & 0 deletions .changeset/37768-closed-states-objectql.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
'@objectstack/objectql': minor
---

feat(objectql): a record in a closed state, and its lines, are closed to change (`closedStates`, ADR-0162 D2 to D7, D10)

Clause-②: yes (widening: the engine enforces the new optional key `ObjectSchema.closedStates`; an object without it behaves exactly as before)
Metadata-protocol: none

A record whose stored state is one of the values its object lists in `closedStates` is closed, and so are its direct `master_detail` lines (a junction row is a line of both masters). Every write a system context does not make is refused `409 RECORD_LOCKED`, with `reason` (`record_closed`, `master_closed`, `cascade_reaches_closed`, `cannot_judge`), `object`, `blockingObject` and `lockReason: 'closed_state'`; the message names no record id and no state value.

- **What is judged**: an update or delete of a closed record; a line create, update, delete or move under a closed master, or out of one. An update is judged by the stored row, not by its payload, so the write that closes a record lands whole, other fields included, and the next write is refused. A write with no context is bound.
- **Many-row writes are refused whole**, before any row is written: one existence probe where the store compiles the line semi-join (SQL, the memory driver), otherwise the write's one read of its matched rows, under the engine's per-row ceiling.
- **Refused when it cannot be judged**: a master named in a form the engine cannot read as one id, a master or state read that fails, a many-row line write over the ceiling on a store with no probe.
- **Cascades and restore**: a delete whose cascade reaches a closed record removes no row, with or without transactions; restoring a line under a live closed master that is not part of the entry is refused. The referential clear of a deleted record's references, the recycle-bin relink, and the roll-up summary recompute (a system context) land. Change Owner and the hand-over of a banned user's work are bound like any edit: each closed record is listed among the failures.
- **Placement**: after the permission and record-access gates, before the before-hooks; a master the write names is checked through the caller's own read first. A master a before-hook supplies is not judged.
- **The registry fold** keeps a package's declaration honest: an extension's redeclaration that removes, retypes, makes multi-value or narrows a field the declaration names is refused (the field stands, and the fold logs it once), and a tenant overlay may add closed values but may not shorten the package's list or break a field it names.
10 changes: 10 additions & 0 deletions .changeset/37768-closed-states-platform-objects.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@objectstack/platform-objects': patch
---

feat(platform-objects): the Studio object form's closed-states row is translated in every metadata-forms locale pack

Clause-②: yes (widening: one new optional authorable key, `ObjectSchema.closedStates`)
Metadata-protocol: added

The object form's Advanced section offers `closedStates` (ADR-0162 D1); its label and help text are authored in all eleven metadata-forms locale packs.
15 changes: 15 additions & 0 deletions .changeset/37768-closed-states-spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
'@objectstack/spec': minor
---

feat(spec): an object declares its closed states (`closedStates`, ADR-0162 D1)

Clause-②: yes (widening: one new optional authorable key, `ObjectSchema.closedStates`)
Metadata-protocol: added

An object may now declare the states in which its records are closed: a map from a stored, single-value `select` field of the object to the list of that field's option values that close a record, e.g. `closedStates: { status: ['paid', 'void'], approval_status: ['approved'] }`. A record is closed when any listed field holds one of its listed values. In a closed state the record and its direct `master_detail` lines are closed to change for every caller that is not a system context.

- **Refused where the object is authored**, at parse and at the metadata save and publish door, one located issue each: a key that names no field of the object; a field that is not a single-value `select` (another type, `radio` included, or `multiple: true`); a select whose options are not declared inline on it (a `picklist`-backed select); an empty list; a value that is not one of the field's options; a value listed twice. So is the edit that would leave such a declaration behind: removing or retyping a field, or removing an option, that a declaration still names. Take the entry out of `closedStates` first.
- **Optional**: an object without the key behaves exactly as before. A line object declares nothing to be closed with its master, and may declare its own `closedStates`. The key has no tie to a `state_machine` rule in either direction.
- Liveness row `object.closedStates`, the Studio object form's Advanced section offers it as a JSON row, and the reference docs, authorable-surface record and state counts are regenerated.
- The error-code ledger registers `RECORD_LOCKED` for `@objectstack/objectql`, the engine's closed-state refusal, beside the approval lock that already emits it.
Loading