Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 18 additions & 0 deletions .changeset/35955-migrate-list-preferences.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
'@objectstack/cli': patch
---

feat(cli): `os migrate list-preferences` deletes the per-reader list preference rows the Console no longer reads

Clause-②: no
Metadata-protocol: none

The Console no longer reads or writes the per-reader list preference rows an earlier Console stored in `sys_user_preference` under `ui.list.<object>` (column widths, row height, view-tab order and, before that, sorts, filters and columns). The rows are not carried anywhere. This new operator command deletes them.

- `os migrate list-preferences` is a dry run by default: it counts the rows, readers and organizations, and per key the rows and readers holding it. It never prints a value and writes no row, table or file.
- `--apply` deletes, and only with `--export <path>`: every row the run deletes, as stored, is written to an owner-only file (`0600`, never overwriting one) and read back before the first delete. Each delete is the engine's by-id delete in the system context, on every organization's rows.
- After the deletes the family is read again; any row still there exits `1`. A second run finds nothing and exits `0`.
- A row belongs to the family only when its key starts with `ui.list.`, compared exactly. `ui.record.<object>` and every other preference key are untouched.
- Nothing on a boot, upgrade or migrate path runs it.

Upgrade note: once the upgraded Console is serving, run `os migrate list-preferences` once, a dry run first and then `--apply --export <path>`. Left in place the rows are unread, so it is cleanup, not a gate.
45 changes: 45 additions & 0 deletions content/docs/deployment/cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1546,6 +1546,7 @@ where the data lives.
| `os migrate audit-mail-bodies` | Mask the mail bodies (`body_text`, `body_html`) that `sys_audit_log` and `sys_activity` copies of `sys_email` / `sys_identity_email` rows still hold in clear, written before the audit writer masked them. Covers the `archive` datasource `sys_audit_log` archives to as well. Reports counts only. No flag; idempotent. See [below](#os-migrate-audit-mail-bodies) |
| `os migrate audit-key-material` | Remove the encrypted key-material columns from the `sys_audit_log` and `sys_activity` copies written before the audit writer omitted them. Covers the `archive` datasource `sys_audit_log` archives to as well. Reports counts only. No flag; idempotent. See [below](#os-migrate-audit-key-material) |
| `os migrate audit-side-copies` | Remove the side-copy columns (another record's field values, such as an approval request's `payload_json`) from the `sys_audit_log` and `sys_activity` copies written before the audit writer omitted them. Covers the `archive` datasource `sys_audit_log` archives to as well. `--object` narrows it to one copy table. Reports counts only, per table and store. No flag; idempotent. See [below](#os-migrate-audit-side-copies) |
| `os migrate list-preferences` | Delete the per-reader list preference rows an earlier Console stored in `sys_user_preference` under `ui.list.<object>`, which the Console no longer reads. Dry run by default (counts per key, writes no row); `--apply` deletes, only with an owner-only `--export` written and read back first. Run it once after upgrading. See [below](#os-migrate-list-preferences) |
| `os migrate comment-parent-pair` | Stamp the parent pair (`object_name`, `record_id`) on the `sys_comment` rows written before it existed. Until it runs, a broad comment read past 2,000 candidate rows omits comments the reader may see, and its total agrees with the short list, so run it at once after upgrading. No flag; idempotent |
| `os migrate meta --stored` | Replay the metadata conversion chain over this deployment's `sys_metadata` rows and rewrite the ones still carrying a pre-protocol shape. Hygiene, not a gate — nothing depends on it having run |
| `os migrate security-catalog-overlays` | List the environment-wide permission-set and position rows (the legacy plurals `permissions` / `positions` included) stored over a name a configured package holds — the rows a v18 cold boot refuses — each with the package that holds its name; `--apply` deletes them, one history tombstone per row. Run it before the first v18 boot, with the flags and environment the deployment boots with: the platform security plugin's sets are held only where `os serve` composes it (an auth secret set, and the `auth` tier on), and the step takes `serve`'s `--preset` and `--dev` with `serve`'s meaning. Adopts nothing; exits 1 while it lists a row |
Expand Down Expand Up @@ -2390,6 +2391,50 @@ the upgraded deployment's schema sync, which an `--apply` run performs itself:
a dry run against a database no upgraded process has opened cannot read them,
reports the failed read and exits `1`. A failed read or write exits `1`.

#### `os migrate list-preferences`

An earlier Console remembered each reader's list state on the server: one
`sys_user_preference` row per reader and object, keyed `ui.list.<object>`. It
held the column widths, the row height and the view tabs' order, and before
that the reader's sorts, filters and columns too. The Console no longer reads
or writes those rows: a change on a list is an unsaved draft until the reader
saves it into a view, and the widths, row height and tab order are kept in the
reader's own browser. The stored rows are not carried anywhere; every reader's
lists open as their views declare them. This command deletes the rows.

```bash
os migrate list-preferences # Dry run: counts per key, writes no rows
os migrate list-preferences --json # the same report, machine-readable
os migrate list-preferences --apply --export ./list-preferences-backup.json
os migrate list-preferences --apply --export ./list-preferences-backup.json --yes --json
```

The report counts the rows, the readers and the organizations, and per key
(`ui.list.account`, …) the rows and the readers holding it. It never prints a
value. It reads every organization's rows. A row belongs to the family only when
its key starts with `ui.list.`, compared exactly, dot and case included:
`ui.record.<object>` (the record page's "show empty fields" choice, still read),
`ui.recent` and every other preference key are never touched.

**Options:**
- `--apply` — delete the listed rows (default off: a read-only dry run)
- `--export <path>` — **mandatory with `--apply`**: every row the run deletes, as stored, written
owner-only (`0600`) and read back before the first delete; refuses to overwrite an existing file
- `-y, --yes` — skip the confirmation prompt; without it, a run whose stdin is not a terminal (or `--json`) reads
nothing, deletes nothing and exits `1`
- `--force` — apply even when another process is using the SQLite file
- `--database-url <url>`, `--json`

Each delete is the engine's by-id delete in the system context. After the
deletes the family is read again, and the run exits `1` when any row is still
there: one whose delete was refused, or one a Console that still writes the
family stored after the export. **Re-runnable**: a second run finds nothing,
writes no export and exits `0`. It is never run for you; nothing on any boot,
upgrade, migrate or lifecycle path invokes it. Run it once after the upgraded
Console is serving (an older Console would write the rows again), and keep the
export until you are certain the sweep was right: it is the only copy, and
nothing reads it back into the platform.

#### A database created by this version needs no migration

A deployment whose database the platform **creates from empty** records these
Expand Down
2 changes: 2 additions & 0 deletions content/docs/upgrading.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,8 @@ the protocol-18 step, which `os migrate meta --from 17` lists for your sources

**Upgrading from 18.5.0 or earlier:** the first [`os migrate plan`](/docs/deployment/cli#schema-migrations) after the move lists a safe `create_index` for each `(created_at, id)` and `(owner_id)` index schema sync now builds without a declaration, and on SQLite a `normalize_boolean_storage` step for boolean cells stored as text; the next sync or `os migrate apply` builds them, and neither is destructive. Where an app declares `lifecycle.seal`, an `os migrate audit-* --apply` run on SQLite or Turso now needs every sealing server stopped and `--sealer-stopped` ([18.6.0 checklist](/docs/releases/v18/18-6#upgrade-checklist)).

**Upgrading from 18.6.0 or earlier:** the Console no longer reads the per-reader list preferences stored in `sys_user_preference` under `ui.list.<object>`, so every reader's lists open on their views' own sorts, filters, columns, widths, row height and tab order; nothing is carried over. Once the upgraded Console is serving, run [`os migrate list-preferences`](/docs/deployment/cli#os-migrate-list-preferences) once, a dry run first and then `--apply --export <path>`; it deletes those rows after writing them to an owner-only export. Left in place they are unread, so it is cleanup, not a gate.

The v17 and v18 lines are broken out per release. Each v17 minor shipped
breaking changes under the repo's launch-window convention — which ships a
breaking change as `minor` rather than `major`, so the version number is not the
Expand Down
Loading
Loading