Skip to content

Commit 333edb0

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/area-E1-32354
Claude-Session: https://claude.ai/code/session_016WV4cy1y7UNVbT2QAdmgdn Co-Authored-By: Claude <noreply@anthropic.com>
2 parents 27fb3f2 + 87330e8 commit 333edb0

148 files changed

Lines changed: 5809 additions & 747 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: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
'@objectstack/service-automation': patch
3+
---
4+
5+
feat(service-automation): the connector connection store, the connect door and the OAuth callback read and write one instance by its package and name (ADR-0150 D4, #31699)
6+
7+
Clause-②: yes (widening) — the connect door (`getConnectorConnection`, `beginConnectorConnection`, `completeConnectorConnection`, `revokeConnectorConnection`) and a dispatch answer new refusals, each listed under "What answers differently"; a connection row now carries its instance's package. The one-holder backstop still keeps every connector name to one package at boot, and while a name has one holder every row of the name answers its one instance, as the read by name did, so on a database where each organization keeps one connection of an instance and the name has one holder, every answer is as before, a declaration that moved to another package or to the environment included.
8+
Metadata-protocol: none
9+
Skills-docs: `content/docs/automation/connectors.mdx` says a callback completes the instance its connect was begun for and the door refuses a name two packages hold. `skills/**` teaches "connect once per organization", which still holds per instance.
10+
11+
<!-- adr-0087: not-required (no-migration-prescription) No key of any authorable schema is added, removed, renamed or re-shaped: the store, the door and the pending authorization are runtime, and `connector_package` is the column PR 3a added. -->
12+
13+
Part of #31699 (ADR-0150 child B, PR 3a-ii). PR 3a widened `sys_connector_connection`'s key to `(organization_id, connector_package, connector_name)`; this PR makes the store and its callers use it.
14+
15+
**The store: `ConnectorConnectionStore`.**
16+
17+
- `connect`, `read`, `readOrRefuse`, `revoke` and `listFor` take the instance's package (`string`: a package's instance; `null`: no package's). `revoke` and `listFor` require it; on `connect`, `read` and `readOrRefuse` an absent package still reads the bare name, for the callers that know no package. A connect writes `connector_package` on the row it inserts.
18+
- While the name has one holder (its durable resolution, the question the boot backfill asks, disabled packages included, answers one), or no registry can judge it, every row of the name answers its instance, whatever package the row names: a row naming no package, and a row a moved declaration left under its old package, are the instance's connection, as the read by name answered. A connect adopts the row and stamps it with the instance's package in place (design M2; `null` for the environment's or the platform's instance): one row, never two. A revoke removes it. While two packages hold the name, each package reads its own row; a row naming no package, or naming a package that is not one of the holders, is no package's, and with no row of its own the package's read is refused `409` naming `os migrate stored-references bind --table sys_connector_connection`.
19+
- Two rows answering one instance (a package's own row and another row of the name under one holder, or two rows a guard-less database admitted) are refused `409` by the door and `503` by a dispatch, with or without the run's organization, never one of them used; a revoke removes every row that answers. The connection list (`listFor`) still counts such an organization, carrying the refusal: a dispatch with no organization is refused `422` where another organization is connected too, as before, and the materializer does not count it as connected.
20+
- The post-insert take-back that PR 3a added now counts by `(organization, package, name)`.
21+
22+
**The door and the callback.**
23+
24+
- The connect door resolves the name to one declared instance and its package: the resolved package's entry; with no registry to ask (a code-registered instance, a composition with no ObjectQL) or no holder, the one declared entry with the package it carries; two holders, or two declared entries with no registry, `409`.
25+
- The begin records the package in the pending authorization (`packageId`, `null` for the environment's or the platform's instance). The callback completes exactly that package's entry, never the name resolved again; when that package no longer declares the instance, the callback is refused `404` before its code is exchanged. A pending record written before this change (no key, at most ten minutes old) resolves the name, as the begin did.
26+
- An instance's package is its entry's stamp when that is a real package, none for the environment's stored entry, and, for an entry with no stamp or the compatibility API's default, the package the name's durable resolution holds it under (the package the boot backfill binds a package-less row of the name to, so a row the instance connected stays its own once bound), else none. The door, the dispatch handle, the materializer and the reconnect-required mark all read by that one rule. When the name resolves to a package no declared entry is the instance of, the door serves the one declared entry with its own package, as with no registry.
27+
28+
**What answers differently.**
29+
30+
- `409` at the door where a name has two holders, and where two declared entries share a name with no registry to resolve it; before, the first declared entry was served.
31+
- `409` at the door, and `503` at a dispatch, where two rows answer one instance in one organization (above). Before, the old key kept one row per organization and name, so this needs a database where the guard was refused or a package's row beside an adopted package-less one; when the two rows are met only at the callback, the code has already been exchanged and the connect is refused after it.
32+
- `409` on the read and the revoke of a row of a name two packages hold that names no package, or a package that is not one of the holders (a disabled holder counts: the question is the boot backfill's), where the read answered the row before. Bind it with `os migrate stored-references bind --table sys_connector_connection` and revoke it as its package's, or uninstall one of the holders, after which a revoke of the one remaining instance removes it.
33+
- `404` at the callback when the package its connect recorded no longer declares the instance; before, any entry of the name completed it.
34+
35+
**Declared deviations from the design review.**
36+
37+
- M5: no `?package=` on the HTTP door and no spec change. The door addresses one instance by resolving its name; addressing a second holder's instance explicitly comes with the PR that narrows the one-holder backstop, which is the first PR under which two holders can boot, and no later. Until then a name with two holders (a package installed after boot) is refused at every leg of the door, revoke included: its connections stay stored and keep no dispatch, and the remedy is to uninstall one holder or bind the row.
38+
- M6: where the name has no holder or no registry answers, the door serves the one declared entry with the package that entry carries, not `null`: the row a code-registered package instance connects is that package's, as the backfill would bind it. That stamp is durable while the judgment is not (a later registry may resolve the name elsewhere); it never loosens: while two packages hold the name, the stamped row answers only its own package.
39+
- S3: under two holders a package's own row wins over a package-less row of the name, and the package-less row answers neither (ADR-0150 R9 refuses such a row; the store reads around it rather than refusing the package's own connection). The stray row keeps its encrypted refresh token until it is removed: the door is refused `409` at every leg while two packages hold the name (M5), so it is removed by uninstalling one of the holders, after which the name has one holder, every row of it answers that instance, and a revoke removes them all.
40+
41+
**In-process APIs.** None public: the store, the pending authorization and the grant handle are internal modules of `@objectstack/service-automation`, none exported from its entry point.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
'@objectstack/service-automation': minor
3+
'@objectstack/spec': minor
4+
'@objectstack/lint': minor
5+
---
6+
7+
feat(automation)!: a flow that runs after a record change is not armed while a subflow it calls retries an inline outbound call, and a durable `http` node with no outbox does not hold the save
8+
9+
Clause-②: yes (narrowing) — a record-triggered flow the engine armed before is now registered but not armed when a `subflow` / `map` child retries an inline call; `@objectstack/spec/contracts` gains the `FLOW_UNBOUND_CAUSES` value `retried_callout_in_subflow`.
10+
Metadata-protocol: semantic
11+
Skills-docs: none — taught in content/docs/automation/flows.mdx (Try / catch / retry) and in `os explain flow-after-save-inline-retry`; no skill under `skills/**` teaches the subflow or the no-outbox case.
12+
13+
<!-- adr-0087: not-required (no-migration-prescription) No schema key, accepted value or metadata type is added, removed or renamed, and every flow that registered before still registers. One flow is no longer armed, and one durable request on a host with no outbox is sent in the background; no rewrite of a stored flow keeps what its author meant, so the author chooses the fix. -->
14+
15+
**BREAKING** for two shapes of a flow whose start node runs it after a record change (`record-after-create`, `-update`, `-delete`, `-insert`, `-write`). Ruling D on the after-save retry card: the record save never waits on an external system.
16+
17+
- **A retried inline call in a subflow.** Before, the after-save rule (`flow-after-save-inline-retry`) judged only the flow's own nodes, so a flow whose `subflow` or `map` node called a child holding a retried `http` (without `durable: true`) or `connector_action` node armed, and while the outside system was down the save waited through every attempt and backoff delay. The retry counts wherever it sits on the call chain: the child's own `try_catch` retry or `errorHandling: { strategy: 'retry' }`, a deeper child's, or a retry around the call in the caller. Now the arming gate declines such a flow, after its disabled-subflow, save-notice and region halves: it still registers, is not armed, and warns once, naming the call node, the retried node, the flow that holds it and what retries it. `GET /automation/_status` reports it `bound: false` with that reason and the new `unboundCause` value `retried_callout_in_subflow`, and the Studio's run note says it in plain words. Whenever a flow is registered, every flow whose calls reach it is judged again, so the decline does not depend on load order, and a child republished with the call durable (or unretried) arms the caller again.
18+
- **A durable `http` node on a host with no messaging HTTP outbox.** Before, such a node fell back to the inline call on every path, so on the save path a retry around it held the save through the whole ladder. Now, on the save path (an after-record-change run, or a `subflow` / `map` child of one), the request is sent once in the background and the run does not wait for it or see its outcome, as with the outbox: the node answers `{ enqueued: false, background: true }`, and a failed send is logged at `error` and is not retried. Off the save path the fallback is the inline call, as before.
19+
- **Not changed.** Registration, the save door and `objectstack validate` accept the same flows as before. A flow that does not run after a record change, an inline call nothing retries, and a durable `http` node with an outbox wired behave as before.
20+
21+
**What an author does.** For a declined flow: in the child the warning names, set `durable: true` on the `http` node, or remove the retry around it (a `connector_action` has no background path: remove the retry, or run that work on demand or on a schedule). For a host with no outbox: wire the messaging service with reliable delivery so a durable request is queued and retried, rather than sent once.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/metadata': patch
3+
---
4+
5+
fix(metadata): history retention keeps the latest N versions per package for a type stored per `(package, name)`, so one package's saves no longer evict another package's rollback targets
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`HistoryCleanupManager`'s `maxVersions` retention counted a name's history versions per `(type, name)`. For a type stored per `(package, name)` (`PACKAGE_SLOTTED_STORE_TYPES`), two packages and the environment each keep their own row of one name, and their snapshots share one version sequence, so a package saved often pushed every other holder's versions past the limit and `runCleanup()` deleted them: the other package had nothing left to roll back to. Retention for those types now keeps the latest `maxVersions` per `(type, name, package_id)`: each package's versions, the environment's versions (the `sys_metadata` marker) and versions recorded under no package (rows written before the `package_id` column existed) are each counted on their own. `getCleanupStats()` counts the same way. Every other type, a name only one package holds, the age-based retention and the `executionPinned` exemption (`flow`, `agent`) are unchanged. A row is only ever deleted now if the old rule would also have deleted it.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
'@objectstack/plugin-webhooks': patch
3+
'@objectstack/cli': patch
4+
---
5+
6+
fix(plugin-webhooks, cli): an activation row a departed package left switches no remaining webhook holder, and the 18.x ownership ceremony writes a two-holder copy's switch as a row naming no package instead of picking one holder (ADR-0150 D8)
7+
8+
Clause-②: yes (widening; narrowing on a departed row switched on) — widening: a departed package's row switched off no longer keeps a remaining holder off, so its outbound deliveries start on upgrade. Narrowing: a departed package's row switched on no longer turns on a holder shipped inactive.
9+
Metadata-protocol: none
10+
11+
**A departed package's activation row (plugin-webhooks).** A declared webhook's slot with no activation row of its own read the name's rows naming a package that no longer declares the name as its switch while the name had one holder, and under two holders such a row switched off kept both off. Such a row was the departed package's switch, and it now switches no remaining holder, in either direction:
12+
13+
- one holder, a departed package's row switched off: FROM the holder off TO the holder at its own row, else its declared `isActive`;
14+
- one holder shipped inactive, a departed package's row switched on: FROM the holder on TO the holder off (its declared default);
15+
- two holders, a departed package's row switched off: FROM both off TO each at its own row or its declared default.
16+
17+
The source says so once per name at `warn`, naming the departed package, the holders and the per-holder address (`POST /api/v1/security/_activation/webhook/NAME?package=PACKAGE`). A row naming no package is read exactly as before: the one holder's switch, and under two holders off keeps every holder with no row of its own off and on turns none on. A holder's own row still wins.
18+
19+
**Operator action on upgrade.** A webhook you switched off while another package held its name, and which a remaining package now declares, starts delivering again after this release unless that holder has its own row. To keep it off, switch the holder off at its own address: `POST /api/v1/security/_activation/webhook/NAME?package=PACKAGE` (no `package` for the environment's own). The warning above names each such webhook and its holders.
20+
21+
**The 18.x ownership ceremony's declared-webhooks step (cli).** A customized `sys_webhook` copy writes the declaration's activation row. When the copy's definition names no package, the row named the holder the composition listed LAST for the name. Of a name one holder declares it still names that holder; of a name two or more holders declare it now names no package — the name-keyed switch the copy was — and the step's notes name every holder and the per-holder address. When the environment is one of those holders, a row naming no package would be the environment's own switch, so the step writes no switch row and its notes report the copy's switch (on or off) and name every holder; switch each at its own address. A copy whose definition names its package writes that package's row, as before.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/core': patch
3+
---
4+
5+
fix(core): the security catalog's list keeps every holder of a permission set name the metadata service holds, so a grant naming a package is judged by (package, name) whatever order the stored rows are listed in (ADR-0150 D4)
6+
7+
Clause-②: yes (widening; narrowing on the agent-account ceiling) — on the metadata-only path (a permission set name the engine registry holds nowhere, read from the metadata service, as an environment kernel reads its stored sets), a grant whose `permission_set_package` names the holder listed second moves FROM `409 RESOURCE_CONFLICT` `not-held-by-qualifier` naming only the first-listed holder TO stored with that package, the answer the registry path already gives. A refusal on that path (a package that holds no set of the name) now names every holder of the name, packages in id order and the environment's own row last, where it named the first row listed. Nothing refused on the registry path is admitted here. The narrowing: an agent-account grant (or a position binding the name) of a set name two packages hold on that path, read with no package, is judged against every holder's body (#32164); it moves FROM admitted, when only the holder listed second breaches the agent ceiling, TO the agent-ceiling validation refusal (`invalid_value` at `permission_set`, or at `position`) naming that breach, the answer the registry path already gives.
8+
Metadata-protocol: none
9+
10+
`createSecurityCatalogReader(...).list('permission')` answered, for a name only the metadata service holds, one entry: the first row of the name the service listed. Every reader that judges a named holder from that list (the grant name hook's `judgeGrantSet`, the activation door's `?package=` read, the activation ledger's holder count) therefore saw one holder, and which one followed the service's row order. The list now carries one entry per (package, name) holder on that path too — the shape the registry path gives — ordered by package id with the environment's own row (no package, or the `sys_metadata` provenance) last. A disabled package's row is still not listed, as on the registry path. A bare-name read is unchanged: the store still refuses a name two packages' slots hold, naming both.

0 commit comments

Comments
 (0)