Skip to content

Commit 74a7e4c

Browse files
committed
Merge origin/main into claude/project-thread-3giljf
Claude-Session: https://claude.ai/code/session_01QSeKYm8sWjp2Pk76warN7w Co-authored-by: Claude <noreply@anthropic.com>
2 parents 0f93f8f + 84177cf commit 74a7e4c

37 files changed

Lines changed: 2043 additions & 138 deletions
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/rest': patch
3+
---
4+
5+
feat(rest): the import door's `mappingName` takes the `/meta` door's qualified address `NAMESPACE/NAME`, so a mapping name two packages hold can be imported by naming its holder (ADR-0150 D5)
6+
7+
Clause-②: yes
8+
Metadata-protocol: none
9+
10+
`POST /api/v1/data/:object/import` and `POST /api/v1/data/:object/import/jobs` read `mappingName: "<namespace>/<name>"` as the address `GET /api/v1/meta/mapping/<namespace>/<name>` reads, through the same protocol reads (`resolveMetaItemAddress`, then the exact qualifier `?package=` naming the namespace's holder): the import applies exactly that package's mapping. `"_env/<name>"` names the mapping saved in the environment (`admitEnvironmentQualifier`). A qualifier naming a namespace, or the environment, that holds no mapping of the name while a package does is refused `409 RESOURCE_CONFLICT` with the `not-held-by-qualifier` sentence that read answers, naming every holder, and no row is written.
11+
12+
Only a new optional spelling is added. A `mappingName` with no `/` reads and answers exactly as before: the environment's own mapping, else the one package holder, else `409` naming both holders. A first segment that is neither `_env` nor an installed namespace is no address, and the whole string is read as the name it always was read as (a mapping name is snake_case, so it answers `404 MAPPING_NOT_FOUND`), never the part after the `/`. The address keeps the metadata read's two limits: a shareable namespace (`base`, `system`, `sys`) two of whose packages hold the name answers `409` naming both, and a mapping named like a `/meta` sub-resource segment (`history`, `layers`, …) has no qualified address.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
'@objectstack/plugin-auth': patch
3+
'@objectstack/platform-objects': patch
4+
---
5+
6+
fix(plugin-auth)!: a user a SCIM directory provisions reads `idp_provisioned` from the moment SCIM creates it, and users a directory provisioned earlier are marked once at boot
7+
8+
Clause-②: yes (narrowing) — every refusal and hidden action keyed on a directory-owned identity (`sys_user.source = 'idp_provisioned'`) now applies to a SCIM-provisioned user who holds no local password: `POST /api/v1/auth/admin/set-user-manager` answers `403 PERMISSION_DENIED` with reason `idp_provisioned`; the admin bulk import (`POST /api/v1/auth/admin/import-users`) refuses that user's `manager_id` link through the same refusal; `admin/set-user-password` on a cloud-managed environment answers `409 RESOURCE_CONFLICT`; the Setup "Set Manager" row action is hidden; and the self-service Change Password, Change Email and Delete My Account actions are hidden (ADR-0135 D4, D5.2).
9+
Metadata-protocol: none
10+
11+
<!-- adr-0087: not-required (no-migration-prescription) No key of any schema is added, removed, renamed or re-shaped, no export changes, and `sys_user.source` keeps its two values. The stored rows the rule covers are marked by the boot pass itself, so there is nothing for a migration to rewrite. -->
12+
13+
**BREAKING** accept-set narrowing for SCIM-provisioned users (ADR-0135 D4).
14+
15+
- A user a SCIM connection creates, re-links through a tombstone or reprovisions reads `sys_user.source = 'idp_provisioned'` ("IdP-Provisioned" in Setup), written in the same transaction as the SCIM write. On a create or another active write the mark fails closed: if it cannot be written, the SCIM request fails, nothing persists, and the identity provider retries it. On a deactivation or a `DELETE` the account is disabled first and the mark after it is best-effort, so a mark that cannot be written never leaves a deprovisioned account enabled; it is logged at `error` and re-run by the next active write and the boot pass.
16+
- At boot, every user that owns a `sys_scim_subject` row and does not already read `idp_provisioned` is marked. The pass logs how many users it marked and writes nothing on a later boot.
17+
- A user who holds a local password keeps `env_native`: setting a password on a directory-provisioned user still flips it to `env_native`, and a later SCIM sync or boot leaves that value.
18+
- `sys_user.source`'s description names SCIM directory provisioning beside federated SSO (`@objectstack/platform-objects`).
19+
20+
**Who moves: the manager of a SCIM-provisioned user.** For a SCIM-provisioned user with no local password, the admin set-manager endpoint, the Setup "Set Manager" button and the bulk import's `manager_id` column all refuse ("directory wins, per identity"). The platform does not write the manager from SCIM: it declares the SCIM `manager` attribute without projecting it onto `sys_user.manager_id`, and an existing `manager_id` value stays as it is. An approval node whose `manager` rung resolves to nobody for such a user can declare `onEmptyApprovers: 'fallback'` with a `fallbackApprovers` list; the other remedy is a provisioning path your deployment supplies that writes the column.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
'@objectstack/spec': minor
3+
'@objectstack/lint': minor
4+
---
5+
6+
fix(spec,lint)!: `deriveColumnSummary` declares the stored value a `min` / `max` column summary answers, and an `object-grid` aggregation that sums or averages a field the aggregate × field-type table refuses is refused at authoring (`grid-aggregation-field-type-refused`) (#32144)
7+
8+
Clause-②: yes (narrowing)
9+
Both halves: item 1 widens a published return type of `deriveColumnSummary`; item 2 narrows what authoring accepts for an `object-grid` aggregation.
10+
Metadata-protocol: narrowed
11+
Skills-docs: none — `skills/**` and `content/docs/**` teach no `object-grid` `aggregations` entry and no return type of `deriveColumnSummary`; the reasoning ships as the `os explain grid-aggregation-field-type-refused` entry.
12+
13+
<!-- adr-0087: not-required (no-migration-prescription) No key of any schema is added, removed or renamed: GridAggregationSchema keeps its shape, and lint now gives an object-grid aggregation the verdict the engine aggregate door already gives the same pair at query time. A refused pair never drew a meaningful number (a grid that owns its fetch had its grouped header query answered 400 INVALID_FIELD, a grid handed its rows drew 0 for a text sum), and which field or function the author meant is not something a conversion can choose; the refusal names the aggregates the field's type accepts. -->
14+
15+
**`deriveColumnSummary` (`@objectstack/spec/ui`).** Its declared return was `number | null | undefined`, but a `min` / `max` column carries the aggregated field's STORED value: ISO text for a `datetime`, `YYYY-MM-DD` for a `date`. The function is now generic over the summary it is given and returns `ColumnSummaryValue<S> | null | undefined`, a new exported type: a `number` for `count`, `count_unique`, `sum`, `avg`, `count_filled`, `count_empty`, `percent_filled` and `percent_empty`, `unknown` for `min` / `max`, and nothing for `none`. Nothing is converted at runtime: a date turned into a number would lose the value a renderer draws.
16+
17+
- **Who notices.** A TypeScript caller that passes a summary typed as the whole `ColumnSummary` union (or `ColumnSummary | ColumnSummaryConfig`) now gets `unknown`, because that summary may be `min` / `max`; a caller that did arithmetic on that result must narrow it first (`typeof value === 'number'`), or pass a literal member. A caller passing a literal counting member (`'sum'`, `{ type: 'percent_empty', … }`) still gets `number | null | undefined`.
18+
19+
**BREAKING** accept-set narrowing in `os validate` / `os build` / `os lint` and at the page publish door (`PUT /api/v1/meta/page/NAME`; Studio, REST and MCP authors): an `object-grid` block whose `properties.aggregations` entry is `sum` or `avg` over a field the aggregate × field-type table (`AGGREGATE_FIELD_TYPE_COMPATIBILITY`) refuses for that function is refused at `error`, rule `grid-aggregation-field-type-refused`.
20+
21+
- **Before.** `{ field: 'created_at', type: 'sum' }` (or `avg` over a text, date, option, reference or `formula` field, or `sum` over a `percent`) passed authoring. A grid that owns its fetch then had its grouped header query refused by the engine's `aggregate` door with `400 INVALID_FIELD`; a grid handed its rows (`data.provider: 'value'`) grouped them in the browser and drew a number the pair cannot mean (`0` for a text sum).
22+
- **Now.** The same pair is refused where the author writes it, at `pages[i]….properties.aggregations[j]`, and the fix line names the aggregates the field's type accepts (a `formula` field gets the spec's store-it-as-a-number remedy).
23+
- **Accepted.** `sum` over number, currency, rating, slider, progress, summary, boolean and toggle; `avg` over the same plus percent; `count` over any field. `count_distinct`, `min` and `max` are not judged by this rule.
24+
- **Not judged.** An object the stack does not define or that declares no field map, a field that does not resolve, a dotted path, a field two packages define at the same priority, and a field whose declaration carries no type (`id`) or a type outside `FieldType`.
25+
26+
**The remedy.** Point `sum` / `avg` at a numeric field, or aggregate the field with one its type accepts (`min` / `max` for a date, a count for text).
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@objectstack/cli': patch
3+
---
4+
5+
fix(cli): `os init` writes its starter object the way `os g object` does, with `Field.*` builders and a named export
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The `app` and `plugin` templates of `os init` wrote the starter object's fields as raw `{ type: 'text', … }` literals and exported the object as a default export only. `os generate object` and the `npm create objectstack` starter write each field through a `Field.*` builder and export the object by name, so a project created by `os init` mixed two styles as soon as its author ran `os g object`.
11+
12+
- FROM: `const myAppItem = ObjectSchema.create({ fields: { name: { type: 'text', … } } }); export default myAppItem;`, with the barrel line `export { default as myAppItem } from './my_app_item.object';`
13+
- TO: `export const myAppItem = ObjectSchema.create({ fields: { name: Field.text({ … }) } }); export default myAppItem;`, with the barrel line `export { myAppItem } from './my_app_item.object';`, which is the line `os g object` appends.
14+
15+
The compiled object is unchanged: each builder returns the literal it replaces. The default export stays, so the starter app, the list view and any code that default-imports the object keep working. Existing projects need no change.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/lint': patch
3+
---
4+
5+
feat(lint): note a caller-keyed update policy that declares no check, at info tier
6+
7+
Clause-②: yes (widening)
8+
Metadata-protocol: none
9+
10+
New rule `security-update-policy-no-check`, severity `info`. It reports a row-level policy whose `operation` is `update` or `all`, whose `using` compares a column other than `created_by` with `current_user.id` (`owner_id == current_user.id`, an assignee), and which declares no `check`. The rule it states: a row-level policy with no `check` also admits new rows the ownership floor admits; declare `check` to bound what an update may write. Its fix line states the side effect: declaring `check` on any applicable policy takes the USING-only siblings and the floor out of the check, so a creator who is not the owner loses update unless a `check` admits them. `os explain security-update-policy-no-check` carries the composition (ADR-0058 D4).
11+
12+
The finding refuses nothing. It is `info` tier, and `--strict` promotes warnings, never an `info` finding, so neither `os lint --strict` nor `os validate --strict` fails on it. A policy keyed on `created_by` alone, a policy that declares a non-blank `check`, a `select`, `insert` or `delete` policy and a disabled policy are not reported. The rule id is exported from `@objectstack/lint` as `SECURITY_UPDATE_POLICY_NO_CHECK`.

‎content/docs/automation/approvals.mdx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ managed-update whitelist. SCIM provisioning and directory sync can populate it t
102102
through a provisioning path your own deployment supplies: this platform declares the SCIM
103103
`manager` attribute without projecting it onto the column. Where an identity carries
104104
`source: 'idp_provisioned'` the admin operation **refuses**, so that directory stays the one
105-
surface that authors its manager.
105+
surface that authors its manager. A user a SCIM connection provisions carries that value from its
106+
creation unless it holds a local password, so for such a user the column is written only by that
107+
deployment-supplied path, and a value the column already holds stays as it is.
106108

107109
Setting the column is still something you have to *do*. Where `manager_id` is unset the rung
108110
expands to nobody, and under the default `onEmptyApprovers: 'admin_rescue'` the request opens on

‎content/docs/data-modeling/import-mappings.mdx‎

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,26 @@ Both end up resolvable by the same name. When the import endpoint resolves
8181
falls back to the packaged registry — so a runtime-saved mapping and a packaged one are
8282
addressed identically by the request.
8383

84-
`mappingName` names no package, so the name resolves the way any read that names no
85-
package does (ADR-0150 D3): the environment's own mapping, else the one package that
84+
A bare `mappingName` names no package, so the name resolves the way any read that names
85+
no package does (ADR-0150 D3): the environment's own mapping, else the one package that
8686
holds the name. When **two packages** hold the same mapping name, the import is refused
8787
with `409 RESOURCE_CONFLICT` naming every package that holds it, and no row is written;
88-
it never picks one of them. A request cannot yet name the package, so give one of the
89-
two mappings another name. `GET /api/v1/meta/mapping/<name>` answers the same `409`;
90-
`?package=<id>` or `/meta/mapping/<namespace>/<name>` reads one holder's mapping.
88+
it never picks one of them. `GET /api/v1/meta/mapping/<name>` answers the same `409`.
89+
90+
To name the holder, put the mapping's qualified address in `mappingName`:
91+
`"<namespace>/<name>"`, where the namespace is the holding package's manifest
92+
`namespace`, or `"_env/<name>"` for the mapping saved in the environment. It is the
93+
address `GET /api/v1/meta/mapping/<namespace>/<name>` reads, and the import door reads it
94+
the same way (ADR-0150 D5). The import applies exactly that holder's mapping. When that
95+
namespace, or the environment, holds no mapping of the name and a package does, the
96+
import is refused with the `409 RESOURCE_CONFLICT` that read answers, naming every holder,
97+
and no row is written. A first segment that is neither `_env` nor an installed namespace
98+
is no address: the whole string is read as the name, which no mapping has, so the import
99+
answers `404 MAPPING_NOT_FOUND`. Two limits come with the metadata read's address. Where
100+
two packages that share a namespace (`base`, `system`, `sys`) both hold the name, the
101+
address answers `409` naming both. A mapping named like one of that read's sub-resource
102+
segments (`audit`, `diff`, `history`, `layers`, `publish`, `published`, `references`,
103+
`rollback`, `tree`) has no qualified address, and is imported by its bare name.
91104

92105
The `mapping` kind carries no per-organization overlay: there is no tenant-customized
93106
variant of a packaged mapping. A tenant that needs different columns saves its own
@@ -262,7 +275,7 @@ These are whole-request failures — nothing is written, and there is no per-row
262275
| Status | `code` | Cause |
263276
|:---|:---|:---|
264277
| 404 | `MAPPING_NOT_FOUND` | No mapping artifact is registered under that name. |
265-
| 409 | `RESOURCE_CONFLICT` | Two or more packages hold a mapping under that name, and the environment holds none; the error names every holder. |
278+
| 409 | `RESOURCE_CONFLICT` | Two or more packages hold a mapping under that name, and the environment holds none; or a qualified `mappingName` (`<namespace>/<name>`, `_env/<name>`) names a holder that holds no mapping of that name while another does. The error names every holder. |
266279
| 400 | `MAPPING_TARGET_MISMATCH` | The artifact's `targetObject` is not the object in the URL. |
267280
| 400 | `MAPPING_FORMAT_UNSUPPORTED` | The artifact declares `sourceFormat: 'xml'` or `'sql'`; the endpoint accepts csv, json and xlsx payloads only. |
268281
| 400 | `MAPPING_FORMAT_MISMATCH` | The declared `sourceFormat` contradicts the payload actually sent. A `csv` mapping does apply to an `xlsx` payload — those rows are tabular in the same way — but a `json` mapping does not. |

‎content/docs/permissions/access-recipes.mdx‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,16 @@ definePermissionSet({
3232
objects: { deal: { allowRead: true, allowCreate: true, allowEdit: true } },
3333
fields: { 'deal.commission': { readable: false } }, // FLS: hide a field
3434
rowLevelSecurity: [
35-
{ name: 'own_deals', object: 'deal', operation: 'all', using: 'owner_id == current_user.id' },
35+
{
36+
name: 'own_deals', object: 'deal', operation: 'all',
37+
using: 'owner_id == current_user.id', // the rows a rep reads, edits and deletes
38+
check: 'owner_id == current_user.id', // every row a rep's insert or update writes
39+
},
3640
],
3741
});
3842
```
3943

44+
- **Declare `check` on a write policy.** When no applicable policy declares `check`, each policy's `using` stands in as the write check, OR-combined with the platform's ownership floor (`created_by == current_user.id`) wherever the write's row gate keeps it, so a USING-only `owner_id` policy also admits an update by the deal's creator; once any applicable policy declares `check`, only the declared checks decide and the USING-only policies and the floor leave the check, so a creator who is not the owner loses update unless a `check` admits them.
4045
- **"My own"** vs **"my team's"** vs **"the org's"** is the RLS *depth* axis (`readScope` / `writeScope`: `own | own_and_reports | unit | unit_and_below | org`, ADR-0057). A manager set uses `unit`; a rep uses `own`. The hierarchy-relative scopes (`own_and_reports` / `unit` / `unit_and_below`) need the enterprise hierarchy resolver and **fail closed to `own`** without it — see [Access depth](/docs/permissions/permission-sets#access-depth--readscope--writescope-adr-0057-d1).
4146
- Grants combine **most-permissively** across a user's sets; the tenant-isolation policy `AND`s on top; the superuser bypass (`viewAllRecords` / `modifyAllRecords`) short-circuits RLS where the object's posture allows it (ADR-0066).
4247
- For genuinely sensitive objects, set `access: { default: 'private' }` so they are **not** covered by blanket wildcard grants — access needs an explicit grant.

0 commit comments

Comments
 (0)