Skip to content

Commit e241a87

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/issue-36344-markdown-cell-heading
2 parents 919a2f4 + 4e55e4e commit e241a87

55 files changed

Lines changed: 2706 additions & 180 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: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
'@objectstack/formula': minor
3+
'@objectstack/spec': minor
4+
---
5+
6+
fix(formula)!: a flow condition that does date arithmetic on `record.FIELD` or `previous.FIELD` is now refused, as the bare field name already was
7+
8+
Clause-②: no (narrowing)
9+
Metadata-protocol: narrowed
10+
11+
<!-- adr-0087: registered flow-condition-record-date-arithmetic-refused -->
12+
13+
**BREAKING** accept-set narrowing. In a flow condition (a start, edge or `decision` branch condition) the run binds the record's fields under their bare names and also as `record`, with the row before the write as `previous`. The date-arithmetic check judged only the bare name: `due_date + 1 > 5` over a `date` field was refused, but `record.due_date + 1 > 5` passed `os validate` and the publish door. The flow then failed on every run, because a date field reaches the run as its `YYYY-MM-DD` text and the evaluator cannot add a number to it.
14+
15+
- **The verdict.** A `record.FIELD` / `previous.FIELD` read of a `date` or `datetime` field in arithmetic against a number now gets the verdict its bare name gets, with the same code and outcome arm (`date-arithmetic-run-fails` on a record-triggered flow or a sweep of the typed object, `date-arithmetic-run-may-fail` elsewhere). A root read keeps the row's arm where bare names are unproven or a flow variable shadows the bare name. The message names the read as written and prescribes `daysBetween(a, b)` or `addDays(d, n)`.
16+
- **Where.** `os validate` / `os build` (`validateStackExpressions`) report an `error`, and the flow publish door refuses the publish with `INVALID_METADATA` (422). `registerFlow` logs it as an advisory, as it does for the bare name, and still registers the flow, so a stored flow keeps its run-time behaviour until it is next published.
17+
- **Not refused.** An ordering of the field (`record.due_date < today()`), `daysBetween` / `addDays` over it, and the date-text shapes, which keep their own verdicts. Formula fields and validation rules read `record.FIELD` already and were refused before. The run-time evaluator is unchanged.
18+
19+
## FROM → TO
20+
21+
| FROM | TO |
22+
|:---|:---|
23+
| `record.due_date + 1 > 5` | `daysBetween(record.due_date, today()) > 5` (days past due) or `addDays(record.due_date, 1) < today()` (a shifted date) |
24+
| `previous.due_date - 7 < today()` | `addDays(previous.due_date, -7) < today()` |
25+
26+
One-line fix: in a flow condition, never add or subtract a number on a date field read through `record` or `previous`; use `daysBetween(a, b)` for a span and `addDays(d, n)` to shift a date.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
---
4+
5+
fix(console): a view settings save is pinned to the draft it opened, so it can no longer be published by someone else's Save to this view
6+
7+
Clause-②: yes (widening) — `ViewConfigPanel`'s `onSave` host prop gains an optional second parameter, the panel's draft-version guard (`saveDraft`), which the panel always passes; a host that takes one argument is called as before; nothing removed or renamed
8+
Metadata-protocol: none
9+
10+
**Save to this view** on a shared view writes a draft and then publishes it. A save from the view settings panel that landed between the two used to overwrite that draft unpinned, and the publish then made the settings panel's unreviewed change live for everyone.
11+
12+
- The view settings panel now sends its draft save pinned to the draft it opened: `If-Match` with the version its load read, or `If-None-Match: *` when the view had no draft. After a save lands, the next one is pinned to that save's receipt. A save over a draft that changed since (another admin's settings save, or a Save to this view in flight) is refused by the server, and the panel opens the Studio editors' draft conflict dialog: reload the saved version, overwrite it after a second confirmation, or keep editing. The edit stays in the panel until the author chooses.
13+
- Creating a view (the Create View dialog, the panel's create mode, Save as view) sends the first-write pin, `If-None-Match: *`, so a create over a name that already holds a pending draft is refused instead of writing over it.
14+
- A host of `ViewConfigPanel` that writes through the guard it receives gets the pin and the dialog; a host that ignores it saves unpinned, as before.
15+
16+
No metadata key, value or default changes.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
'@objectstack/formula': minor
3+
'@objectstack/lint': minor
4+
'@objectstack/service-automation': minor
5+
'@objectstack/spec': minor
6+
---
7+
8+
fix(formula): the `list-equality` refusal prescribes a rewrite that works where it is read, and a flow condition is judged only where the run binds a row of the typed object
9+
10+
Clause-②: yes (widening)
11+
Metadata-protocol: added
12+
Skills-docs: follow-up #36217
13+
14+
The two widenings. A flow condition in a flow that no record write or sweep starts (an API, scheduled or trigger-less flow) is no longer refused as `list-equality`, bare or `record.`: that run holds what its entrance handed it, so `labels == 'frontend'` can be correct code there. And `ExprSchemaHint` gains the optional key `filterCompiled`, which tells the validator that the site's source compiles to a query filter.
15+
16+
The rewrite the refusal prescribes now depends on the site, and is parenthesised whole so it can stand where the comparison stood (`A && (…)`):
17+
18+
- **A `record.` / `previous.` read evaluated as CEL** (a validation rule, a field rule, a formula, an action's `visible` / `disabled` / `pressed`, a hook condition):
19+
- FROM `record.labels != null && "frontend" in record.labels`
20+
- TO `(has(record.labels) && record.labels != null && "frontend" in record.labels)`
21+
- `has()` answers on a sparse row or a null `previous`, where the old form faulted.
22+
- For `!=` the TO form is `(!has(record.labels) || record.labels == null || !("frontend" in record.labels))`. The old `!=` form, with no parentheses, split under a leading `&&`.
23+
- **A bare name at a flow condition:**
24+
- FROM `labels == null || !("frontend" in labels)`
25+
- TO `(labels == null || !("frontend" in labels))`
26+
- For `==` the TO form is `(labels != null && "frontend" in labels)`.
27+
- **A sharing rule `condition`**, which compiles to a query filter:
28+
- FROM `record.labels != null && "frontend" in record.labels`, which does not lower (`in` needs a field on its left), so the rule was dropped as `sharing-rule-unlowerable-condition`.
29+
- TO `(record.labels != null && record.labels.contains("frontend"))`, which lowers to a membership filter (`$contains`).
30+
- For `!=` the TO form is `(record.labels == null || !record.labels.contains("frontend"))`.
31+
- A number or boolean operand is passed as its text (`contains("3")`).
32+
33+
One-line fix: write the rewrite the refusal names.
34+
35+
`registerFlow`'s advisory pass now hands the validator `faultOutcome: 'run-fails'` on a record-triggered flow and on a time-relative sweep of the typed object, the same flows `os validate` declares it on. On those flows its logged type-mismatch lines now use the wording `os validate` prints. It still only logs and never throws.

‎.changeset/sec2-ggfh.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
'@objectstack/plugin-auth': patch
3+
'@objectstack/platform-objects': patch
4+
---
5+
6+
fix(plugin-auth)!: deleting an SSO provider ends the sessions a sign-in through it opened and removes its projected grants
7+
8+
Clause-②: no (narrowing)
9+
Metadata-protocol: none
10+
Skills-docs: none — no published skill teaches deleting an SSO provider, its sessions or its projected grants; the rule is documented in `content/docs/permissions/sso.mdx` ("Deleting an SSO provider")
11+
12+
<!-- adr-0087: not-required (no-migration-prescription) No authorable key, value or export is added, removed, renamed or re-shaped. `sys_session` gains a system-managed, read-only column the platform writes itself, and what changes is which sessions and projected grants stay live once an SSO provider is gone: no stored metadata row, registry key or authored value moves, so there is nothing for a migration to rewrite. -->
13+
14+
**BREAKING** for a session a sign-in through an SSO provider opened: deleting that provider ends the session, and its next request is answered as signed out. Sessions opened any other way are not touched.
15+
16+
- **Sessions.** Each session an SSO sign-in opens records the provider it was signed in through, in the new read-only `sys_session.sso_provider_id` column. `POST /api/v1/auth/sso/delete-provider` revokes the live sessions that record the deleted provider (`revoke_reason: 'sso_provider_deleted'`). A session signed in any other way (a password, another provider) is left as it is, and a delete the vendor refuses ends nothing.
17+
- **The answer.** A successful delete's `data` carries `revokedSessions`, the number of live sessions it ended, beside the other counts, and its `message` says so.
18+
- **Projected grants.** A permission-set grant projected by an SSO provider's group mapping exists only while that provider does: the delete removes them, as before, and at every boot the grants whose `reason` names a provider with no `sys_sso_provider` row are removed too, as are live sessions recording such a provider. The boot does not remove the provider's group mappings (delete each with **Delete Mapping**, or `POST /api/v1/auth/admin/scim/delete-group-mapping`); it logs at `info` what it removed, and at `error`, with the remedy, when it could not. Several servers sweeping at once each remove what is left, and none reports the others' removals as a failure.

‎content/docs/permissions/sso.mdx‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,41 @@ the next one applies the mappings again.
10111011

10121012
---
10131013

1014+
## Deleting an SSO provider
1015+
1016+
Deleting a provider ends the sessions a sign-in through it opened and removes
1017+
the permission-set grants its group mappings projected. Setup's **Delete SSO
1018+
Provider** (or `POST /api/v1/auth/sso/delete-provider` with
1019+
`{ "providerId": "…" }`) first shows what the delete removes, then:
1020+
1021+
- **unlinks** every user who signed in through the provider;
1022+
- **ends the live sessions signed in through it.** Each session an SSO sign-in
1023+
opens records its provider (`sys_session.sso_provider_id`); the delete
1024+
revokes the live sessions that record this provider, with `revoke_reason`
1025+
`sso_provider_deleted`, so their next request is signed out. A session signed
1026+
in any other way (a password, another provider) is left as it is;
1027+
- **removes its group mappings and the permission-set grants they projected**
1028+
(the grants whose `reason` is the provider's projection marker), never a grant
1029+
made by hand or by SCIM.
1030+
1031+
The answer names each count: `unlinkedUsers`, `usersWithoutOtherSignIn`,
1032+
`revokedSessions`, `removedGroupMappings` and `removedGrants`. When the cleanup
1033+
after the delete fails, the answer says so (`dependentsRemoved: false`) and the
1034+
failure is logged once at `error`.
1035+
1036+
**At every boot**, the projected grants and live sessions of a provider that no
1037+
longer exists are removed too: a projected grant whose `reason` names a
1038+
provider with no `sys_sso_provider` row is deleted, and a live session that
1039+
records such a provider is revoked. So the grants and sessions a failed cleanup
1040+
left are settled at the next start; the boot logs at `info` what it removed,
1041+
and at `error` when it could not. The boot does **not** remove the provider's
1042+
group mappings: delete each one with Setup's **Delete Mapping** on its row, or
1043+
`POST /api/v1/auth/admin/scim/delete-group-mapping` with `{ "mappingId": "…" }`.
1044+
Several servers booting at once may run the sweep together; each removes what is
1045+
left and none reports the others' removals as a failure.
1046+
1047+
---
1048+
10141049
## Verify configuration
10151050

10161051
Restart the server (`pnpm dev`), then:

‎content/docs/ui/views.mdx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,10 @@ also holds Discard on a narrow list or a phone).
641641
widths into the view. When the view already has unpublished changes (a draft saved from
642642
the view settings, by anyone), nothing is saved: the Console says so and points to the view
643643
settings to publish or discard that draft first. Every other change to a shared view still
644-
goes to a draft that the view settings publish.
644+
goes to a draft that the view settings publish. A view settings save is pinned to the draft
645+
the settings opened, so one that lands while a Save to this view is between its save and its
646+
publish is refused, never published with it: the settings say the draft changed and offer
647+
to reload it, overwrite it or keep editing.
645648
- A footer calculation is offered on every column the saved view would carry: the columns
646649
the list draws and the fields the user added. Picking the view's own calculation again
647650
takes that column out of the draft.

‎docs/audits/2026-08-tenant-audit-write-call-sites.counts/plugins/plugin-auth.md‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,25 @@ a row or a number here — fix the code, or the census, and regenerate.
1414

1515
| Measure | Value |
1616
|---|---:|
17-
| Write call sites | 106 |
18-
| Object name statically decidable | 58 |
17+
| Write call sites | 108 |
18+
| Object name statically decidable | 60 |
1919
| Object name chosen at run time | 48 |
2020
| Object name spelled inline | 47 |
21-
| Object name spelled through a `const` | 11 |
21+
| Object name spelled through a `const` | 13 |
2222
| Object name is an `object: string` parameter | 3 |
2323
| Object name is some other run-time expression | 45 |
24-
| Against a tenancy-enabled object | 56 |
24+
| Against a tenancy-enabled object | 58 |
2525
| Against an object declaring tenancy off | 2 |
26-
| Threading a tenant context | 62 |
26+
| Threading a tenant context | 64 |
2727
| Provably carrying none (options read, no context key) | 15 |
2828
| …and decidably tenancy-enabled | 3 |
2929
| Options argument unreadable | 29 |
3030
| …and decidably tenancy-enabled | 16 |
31-
| Threading a decidably elevated (`isSystem`) context | 44 |
31+
| Threading a decidably elevated (`isSystem`) context | 46 |
3232
| Threading a decidably non-elevated context | 0 |
3333
| Threading a context of undecidable elevation | 47 |
3434
| Receiver carried a readable engine type | 80 |
35-
| Receiver erased, placed by the object NAME | 24 |
35+
| Receiver erased, placed by the object NAME | 26 |
3636
| Receiver erased, placed by an `object: string` PARAMETER | 1 |
3737
| Receiver erased, placed by an `UNTYPED_RECEIVERS` row | 1 |
3838

@@ -125,7 +125,9 @@ a row or a number here — fix the code, or the census, and regenerate.
125125
| `packages/plugins/plugin-auth/src/session-tombstone.ts` | `update` | `objectName` | undecidable | options unreadable | 1 |
126126
| `packages/plugins/plugin-auth/src/sso-client-secret.ts` | `update` | `sys_sso_provider` | disabled | elevated | 1 |
127127
| `packages/plugins/plugin-auth/src/sso-provider-lifecycle.ts` | `delete` | `IDP_GROUP_MAPPING_OBJECT` | undecidable | PROVABLY NONE | 1 |
128+
| `packages/plugins/plugin-auth/src/sso-provider-lifecycle.ts` | `update` | `sys_session` | enabled | elevated | 1 |
128129
| `packages/plugins/plugin-auth/src/sso-provider-lifecycle.ts` | `delete` | `sys_user_permission_set` | enabled | elevated | 1 |
130+
| `packages/plugins/plugin-auth/src/sso-session-provider.ts` | `update` | `sys_session` | enabled | elevated | 1 |
129131
| `packages/plugins/plugin-auth/src/sys-session-revoke.ts` | `update` | `SystemObjectName.SESSION` | undecidable | elevated | 1 |
130132
| `packages/plugins/plugin-auth/src/user-ban-write.ts` | `update` | `sys_user` | enabled | context, elevation undecidable | 1 |
131133
| `packages/plugins/plugin-auth/src/user-session-admission.ts` | `update` | `sys_user` | enabled | elevated | 2 |

‎packages/formula/src/cel-engine.ts‎

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,10 @@ export function firstTypeMismatch(
13391339
operands: string;
13401340
celType: FieldCelType;
13411341
field: string | null;
1342-
/** [#29959] Set when a flattened condition's mismatch is a `record.<field>` / `previous.<field>` read. */
1342+
/**
1343+
* [#29959, #34946] Set when a flattened condition's mismatch (`type-mismatch`
1344+
* or `date-arith`) is a `record.<field>` / `previous.<field>` read.
1345+
*/
13431346
root?: 'record' | 'previous';
13441347
category: 'date-arith' | 'type-mismatch';
13451348
} | null {
@@ -1419,12 +1422,24 @@ export function firstTypeMismatch(
14191422
}
14201423
// [#29959] A flattened condition reads the same field as `record.<field>`
14211424
// (and `previous.<field>`), which the bare typing above leaves `dyn`. A
1422-
// second pass types those roots too, for the text/boolean mismatch only:
1423-
// the same verdict the bare name gets. The `date-arith` verdict stays the
1424-
// bare name's alone, as before; the date-text family reaches the roots
1425-
// through `validate.ts`'s record-root pass (#34662).
1425+
// second pass types those roots too, for the verdicts the bare name gets
1426+
// here: the text/boolean mismatch, and (#34946) date/duration arithmetic
1427+
// against a number — `record.due_date + 1` faults on the field's text on
1428+
// every run exactly as `due_date + 1` does. Either names the read as
1429+
// written (`root`). The date-text family reaches the roots through
1430+
// `validate.ts`'s record-root pass (#34662), which stands down on the
1431+
// date-arith shape answered here ({@link recordRootReadsFaultDateArith}).
14261432
if (scope !== 'flattened' || !RECORD_ROOT_READ_RE.test(source)) return null;
14271433
const rootTyped = unsoundOverload(buildTypedEnv(bareTypes, 'flattened', 'timestamp', fieldCelTypes));
1434+
if (rootTyped && isDateArith(rootTyped)) {
1435+
const read = offendingRecordRead(source, fieldCelTypes, 'timestamp');
1436+
return {
1437+
operator: rootTyped[2], operands: `${rootTyped[1]} ${rootTyped[2]} ${rootTyped[3]}`,
1438+
celType: 'timestamp', category: 'date-arith',
1439+
field: read?.field ?? null,
1440+
...(read ? { root: read.root } : {}),
1441+
};
1442+
}
14281443
const r = rootTyped && textOrBool(rootTyped) ? confirmAgainstDateText(rootTyped, fieldCelTypes) : null;
14291444
const celType = r ? textOrBool(r) : null;
14301445
if (!r || !celType) return null;
@@ -1595,7 +1610,8 @@ export function firstDateTextVerdict(
15951610
* name `dyn`) is date/duration arithmetic against a number ({@link isDateArith})
15961611
* — `record.due_date + 1`. That shape is the `date-arithmetic` family's, and it
15971612
* is exactly where the bare name's own order stops: {@link firstTypeMismatch}
1598-
* answers `date-arith` there and the date-text check is never asked. Any other
1613+
* answers `date-arith` there (for the root read too, #34946) and the date-text
1614+
* check is never asked. Any other
15991615
* Timestamp-typing fault — `record.end_date - record.start_date > 3` (a Duration
16001616
* ordered against a number), `record.d >= "2026-01-01"` (the text ordering the
16011617
* runtime answers) — leaves the bare name's mismatch check at null and the

0 commit comments

Comments
 (0)