Skip to content

Commit c57e06e

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/project-thread-7uyrn8
2 parents 0ada679 + 9a3a500 commit c57e06e

632 files changed

Lines changed: 29253 additions & 2968 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: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
'@objectstack/plugin-sharing': patch
3+
'@objectstack/plugin-security': patch
4+
'@objectstack/spec': patch
5+
---
6+
7+
fix(plugin-sharing)!: every share grant counts; the sharing scopes carry the share-grant leaf instead of a list capped at 5,000 grants (ADR-0155 plan step 6)
8+
9+
Clause-②: yes (narrowing)
10+
Metadata-protocol: none
11+
12+
<!-- adr-0087: not-required (no-migration-prescription) No key of any schema is added, removed, renamed or re-shaped, and no stored row, registry key or authored value changes. What moves is how the sharing scopes count share grants (every grant, through a subquery, where a read of at most 5,000 used to stand), that grants stop counting on objects whose storage cannot evaluate that subquery, and that a host registering a narrowing of sys_record_share reads by name no longer boots. There is nothing for a migration to rewrite and no tombstone; each host-side remedy is one line, below. -->
13+
14+
**What was wrong.** The read scope of a sharing-scoped object read the caller's share grants into an id list first, at most 5,000 of them, and dropped the rest without a word: a member holding 6,000 grants on one object saw 6,000 rows of 7,000 (1,000 owned plus 5,000 of the 6,000 shared), and a GET of an unread grant answered 404. The predicate-update scope had the same cap on edit-level grants.
15+
16+
**Now.** `buildReadFilter` and `buildWriteFilter` carry the share arm as the share-grant leaf, `{ id: { $in: SharedRecordIds.read(object, user) } }` (the update scope carries `.write(object, user, ['edit', 'full'])`), which the SQL driver compiles as a subquery over `sys_record_share` inside the same statement. Every grant counts, at any number; no grant is read into memory and nothing binds one parameter per grant. The pending-approval ids stand as a disjunct of their own. `delete` scopes to the owner match alone, as before.
17+
18+
**BREAKING**, in three places, each a tightening that lands here, where it takes effect:
19+
20+
- **Share grants stop counting on objects whose storage cannot evaluate them** (ADR-0155 R2). An object stored on another datasource than `sys_record_share`, or by a driver that does not evaluate the leaf (`supports.fixedReadLeaves` without `SharedRecordIds`: today the MongoDB, in-memory and OData drivers), keeps its owner, queue and pending-approval access unchanged, but its share rows are no longer consulted: no scope carries the share arm, the edit gate reads no grant, and a new grant or a new sharing rule on it is refused `SHARING_NOT_ENABLED` (422 at the REST doors). The boot names, once at `warn`, every such object that holds `sys_record_share` rows, with the reason. `security/explain` reports each share on such a record as evaluated and not granting, and says why.
21+
The fix for a host: to share such an object's records again, store it on the datasource of `sys_record_share`, on a driver that evaluates share grants (the SQL drivers do).
22+
- **A narrowing of `sys_record_share` reads registered BY NAME refuses the boot** (ADR-0155 R1 at boot, D4). A host that registers an object-scoped middleware, or a `beforeFind` / `afterFind` hook, for `sys_record_share` (an opt-in of that table into plugin-audit's record-view auditing included) no longer starts: the boot fails at `kernel:bootstrapped`, before any request is served, with `INTERNAL_ERROR` / 500 naming the registration. No registration is exempt, one whose handler skips system reads included. A registration made after boot is refused at read by the engine, with the same envelope.
23+
The fix for a host: remove that registration for `sys_record_share`. A host that opted the table into record-view auditing gives up that auditing of share rows.
24+
- **A narrowing that names NO object is not run on the share arm.** A middleware or a find hook registered for no object, or for `'*'`, ran on today's grant read, which went through the engine as a system read. The share arm now makes no engine read of `sys_record_share`, so such a registration does not run on it, and nothing refuses, reports or logs that. On a host where such a registration changes a system read of `sys_record_share`, the share arm's rows can differ from what they were. This paragraph is the telling (ADR-0155 D4's boundary; `ISharingService`'s contract says the same). The repository's own registrations of that kind were read before this change, and none changes that read.
25+
26+
**Preconditions this step inherits from the PostgreSQL key-type change** (ADR-0155 O2):
27+
28+
1. On PostgreSQL, a statement holding the leaf whose catalog read fails, or finds no such relation, answers `INTERNAL_ERROR` / 500, where an uncast statement would have run.
29+
2. Each transaction pays one savepoint and one catalog read per table it compares a leaf against, when the table has no pooled reading.
30+
3. A failed catalog read inside that savepoint rolls back the caller's concurrent statements on the same transaction. The sharing plugin issues no statement of its own that carries the leaf, and none of its reads runs inside a caller's transaction or concurrently with another on one: its own reads are sequential system reads.
31+
32+
**What it costs, quoted no wider than ADR-0155 quotes it.** For the scope statements alone (an account page, its total and the two grant reads), at 1M rows and 5,000 grants, the id-list scope against the subquery scope read PostgreSQL 21.6 → 7.0 ms and SQLite 18.3 → 12.1 ms. It is not a whole-request figure. For a caller holding no grant, whose scope was the bare owner match and is now an `$or` with the subquery, SQLite still serves the page and its total from the owner index; PostgreSQL 16 serves the page as before but plans the total as a sequential scan, which grows with the table: measured, that caller's total went from 1.46 to 7.29 ms at 100k rows and from 7.88 to 42.21 ms at 1M, the page flat at both. SQLite keeps the owner index. Follow-up #36034 measures `id = ANY(ARRAY(SELECT …))` against the subquery for that caller on PostgreSQL.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): objectstack-automation names the inbound hook's answer for a disabled package's flow, and the refusal of an undeclared `connector_action` input key
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The inbound hook section gains one bullet: a flow whose package is disabled answers the door's `401 INVALID_SIGNATURE` at both its bare and its qualified address, with nothing enqueued, and a sender's retry is accepted (`202`) once the package is enabled. Text only; the neighbouring bullets are tightened to pay for it.
11+
12+
The `connector_action` row and the integration recipes now say that an input key the action's `inputSchema` does not declare fails the step before dispatch, and that on an OpenAPI document nobody de-referenced a `$ref` parameter or a `$ref` / schemaless request body reads as open input, sent unjudged (a `$ref` response is still silently lost).
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
'@object-ui/plugin-dashboard': patch
3+
'@objectstack/service-analytics': patch
4+
---
5+
6+
fix(plugin-dashboard): a compare widget dated on a related record's field is served through the dataset's declared date dimension over that path
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
A dataset-bound compare widget (`compareTo`) sends its date window to the dataset query under the filtered field's name. The dataset query answers only declared dimensions, and a dimension name has no dot, so a window on a related record's field, such as `account.founded_at`, was refused with `400 INVALID_FIELD`.
12+
13+
When such a key is in the window, the widget now reads the dataset definition and sends the window under the one declared dimension with `type: 'date'` and `field` equal to that path (for example `{ name: 'account_founded', field: 'account.founded_at', type: 'date' }`). A `compareTo.dimension` that names the window by the path or by that declared name is sent as the declared name. When no declared date dimension covers the path, or two or more do, the key is sent as authored and the dataset query still refuses it. Keys that can be dimension names, such as `close_date`, are never renamed, and widgets whose window has no such key read nothing extra.
14+
15+
To serve a compare widget dated on a related record's field, declare one date dimension over that path on the dataset.
16+
17+
The dataset query's `400 INVALID_FIELD` refusal for a comparison-window date key that cannot be a dimension name no longer says the comparison cannot run unless the date field is a field of the dataset's own object; it names the remedy that exists: declare one date dimension over that field (`type: 'date'`, `field` set to it, any snake_case name, the relationship in the dataset's `include`) and name it in `timeDimensions`, which a dashboard compare widget then does itself. The refusal's code, status and when it fires are unchanged.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
'@objectstack/rest': patch
3+
---
4+
5+
Clause-②: yes — widening: one new anonymous read-only discovery route (an open restriction profile); nothing served today changes
6+
Metadata-protocol: none
7+
8+
feat(rest): a self-hosted runtime serves the restriction profile `os validate --target` reads
9+
10+
`GET /api/v1/discovery/restriction-profile` is now served by `@objectstack/rest`, the route `os validate --target <url>` reads, so `os validate --target` against a self-hosted runtime reads a profile instead of failing with a 404. It answers `{ success: true, data }`, where `data` is a `RestrictionProfileSchema` value: the open runtime restricts nothing, and `versions.spec` and `versions.skills` name the `@objectstack/spec` version it runs.
11+
12+
- It answers without a credential, as `/discovery` does and as the cloud already serves the same route (ADR-0138 D2, amended 2026-11-20: the control-plane discovery role).
13+
- It reads no query parameter: any one is refused `400 VALIDATION_ERROR`.
14+
- When the runtime cannot read the `@objectstack/spec` version it runs, it answers `503 SERVICE_UNAVAILABLE` and publishes no profile.
15+
- `api.enableDiscovery: false` unmounts it together with the rest of discovery; the CLI then fails as it does for any server that does not serve the route.
16+
- `allowedFlowNodeTypes` is a constant: the profile's whole node-type vocabulary, the approvals plugin's `approval` / `approval_revise` included. It does not say which plugins the runtime runs, so `os validate --target` does not check whether an approval flow has an executor on that runtime.
17+
- fix(rest): the CommonJS build (`require('@objectstack/rest')`) now resolves package manifests as the ESM build does. esbuild emptied `import.meta` in that build, so `loadOpenApiSpec` could not read the static OpenAPI artifact, and the new restriction-profile route would have answered `503` there; the package now builds with tsup's `shims`.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
Clause-②: no
6+
Metadata-protocol: none
7+
8+
`objectstack-data`'s hook reference (`references/data-hooks.md`) now says that `input` and `ctx` are already bound in an action body's `(async (input, ctx) => { … })` wrapper, shows the refused redeclaration (`const input = ctx.input || {};`, `let ctx`) with its rule id `action-body-does-not-compile`, and links the hook-body compile paragraph for the commands, the `422 INVALID_METADATA` save and the fix. That paragraph's suggested local is now `const data = …`, a name no wrapper binds. The file stays inside its token ceiling by dropping two restatements.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/scenarios': patch
3+
---
4+
5+
docs(scenarios): an acknowledged roll-up finding on a child the card withholds is still charged
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The scenario runner's README now states how the scorer treats a `security-rollup-source-unreadable` finding the build acknowledged with `rollupSourceUnreadableReason`: it is charged as a failed Build check exactly like an unacknowledged one, whenever the card withholds the roll-up's child (or the child field it reads) from that persona. A written reason does not change what the persona sees, so a total the card withholds has to be masked, not explained. The scorer's behaviour does not change; a test now runs the real rule on acknowledged permission sets and pins that the runner reads the rule's suffixed `info` message on both of its readings (the child object and the child field) and charges every one.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/scenarios': patch
3+
---
4+
5+
fix(scenarios): the `travel_expense` build prompt names who approves a claim's second step
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The detailed prompt said a claim goes to "the department manager first (a manager's own claim goes to the finance manager), then Finance". Finance has two members, and the same sentence calls one of them the finance manager, so a build could route the second step to that manager, while every seeded step-2 row and the `manager_approves_step_one` operation name the Finance officer. The prompt now says the second step goes to a Finance officer (Finance staff other than the finance manager), in English and Chinese. The expected approver, the seed rows and the operation are unchanged.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@objectstack/scenarios': patch
3+
---
4+
5+
feat(scenarios): every question of a dataset card names its ask kind, and a round's record counts every kind
6+
7+
Clause-②: yes (widening) — new optional card key `askKind` on `QuestionSchema` and `DatasetQuestionSchema`; new exports `ASK_KINDS`, `AskKind`, `AskKindSchema`, `questionTurnKind`, `checkAskKinds`, `askTurns`, `askKindCounts` and `AskTurn` (package root); `kindTally`, `kindCell` and `KindTally` (`./runner`); new optional fields `QuestionResult.askKind`, `DatasetQuestionResult.askKind` (`./runner`) and `HalfScores.kinds` (`scorecard.ts`, `./runner`)
8+
Metadata-protocol: none
9+
10+
The open dataset cards (`order_to_cash`, `travel_expense`) stated no kind of question for their ordinary questions, so a round could not show which of the ten ask kinds it measured. A question and a dataset question now name one (`askKind`): `count`, `group_sum`, `top_n`, `time_range`, `join`, `owner_latest`, `business_term`, `ambiguous`, `forbidden` or `unanswerable`. A card that names one kind names the kind of every question and dataset question it asks, all or none, so a card that names no kind loads as before; the loader refuses a kind its question's truth or route contradicts (a `top_n` that does not rank, an `owner_latest` that does not group by a person field, a `business_term` that is not a `metric_selected` dataset question, an `unanswerable` the seed answers), at the question's `askKind`. A turn asked as a persona its truth is withheld from is a `forbidden` ask.
11+
12+
The runner stamps each turn's kind on its result (`askKind` on every question and dataset-question result), the scorecard counts the asks kind by kind (`HalfScores.kinds`, new `Run · kinds` and `Iterate · Run · kinds` rows naming all ten kinds), and `summary` sums the row. A card that names no kind, and a record written before turns carried one, show no such row. New exports: `ASK_KINDS`, `AskKind`, `AskKindSchema`, `questionTurnKind`, `checkAskKinds`, `askTurns`, `askKindCounts` and `AskTurn` from the package root; `kindTally`, `kindCell` and `KindTally` from the runner.
13+
14+
The two cards ask every kind at least twice per round, a table in `docs/qa/scenarios/README.md` states the counts, and a test holds it equal to the cards. `order_to_cash` changes only by the added `askKind` keys, and `travel_expense` also by the step-2 approver line of its build prompt (the changeset beside this one), so both cards' sha256 move and ask-round records split at these card hashes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
'@objectstack/core': patch
3+
'@objectstack/rest': patch
4+
'@objectstack/client': patch
5+
'@objectstack/spec': patch
6+
'@objectstack/service-messaging': patch
7+
---
8+
9+
feat(rest): Change Owner endpoint — hand one record or a list of records to another owner, on objects that offer the action
10+
11+
Clause-②: yes (widening)
12+
Metadata-protocol: none
13+
14+
Two new doors under the data surface, both run as the caller:
15+
16+
- `POST /api/v1/data/:object/:id/change-owner` with `{ ownerId | queue, notify? }` hands one record to a person or moves it to an ownership queue (ADR-0142), and answers the record's new owner.
17+
- `POST /api/v1/data/:object/change-owner` with `{ ids, ownerId | queue, notify? }` does the same for up to 500 records, one update per record, and answers a per-row report that lists every record that did not move with its code and sentence.
18+
19+
An object offers Change Owner when the platform gives it a reassignable owner and its `userActions.transfer` switch is on (on by default, off on a `controlled_by_parent` detail). Any other object is refused as a whole, `403 CHANGE_OWNER_DISABLED`, whoever asks — a holder of `modifyAllRecords` included. The switch gates this action only: a plain `owner_id` update still needs the transfer grant and nothing else, so imports and hooks are unaffected. On an object that offers it, each record moves through the ordinary write path, so the caller needs edit on the record and the transfer grant (`allowTransfer` or `modifyAllRecords`); without the grant the record keeps its owner and the answer is the data door's own `403 PERMISSION_DENIED`. `notify: true` sends the new owner one notification under the `record.owner_changed` topic, its title keyed so it renders in the new owner's own language (English when no entry renders).
20+
21+
`@objectstack/core` exports `changeRecordOwner`, `changeRecordsOwner`, `changeOwnerOffReason`, `changeOwnerOffRefusal`, `CHANGE_OWNER_DISABLED`, `CHANGE_OWNER_NOTIFICATION_TOPIC`, `CHANGE_OWNER_NOTIFICATION_TEXT` and `assertAssignableUser` (the assigned-work hand-over's target check, now shared). That check now reads the target user the way the write path reads a user reference: a user the caller cannot read answers as one that does not exist (`404`, `reference_not_found`), on Change Owner and on the hand-over alike. `@objectstack/client` adds `data.changeOwner` and `data.changeOwnerMany`. `@objectstack/spec` registers `CHANGE_OWNER_DISABLED` in the error-code ledger, and the `userActions.transfer` liveness row is now `live`. `@objectstack/service-messaging` lists `record.owner_changed` among the platform's notification topics and carries the notice's title in every shipped locale (`messages.recordOwnerChangedTitle`, `messages.recordsOwnerChangedTitle`).

0 commit comments

Comments
 (0)