Skip to content

Commit 6643455

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/project-thread-r4sjiv
2 parents eeedb57 + aeb9cf0 commit 6643455

54 files changed

Lines changed: 1684 additions & 88 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: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
'@objectstack/spec': minor
3+
'@objectstack/cli': minor
4+
'@objectstack/platform-objects': minor
5+
---
6+
7+
feat(spec): a greyed action says why — `disabledReason` beside `disabled`
8+
9+
Clause-②: yes (widening)
10+
Metadata-protocol: added
11+
12+
`ActionSchema` gains one optional key, `disabledReason`: the sentence a greyed action shows to say why it is unavailable, beside the `disabled` predicate that greys it. An action that does not declare it parses exactly as before, and the console keeps its default reason, "Not available for this record".
13+
14+
```ts
15+
defineAction({
16+
name: 'submit_for_approval',
17+
label: 'Submit for approval',
18+
objectName: 'clm_contract',
19+
disabled: "record.legal_review_status != 'approved'",
20+
disabledReason: 'An approved legal review is required before the contract enters approval.',
21+
});
22+
```
23+
24+
- **An `I18nLabel`.** A plain string or an inline locale map (`{ en, 'zh-CN' }`). A blank string is refused at parse: `''` or whitespace only. Omit the key to keep the default. The locale-map arm is the `InlineLocaleMapSchema` every `I18nLabel` takes, so a map is not checked for blank values. `disabledMessage`, `disabledTooltip`, `disabledHint` and `disabledText` are renamed onto it.
25+
- **Translated with the copy keys.** The slot is `objects.OBJECT._actions.ACTION.disabledReason` (`globalActions.ACTION.disabledReason` for an action with no `objectName`), beside `confirmText` and `successMessage`. `translateAction` overlays it, and `os i18n extract` (`@objectstack/cli`) scaffolds it for an action that declares one and seeds nothing for one that does not.
26+
- **Display only.** It does not change what `disabled` evaluates to and is never read as a condition: `os validate` checks `disabled`, not `disabledReason`. It is not access control either. A call that reaches the server anyway is refused by the action's own rules (its body or hook, `requiredPermissions`), never by this text.
27+
- **Studio.** The action editor's Placement section gains a "Disabled Reason" row under "Disabled", translated in `@objectstack/platform-objects` for zh-CN, ja-JP and es-ES.
28+
29+
Nothing renders the key yet. The console's greyed-action surfaces (the record header, the record section bar, the declared actions bar and the four `action:*` renderers) read it in the follow-up change. Until then the liveness ledger marks it `planned` with `authorWarn`, so `os validate` warns an author who declares it that nothing shows it yet.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
'@objectstack/plugin-security': patch
3+
---
4+
5+
fix(plugin-security)!: security explain refuses a `userId` that no `sys_user` record has with `404 RECORD_NOT_FOUND`, naming the id, instead of explaining the baseline principal the resolver builds for any id
6+
7+
Clause-②: no (narrowing) — `POST` / `GET /security/explain` and the in-process `explain()` refuse a request naming another user whose id no `sys_user` record has, which they answered with a verdict before. Nothing is widened.
8+
Metadata-protocol: none
9+
10+
<!-- adr-0087: not-required (no-migration-prescription) No key of any schema is added, removed, renamed or re-shaped, and no export or type changes: the explain request's userId keeps its shape, and an id that names nobody is now refused instead of explained. A verdict about nobody had no meaning to keep, so there is nothing for a migration to rewrite. -->
11+
12+
**BREAKING** accept-set narrowing at the access-explanation door (`@objectstack/plugin-security`), served at `/security/explain` on both transports.
13+
14+
- **Before.** An administrator explaining another user by an id that no `sys_user` record has (a typo, a deleted user, an id from another deployment) was answered `200` with a full verdict, usually `allowed: true`: the authorization resolver gives any id the baseline position and permission sets. `GET /data/sys_user/ID` answered 404 for the same id.
15+
- **Now.** That request is refused `404 RECORD_NOT_FOUND`, and the message names the id. The id is read through the same `sys_user` existence read the on-behalf-of delegator path uses.
16+
- **Unchanged.** The order of checks: an anonymous caller is refused 401, and a caller who may not explain others gets the same 403 `PERMISSION_DENIED` whether the id exists or not, before any existence read. Explaining yourself (no `userId`, or your own) and explaining a user who exists answer as before.
17+
- **Who sees it.** A caller holding `manage_users` (or a system caller) who names an id that does not exist. An organization administrator or a delegated administrator naming such an id still gets the 403: no membership or scope covers a user who does not exist.
18+
19+
**The remedy.** None needed: pick the user from the directory, or check the id.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/i18n': patch
4+
---
5+
6+
feat(app-shell): the page designer can set a list block's object, view and row cap
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
Selecting a `list-view` block in the page designer used to open an inspector with no typed fields. Its row cap, the number of rows a list block in a wide page region draws (5 when none is stated), could be set only by editing the page's JSON, because the "Advanced" section lists only keys the block already has.
12+
13+
- **Three controls.** Object, View and Row limit. They write the block's `dataSource` binding (`dataSource.object`, `dataSource.view`, `dataSource.limit`), the keys the list block already reads. The Row limit box hints `5` when empty.
14+
- **Labels in both designer locales**, English and Chinese, in the `studio` namespace of `@object-ui/i18n` where the page inspector's rows live.
15+
- No new key is declared anywhere, and nothing an author already wrote changes. The palette still does not offer `list-view`: the controls edit list blocks a page already carries.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@objectstack/connector-mcp': minor
3+
---
4+
5+
fix(connector-mcp): `tools/list` follows `nextCursor` through every page, and a rejected credential (HTTP 401 / 403) is a fatal configuration fault, not a retried upstream outage
6+
7+
Clause-②: no (narrowing)
8+
Metadata-protocol: narrowed
9+
10+
<!-- adr-0087: not-required (no-migration-prescription) No key of any schema is added, removed, renamed or re-shaped and no export is removed: discovery now reads every tools/list page, and a credential the server rejects is classified as a configuration fault. The fix is to a credential, not to the metadata's shape, so there is nothing for a metadata migration to rewrite and no tombstone. -->
11+
12+
- **Pagination.** Discovery called `tools/list` once with no cursor, so a server that pages its tool list lost every tool past the first page, silently. The SDK-backed client now follows `nextCursor` until the server stops answering one, so every tool on every page becomes an action (and is offered to `providerConfig.include`). The walk is bounded at 100 pages: a server still answering a `nextCursor` after that fails discovery with an error naming the bound, never a connector built from a truncated tool list. On a declarative instance that failure is classified like any other failed discovery (the instance degrades and is retried). `McpClientLike.listTools()` is documented as returning every page; an injected client returns the whole list.
13+
- **Rejected credential.** An HTTP 401 / 403 during connect, handshake or `tools/list` was wrapped as `ConnectorUpstreamUnavailableError`, so the instance degraded and was retried as if the server were down. The `mcp` provider now tells it apart by the MCP SDK's own HTTP-transport error (`StreamableHTTPError` with status 401 / 403, or `UnauthorizedError`, anywhere in the `cause` chain) and throws it plain: fatal at boot, a skipped entry on reload, never retried. A JSON-RPC error that merely carries code 401 is not one, and every other connect / discovery failure keeps the retryable classification.
14+
15+
**BREAKING** for a declarative `mcp` instance whose server rejects its credential: it now fails boot with `connector-mcp provider: connector 'NAME' was refused by its MCP server (HTTP 401): … This is a configuration fault and is not retried …` instead of booting degraded. The remedy is a credential the server accepts (the instance `auth`, or `providerConfig.transport.headers`); the metadata keeps its shape.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@objectstack/connector-openapi': minor
3+
---
4+
5+
fix(connector-openapi): a document that is not OpenAPI 3.x is refused at load — a Swagger 2.0 document included
6+
7+
Clause-②: no (narrowing)
8+
Metadata-protocol: narrowed
9+
10+
<!-- adr-0087: not-required (no-migration-prescription) No key of any schema is added, removed, renamed or re-shaped and no export changes: providerConfig.spec keeps its three forms, and what is now refused is an external document the generator never mapped correctly. The fix is to the document, outside the metadata, so there is nothing for a metadata migration to rewrite and no tombstone. -->
11+
12+
The declarative `openapi` provider loaded any JSON object as its document. A Swagger 2.0 document "loaded" with its `host` / `basePath` ignored and its `body` / `formData` parameters dropped, so the instance came up with wrong actions and no error. The provider now checks the document's `openapi` field on every `providerConfig.spec` form (inline object, http(s) URL, package-relative file): absent, or anything but `3.x` (a `swagger: "2.0"` document included), is a configuration fault — fatal at boot, a skipped entry on reload — whose message names the inline document, URL or file and the remedy. The runtime never converts.
13+
14+
**BREAKING** accept-set narrowing at the `openapi` provider's document load. What an upgrader sees: an instance whose `spec` is a Swagger 2.0 document now fails boot with `connector-openapi provider: connector 'NAME' providerConfig.spec file './x.json' is a Swagger "2.0" document; … Convert the document to OpenAPI 3.x offline …`. The document is converted outside the runtime (any Swagger 2.0 → OpenAPI 3 converter); the metadata keeps its shape. A 3.x document (3.0 or 3.1) loads as before.

‎content/docs/automation/connectors.mdx‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@ Each operation becomes an action keyed by its `operationId` (or a
148148
`method_path` slug when the document omits one) — so `getInvoice` in the
149149
document is `actionId: 'getInvoice'` in your flow.
150150

151+
The document must be **OpenAPI 3.x**. A Swagger 2.0 document — or one with no
152+
`openapi` version field — is refused at boot with an error naming the inline
153+
document, URL or file it came from: convert it to OpenAPI 3.x offline and point
154+
`spec` at the converted document. The runtime never converts.
155+
151156
### `provider: 'mcp'` — one action per tool
152157

153158
Config: **`transport`** (required) and **`include`** (optional tool-name
@@ -177,7 +182,13 @@ export const SearchToolsConnector = defineConnector({
177182
```
178183

179184
At materialization the provider connects, calls `tools/list`, and maps each
180-
tool to an action — the MCP server's tool names are your `actionId`s.
185+
tool to an action — the MCP server's tool names are your `actionId`s. A
186+
paginated tool list is followed through every page (`nextCursor`), up to 100
187+
pages; a server still paging after that fails discovery instead of yielding a
188+
truncated tool list. A server that is unreachable or failing degrades the
189+
instance, which is retried. A credential the server rejects (HTTP 401 / 403 on
190+
connect, handshake or `tools/list`) is a configuration fault instead: it fails
191+
the boot and is not retried — fix the credential and reload.
181192

182193
<Callout type="warn">
183194
**Declarative stdio transports are denied by default.** Materializing one

‎content/docs/permissions/explain.mdx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ rule:
9696
`adminScope` whose business-unit subtree covers that user (ADR-0090 D12):
9797
an administrator who can rewire a user's grants may read why they resolve
9898
the way they do — and *only* a covering administrator. Anything else → 403.
99+
- **A `userId` no user has** — once the caller may explain that user, an id
100+
with no `sys_user` record is refused `404 RECORD_NOT_FOUND`, naming the id,
101+
instead of being explained as a baseline member. The 403 above comes first,
102+
so a caller who may not explain others cannot use explain to learn which ids
103+
exist.
99104

100105
A deployment without `@objectstack/plugin-security` answers 501.
101106

‎content/docs/protocol/objectui/actions.mdx‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ interface Action {
245245
visible?: ExpressionInput; // Visibility predicate (CEL)
246246
requiresFeature?: string; // Public auth feature flag gate — lowered into `visible` at parse time
247247
disabled?: boolean | ExpressionInput; // Disabled when TRUE (CEL)
248+
disabledReason?: I18nLabel; // Why it is greyed — hover title + accessible description (display only)
248249

249250
// Bulk
250251
bulkEnabled?: boolean; // Apply to multiple selected records
@@ -333,6 +334,21 @@ disabled: "record.status != 'paid'"
333334
Predicates are **bare CEL** — `record.status == 'paid'`, not `${record.status == 'paid'}` and not `{record.status} == 'paid'` (in CEL, `{…}` is a map literal). A `${…}`-wrapped or brace-wrapped predicate is not evaluated as a boolean.
334335
</Callout>
335336

337+
#### Saying why: `disabledReason`
338+
339+
A greyed action says **why** with `disabledReason`, the sentence beside the `disabled` predicate. It is meant for the button's hover title and its accessible description (a menu item, under its label). The console does not show it yet: until its greyed-action readers ship, every greyed action shows the console's default reason, "Not available for this record", and `os validate` warns an author who declares the key.
340+
341+
```yaml
342+
name: submit_for_approval
343+
label: Submit for approval
344+
disabled: "record.legal_review_status != 'approved'"
345+
disabledReason: An approved legal review is required before the contract enters approval.
346+
```
347+
348+
- It is an `I18nLabel`: a plain string, translated at `objects.<object>._actions.<action>.disabledReason` (`globalActions.<action>.disabledReason` for an action with no `objectName`), or an inline locale map. `os i18n extract` scaffolds the key.
349+
- A blank string (`''` or whitespace only) is refused at parse. Omit the key to keep the default.
350+
- It is **display only**. It does not change what `disabled` evaluates to, nothing reads it as a condition, and it is not access control: a call that reaches the server anyway is refused by the action's own rules (its body or hook, `requiredPermissions`), never by this text.
351+
336352
#### Evaluation context
337353

338354
Action predicates evaluate against the **record the action is attached to**. Both `record.<field>` and the bare field name resolve to the current record's value:

‎content/docs/references/data/object.mdx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ const result = ApiMethod.parse(data);
499499
| **requiresFeature** | `Enum<'twoFactor' \| 'organization' \| 'multiOrgEnabled' \| 'degradedTenancy' \| …>` | optional | Public auth feature flag gating this action; lowered into `visible` at parse time. |
500500
| **requiresMembershipReach** | `Enum<'invite_member' \| 'cancel_invitation' \| 'update_member_role' \| …>` | optional | Organization endpoint (a MEMBERSHIP_REACH row) whose membership-grade gate this action follows; lowered into `visible` over current_user.positions at parse time. |
501501
| **disabled** | `boolean \| string \| { dialect: Enum<'cel' \| 'cron' \| 'template'>; source: string; ast?: any; meta?: object }` | optional | Disabled predicate — `true`/`false` literal, CEL string, or `{dialect, source}` envelope. The action is shown but refused when it evaluates TRUE. Omit = never disabled. |
502+
| **disabledReason** | `string \| Record<string, string>` | optional | Display-only reason for a greyed action, for its hover title and accessible description while `disabled` evaluates TRUE (declared ahead of its console reader: no renderer shows it yet) — the default-language string, or an inline locale map; translated at `objects.OBJECT._actions.ACTION.disabledReason` (`globalActions.ACTION.disabledReason` for an object-less action). Not a gate: the server refuses a call on its own rules (hooks, `requiredPermissions`), and nothing reads this as a condition. Omit = the default reason, "Not available for this record". A blank reason is refused. |
502503
| **requiredPermissions** | `string[]` | optional | [ADR-0066 D4] Capabilities required to invoke this action. Enforced with 403 on the platform action route (script/flow/modal + MCP) and mirrored as a UI hide; a `type: api` action pointed at a custom endpoint must re-check it there. |
503504
| **ai** | `{ exposed?: boolean; description?: string; category?: Enum<'data' \| 'action' \| 'flow' \| 'integration' \| 'vector_search' \| 'analytics' \| 'utility'>; paramHints?: Record<string, object>; … }` | optional | AI exposure (opt-in). Set ai.exposed=true + ai.description to make this callable by agents. |
504505
| **recordIdParam** | `string` | optional | Body key to inject the row id into when running from a list_item context. |

‎content/docs/references/kernel/metadata-plugin.mdx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ const result = MetadataBulkResultSchema.parse(data);
346346
| **requiresFeature** | `Enum<'twoFactor' \| 'organization' \| 'multiOrgEnabled' \| 'degradedTenancy' \| …>` | optional | Public auth feature flag gating this action; lowered into `visible` at parse time. |
347347
| **requiresMembershipReach** | `Enum<'invite_member' \| 'cancel_invitation' \| 'update_member_role' \| …>` | optional | Organization endpoint (a MEMBERSHIP_REACH row) whose membership-grade gate this action follows; lowered into `visible` over current_user.positions at parse time. |
348348
| **disabled** | `boolean \| string \| { dialect: Enum<'cel' \| 'cron' \| 'template'>; source: string; ast?: any; meta?: object }` | optional | Disabled predicate — `true`/`false` literal, CEL string, or `{dialect, source}` envelope. The action is shown but refused when it evaluates TRUE. Omit = never disabled. |
349+
| **disabledReason** | `string \| Record<string, string>` | optional | Display-only reason for a greyed action, for its hover title and accessible description while `disabled` evaluates TRUE (declared ahead of its console reader: no renderer shows it yet) — the default-language string, or an inline locale map; translated at `objects.OBJECT._actions.ACTION.disabledReason` (`globalActions.ACTION.disabledReason` for an object-less action). Not a gate: the server refuses a call on its own rules (hooks, `requiredPermissions`), and nothing reads this as a condition. Omit = the default reason, "Not available for this record". A blank reason is refused. |
349350
| **requiredPermissions** | `string[]` | optional | [ADR-0066 D4] Capabilities required to invoke this action. Enforced with 403 on the platform action route (script/flow/modal + MCP) and mirrored as a UI hide; a `type: api` action pointed at a custom endpoint must re-check it there. |
350351
| **ai** | `{ exposed?: boolean; description?: string; category?: Enum<'data' \| 'action' \| 'flow' \| 'integration' \| 'vector_search' \| 'analytics' \| 'utility'>; paramHints?: Record<string, object>; … }` | optional | AI exposure (opt-in). Set ai.exposed=true + ai.description to make this callable by agents. |
351352
| **recordIdParam** | `string` | optional | Body key to inject the row id into when running from a list_item context. |

0 commit comments

Comments
 (0)