Skip to content

Commit 7969da8

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/area-A5b-34199
Conflict in packages/spec/src/data/field.zod.ts resolved by hand: main's picker sentences (the value, orEmpty and lookupFilters describes as the picker change rewrote them) taken whole, and this branch's server sentence kept in each of the value and lookupFilters describes, with no PLANNED tail. Generated references are regenerated from the merged source in the next step. Claude-Session: https://claude.ai/code/session_01FEkQ5kgF3mo9f7LXuv5hac Co-Authored-By: Claude <noreply@anthropic.com>
2 parents 16c765b + cfcba53 commit 7969da8

402 files changed

Lines changed: 22221 additions & 24041 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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/metadata-protocol': patch
3+
---
4+
5+
fix(metadata-protocol): the read naming no bundle member serves an App pair's declared override of the canonical member a bundle addition ships
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
A read that names no bundle member addresses the canonical one (`en-US` for an email template), the same request as `?member=en-US`. When a bundle addition Z ships that canonical member beside another package's member of the same name (for example X ships `fr-FR`), and the App's customization pair (`<app>.custom`) stores a row declaring `overrides: { package: Z }` for it, `?member=en-US` already served the override. The plain read, the execution read and the layered read naming no member (`GET /meta/email_template/:name`, `?layers=true`) served Z's shipped `en-US` instead, and `/published`, which asks the layered read for its overlay exit, found no runtime-published row there.
11+
12+
They now judge the canonical member as `?member=en-US` does and read it at Z: the override is served, the layered `effective` is the override with Z's shipped member as `code`, and `/published` serves the override. The strict draft read and the layered draft layer stay where they were. Nothing else moves: no override declared, an undeclared pair row, a row declaring another package (still refused naming both), another package's own member, the environment's own item, a disabled shipper, and a bundle that ships no canonical member answer as before. No stored row changes shape.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
'@objectstack/plugin-auth': patch
3+
---
4+
5+
feat(auth): a cloud-managed environment can remove a pending person, cancelling their invitation at the host
6+
7+
Clause-②: yes (widening) — added: `POST /api/v1/auth/admin/remove-sso-user` (platform administrators, cloud-managed environments only); an optional `userRemoved` member on the environment-user host contract and the `'removed'` event kind; the `'deactivated'` value of the host outcome's `reason`. Nothing that was accepted is refused.
8+
Metadata-protocol: none
9+
10+
On a cloud-managed environment, a person added to sign in through the hosting organisation's identity provider stays pending until their first sign-in. Before this change a pending person with a typo in their email could only be deactivated.
11+
12+
**Removing a pending person.** `POST /api/v1/auth/admin/remove-sso-user` with `{ "userId": "…" }` asks the host first, outside any transaction, then removes the person with their positions, permission sets and membership in one unit of work:
13+
14+
- The host is told through `userRemoved`. A host without it is told through `userDeactivated` with `source: 'idp_pending'`, which already means "cancel the invitation". A host should implement `userRemoved`.
15+
- A host refusal (403/409) answers with the host's sentence, and no one is removed.
16+
- A host that cannot be reached refuses the removal with `503 SERVICE_UNAVAILABLE`, and no one is removed: the door calls the host once and keeps no record to ask again from, so try again. Durable retry is the host's job.
17+
- With no host wired, the person is removed and the answer says `host: { notified: false, reason: 'no_host' }`.
18+
- A person who is not pending answers `409`: deactivate them instead. This holds at the removal itself: the person is re-checked inside the unit of work and the delete carries `source: 'idp_pending'`, so a person whose first sign-in lands while the host is asked is not removed. On an object with cascading lookups (such as `sys_user`) the engine re-deletes by id after the cascade, so a first sign-in committing in that narrow window is not yet refused.
19+
- A person that other records still point at (`deleteBehavior: 'restrict'`) answers the engine's refusal, and nothing is removed. If the host had already cancelled the invitation of a person who is still pending and not deactivated, the door sends it again through `userAdded`, once, and the answer says whether that worked.
20+
- An unknown id answers `404`; a body with any key but `userId` answers `400`. Off a cloud-managed environment the door answers `409` and removes no one.
21+
22+
**A deactivated person is never sent an invitation.** Adding a deactivated pending person again no longer calls `userAdded`; the answer says `host: { notified: false, reason: 'deactivated' }`. Reactivating them (`admin/unban-user`) is what tells the host again.
23+
24+
Nothing to migrate.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): renaming a position tells the author to re-point their own source, names the environment as an owner, and restores who may explain another user
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`skills/objectstack-data/rules/security.md`, the **Renaming a position** paragraph: the holder carry moves holders only and rewrites no other reference to the old name, Setup-authored ones included, so the author re-points their own package source that names the old position (a `type: 'position'` sharing recipient, queue member or approver, a policy's `positions`, a `current_user.positions` predicate); the boot log lists stored references by table for an administrator. The not-carried list now says an old name recorded under another owner, a package or the environment, since the activation ledger records the environment as an owner too. § Assigning a permission set to a user says again who may ask `GET /api/v1/security/explain` about another user: a holder of `manage_users`, an administrator of one of that user's organizations, or a delegated `adminScope` covering that user. One eval case asks the rename with a same-package sharing rule. The `tabPermissions` pointer to objectstack-ui `rules/navigation.md` is kept, shortened. The file pays by dropping text that is stated elsewhere, and its token ceiling moves by the measured remainder: the kernel-name list (now a reference to the placeholder table in the same file), the membership-tier list (at the linked docs anchor), the second definition of `outside-closure` / `ambiguous-in-closure` (now a reference to the queue bullet above it), and short restatements. No schema or runtime change.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
'@objectstack/runtime': minor
3+
'@objectstack/mcp': minor
4+
---
5+
6+
feat(runtime,mcp): the MCP `run_action` and `resume_run` tools ask the person in their client when it advertises `elicitation`
7+
8+
Clause-②: no
9+
Metadata-protocol: semantic (at the stdio MCP door, an author's `ai.requiresConfirmation: true` is confirmed in place for a client that advertises `elicitation`)
10+
Skills-docs: follow-up owed — skills/objectstack-ai/SKILL.md (the `run_action` row of the MCP tool table; the same row the hand-off follow-up #34210 rewrites)
11+
12+
This release implements step 1 of the amended confirmation contract (`AI_ACTION_CONFIRMATION_CAPABILITY`, `@objectstack/spec/contracts`) on the long-lived MCP server, the one behind the stdio transport.
13+
14+
- When the client advertised `elicitation` at `initialize` (an empty `elicitation: {}` reads as form mode), a call on an action whose author declared `ai.requiresConfirmation: true` is asked in place: after every admission gate, the subject load and the caller-scope subject verdict included, the server sends one `elicitation/create` request in form mode, related to the open tool call, naming the action, the object and the record (its id, and the title the caller-scope read served, bounded to one line). Only the result's `action` is read.
15+
- `accept` runs the call exactly once, as any admitted call, under the caller's permissions, on the gates and the subject read again after the answer; the next call is asked again. `decline` is refused `428 ACTION_CONFIRMATION_REQUIRED` with `details.reason: 'declined'`. `cancel`, an error answer, a tool call cancelled by the client and a connection that closes first are refused with `reason: 'cancelled'`. No answer within the door's bound, `ACTION_CONFIRMATION_ELICITATION_TIMEOUT_MS` (five minutes, exported by `@objectstack/mcp`), is refused with `reason: 'timed_out'`, and a later answer runs nothing. Nothing is handed off on any of these answers.
16+
- `resume_run` is asked the same way for the run's action: `accept` resumes the parked run with the call's values; any other answer refuses the call and the run stays paused.
17+
- An AI service account is refused before anyone is asked, as before (`reason: 'service_account'`).
18+
- Unchanged: a client that does not advertise `elicitation` takes the hand-off (or the `no_confirmation_service` refusal) exactly as before, and is never refused for that alone. The Streamable HTTP door builds a fresh server per request that never read the client's `initialize`, so it cannot elicit, and every caller there is handed off as before; its answers stay plain JSON.
19+
- `McpActionBridge.runAction` and `resumeRun` take an optional third argument, `door: { elicitConfirmation }` (`McpActionCallDoor`), which the tools pass only when the call can be elicited. `@objectstack/mcp` also exports `actionConfirmationElicitorFor`, `actionConfirmationQuestion`, `confirmationQuestionText`, the bounds `ACTION_CONFIRMATION_QUESTION_TEXT_MAX` and `ACTION_CONFIRMATION_QUESTION_ID_MAX`, and the types `McpActionConfirmationSubject`, `McpActionConfirmationAnswer` and `McpActionConfirmationElicitor`.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
'@objectstack/objectql': patch
3+
'@objectstack/metadata-protocol': patch
4+
---
5+
6+
fix(objectql): the duplicate-record refusal reaches the writer's locale on the action door and on bulk rows
7+
8+
Clause-②: yes (widening). The /data 409 and the row errors gain a `userMessage` key, with the same text as the end-user sentence. `message` keeps its diagnostic text.
9+
Metadata-protocol: none
10+
11+
The engine's duplicate-record refusal already composed its end-user sentence in the writer's locale, and `/api/v1/data` answered it as the 409 body's `error`. Other doors read the user-facing sentence from `userMessage` and keep `message` as the diagnostic. The refusal did not declare that key, so an action button or a bulk edit showed the English diagnostic, for example `Duplicate record refused on '周成本': …`, where the form save showed `已存在「工厂」、「牌号」、「成本周次」均相同的记录`.
12+
13+
- `DuplicateRecordError` now declares the same sentence as `userMessage`. The action door (declarative and sandboxed script actions), the Hono handler-throw seam, MCP tool errors and a flow's inner refusal forward it unchanged. `message` is still the diagnostic sentence.
14+
- Row errors from `updateMany` and `batch` (`create`, `update`, `upsert`) carry a declared `userMessage`, with the same bound the `/data` door applies. A row whose producer marked nothing carries no `userMessage`, as before.
15+
- The flat `/data` 409 (and the whole-request `createMany` 409) gains `userMessage` beside `error`, with the same text. `error`, `code`, `field` and `developerMessage` are unchanged.
16+
17+
The sentence names fields by label and quotes no record value.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
'@objectstack/service-analytics': patch
3+
---
4+
5+
fix(service-analytics)!: the native SQL strategy evaluates a cross-object `where` leaf on an existing parent, so a detail row with no parent is not selected, as on the engine path and `/data`
6+
7+
Clause-②: no (narrowing)
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 changes shape. The moved answer is an aggregate over a cross-object filter, which now leaves out the detail rows with no parent, as the engine path and the /data nested-relation filter already did: no stored row, registry key or authored value changes, so there is nothing for a migration to rewrite and no tombstone. -->
11+
12+
**BREAKING** for a reader of an analytics answer served by the native SQL strategy (a cube or dataset query with no bucketed time dimension, on a SQL datasource) that reads a related object's field through a relationship path (`'order.status'`) in any of the three filter positions one compile serves: the query's `where`, a measure's own `filter` (its conditional aggregate) and the dataset's own `filter`:
13+
14+
- FROM: a detail row whose relation field is empty, or names no existing record, was selected by `$ne`, `$nin`, `$notContains`, `$null: true`, `$eq: null`, `$exists: false` and `$empty: true` on the related field, because the `LEFT JOIN` read every related column of such a row as NULL. So the same widget answered a different total once a time bucket sent it to the engine path. TO: such a leaf is evaluated on an existing parent (the last hop's `id = id` is conjoined to it, through every hop of the path: TRUE for an existing parent, UNKNOWN for none, so a `$not` cannot flip it), and outside `$not` no such row is selected by those operators. Under `$not` the native answer is the one it gave before. The native, engine and `/data` answers agree on those operators.
15+
16+
**Not moved.** A parent that exists with no value in the field still satisfies `$ne`, `$nin`, `$notContains` and `$null: true`. A positive operator (`$eq` a value, `$in`, `$gt`, `$contains`, …) selected no such row before either, and its statement is unchanged. A leaf on the base relation field itself (`{ order: { $null: true } }`) reads no join and is unchanged. Two native-path answers still select such a row, unchanged by this release: a positive comparison under `$not` (`{ $not: { 'order.status': 'open' } }`, a shape the engine path refuses; write `$ne` / `$nin` inside the condition instead), and `$nin: []`, which folds to the constant TRUE and selects every row, where the engine path leaves such rows out.
17+
18+
The fix for an author who wants the rows with an empty relation: OR the base relation field in, `{ $or: [{ 'order.status': { $ne: 'open' } }, { order: { $null: true } }] }`. A row naming a record that no longer exists is not brought back by it, on either path.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
'@objectstack/spec': minor
3+
'@objectstack/metadata-protocol': minor
4+
'@objectstack/runtime': minor
5+
'@objectstack/cli': minor
6+
---
7+
8+
feat(spec, metadata-protocol): a seed dataset can declare `dependsOn`, the objects it loads after, for an order no lookup field gives
9+
10+
Clause-②: yes (widening)
11+
Metadata-protocol: added
12+
Skills-docs: follow-up #34277 — `skills/objectstack-data/references/seeds.md` (its relationship section and its best-practice table tell the author to order seeds parent before child in the exported array, which orders nothing; `dependsOn` is not taught)
13+
14+
The seed loader orders a load's datasets by the `lookup`, `master_detail` and `user` fields between their objects; the order of the stack's `data` array only breaks ties. A dataset whose `beforeInsert` hook reads another seeded object had no way to say so, and its hook ran against whatever that object held at the moment, which an unrelated dataset could change. A rating scored from seeded bands, ordered by its one lookup to its rule, was written a wave before the bands and scored every row as if none existed.
15+
16+
- **`Seed.dependsOn: string[]` names objects.** Each name adds an edge to the same dependency graph the lookup fields feed, so the dataset's object loads after the named object's rows: `defineSeed(CustomerRating, { dependsOn: ['crm_rating_band'], records })`. The edges of several datasets of one object are pooled onto that object, and the returned `dependencyGraph.nodes[].dependsOn` lists them beside the lookup edges.
17+
- **A load that declares none keeps its order exactly.** Nothing changes for an app that does not write the key.
18+
- **A declaration the load cannot honour refuses the whole load, before any row is written.** The load answers `success: false` with one `errors[]` entry per refused declaration (`field: 'dependsOn'`, `sourceObject` the declaring object, `targetObject` the named one), and every caller reports it the way it reports any failed load. Three cases: a name that is the dataset's own object; a name no other dataset of the same load seeds (a misspelling, or an object whose datasets `env` or `locale` scoped out of this load, which the message says); and a declared edge that closes a cycle with the other edges, lookups included, with the cycle spelled out object by object. A cycle made of lookup fields alone still loads in deferred passes, as before.
19+
- **A refused boot seed reads as a failed seed.** The single-tenant boot seed (`AppPlugin`) counts each error of a load refused before any dataset ran as a rejected row in the outcome it records, so `os dev` / `os serve` print the source with a warning on the banner's `Seeds:` line and the `objectstack:seed-settled` message answers `ok: false`; before, a refused load wrote nothing and read clean on both.
20+
- **`defineSeed` refuses a dataset that names its own object** when it runs. The other two cases need the whole load, so only the loader can judge them.
21+
22+
A seed published on its own (a draft publish) is its own load, so a published seed whose `dependsOn` names an object seeded by another item is refused until the two are published together.

‎.changeset/33905-disabled-sole-holder-flow.md‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@ What moves, for such a flow, while its package is disabled:
1818
- `getFlow(name)` answered the flow. It now answers `null`, so the bare HTTP doors that ask it first (`GET /automation/NAME`, `POST /automation/NAME/trigger`, `POST /automation/trigger/NAME`, `POST /automation/NAME/toggle`, `POST /automation/NAME/clone`, `GET /automation/NAME/runs`) answer `404`, which is what the namespaced address `/automation/NAMESPACE/NAME…` already answered.
1919
- `toggleFlow(name, …)` switched the flow. It now rejects with `Flow 'NAME' not found`.
2020

21-
Three HTTP write doors ask `getFlow` whether the name is held, and move with it for such a flow. These answers were read from the runtime source; the engine's half of the clone answer was measured. Each holds only where the door's earlier checks, such as the packaged-base and authoring rules, let the request through.
22-
23-
- `POST /automation/SOURCE/clone`, with the flow's name as the new name: the taken-name probe refused the copy with `409`. It now finds no flow and lets the copy through. The engine files the copy's body in the disabled package's slot of the name, and once the package is enabled again its trigger runs the copy's body until the next re-sync. That is the answer the door already gives once the disable's re-sync has withdrawn the flow, so the door accepts nothing the normal path refuses.
24-
- A definition write (`POST /automation`, `PUT /automation/NAME`) or a clone that the engine accepts and that is then refused (an unknown `notify` channel, a refused landing, a refused save) put back the definition the engine held. It now has nothing to put back, so it removes the name's registration. A `PUT` body that leaves out a stored credential no longer keeps the one the engine held.
25-
- `DELETE /automation/NAME` answered a deletion. It still removes the engine's registration, but now answers `404` unless a stored row was removed.
21+
The HTTP write doors that ask a lasting question of the name do not move with it: the clone door's taken-name check on the new name, the definition a refused `POST /automation` or `PUT /automation/NAME` puts back, the stored credential a `PUT /automation/NAME` body, or a `POST /automation` body onto a name the engine holds, keeps when it leaves it out, and the `DELETE /automation/NAME` existence check read the flow the engine holds whatever its package's enable state. For such a flow the clone's new name is refused `409`, the held definition is put back, the credential is kept and `DELETE` answers a deletion, as before this release. A name two packages hold is read at those doors on its served holder, as the bare entries read it.
2622

2723
Remedy: enable the package. Its flow runs on its trigger again with no re-arm, and the bare entries serve it again.
2824

0 commit comments

Comments
 (0)