Skip to content

Commit 65c4733

Browse files
committed
test(cli): list-preferences integration and no-auto-run pins; docs and changeset
Claude-Session: https://claude.ai/code/session_01FEkQ5oY5WCqqqBMtn9qt7m Co-Authored-By: Claude <noreply@anthropic.com>
1 parent fb59ebe commit 65c4733

6 files changed

Lines changed: 508 additions & 0 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
'@objectstack/cli': patch
3+
---
4+
5+
feat(cli): `os migrate list-preferences` deletes the per-reader list preference rows the Console no longer reads
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
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.
11+
12+
- `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.
13+
- `--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.
14+
- After the deletes the family is read again; any row still there exits `1`. A second run finds nothing and exits `0`.
15+
- 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.
16+
- Nothing on a boot, upgrade or migrate path runs it.
17+
18+
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.

‎content/docs/deployment/cli.mdx‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,6 +1546,7 @@ where the data lives.
15461546
| `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) |
15471547
| `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) |
15481548
| `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) |
1549+
| `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) |
15491550
| `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 |
15501551
| `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 |
15511552
| `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 |
@@ -2390,6 +2391,49 @@ the upgraded deployment's schema sync, which an `--apply` run performs itself:
23902391
a dry run against a database no upgraded process has opened cannot read them,
23912392
reports the failed read and exits `1`. A failed read or write exits `1`.
23922393
2394+
#### `os migrate list-preferences`
2395+
2396+
An earlier Console remembered each reader's list state on the server: one
2397+
`sys_user_preference` row per reader and object, keyed `ui.list.<object>`. It
2398+
held the column widths, the row height and the view tabs' order, and before
2399+
that the reader's sorts, filters and columns too. The Console no longer reads
2400+
or writes those rows: a change on a list is an unsaved draft until the reader
2401+
saves it into a view, and the widths, row height and tab order are kept in the
2402+
reader's own browser. The stored rows are not carried anywhere; every reader's
2403+
lists open as their views declare them. This command deletes the rows.
2404+
2405+
```bash
2406+
os migrate list-preferences # Dry run: counts per key, writes no rows
2407+
os migrate list-preferences --json # the same report, machine-readable
2408+
os migrate list-preferences --apply --export ./list-preferences-backup.json
2409+
os migrate list-preferences --apply --export ./list-preferences-backup.json --yes --json
2410+
```
2411+
2412+
The report counts the rows, the readers and the organizations, and per key
2413+
(`ui.list.account`, …) the rows and the readers holding it. It never prints a
2414+
value. It reads every organization's rows. A row belongs to the family only when
2415+
its key starts with `ui.list.`, compared exactly, dot and case included:
2416+
`ui.record.<object>` (the record page's "show empty fields" choice, still read),
2417+
`ui.recent` and every other preference key are never touched.
2418+
2419+
**Options:**
2420+
- `--apply` — delete the listed rows (default off: a read-only dry run)
2421+
- `--export <path>` — **mandatory with `--apply`**: every row the run deletes, as stored, written
2422+
owner-only (`0600`) and read back before the first delete; refuses to overwrite an existing file
2423+
- `-y, --yes` — skip the confirmation prompt (required with `--json`)
2424+
- `--force` — apply even when another process is using the SQLite file
2425+
- `--database-url <url>`, `--json`
2426+
2427+
Each delete is the engine's by-id delete in the system context. After the
2428+
deletes the family is read again, and the run exits `1` when any row is still
2429+
there: one whose delete was refused, or one a Console that still writes the
2430+
family stored after the export. **Re-runnable**: a second run finds nothing,
2431+
writes no export and exits `0`. It is never run for you; nothing on any boot,
2432+
upgrade, migrate or lifecycle path invokes it. Run it once after the upgraded
2433+
Console is serving (an older Console would write the rows again), and keep the
2434+
export until you are certain the sweep was right: it is the only copy, and
2435+
nothing reads it back into the platform.
2436+
23932437
#### A database created by this version needs no migration
23942438
23952439
A deployment whose database the platform **creates from empty** records these

‎content/docs/upgrading.mdx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,8 @@ the protocol-18 step, which `os migrate meta --from 17` lists for your sources
493493

494494
**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)).
495495

496+
**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.
497+
496498
The v17 and v18 lines are broken out per release. Each v17 minor shipped
497499
breaking changes under the repo's launch-window convention — which ships a
498500
breaking change as `minor` rather than `major`, so the version number is not the

0 commit comments

Comments
 (0)