Skip to content

Commit 9e37aef

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/project-thread-samipm
2 parents 9ba0c56 + 5b7269f commit 9e37aef

67 files changed

Lines changed: 5557 additions & 142 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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
'@objectstack/service-analytics': patch
3+
'@objectstack/spec': patch
4+
---
5+
6+
feat(service-analytics): `list_datasets` and `query_dataset` — the dataset AI tools, one definition and one executor (ADR-0149 D2–D4)
7+
8+
Clause-②: yes (widening) — new exports `createDatasetTools`, `getDatasetToolDefinitions`, `DATASET_TOOL_DEFAULT_MAX_ROWS`, `matchDatasetTerms` and their types, and three new `AnalyticsService` methods (`datasetTools`, `hasPluginWiredAdmission`, `admitDatasetCatalogEntry`) plus `reportDatasetCatalogDefect`.
9+
Metadata-protocol: none
10+
11+
An AI can now answer a business question from a governed dataset instead of guessing a field on an object.
12+
13+
- **Two tools, defined once.** `getDatasetToolDefinitions()` returns the two `AIToolDefinition`s — names, the descriptions that teach the model the selection rule, and the JSON Schemas projected from `@objectstack/spec`'s tool schemas. `AnalyticsService.datasetTools({ loadDatasets, maxQueryLimit?, diagnoseDelegation? })` (or `createDatasetTools`) binds the executor; the MCP bridges and the product AI's registry both call it.
14+
- **`list_datasets`** lists the saved datasets the caller may query, with each member's label, business description and synonyms at the caller's locale. It asks the same gates a query of the dataset asks: a dataset whose object the caller may not read, or that is not API-exposed, is absent; a member over a field the caller may not read is left out and `membersWithheld: true` says so; a member over an `internal` field is left out for every caller and reported once to the server log. With `terms`, each dataset's `matches` names which word equals which member's name, label (any locale) or synonym, after the dataset schema's own normalization.
15+
- **`query_dataset`** runs a `DatasetSelection` against one saved dataset through `queryDataset` with the caller's context — no gate added, none skipped. A missing dataset and one the caller may not query both answer `NOT_FOUND`. Rows are capped (50 by default) with `truncated`; the answer carries no SQL and adds a `provenance` block (dataset, measures with their descriptions, dimensions, the caller's `runtimeFilter`) composed from what ran — the model's input cannot set it.
16+
- **Plugin-wired only.** Both tools refuse with `SERVICE_UNAVAILABLE` / 503 on an `AnalyticsService` built without the admission hooks `AnalyticsServicePlugin` wires, where the exposure gate would warn and pass and the read admission would return silently.
17+
- **Member descriptions reach the Cube.** `compileDataset` writes a dataset member's `description` onto the Cube member, so `GET /api/v1/analytics/meta` publishes it for a registered dataset cube.
18+
- The spec liveness ledger moves the four dataset member rows (`synonyms` and `description` on dimensions and measures) from `planned` to `live`.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
'@objectstack/service-settings': patch
3+
'@objectstack/service-cluster': patch
4+
---
5+
6+
feat(cluster): a settings change on one replica reaches every replica
7+
8+
Clause-②: yes (widening)
9+
Metadata-protocol: none
10+
11+
Multi-replica deployments on the `redis` cluster driver only. The single-node default (no declared replicas, or any driver but `redis`) emits exactly what it emitted before.
12+
13+
`settings:changed` is an in-process subscriber set, and its subscribers rebuild the auth posture, password / session / MFA policy, organization access policy, mail, SMS, storage and the AI provider. Under round-robin only the replica that took the write rebuilt; every peer kept the old configuration, security posture included, until it restarted.
14+
15+
- **A fifth cluster lane (`@objectstack/service-cluster`).** `MetadataClusterBridgePlugin` attaches the settings service to the cluster bus on the `settings.changed` channel, only where the deployment declares several replicas (`OS_CLUSTER_REPLICAS` greater than 1, or `OS_EXPECT_MULTI_NODE=true`) over the `redis` driver (`declaresMultiReplicaOnRedis`). The split-brain guard is unchanged.
16+
- **The message is an address, never a value (`@objectstack/service-settings`).** A write publishes the namespace, key, scope, action and time of the change. A peer emits its own local `settings:changed`, so each subscriber re-reads the shared store. A received change is never published again, and the writer's own message is dropped by its node id. New exports: `SETTINGS_CHANGE_CLUSTER_CHANNEL` and the `ClusterSettingsChangePayload` type; new methods `SettingsService.attachSettingsChangePubSub()`, `detachSettingsChangePubSub()` and `resyncSettingsChangePubSub()`.
17+
- **Joins `cluster.resync`.** When the cluster driver's connection returns after an outage, every registered namespace is announced locally once (`key: '*'`), so a change whose message was lost during the outage still takes effect without a restart.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
'@objectstack/core': patch
3+
'@objectstack/platform-objects': patch
4+
'@objectstack/objectql': patch
5+
'@objectstack/driver-sql': patch
6+
'@objectstack/metadata-protocol': patch
7+
'@objectstack/driver-mongodb': patch
8+
---
9+
10+
feat(core): the activation ledger is keyed by `(metadata_type, package_id, name)`, and rows that name no package take their one holder
11+
12+
Clause-②: yes (widening) — `@objectstack/core` exports `backfillActivationLedgerPackages` and the `ActivationLedgerHolder`, `ActivationLedgerUnboundRow`, `ActivationLedgerBackfillReport` and `ActivationLedgerBackfillOptions` types from its root, and `@objectstack/metadata-protocol` exports `ensureActivationLedgerPackagelessIndex`, `buildActivationLedgerPackagelessIndexSql`, `buildActivationLedgerPackagelessDuplicateProbeSql`, `ACTIVATION_LEDGER_PACKAGELESS_INDEX_NAME` and the `EnsureActivationLedgerPackagelessIndexResult` / `EnsureActivationLedgerPackagelessIndexStatus` types; nothing is removed or renamed, and every door and name-keyed reader answers as before.
13+
Metadata-protocol: none
14+
15+
`sys_metadata_activation` (the switch an administrator throws to turn a packaged flow, action, permission set, sharing rule, webhook, queue or assignment rule off) is now unique on `(metadata_type, package_id, name)` instead of `(metadata_type, name)` (ADR-0150 D4, D8 row R4). Two packages may each hold a row for an item of the same name; one package may not hold two.
16+
17+
At every boot, once the package holders are sealed, a ledger row that names no package is given the package that holds its item, as the package-scoped resolver answers it. Who sees it: an operator whose deployment carries such rows reads one `info` line naming each row bound. A row whose name two packages hold is left as it is and reported in one `warn` line naming every holder; nothing is picked. A row for an item the environment authored, or for a position, keeps naming no package. The backfill writes only `package_id`, never the switch itself, so the next boot finds nothing to change.
18+
19+
Nothing reads the package yet: every flow, action and catalog switch still applies by type and name exactly as before, and the activation doors answer as before.
20+
21+
Rows for an item the environment authored name no package, and SQL `UNIQUE` (like the memory and MongoDB drivers) exempts a row whose key part is NULL, so the new key does not constrain them. They keep one row per `(metadata_type, name)` through an index of their own, `uniq_sys_metadata_activation_packageless`: built at boot by `metadata-protocol` (SQLite and PostgreSQL: a partial index `WHERE package_id IS NULL`; MySQL 8.0.13+: a functional key part) and by `driver-mongodb` at collection sync (a `{ package_id: null }` partial filter). Who sees it: a second activation row naming no package for one item is refused `409 DUPLICATE_RECORD`, as it was before. A database that already holds such duplicates keeps them and gets one `error` line with the query that lists them, also reported by `os migrate duplicates`; nothing is deleted. MariaDB can build neither form and says so at `error`. The memory driver enforces declared indexes only.
22+
23+
On an existing SQL database the boot's schema sync creates the new key's index beside the old one, and once the package-less index stands, `os migrate plan` reports the old `(metadata_type, name)` index as superseded: one `replace_unique_index`, category safe, applied by `os migrate apply` with no `--allow-destructive`. The SQL driver reads a generated plain UNIQUE whose columns are an in-order proper subsequence of a declared global UNIQUE on the same table this way, because widening a unique key only admits rows the old key refused; when a column the key gained is nullable, it does so only beside a partial UNIQUE on the old columns, and until then keeps the old index without offering to drop it (MariaDB stays there). A UNIQUE on other columns still reads as an orphan, as before. Until the replace is applied the old index keeps refusing a second package's row of the same name, which nothing writes yet.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
'@objectstack/cli': patch
3+
---
4+
5+
fix(cli)!: `os serve` asks the multi-node gate about a topology declared by `OS_EXPECT_MULTI_NODE=true`, not only by `OS_CLUSTER_REPLICAS`
6+
7+
Clause-②: no (narrowing)
8+
Metadata-protocol: none
9+
Skills-docs: `skills/**` names neither spelling of the multi-node declaration. `content/docs/kernel/cluster.mdx` already teaches both spellings as the declaration; its sentence that a gate denial "downgrades … rather than failing" is corrected in this diff: with a declared topology the split-brain guard refuses the boot.
10+
11+
<!-- adr-0087: not-required (no-migration-prescription) No schema key, export, type or stored shape changes. The narrowing is a boot refusal keyed to environment variables an operator sets, so there is nothing for a metadata migration to rewrite and no tombstone. -->
12+
13+
**BREAKING** for a deployment that runs `os serve` with a remote cluster driver (`OS_CLUSTER_DRIVER` other than `memory`), declares multi-node only as `OS_EXPECT_MULTI_NODE=true`, and registers no multi-node gate.
14+
15+
A multi-node topology has two spellings, `OS_CLUSTER_REPLICAS` greater than 1 and `OS_EXPECT_MULTI_NODE=true`. With no gate registered, the gate refuses a declared multi-node topology, because multi-node is a licensed capability. `os serve` used to ask the gate with `OS_CLUSTER_REPLICAS` alone, so a topology declared only as `OS_EXPECT_MULTI_NODE=true` reached the gate as undeclared and booted the remote driver multi-node with no gate. The same deployment spelled `OS_CLUSTER_REPLICAS=2` was already refused.
16+
17+
After the upgrade both spellings answer the same way. `os serve` reads the declaration through `declaresMultiNode` from `@objectstack/service-cluster`. A declaration with no count is asked as 2 nodes, the smallest multi-node count. With no gate registered it prints `[cluster] multi-node not authorized (…)`, drops the remote driver, and the split-brain guard refuses the in-process fallback, so the boot stops.
18+
19+
FROM a multi-replica deployment that sets `OS_EXPECT_MULTI_NODE=true` over a remote driver with no gate TO either:
20+
21+
- register a multi-node gate (install the distribution that carries it), which authorizes the topology, or
22+
- drop `OS_EXPECT_MULTI_NODE` (and keep `OS_CLUSTER_REPLICAS` unset or 1) to run single-node.
23+
24+
A single-node boot, a boot declared as `OS_CLUSTER_REPLICAS`, and a boot whose registered gate admits the topology are unchanged.
25+
26+
When a gate that caps the node count admits fewer nodes than that 2, the licensed-cap advisory no longer prints a replica count the operator did not write. It names `OS_EXPECT_MULTI_NODE=true`, says what the licence admits, says the cap is advisory and every replica still joins, and asks the operator to run at most that many replicas (or set `OS_CLUSTER_REPLICAS`) or raise the limit. The advisory for a count declared as `OS_CLUSTER_REPLICAS` is unchanged.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@objectstack/service-cache': patch
3+
'@objectstack/service-cluster': patch
4+
'@objectstack/service-cluster-redis': patch
5+
---
6+
7+
fix(service-cache): the shared cache's Redis connection reports its outage once instead of printing an unhandled error per reconnect
8+
9+
Clause-②: yes (widening)
10+
Metadata-protocol: none
11+
12+
During a Redis outage, the connection the shared cache derives from the redis cluster driver's (`duplicate()`) had no `error` listener. Every reconnect attempt on every replica printed `[ioredis] Unhandled error event` with a stack, which buried the single outage warning operators need.
13+
14+
- `@objectstack/service-cluster`: new `watchClusterDriverConnection(cluster, client, source)` reports a connection derived from the driver's into the driver's liveness. It returns a disposer and attaches nothing when the driver offers no liveness. `ClusterDriverLiveness` gains `watchConnection(client, source)`, the one listener style both use.
15+
- `@objectstack/service-cluster-redis`: `watchRedisConnection` delegates to `ClusterDriverLiveness.watchConnection`. Its signature and behaviour are unchanged.
16+
- `@objectstack/service-cache`: the plugin watches the connection it derives, as source `'cache'`. One outage now logs one warning across all of the driver's connections, and `cluster.resync` waits until the cache's connection is back too. If the driver offers no liveness (a redis driver released before the liveness offer), the connection gets a liveness of its own, so its outage is still logged once, without credentials, through the plugin's logger. The plugin detaches before its deliberate `quit()` on shutdown, so a shutdown is not reported as an outage. An injected `redis.client` belongs to its owner and gets no listener, and the memory cache is unchanged.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): objectstack-data `security.md` teaches that a package's sharing rule resolves its queue recipient from its own package
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`skills/objectstack-data/rules/security.md` now states the rule the sharing plugin enforces since ADR-0150 E4: a declared sharing rule's `sharedWith: { type: 'queue', value }` reads the name as its own package's queue, else the one holder in the package's declared `dependencies` closure plus `sys`, else (no package or environment item declares the name) an organization's `sys_queue` row. Three refusal codes are taught, each with an example: `outside-closure` (the only holder is a package the rule's package does not depend on, or an environment-authored item), `ambiguous-in-closure` (two dependencies hold the name) and `ambiguous-in-environment` (the holder the rule reaches, its own package or one dependency, and a non-dependency both hold it). A refused rule grants no one new and is warned as `RESOURCE_CONFLICT`; it loads, so nothing earlier tells the author. `evals/hooks-security-seeds-datasources.json` gains case 18, which requires the queue recipient plus a manifest `dependencies` entry on the queue's package and refuses redeclaring the queue in the rule's package.
11+
12+
The file sits at its token ceiling, so the new bullet (446 bytes) is paid for by these cuts in the same file (459 bytes; the file goes from 15069 to 15056 bytes):
13+
14+
- `(PermissionSetSchema.rowLevelSecurity)` after "permission set / profile" (41 B); the same sentence names `rowLevelSecurity` on a permission set.
15+
- "(the tenant wall still applies)" in the RLS default-deny sentence (32 B); the Layer 0 bullet says the wall is AND-composed ahead of all business RLS.
16+
- The sentence that a legacy SQL-style `=` / `IN (...)` predicate still compiles through a deprecated bridge (98 B). This is not a restatement: the file now teaches canonical CEL only.
17+
- The four "(for `IN`)" notes in the `current_user.*` table (42 B); the predicate list above it spells `field in current_user.ARRAY`.
18+
- The membership-key section intro, shortened to "Declare the set on the roster object, not one policy per record." (80 B); the section heading and the "Choose by" bullet's "a named record → a membership key" carry the rest.
19+
- "(`isDefault` sets)" after the `everyone` baseline in the Positions section (19 B); the `isDefault: true` bullet defines that baseline.
20+
- The admin-only recipe's `tenancy` comment "not a tenant object → Layer 0 contributes nothing" (55 B); the blockquote below it explains the key.
21+
- The blockquote's "it is the half that holds however permissive the grants" (59 B); the `requiredPermissions` paragraph calls it an AND-gate, strictest-wins over field grants.
22+
- "(`@objectstack/plugin-security`)" after `sys_user_permission_set` (33 B); a package pointer an author never writes.
23+
24+
The `(definePermissionSet)` example comment and the field-lock recipe docs link stay.

0 commit comments

Comments
 (0)