Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
04427b7
feat(metadata-protocol): the stored-form ceremony's write half (--app…
claude Nov 30, 2026
4c77a1e
fix(metadata-protocol): the fold reads a withdrawal the other type's …
claude Nov 30, 2026
5eaca82
test(objectql): the stored-form ceremony's write half over the real p…
claude Nov 30, 2026
68b146c
fix(metadata-protocol): the stored-form move writes the stored body, …
claude Nov 30, 2026
e5dd21b
test(objectql): a held row writes nothing at any address; the pair do…
claude Nov 30, 2026
ae532d4
fix(metadata-protocol): where no pair id can be derived, the ceremony…
claude Nov 30, 2026
3093ce7
fix(metadata-protocol): the stored-form move writes a declared overri…
claude Nov 30, 2026
bedd598
test(rest): a declared override of a form a base ships as a `form` it…
claude Nov 30, 2026
a5985f4
docs(deployment): what the upgrade command writes for stored forms; c…
claude Nov 30, 2026
5ed2329
refactor(metadata-protocol): the stored-form ceremony's writes as mod…
claude Nov 30, 2026
bedc74f
fix(metadata-protocol): the stored-form census reads the store's seal…
claude Nov 30, 2026
bcec01a
test(rest): take the worker's cold `@objectstack/lint` load in a hook…
claude Nov 30, 2026
d8c2615
fix(metadata-protocol): a form no door serves today is left in place …
claude Nov 30, 2026
4a67c9f
chore(changeset): name the CLI's new left-in-place line and the censu…
claude Nov 30, 2026
906d10a
fix(metadata-protocol): leave in place every form no door serves today
claude Nov 30, 2026
d61a32a
fix(metadata-protocol): read the store's seal for a kept row the run …
claude Nov 30, 2026
85c7eeb
fix(metadata-protocol): refuse stored-form --apply on a database that…
claude Nov 30, 2026
9ecc15b
docs(adr-0159): state when no door serves a form; the page and change…
claude Nov 30, 2026
bf56df4
test(rest): a package-less form at the environment's address is serve…
claude Nov 30, 2026
1133818
fix(metadata-protocol): leave an unserved form in place before the pa…
claude Nov 30, 2026
74b1cfc
feat(cli): the stored-forms census says where the upgrade's run will …
claude Nov 30, 2026
7831394
docs(adr-0159): the environment's address, rows another address moves…
claude Nov 30, 2026
c18c134
chore(changeset): the CLI's run-refusal line and the holds an unserve…
claude Nov 30, 2026
5f0b99f
test(cli): read the run-refusal sentence without loading the stack th…
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
15 changes: 15 additions & 0 deletions .changeset/37111-stored-forms-apply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
'@objectstack/metadata-protocol': patch
'@objectstack/cli': patch
---

feat(metadata-protocol): the stored-form ceremony's write half, the `--apply` the next major's upgrade command runs (ADR-0159 D7)

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

`applyStoredFormsOf(protocol, { actor })` runs the census `os migrate stored-forms` prints and acts on it, all or nothing with the switch: when the precheck counts any row, it writes nothing and every stored row stays byte-equal. Otherwise it ensures the `.custom` pairs the moves land in (they stay if the run fails; an empty pair changes no answer and the next run reuses it), then, in one transaction, writes each form that is kept with a carried withdrawal or moved as a `form` row at its destination, with its body as stored (a folded row's withdrawal switches the kept form off, its link kept; a declared override is written as its pair's own row), reads each one back, and only then deletes or re-saves the old rows: a view item row is deleted, a stored container is re-saved without the forms that left it (its lists and the forms it keeps byte-equal), and a container left with nothing is deleted. Internal record forms are removed the same way, with their bodies in the result. Forms left in place and drafts are not touched; a second run moves nothing. On a database whose default driver cannot roll a transaction back, a run that would write or take a row is refused before anything is written, naming the driver and what to do (run against a database whose driver supports transactions, or stay on the current release). It is exported for the major's upgrade command only; `os migrate stored-forms` stays read-only.

The census gains three readings: a withdrawal in a `view` row a `form` row outranks at its place, and one in a second pair's declared override, are read today, so the fold does not name the form newly closed; a row bound to a package that ships no form of the name moves into the pair as its own item where the base records no version (that item declares no `basedOn`); and where no pair id can be derived from a base, the refusal names why in words. Two more keep the census and `--apply` in step: a move, or a kept row that carries a withdrawal, whose destination row the store seals (a managed package ships the form's name as a `form` item, and the destination is not a declared override) holds the upgrade, naming that package, instead of failing the run; and a form no door serves today is left in place by the upgrade, whatever package its row is bound to (`served_by_no_door`, a new member of the exported `StoredFormLeftReason`), which `os migrate stored-forms` prints; such a form does not hold the upgrade at the pair door or at a sealed destination either. On a database that cannot roll back, `os migrate stored-forms` says the upgrade's run will be refused (`runRefused` in `--json`).

The operations page `content/docs/deployment/stored-forms-upgrade.mdx` says what the upgrade command writes.
56 changes: 52 additions & 4 deletions content/docs/deployment/stored-forms-upgrade.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ switch, and the deployment stays on the release it is running.

`os migrate stored-forms` shows you that outcome before you upgrade. It writes
nothing, and it has no `--apply`: the move is reached only from the upgrade
command.
command ([below](#what-the-upgrade-command-writes)).

```bash
os migrate stored-forms
Expand All @@ -35,12 +35,21 @@ package of your own, or the environment itself when no package ships it.

| Outcome | What the upgrade does |
|---|---|
| **kept** | The form is already stored as a form. Older rows of the same form fold into it. |
| **moves** | The row moves to a form row, with its body as written: into the package's paired `.custom` package as a declared override for a read-only package, into the package itself for a writable one, or into the environment. An override already stored in a `.custom` package keeps its package and the version it is based on. A row bound to a read-only package that ships no form of that name, or an override of a package that ships none, moves into that package's `.custom` package as a form of its own, with no override declared; its public address answers as it does today. Where the server today serves such a row at one other package's address, it moves as a row of that package does, into that package's `.custom` package as a declared override. Older rows of the same form fold into it. |
| **kept** | The form is already stored as a form. The rows the server serves behind it at that package fold into it. |
| **moves** | The row moves to a form row, with its body as written: into the package's paired `.custom` package as a declared override for a read-only package, into the package itself for a writable one, or into the environment. An override already stored in a `.custom` package keeps its package and the version it is based on. A row bound to a read-only package that ships no form of that name, or an override of a package that ships none, moves into that package's `.custom` package as a form of its own, with no override declared; its public address answers as it does today. Where the server today serves such a row at one other package's address, it moves as a row of that package does, into that package's `.custom` package as a declared override. The rows the server serves behind the moved row at that package fold into it. |
| **will be removed** | The row is an internal record form: a create or edit form with no public link that no action opens, over nothing that has a link. New and Edit follow the object's field groups instead, and the report says whether the object declares any. A row bound to no package is read at every package that ships its form: it is removed only when it is an internal record form at each of them, and moves at each of them otherwise. An older row behind the removed one goes with it, unless another package serves that row: the report then names it as not removed, with what happens to it there. |
| **left in place** | Nothing moves. The row served for the name carries no form (a list stored over it, alone or with older form rows behind it), or an internal record form is served ahead of a row with a public link and is not removed because of it. Every row of the name stays as stored, and the address keeps answering as it does today. Where another package serves that row with a public link and would move it, the row holds the upgrade at every one of those packages instead: both rows stay. Both rows stay as stored at every other package too: where either stands behind a row another package would move or remove, that move or removal holds the upgrade instead of folding or removing it. When the row served is one whose form content cannot be read, the form waits on that row, which holds the upgrade (below). |
| **left in place** | Nothing moves. The row served for the name carries no form (a list stored over it, alone or with older form rows behind it), or an internal record form is served ahead of a row with a public link and is not removed because of it. Every row of the name stays as stored, and the address keeps answering as it does today. Where another package serves that row with a public link and would move it, the row holds the upgrade at every one of those packages instead: both rows stay. Both rows stay as stored at every other package too: where either stands behind a row another package would move or remove, that move or removal holds the upgrade instead of folding or removing it. When the row served is one whose form content cannot be read, the form waits on that row, which holds the upgrade (below). A form no door serves today is left in place by the upgrade too, whatever package its row is bound to: the server serves no form of that name at the address the report names, so nothing of it moves, its rows stay as stored there, and the address keeps answering as it does today. A form that is switched off is not one of these: the server serves it closed, and it moves with its switch. |
| **holds the upgrade** | The row cannot be moved. The report repeats the reason and the action. |

For each form, the report asks the server whether it serves a form of that
name today at the address the report names it at: a package, or the
environment. For a form stored with no package, the environment's address
covers every place the server serves it, under a package that ships only a
list of that name included. A form it does not serve there is **left in
place** where the table would move it, and also where the move would hold the
upgrade because its `.custom` package cannot be ensured or its destination is
sealed: the upgrade never moves a form into service.

A list stored behind the row served for a form is not part of it: the upgrade
leaves it as stored, and the report says so. When a row is read at more than
one package, the report names it at each. Where the server today serves one
Expand Down Expand Up @@ -73,6 +82,44 @@ A row that declares a public link, or that stands over a form that declares
one, is never offered for deletion. Deleting such a row would open a form
that is closed today.

## What the upgrade command writes

The major's upgrade command runs the same check first, and writes only when
no row holds the upgrade. If one row holds it, nothing is written: every
stored row stays byte for byte as it is, both public doors answer as they do
today, and the deployment stays on the release it is running.

Otherwise, the `.custom` packages the moves land in are created first,
through the one path that creates them, before any row is written. They stay
if the run fails: an empty `.custom` package changes no answer, and the next
run reuses it. Then, in one transaction:

1. Each form that moves is written as a form row at its destination, with its
body as stored. A form whose folded row switched it off is written switched
off, its link kept. Each written row is read back before anything else
changes.
2. Then the old rows go: a view item row is deleted; a stored view container
is saved again without the form it held, its lists and any form it still
keeps byte for byte as they were. A container left with nothing in it is
deleted.
3. Each internal record form listed as **will be removed** is deleted the same
way, and the report carries its body.

If any step fails, the transaction rolls back and every stored row stays as
it was.

The upgrade command writes only on a database that can roll a transaction
back. Where the database's driver cannot, the command refuses before it
changes anything (no `.custom` package is created either) and names the
driver. Run the upgrade against a database whose driver supports
transactions, or stay on the release you are running. `os migrate
stored-forms` still reports what the upgrade would move, and says on such a
database that the upgrade's run will be refused. A run with nothing
to move or remove is not refused.

A form left in place is not touched, nor is a draft. Run the command again and
it finds nothing left to move.

## Clearing a row that holds the upgrade

| Cause | Who can clear it | What to do |
Expand All @@ -82,6 +129,7 @@ that is closed today.
| The app declares no namespace, or an invalid one; its version is not SemVer; or the package belongs to several apps and its namespace picks none | The app's author | The deployment stays on the release it is running until the app ships a version without the cause. The row keeps working as it does today meanwhile. |
| The package is a kernel package, which has no `.custom` package in this version | The platform maintainers | Report it before upgrading. |
| Two rows would land in one slot of an app's `.custom` package, or one row that several packages serve would not be treated alike by all of them | No one, on this release | No exit from it was measured: the deployment stays on the release it is running, and every address keeps answering as it does today. Where the row is read at two packages of one app that would both move it, the app shipping the form from one of those packages only lets it be read at that package alone. Where the row waits on another hold of its own, it takes that hold's row above. |
| Another package ships a `form` item under the form's name, so the row would be written over a managed package's item, which is sealed | The author of the package that ships it | No exit from it was measured: the deployment stays on the release it is running, and the row keeps working as it does today. |
| The stored view's form content cannot be read | The administrator | Save the view again with its form content repaired (a `form` or `formViews` entry that is an object), then run the check again. On the release you are running, both public doors answer for the row as they do today. On the next major its links close, and that server's start-up log names each such row and points to this command. |

## Also listed
Expand Down
Loading
Loading