Skip to content

Commit 1537210

Browse files
committed
Merge branch 'main' of https://github.com/objectstack-ai/objectstack into claude/project-thread-2l0ab5
2 parents c5dc817 + dea68e9 commit 1537210

101 files changed

Lines changed: 5317 additions & 1033 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@objectstack/plugin-audit': patch
3+
---
4+
5+
feat(plugin-audit): export the readers that rebuild a stored checkpoint or amendment row into its signed body
6+
7+
Clause-②: yes
8+
Metadata-protocol: none
9+
10+
`@objectstack/plugin-audit` now exports `checkpointBodyFromRow` and `amendmentBodyFromRow` from its package entry, with the two body types they answer, `CheckpointSignedBody` and `AmendmentSignedBody` (ADR-0154 D11).
11+
12+
A checkpoint sink (`audit.checkpointSink`) is handed each signed checkpoint and amendment once, and re-delivers what a failed call missed by re-reading the stored records. Read from an unaltered stored `sys_audit_checkpoint` or `sys_audit_amendment` row, these readers answer the body the sink was handed: its RFC 8785 serialization is the bytes the row's `signature` covers, so a sink outside the package can rebuild and re-send a record without copying the body's shape or its parsing. A malformed row is refused with an error whose `name` is `SignedBodyError` and whose message names the field.
13+
14+
The readers validate and normalize; they never verify the signature. A row whose signed columns were rewritten reads back into a body that fails verification (a rewrite of an unsigned column, `id`, `chain_key` or a checkpoint's `leaf_hashes`, reads back into the same body, and a malformed one is refused with a `SignedBodyError`). A row rewritten and re-signed under a key planted on the host fails under a key the sink trusts itself. A row rewritten and re-signed by whoever holds the genuine signing key verifies, and only the copies already off the host can catch it: a later checkpoint's signed `previous_digest` no longer matches a rewritten checkpoint, while no later record carries an amendment's digest at all. So a sink verifies the row's `signature` over the rebuilt body, under a key it trusts itself, before it treats the row as delivered.
15+
16+
A sink assembles the entry it re-delivers itself: `kind` is `checkpoint` or `amendment`, from the table it read; `keyId` is `body.signing_key_id`; and `signature` is the row's `signature` column. The signed bytes are the body's RFC 8785 (JCS) serialization, which the sink computes with its own serializer: this package does not export one.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@object-ui/console': patch
3+
---
4+
5+
perf(console): a record page asks its app's object list beside the page list, not after it
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
Opening a record page inside an app read the page list first and asked the app's object list only once that answer had landed, so the record's data waited one more round trip than a list page's. Both outcomes of the page list read that object list first, so it now leaves in the same round trip as the page list: the same request, earlier. When the app bundle already says it cannot name the record's related objects (no bundle, a draft preview), nothing is started early, and the record page reads exactly what it read before.

‎.changeset/35685-list-cell-undo.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
'@object-ui/plugin-grid': patch
3+
'@object-ui/react': patch
4+
---
5+
6+
feat(list): undo a list cell save from its toast or with Ctrl+Z
7+
8+
Clause-②: yes (widening) — `toastRecordSave` in `@object-ui/react` takes an optional fourth argument, an `action` button the toast carries (new exported type `RecordSaveToastAction`), and `RecordSaveSink`'s options accept that `action`; nothing removed or renamed
9+
Metadata-protocol: none
10+
11+
In a grid that mounts `GridCellSelection` (the select-first grid every `ListView` draws), a landed cell save can be taken back:
12+
13+
- **The save toast has an Undo button**, and **Ctrl+Z** (Cmd+Z on macOS) on a cell of the grid undoes the newest save, then the one before it. Each save is taken back once.
14+
- **An undo is a new update, not a local rollback.** It writes the value each saved field held before the save (a relation as its stored id), with the version this grid's own newest write of the record answered as `If-Match`, so a change someone else made since answers 409 and opens the same conflict dialog as a save instead of being overwritten. A refused or cancelled undo is used up; the next Ctrl+Z undoes the save before it. The server's history records the save and its undo as two changes. Only the row is redrawn, as for a save.
15+
- Inside an open editor Ctrl+Z stays the editor's own text undo. On a cell, the grid's key is handled by the grid alone: the console's shared Ctrl+Z undo stack is not popped by it.
16+
- A save of a field the row did not read offers no Undo, rather than a partial one.
17+
18+
A grid without `GridCellSelection` (a related list in a record drawer, for one) now re-reads on every write of its object again, including a write the list around it draws itself: before, it skipped the writes that list held while they ran.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
'@objectstack/plugin-auth': patch
3+
---
4+
5+
feat(plugin-auth): a host's session-creation organization choice can fall back when that organization's access policy would refuse the sign-in
6+
7+
Clause-②: yes
8+
Metadata-protocol: none
9+
10+
A host's `session.create.before` hook (`AuthManagerOptions.databaseHooks`) chooses the organization a new session is scoped to, and the framework then refuses the sign-in (`IP_NOT_ALLOWED`, 403) when that organization's own allowed IP ranges do not admit the request. The hook can now return an ordered list of fallbacks beside `data`:
11+
12+
```ts
13+
import type { SessionCreateBeforeResult } from '@objectstack/plugin-auth';
14+
15+
databaseHooks: {
16+
session: {
17+
create: {
18+
before: async (session): Promise<SessionCreateBeforeResult> => ({
19+
data: { ...session, activeOrganizationId: lastUsedOrgId },
20+
activeOrganizationCandidates: [ownedOrgId, oldestOrgId],
21+
}),
22+
},
23+
},
24+
},
25+
```
26+
27+
The session is scoped to the first organization, `data.activeOrganizationId` first and then the list in order, that the organization's scoping admits. Each one is judged exactly as the single choice is: the same client address the server established for the request, the same organization policy, the same tenant-level administrator exemption. When no candidate is admitted, the sign-in is refused as before, and the `login_failed` audit row names the host's first choice. The list never reaches the stored session.
28+
29+
`data` is required, as in better-auth's own hook result: a hook that returns only a list still returns `data: session` beside it. The candidates are the host's word: plugin-auth judges each organization's access policy, never membership, so list only organizations the user is a member of. A non-member candidate can be admitted at creation, and the per-request membership check then drops the session's organization.
30+
31+
Nothing changes for a host that returns no list or an empty one. A value that is not an array of non-empty organization ids is a host error and fails the session creation with a `TypeError`. The new public export is the type `SessionCreateBeforeResult`.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
'@objectstack/driver-sql': patch
3+
'@objectstack/driver-turso': patch
4+
'@objectstack/spec': patch
5+
---
6+
7+
feat(driver-sql, driver-turso): the SQL drivers compile the `SharedRecordIds` fixed-read leaf to a subquery (ADR-0155, step 3 of 6)
8+
9+
Clause-②: yes
10+
Metadata-protocol: none
11+
12+
No visible change on its own: nothing on main writes a `SharedRecordIds` leaf yet. The sharing plugin starts writing it at ADR-0155's last step.
13+
14+
- **The compile** (`@objectstack/driver-sql`). A `SharedRecordIds` leaf in a field's `$in` compiles to one subquery in the list's own position: `id IN (SELECT record_id FROM sys_record_share WHERE object_name = ? AND recipient_type = 'user' AND recipient_id = ? AND record_id IS NOT NULL AND record_id <> '')`. The write form adds `AND access_level IN (…)` inside the subquery. Every value is bound. The subquery carries no tenant scope (ADR-0155 ① ruled A), and the outer statement's tenant wall is unchanged. It compiles on every read verb and on `updateMany`, for SQLite, PostgreSQL, MySQL, SQL Server and Oracle. SQLite and PostgreSQL were run live for this release. MySQL, SQL Server and Oracle are pinned at compile shape, and MySQL also runs live in CI's Temporal Conformance job. On PostgreSQL, an object whose `id` column is not text (an integer- or uuid-keyed federated table) fails the compiled subquery with `DATABASE_ERROR` (42883) instead of answering its rows. That case is open on #35906 (ADR-0155 D-0) and is settled before the sharing plugin writes the leaf. On Oracle the `<> ''` half is left out, because Oracle stores `''` as NULL. `SqliteWasmDriver` and Turso's local mode inherit the compile.
15+
- **The remote transport** (`@objectstack/driver-turso`). Turso's remote mode compiles the same subquery with its own compiler, from the same predicates.
16+
- **The declaration.** `SqlDriver.supports.fixedReadLeaves` is `['SharedRecordIds']`, and `TursoDriver` inherits it in every mode. The engine's seam now hands the leaf to these drivers instead of refusing it.
17+
- **The refusal.** A leaf anywhere other than a field's `$in` comparand is refused before any statement runs, with `INTERNAL_ERROR` / 500, and logged at `error` once per driver.
18+
- **New exports** (`@objectstack/driver-sql`). `findMisplacedFixedReadLeaf`, `fixedInnerReadPredicates` and `misplacedFixedReadLeafMessage` are the walk, the predicates and the refusal text the two compilers share.
19+
- **The shared case-set** (`@objectstack/spec`). `SHARED_RECORD_IDS_CASE_SET` gains a note (`n5`) on a doc whose only grant is stamped in another organization, and a nested case read under a tenant. Together they witness, in the nested position, that the inner read carries no tenant scope.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
'@object-ui/components': patch
3+
'@object-ui/plugin-grid': patch
4+
'@object-ui/plugin-list': patch
5+
'@object-ui/i18n': patch
6+
---
7+
8+
fix(plugin-list): a list's column header opens a menu and keeps a multi-level sort; a sort chip opens the sort panel
9+
10+
Clause-②: yes (widening)
11+
Metadata-protocol: none
12+
13+
On a list page (the grid `ListView` draws), a click on a column header no longer sorts at once. It opens the column menu: sort ascending, sort descending, hide the column (a column that does not sort offers hide alone). Enter, Space or ArrowDown on the focused header opens the same menu, the arrows move through it, Enter chooses, and Esc shuts it without touching the sort. With no sort or a single level, the column picked in the menu replaces the sort; with two levels or more it becomes the first level, the other levels keep their order after it, and a column already in the sort moves up with the picked direction. No level is dropped. The ↑1 / ↓2 marks on the headers are unchanged.
14+
15+
A sort chip under the view bar no longer reverses its direction on a click: it opens every sort level in one panel. Each level row in the sort builder now has a handle; dragging it, or ArrowUp / ArrowDown on the focused handle, reorders the levels.
16+
17+
New public surface, all additive: `GridHeaderMenuProvider` and `useGridHeaderMenu` from `@object-ui/components` (a host opts a data-table into the header menu; without it a header click sorts as before, so related lists, dashboard tables and every other host keep click-to-sort); the `headerMenu` runtime prop on `ObjectGrid`; and the `sortBuilder.reorder` key in every `@object-ui/i18n` locale. The column menu itself is now a menu (`role="menu"` entries, keyboard reachable) wherever it opens, including a right-click on a header and the design host's caret.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/console': patch
4+
'@object-ui/i18n': patch
5+
---
6+
7+
feat(app-shell): on a phone, sign-in lands in an app whose home is its whole menu, and the bottom bar is fixed to Home, Notifications, Approvals and search
8+
9+
Clause-②: no
10+
Metadata-protocol: none
11+
12+
Phone width only (below 768 px). Desktop and tablet widths do not change.
13+
14+
- **Where sign-in lands.** A phone opens the app the person used last. The app the product marks as default is used only when there is no record yet, for example on a first sign-in. With one app it opens that app; with several and neither, it opens the app list. The last app is kept per person with their other console preferences (the `ui.app.last` key), so it follows them across devices. It is read in the same request as those preferences, not in a new one. A desktop still lands on the declared default first, as before.
15+
- **The app's home is its whole menu.** On a phone, `/apps/SEGMENT` shows the app's menu with its groups, order and icons, one row per entry. It no longer redirects to the first entry. This is the sidebar's own menu drawn in a second place, so it cannot list an entry the sidebar hides. 「‹」 on a page one level down goes back to it, and the page comes back scrolled as it was left. An app that shows the member no entry still says so.
16+
- **App switcher.** The app pill at the top left opens a bottom sheet: 「Current app」 with a check, then 「Other apps」 with Setup last, and a search box at the bottom. On a phone, `/home` is that same list as a page.
17+
- **Bottom bar.** The bar has three fixed cells, Home, Notifications and Approvals, and a round search button. They do not change with the app and cannot be configured. Home opens the app's home. Notifications and Approvals open the pages the bell opens, with the bell's two counts as badges. Search opens the command palette. The bar shows only on those three pages; a list, a record, a form or any deeper page has the screen to itself. The bar no longer holds menu entries, a 「More」 cell or pinned entries (objectstack#34594). Pins already stored are ignored, and the drawer's menu search and pin hint are gone. The drawer still opens with a swipe in from the left edge.

‎content/docs/frontend/plugins/plugin-grid.mdx‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,27 @@ is no top-level `sortable` switch.
111111
}
112112
```
113113

114+
A click on a sortable column header sorts by that column; another click on it
115+
changes the direction.
116+
117+
**On an object's list page** the header opens a menu instead
118+
(objectstack#35876), which its host turns on (the `headerMenu` component
119+
prop, not a schema key): **Sort ascending**, **Sort descending** and **Hide
120+
column**. A column that does not sort offers **Hide column** alone. The
121+
header itself never changes the sort. Enter, Space or ArrowDown
122+
on the focused header opens the same menu; the arrows move through it, Enter
123+
chooses and Escape closes it without touching the sort.
124+
125+
- With no sort, or a single level, the column picked in the menu replaces the
126+
sort.
127+
- With two levels or more it becomes the first level and every other level
128+
keeps its place after it; a column already in the sort moves up with the
129+
picked direction. No level is dropped.
130+
- The ↑1 / ↓2 marks on the headers show each level's place.
131+
- A sort chip under the view bar opens every level in one panel (it does not
132+
reverse the direction). Each level's handle reorders it: drag it to another
133+
row, or press ArrowUp / ArrowDown on the focused handle.
134+
114135
### Filtering and search
115136

116137
There is no per-column filter key and no top-level `filterable` switch. A grid
@@ -395,6 +416,17 @@ row whose new value would sort it elsewhere stays in place until the next load
395416
- **A newer version** (409) still opens the conflict dialog: "Reload latest"
396417
re-reads the list, "Overwrite anyway" writes over it and keeps the row in
397418
place.
419+
- **Undo** takes a save back: the save toast's Undo button, or Ctrl+Z (Cmd+Z on
420+
macOS) on a cell of the grid, newest save first. An undo is a new update that
421+
writes the value the record held before the save, guarded by the version
422+
this grid's own newest write of the record answered: if someone else changed
423+
the record since, the 409 dialog opens instead of their change being
424+
overwritten. The record's history shows the save and its undo as two
425+
changes. Each save is taken back once, and a refused or cancelled undo is
426+
used up too, so the next Ctrl+Z undoes the save before it. A toast's Undo
427+
takes back that toast's save, while Ctrl+Z always goes newest first. Inside
428+
an open editor Ctrl+Z stays the editor's own text undo. A save of a field the
429+
row did not read offers no Undo.
398430

399431
### Footer calculations
400432

0 commit comments

Comments
 (0)