You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3cbe672
Browse filesBrowse the repository at this point in the historyBrowse files
refactor(objectql): the `ObjectQL#find` and `ObjectQL#findOne` bodies move into the find facet
7
+
8
+
Clause-②: no
9
+
Metadata-protocol: none
10
+
11
+
- The bodies of `find` and `findOne` move out of `engine.ts` into `engine-find.ts`, the facet that already holds their read helpers. Each method stays on the class as a one-call stub with its signature and its docblock. Where a body handed the engine itself on (`ql: this` in the before/after hook context), it reads the same engine through the host's `facade` entry.
12
+
- No behaviour changes and nothing to do on upgrade. The built declaration files keep every member and every docblock; the source maps move.
13
+
- The `query.fields` and `query.top` liveness rows in `@objectstack/spec` now cite `engine-top-level.ts`, where `planFormulaProjection` and `ENGINE_QUERY_SLOTS` are declared, and `engine-find.ts`, where the `find` / `findOne` bodies fold the `top` alias, since `engine.ts` no longer imports those names; the evidence they cite is unchanged.
feat(plugin-auth, service-settings)!: the access policy is set per organization, and the multi-factor requirement has three levels
8
+
9
+
Clause-②: yes (narrowing) — a new `access_policy` settings namespace (scope `tenant`) carries each organization's allowed IP ranges, idle, absolute and concurrent session limits and multi-factor requirement; `auth.mfa_required` changes from a toggle to the levels `off` / `administrators` / `everyone`, `sys_organization.require_mfa` is no longer writable, and `AuthManagerOptions.mfaRequired` becomes `mfaRequirement`.
10
+
Metadata-protocol: none
11
+
12
+
<!-- adr-0087: not-required (runtime-interface-only packages/plugins/plugin-auth/src/auth-manager.ts#AuthManagerOptions) the narrowed operands are a runtime option of the auth manager (`AuthManagerOptions.mfaRequired`, which the compiler names at every caller), a settings value (`auth.mfa_required`, rewritten from a stored toggle to a level by plugin-auth at boot) and a platform object column's editability (`sys_organization.require_mfa`, whose stored value plugin-auth moves into the organization's access policy at boot); no packages/spec schema, registered node type or ADR-0087 conversion surface names any of them, so there is nothing for `objectstack migrate meta` to rewrite -->
13
+
14
+
**BREAKING.** The access policy is set per organization (rulings of record on objectstack-ai/cloud#3668: 「支持按组织(推荐)」, 「可以,按三档做(推荐)」). Each organization sets its own allowed IP ranges, session idle timeout, absolute session lifetime, concurrent-session cap and multi-factor requirement in **Settings → Access policy** (the `access_policy` namespace, one row per organization, written by its administrators). The deployment's values in **Settings → Authentication** are the default and the floor: an organization may tighten and never loosen.
15
+
16
+
The rule per key — a value weaker than the deployment's is refused at the save, and enforcement holds the floor whatever is stored:
17
+
18
+
-`allowed_ip_ranges`: each range must lie inside a deployment range (any range when the deployment sets none), and the list must admit the address it is saved from. A request must pass both lists. A session is scoped to an organization only from an address its list admits: the sign-in is refused with `403 IP_NOT_ALLOWED` when the organization the session would be scoped to does not admit the address, and so is a switch of the active organization. A session the organization's list no longer admits (it roamed, or the list was tightened) is signed out on its next session read through the auth routes. Sign-in itself, before any organization is chosen, is judged by the deployment's list alone. A platform administrator is held by the deployment's list only, so an organization that locks out its own administrators can be reopened, and the save check does not refuse a platform administrator's save from outside an organization's list.
19
+
-`session_idle_timeout_minutes`, `session_absolute_max_hours`: `0` keeps the deployment's limit; a positive value may not exceed the deployment's. The shorter of the two applies to every session scoped to the organization. A switch of the active organization is judged against the target organization's limits before it lands, from the session's last request in any organization; a session past either is signed out and the switch refused.
20
+
-`max_concurrent_sessions_per_user`: `0` keeps the deployment's cap; a positive value may not exceed the deployment's. The deployment's cap still counts every session of the user, in any organization; an organization's cap counts only the user's sessions in that organization and signs out only those, oldest first. Both are checked at sign-in and when a session switches into the organization.
21
+
-`mfa_required`: `off` keeps the deployment's level; a level may not be weaker than the deployment's. The stronger of the two applies. `administrators` holds platform administrators, the organization's own administrators (owner or admin membership) and delegated administrators (a permission set with an `adminScope`), and lets everyone else through.
22
+
23
+
What to do on upgrade:
24
+
25
+
-`auth.mfa_required` saved as on now reads `everyone`, and as off `off`. A stored toggle is rewritten at the first boot; the `OS_AUTH_MFA_REQUIRED` env override still reads `true`/`false` with a warning for one major release — set it to `off`, `administrators` or `everyone`. A **write** of `true` or `false` to `auth.mfa_required` is now refused by the setting's option table (`invalid_option`): write `everyone` or `off`. Consumer: objectstack-ai/cloud's `apps/cloud/test/settings-cross-org-doors.test.ts` (`:533` writes `true`, `:552` expects it back) must be rewritten to `everyone` when the framework pin moves past this release.
26
+
- An organization whose `sys_organization.require_mfa` was on now carries `access_policy.mfa_required` set to `everyone`. Moved at the first boot (unless the organization already chose a level), and the column is cleared once the row lands; a move that fails is logged at `error` and retried at the next boot. The column is now readonly: a data-API write to it is refused like any other non-editable column.
27
+
- A host that passed the auth manager or plugin option `mfaRequired: true` passes `mfaRequirement: 'everyone'` (or `'administrators'`) instead. A host still passing `mfaRequired` is refused at construction (and on `applyConfigPatch`) with an error naming the replacement, never run without the requirement.
28
+
29
+
What does not change: with no organization policy saved, every deployment enforces exactly what it enforced before, and the deployment's own keys keep their names.
fix(plugin-audit): a comment write leaves a ledger row and an activity row, stamped when the author was impersonated
6
+
7
+
Clause-②: no
8
+
Metadata-protocol: none
9
+
10
+
`sys_comment` is no longer on the audit writer's skip list. Creating, editing and deleting a comment now writes one `sys_audit_log` row and one `sys_activity` row, exactly like a write to any other object, and a comment written from an impersonation session carries the administrator in `metadata.impersonated_by` (and `impersonated_by_name` on the activity row). Before, such a comment could not be told from one the user wrote.
11
+
12
+
The rows name the comment as their parent (`object_name: 'sys_comment'`, `record_id`: the comment's id), so a record's own activity timeline does not show the comment twice; they appear in the object-agnostic feeds (the recent-activity feed, the Audit Logs list). A reader is served them only when it can read the comment, which means reading the record the comment is on: the activity and ledger read gates now enumerate `sys_comment` as a parent and ask the comment's own read gate. A holder of the ledger's audit capability keeps reading every ledger row of the organization, as before. Comments written before this change have no rows; nothing is backfilled.
fix(plugin-auth): withdrawing an AI assistant in one organization no longer signs it out of the person's other organizations
6
+
7
+
Clause-②: no
8
+
Metadata-protocol: none
9
+
10
+
A person can authorize the same AI assistant (an OAuth client such as Claude Desktop) in two organizations. Withdrawing it in one of them, from the console (`POST /api/v1/auth/authorized-clients/withdraw` or the admin door) or with `POST /oauth2/revoke`, deleted only that organization's consent but every refresh token the assistant held for that person, in every organization. The assistant then stopped working in the other organization once its access token expired, and the person had to authorize it there again. A withdraw now deletes the refresh tokens minted in the withdrawn organization only: every one of them, rotated or live, and the access tokens minted from them. The other organization's refresh token keeps refreshing. A refresh token minted with no active organization belongs to the grant with no organization and is deleted when that grant is withdrawn. `/oauth2/revoke` answers exactly as before.
fix(formula): the bare-reference and unbound-root refusals say the expression faults, not that it evaluates to null
7
+
8
+
Clause-②: no
9
+
Metadata-protocol: none
10
+
11
+
-**`@objectstack/formula`.** In a `record`-scoped expression, a bare field name (`amount` where `record.amount` is meant) and a mistyped root (`pge.…` where the surface binds `page`) are unknown variables: the expression faults with `Unknown variable: NAME` and never reads the field. The `bare-reference` and `unbound-root` refusals used to say the name "resolves to nothing and the expression silently evaluates to null", which is true only of a formula field. They now say the expression faults, and `bare-reference` names three outcomes of that fault: a formula field reads null, an `error` validation rule refuses the write, an action's `visible` hides the action. `os validate`, `os build` and the `validate_expression` tool print the new sentences.
12
+
- Codes and params are unchanged (`bare-reference``{ name }`, `unbound-root``{ name, roots, suggestion }`). What is refused, warned or passed is unchanged. Only the English `message` changed, so a consumer that matched the old text re-keys to the `code`.
13
+
-**`create-objectstack`.** The scaffolded `AGENTS.md` no longer says a bare field reference "evaluates to `null`". It now says the predicate cannot be evaluated on any record, so an action whose `visible` reads it is hidden everywhere and an `error` validation rule that reads it refuses every write. Projects scaffolded earlier keep their copy until it is edited.
feat(platform-objects): Setup's user page gains an "AI Assistants" tab, for platform administrators
6
+
7
+
Clause-②: no
8
+
Metadata-protocol: none
9
+
10
+
-**`@objectstack/platform-objects`**: the `sys_user` record page (`sys_user_detail`) has a new "AI Assistants" tab, beside API Keys, labelled in en, zh-CN, ja-JP, es-ES and zh-Hant. Its body is the console widget `mcp:authorized-assistants`: the AI assistants (OAuth clients such as Claude Desktop) this person authorized, each with a confirm-first Revoke. An administrator can now see and end what acts as a person who cannot sign in to withdraw it themselves (a lost laptop, a departure). The tab is shown only to a platform administrator (`current_user.isPlatformAdmin == true` on the tab item): the widget's list and Revoke go through the platform-admin-gated `/api/v1/auth/admin/authorized-clients` doors, so any other viewer could only see a refusal. The server's gate is unchanged.
feat(platform-objects): mint and revoke SCIM connection credentials from the console
7
+
8
+
Clause-②: no
9
+
Metadata-protocol: none
10
+
11
+
`sys_scim_connection_credential` gains two actions, so a platform administrator setting up SCIM provisioning no longer needs curl to get a bearer token:
12
+
13
+
-**Mint Credential** (list toolbar) posts `POST /api/v1/auth/admin/scim/mint-credential` with a connection ID and the optional label, organization, provisioning domain and expiry, then shows the token once in a result dialog the administrator must close. Only the token's one-way digest is stored, so it cannot be shown again. Mint is not exposed to AI tools: an agent that ran it would hold a live SCIM bearer.
14
+
-**Revoke Credential** (a credential row or its record header) posts `POST /api/v1/auth/admin/scim/revoke-credential` for that row, after a confirmation. It is offered on an active credential only; the route's 404 and 409 answers show as the action's error. Revoke is exposed to AI tools and always asks the human to confirm first.
15
+
16
+
Both are offered only to a platform administrator and declare the routes' own gate (`manage_platform_settings`). Who may mint or revoke is unchanged: the routes still decide.
17
+
18
+
`@objectstack/plugin-auth`: a mint made on an impersonation session now names the administrator at the keyboard in its `sys_audit_log` row, as `metadata.impersonated_by` (the key the audit writers use). A mint on an ordinary session writes the same row as before.
Copy file name to clipboardExpand all lines: content/docs/data-modeling/formulas.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -239,7 +239,7 @@ come at two severities: **errors** fail the build; **warnings** are advisory
239
239
240
240
| Check | Example | Severity |
241
241
|:---|:---|:---|
242
-
|**Qualify field references** — a formula / validation / predicate binds only the `record` namespace, so a bare `amount`resolves to nothing and evaluates to `null`. Write `record.amount`. |`amount > 100` → `record.amount > 100`| error |
242
+
|**Qualify field references** — a formula / validation / predicate binds only the `record` namespace, so a bare `amount`is an unknown variable and the expression faults instead of reading the field: a formula reads `null`, and a predicate takes its site's fault outcome (an `error` validation rule refuses the write, an action's `visible` hides the action). Write `record.amount`. |`amount > 100` → `record.amount > 100`| error |
243
243
|**Field must exist** — a typo'd `record.<field>` is flagged with a did-you-mean. |`record.amont` → `record.amount`| error |
244
244
|**Unknown function** — a misspelled or nonexistent stdlib call. |`isBlnk(record.x)`| error |
245
245
| **Type soundness** — a text or boolean field used with an arithmetic (`+ - * / %`) or ordering (`< > <= >=`) operator against a number faults at runtime unless the text is numeric. In a formula it evaluates to `null`. Where a fault does something else it is an error, worded for what happens: a validation rule, a field `requiredWhen` / `readonlyWhen`, an option `visibleWhen` or a hook `condition` refuses the write; a record-triggered flow's start, edge or `decision` branch condition fails the run (the write that fired it still lands), whether it reads the field bare or as `record.<field>`, and so does a time-relative flow's that sweeps the same object, where no write fires the run and only the run for that row fails; a bare name that a declared flow variable or a `screen` field holds reads that value, so it is not judged as the field, and a bare name after a node that can bind any name (`script`, `connector_action`, `wait`, `subflow`, `map`, a screen with no fields) gets the warning instead, while its `record.<field>` read is still refused; an advisory (`severity: 'warning'` / `'info'`) validation rule is skipped, so it never gives its advisory. Store it as a number field, compare text with text, or convert explicitly (`size(record.name)` for the length; `double(record.name)`, which itself faults on text that is not a number). | `record.title * 2`; `record.name > 5` in a validation rule → `size(record.name) > 5` | warning in a formula or a display predicate, and in a condition of any other flow, where the warning says the run fails if the condition faults (what such a flow binds under the name depends on how it is started); error at the sites named |
Copy file name to clipboardExpand all lines: content/docs/deployment/validating-metadata.mdx
+10-5Lines changed: 10 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,9 @@ they reference record fields through the `record.` scope:
28
28
29
29
```ts
30
30
// ✗ Wrong — `done` is a bare reference. It type-checks (it's just a string),
31
-
// but at runtime it resolves to null → the action is hidden on EVERY record.
31
+
// but at runtime it is an unknown variable, so the predicate faults on every
32
+
// record — and the Console hides an action whose `visible` faults: hidden on
33
+
// EVERY record.
32
34
{ name: 'mark_done', visible: '!done' }
33
35
34
36
// ✓ Right
@@ -896,16 +898,19 @@ What the failure does depends on what the predicate guards:
896
898
897
899
| Predicate | On failure |
898
900
| :--- | :--- |
899
-
| A field's `visibleWhen`, `readonlyWhen`, `requiredWhen`; a view's `visibleOn`; an option's `visibleWhen`; list conditional formatting |**Fail open**: the rule's safe default applies, so a broken rule never hides a field. A rule that never fires while its field stays visible is the symptom, usually a bare field name where `record.<field>` was meant |
901
+
| A field's `visibleWhen`, `readonlyWhen`, `requiredWhen`; a view's `visibleOn`; an option's `visibleWhen`; list conditional formatting |**Fail open in the Console's rendering**: the rule's safe default applies, so a broken rule never hides a field. A rule that never fires while its field stays visible is the symptom, usually a bare field name where `record.<field>` was meant. This row is the Console's display only; the server judges `requiredWhen`, `readonlyWhen` and an option's `visibleWhen` again on the write (see below)|
900
902
| An object field group's `visibleWhen`|**Fail closed**: the whole group is hidden on the form and the record page |
901
903
| A page node's `visibleWhen` / `visible` / `hidden`, and a `page:tabs` item's `visibleWhen`|**Fail closed**: the node or tab is withheld; a withheld related list is not counted in its tab badge |
902
904
| A navigation item's or area's `visible`|**Fail open**: the item renders for everyone, reported under `app-shell:visible`|
903
905
904
906
At **submit** a broken field rule is refused, not passed. A field `visibleWhen` that
905
907
cannot be evaluated refuses the submit on the client, with a message naming the field
906
-
and the rule, because no server evaluates `visibleWhen`. A broken `requiredWhen` or
907
-
`readonlyWhen` is refused by the server, and the form shows that refusal beside the
908
-
input. A `visibleWhen` that reads `previous` cannot be evaluated on a create form, so
908
+
and the rule, because no server evaluates a field's `visibleWhen`. A broken
909
+
`requiredWhen` or `readonlyWhen`, or an option's `visibleWhen`, is refused by the
910
+
server, and the form shows that refusal beside the input. One exception: a
911
+
`readonlyWhen` that reads a name the write does not bind (a bare field name, or
912
+
`parent` where no master-detail header was resolved) holds the lock instead: the
913
+
server drops the incoming change to that field and the rest of the write lands. A `visibleWhen` that reads `previous` cannot be evaluated on a create form, so
909
914
such a form is always refused.
910
915
911
916
A **blank** rule (`''`, whitespace, or an envelope whose `source` is blank) is not "no
0 commit comments