Skip to content

Commit 331ddbd

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/project-thread-0slbpo
2 parents d386bd3 + 8807dcb commit 331ddbd

144 files changed

Lines changed: 7300 additions & 828 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: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
'@objectstack/plugin-sharing': patch
3+
'@objectstack/plugin-security': patch
4+
'@objectstack/spec': patch
5+
---
6+
7+
fix(plugin-sharing)!: every share grant counts; the sharing scopes carry the share-grant leaf instead of a list capped at 5,000 grants (ADR-0155 plan step 6)
8+
9+
Clause-②: yes (narrowing)
10+
Metadata-protocol: none
11+
12+
<!-- adr-0087: not-required (no-migration-prescription) No key of any schema is added, removed, renamed or re-shaped, and no stored row, registry key or authored value changes. What moves is how the sharing scopes count share grants (every grant, through a subquery, where a read of at most 5,000 used to stand), that grants stop counting on objects whose storage cannot evaluate that subquery, and that a host registering a narrowing of sys_record_share reads by name no longer boots. There is nothing for a migration to rewrite and no tombstone; each host-side remedy is one line, below. -->
13+
14+
**What was wrong.** The read scope of a sharing-scoped object read the caller's share grants into an id list first, at most 5,000 of them, and dropped the rest without a word: a member holding 6,000 grants on one object saw 6,000 rows of 7,000 (1,000 owned plus 5,000 of the 6,000 shared), and a GET of an unread grant answered 404. The predicate-update scope had the same cap on edit-level grants.
15+
16+
**Now.** `buildReadFilter` and `buildWriteFilter` carry the share arm as the share-grant leaf, `{ id: { $in: SharedRecordIds.read(object, user) } }` (the update scope carries `.write(object, user, ['edit', 'full'])`), which the SQL driver compiles as a subquery over `sys_record_share` inside the same statement. Every grant counts, at any number; no grant is read into memory and nothing binds one parameter per grant. The pending-approval ids stand as a disjunct of their own. `delete` scopes to the owner match alone, as before.
17+
18+
**BREAKING**, in three places, each a tightening that lands here, where it takes effect:
19+
20+
- **Share grants stop counting on objects whose storage cannot evaluate them** (ADR-0155 R2). An object stored on another datasource than `sys_record_share`, or by a driver that does not evaluate the leaf (`supports.fixedReadLeaves` without `SharedRecordIds`: today the MongoDB, in-memory and OData drivers), keeps its owner, queue and pending-approval access unchanged, but its share rows are no longer consulted: no scope carries the share arm, the edit gate reads no grant, and a new grant or a new sharing rule on it is refused `SHARING_NOT_ENABLED` (422 at the REST doors). The boot names, once at `warn`, every such object that holds `sys_record_share` rows, with the reason. `security/explain` reports each share on such a record as evaluated and not granting, and says why.
21+
The fix for a host: to share such an object's records again, store it on the datasource of `sys_record_share`, on a driver that evaluates share grants (the SQL drivers do).
22+
- **A narrowing of `sys_record_share` reads registered BY NAME refuses the boot** (ADR-0155 R1 at boot, D4). A host that registers an object-scoped middleware, or a `beforeFind` / `afterFind` hook, for `sys_record_share` (an opt-in of that table into plugin-audit's record-view auditing included) no longer starts: the boot fails at `kernel:bootstrapped`, before any request is served, with `INTERNAL_ERROR` / 500 naming the registration. No registration is exempt, one whose handler skips system reads included. A registration made after boot is refused at read by the engine, with the same envelope.
23+
The fix for a host: remove that registration for `sys_record_share`. A host that opted the table into record-view auditing gives up that auditing of share rows.
24+
- **A narrowing that names NO object is not run on the share arm.** A middleware or a find hook registered for no object, or for `'*'`, ran on today's grant read, which went through the engine as a system read. The share arm now makes no engine read of `sys_record_share`, so such a registration does not run on it, and nothing refuses, reports or logs that. On a host where such a registration changes a system read of `sys_record_share`, the share arm's rows can differ from what they were. This paragraph is the telling (ADR-0155 D4's boundary; `ISharingService`'s contract says the same). The repository's own registrations of that kind were read before this change, and none changes that read.
25+
26+
**Preconditions this step inherits from the PostgreSQL key-type change** (ADR-0155 O2):
27+
28+
1. On PostgreSQL, a statement holding the leaf whose catalog read fails, or finds no such relation, answers `INTERNAL_ERROR` / 500, where an uncast statement would have run.
29+
2. Each transaction pays one savepoint and one catalog read per table it compares a leaf against, when the table has no pooled reading.
30+
3. A failed catalog read inside that savepoint rolls back the caller's concurrent statements on the same transaction. The sharing plugin issues no statement of its own that carries the leaf, and none of its reads runs inside a caller's transaction or concurrently with another on one: its own reads are sequential system reads.
31+
32+
**What it costs, quoted no wider than ADR-0155 quotes it.** For the scope statements alone (an account page, its total and the two grant reads), at 1M rows and 5,000 grants, the id-list scope against the subquery scope read PostgreSQL 21.6 → 7.0 ms and SQLite 18.3 → 12.1 ms. It is not a whole-request figure. For a caller holding no grant, whose scope was the bare owner match and is now an `$or` with the subquery, SQLite still serves the page and its total from the owner index; PostgreSQL 16 serves the page as before but plans the total as a sequential scan, which grows with the table: measured, that caller's total went from 1.46 to 7.29 ms at 100k rows and from 7.88 to 42.21 ms at 1M, the page flat at both. SQLite keeps the owner index. Follow-up #36034 measures `id = ANY(ARRAY(SELECT …))` against the subquery for that caller on PostgreSQL.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
'@objectstack/rest': patch
3+
---
4+
5+
Clause-②: yes — widening: one new anonymous read-only discovery route (an open restriction profile); nothing served today changes
6+
Metadata-protocol: none
7+
8+
feat(rest): a self-hosted runtime serves the restriction profile `os validate --target` reads
9+
10+
`GET /api/v1/discovery/restriction-profile` is now served by `@objectstack/rest`, the route `os validate --target <url>` reads, so `os validate --target` against a self-hosted runtime reads a profile instead of failing with a 404. It answers `{ success: true, data }`, where `data` is a `RestrictionProfileSchema` value: the open runtime restricts nothing, and `versions.spec` and `versions.skills` name the `@objectstack/spec` version it runs.
11+
12+
- It answers without a credential, as `/discovery` does and as the cloud already serves the same route (ADR-0138 D2, amended 2026-11-20: the control-plane discovery role).
13+
- It reads no query parameter: any one is refused `400 VALIDATION_ERROR`.
14+
- When the runtime cannot read the `@objectstack/spec` version it runs, it answers `503 SERVICE_UNAVAILABLE` and publishes no profile.
15+
- `api.enableDiscovery: false` unmounts it together with the rest of discovery; the CLI then fails as it does for any server that does not serve the route.
16+
- `allowedFlowNodeTypes` is a constant: the profile's whole node-type vocabulary, the approvals plugin's `approval` / `approval_revise` included. It does not say which plugins the runtime runs, so `os validate --target` does not check whether an approval flow has an executor on that runtime.
17+
- fix(rest): the CommonJS build (`require('@objectstack/rest')`) now resolves package manifests as the ESM build does. esbuild emptied `import.meta` in that build, so `loadOpenApiSpec` could not read the static OpenAPI artifact, and the new restriction-profile route would have answered `503` there; the package now builds with tsup's `shims`.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
Clause-②: no
6+
Metadata-protocol: none
7+
8+
`objectstack-data`'s hook reference (`references/data-hooks.md`) now says that `input` and `ctx` are already bound in an action body's `(async (input, ctx) => { … })` wrapper, shows the refused redeclaration (`const input = ctx.input || {};`, `let ctx`) with its rule id `action-body-does-not-compile`, and links the hook-body compile paragraph for the commands, the `422 INVALID_METADATA` save and the fix. That paragraph's suggested local is now `const data = …`, a name no wrapper binds. The file stays inside its token ceiling by dropping two restatements.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
Clause-②: no
6+
Metadata-protocol: none
7+
8+
`objectstack-ui` actions rule: no bulk body receives `input.selectedIds`. A name in the list view's `bulkActions` runs the action once per ticked row, its body reading `ctx.recordId` (how the example now writes rows); only a `bulkActionDefs` entry with `operation: 'custom', execution: 'aggregate'` runs it once, the ids in `input._selectedIds`. Also: the new-tab example's `target` uses `${ctx.recordId}` on `record_header`.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
'@object-ui/core': patch
3+
'@object-ui/i18n': patch
4+
'@object-ui/plugin-list': patch
5+
'@object-ui/plugin-detail': patch
6+
'@object-ui/app-shell': patch
7+
---
8+
9+
feat(ui): a record page's related tab is the child object's full list
10+
11+
Clause-②: yes (widening) — a new export `ListConditionsBlock` (`@object-ui/plugin-list`, the condition row as a host element, not a registered node type) and its `ListConditionsHostProps`; a new slot `RelatedListConditionsSlotContext` and its `RelatedListConditionsProps` (`@object-ui/plugin-detail`), which the record page fills (`@object-ui/app-shell`); new exports `ConditionDiscardButton` and its type `ConditionDiscardButtonProps` (`@object-ui/plugin-list`) and `withHeaderSortPick` (`@object-ui/core`); new i18n keys in every `@object-ui/i18n` locale pack (`listConditions.chips.discard`, `listConditions.chips.discardHint`, `detail.relatedNoMatches`, `detail.deleteRowsTitle`, and the count family `detail.deleteRowsConfirmation` with its plural slots `_zero`, `_one`, `_two`, `_few`, `_many`, `_other` as each pack needs them); nothing removed or renamed
12+
Metadata-protocol: none
13+
14+
On a record page, a related list opened as its own tab now works like the object's list page:
15+
16+
- The first row names the child list (its tile and title) on the left and keeps **+ Add** on the right. The **Open in list** button is gone.
17+
- The second row is the list page's own condition row: **Sort** (several levels) and **Filter**, with no view switch, view settings or search. On a narrow tab or in the drawer their labels fold to icons.
18+
- The table is the list page's grid: the column menu, cell editing as on the list page wherever the reader may edit the child object, row selection with the floating bulk bar (bulk delete asks once, deletes the selection in one batch call where the data source has one, and says how many rows went and how many did not), and the footer row, whose calculations cover every matching row, not just the loaded ones. A tab grouped by status draws no footer row.
19+
- Rows load as the page scrolls instead of in pages.
20+
- The tab title still counts every child; the footer counts the rows the filter keeps.
21+
- What the reader changes (sort, filter, footer calculations) lasts while they stay on the record, for that reader only, across its tabs and between its page and its drawer, and is gone after a reload or on another record. **Discard** appears once something changed and puts the tab back; there is no Save. The list page's Discard and this one are one button.
22+
23+
Upgrade note: the header sort and the column widths and order that an earlier version remembered for a related tab in a reader's record-page preference (`sys_user_preference`) no longer apply: the tab opens in its declared order, and its column widths and order are now kept in the reader's browser, as the list page's are, so they start from the default once. Nothing stored is deleted. The default sort and columns of every related list are unchanged.
24+
25+
`@object-ui/core` adds `withHeaderSortPick`, the list page's rule for how a header sort joins an existing multi-level sort, now shared with the related tab. `@object-ui/app-shell`'s list Discard is drawn by `ConditionDiscardButton`; it looks and behaves as before.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
'@object-ui/fields': patch
3+
'@object-ui/app-shell': patch
4+
'@object-ui/console': patch
5+
---
6+
7+
fix(fields, console): condition editors offer a multiple: true field only what its evaluator answers
8+
9+
Clause-②: no
10+
Metadata-protocol: none
11+
12+
A `select`, `lookup` or `user` field declared `multiple: true` holds a list, and the condition editors used to treat it as a single value: they offered Equals and Is any of on it. The engine refuses those operators on such a field with 400 `INVALID_FILTER`, a dataset filter answered them with 0, and a flow edge guard written as `record.attendees == 'u1'` is false for every record. Each editor now passes the field's `multiple` to the shared filter builder, which offers such a field Contains, Does not contain, Is empty and Is not empty, the operators a `multiselect` already got:
13+
14+
- the criteria editor (`@object-ui/fields` `FilterConditionField`, e.g. a sharing rule's criteria);
15+
- the Studio filter editor for a dataset's scope and measure filters and a field's related-list filter. A stored `$eq` or `$in` on such a field now opens in Source instead of as an Equals row;
16+
- the Studio flow edge rows. On a list-valued field they write Contains as CEL list membership, `record.attendees != null && 'u1' in record.attendees`, and Does not contain as `record.attendees == null || !('u1' in record.attendees)`. A guard spelled that way opens as a row again.
17+
18+
A single-value field of the same types keeps its operators. The Studio field list now carries the declared `multiple`, so the CEL condition builder also words and writes Is empty on such a field as an empty list, as the spec's 「is empty」 table says. No metadata key, value or default changes.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/plugin-detail': patch
4+
'@object-ui/components': patch
5+
'@object-ui/i18n': patch
6+
---
7+
8+
feat(record-page): a record's comments move out of the 动态 tab into a comment panel of their own on the desktop
9+
10+
Clause-②: yes (widening) — `@object-ui/plugin-detail` adds exports (`CommentsPanel`, `CommentsButton`, `CommentThread`, `CommentItem`, `CommentComposer`, `CommentHoverActions`, `useRecordComments`, `buildCommentThreads`, `latestRepliers`, `RecordCommentsInPanelContext`) and their types (`CommentsPanelProps`, `CommentsButtonProps`, `RecordCommentThreadProps`, `CommentItemProps`, `CommentItemActions`, `CommentComposerProps`, `CommentHoverActionsProps`, `CommentThreadData`, `RecordCommentsData`), and an optional `reservedWidth` on `useRecordPageTier`. `RichTextCommentInput` (exported) now takes the `Esc` that closes its @ list (`preventDefault` and `stopPropagation`), so nothing round it acts on that key. `RecordActivityTimeline` draws no chip group when it is handed no chips. `@object-ui/components` adds an optional `comments` slot to `RecordTopBar` and `NavigationOverlay`, and the drawer leaves an `Esc` pressed inside a `[data-owns-escape]` region to that region. `@object-ui/i18n` adds five keys to every pack: `detail.closeComments`, `detail.collapseReplies`, `detail.commentActions`, `detail.commentsEmptyHint`, `detail.resolveThread`. Nothing existing is removed or re-typed.
11+
Metadata-protocol: none
12+
Skills-docs: none — no skill under `skills/**` teaches where the console draws a record's comments; `content/docs/frontend/plugins/plugin-detail.mdx` and the plugin-detail README gain the panel in this change.
13+
14+
On the desktop record page and in the record drawer, the record header gains a comments icon with the number of top-level comments. A press opens the record's comment panel, the next one closes it, and the browser remembers whether it was left open (once for the page, once for the drawer).
15+
16+
- The panel is 380 px wide: 「评论」 and ✕ at the top, the threads oldest first, the comment box docked at the foot. A thread's replies fold to 「N 条回复」 with the latest repliers' faces and open in place, with a reply box under them; Reply on any comment of a thread opens it with the caret in that box.
17+
- A comment's actions sit in one row at its top right while the pointer is over it, or focus is in it: Reply, an emoji, and More with Edit and Delete on the viewer's own comments. Every write is offered under the same grants as before.
18+
- From a 1280 px window the panel sits beside the record and the record gives way; in a narrower window it is drawn over the record's right edge. In a drawer narrower than 760 px (the default 720 px drawer) it covers the drawer's body; a wider drawer splits.
19+
- Esc in the panel closes it and returns the focus to the comments icon, in a drawer too: the drawer neither closes nor steps back on it. Esc in the panel's @ list closes the list only and keeps the draft.
20+
- While the panel holds the comments, the 动态 tab and panel hold the system entries only: activity and field changes, with no comment box and no All / Activity / Discussion chips; the Changes chip stays where the record shows its field history, and pressed again it goes back to every entry. Their count leaves the comments out.
21+
22+
Unchanged: a record page authored in full keeps the feed blocks it places (`record:discussion`, `record:activity`) as they were and shows no icon; an object with `enable.feeds: false` shows no icon; the phone keeps the comments in its 动态 tab.

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,41 @@ declare const handleAddComment: (text: string) => void;
195195
- **Positioning**: Panel can be placed at `bottom`, `right`, or `left` of the record view
196196
- **Collapsible**: Optional collapse/expand with configurable default state
197197

198+
## The record's comment panel
199+
200+
On the desktop console, a record's comments live in a panel of their own,
201+
opened from the comments icon in the record header (on the record page and in
202+
the record drawer), and no longer inside the 动态 (Activity) tab
203+
(objectstack#36075):
204+
205+
- **The icon** shows how many top-level comments the record holds. A press
206+
opens the panel, the next one closes it, and the browser remembers whether it
207+
was left open, once for the record page and once for the drawer.
208+
- **The panel** is 380 px wide: 「评论」 and ✕ at the top, the threads oldest
209+
first, the comment box at the foot. A thread's replies fold to 「N 条回复」
210+
and open in place. A comment's actions (Reply, an emoji, and More with Edit
211+
and Delete on your own comments) appear at its top right while the pointer is
212+
over it.
213+
- **Where it sits**: beside the record from a 1280 px window, the record giving
214+
way; over the record's right edge in a narrower window. In a drawer narrower
215+
than 760 px (the default drawer is 720) it covers the drawer's body, and ✕ or
216+
Esc returns to the record.
217+
- **The 动态 tab** then holds the system entries only: activity and field
218+
changes, with no comment box and no All / Activity / Discussion chips. The
219+
Changes chip stays where the record shows its field history; pressed again,
220+
it goes back to every entry. The tab's count leaves the comments out.
221+
222+
The panel and the icon come with the default record page and with a page that
223+
only fills its slots. A record page you author in full keeps the feed blocks it
224+
places (`record:discussion`, `record:activity`) exactly as before, and an object
225+
with `enable.feeds: false` shows no icon. On a phone the comments stay in the
226+
动态 tab.
227+
228+
The components are exported from `@object-ui/plugin-detail` (`CommentsPanel`,
229+
`CommentsButton`, `CommentThread`, `CommentItem`, `CommentComposer`,
230+
`useRecordComments`); each reads the discussion off the host's
231+
`DiscussionContext`, as the feed blocks do.
232+
198233
## The `record:activity` block
199234

200235
`RecordActivityTimeline` is a presenter: you hand it `items`. The SDUI block

0 commit comments

Comments
 (0)