Skip to content

Commit 3e0fd7a

Browse files
feat(spec,metadata-protocol,rest,objectql,runtime): GET /meta/object serves switched-off packaged actions beside the item, and the disabled-action refusal reads as a plain sentence (#27964)
<!-- claude-projects-attribution: {"github_login":"marchtian"} --> _Requested by **田騏** · [project thread](https://claude.ai/code/project/chan_01VmuUhXU9SSUzqJYyXSmYSi?thread=cmsg_01VmuUhXU9SSUzqJYyXSmYSiEosMC3zDfHaauURHFNq1GJ)_ Fixes #27842 Clause-②: yes (widening) Metadata-protocol: added ## 维护者速读 - **改了什么**:`GET /meta/object/:name`(含默认缓存通道)与 `GET /meta/object` 列表,在 item 旁边新增 `disabledActions`,列出本部署在「设置 › 打包自动化」里被关掉的打包动作;点被关动作时的 409 提示改成给终端用户看的白话句子。 - **为什么改**:以前元数据读取里没有“已关闭”这件事,按钮照常显示、一点就红色报错,报错还点名系统表和 ADR;这是 #27504(控制台隐藏按钮)的服务端一半。 - **风险与回滚**:新键是可选的、在 item 之外,`item.actions` 一字不改;没有台账的部署不出这个键,行为同今天。代价是带键的对象读取不再回 304(与 #23316 的 `registration` 同一取舍)。回滚即还原本 PR。 - **先看**:`packages/metadata-protocol/src/protocol-action-activation-reads.ts`(读取缝与“缺席≠空”)、`packages/rest/src/meta-item-read-routes.ts`(对象缓存通道的 304 让路那一处)、`packages/spec/src/api/protocol.zod.ts`(三个 schema 的新键与说明)。 - **两分钟验证**:`pnpm --filter @objectstack/metadata-protocol exec vitest run src/protocol.object-disabled-actions.test.ts`,预期 11 条全绿;在 showcase 关掉 `showcase_mark_done` 后 `GET /api/v1/meta/object/showcase_task` 返回 `"disabledActions":["showcase_mark_done"]`。 - **需要你做的**:在本 PR 里批准键名 `disabledActions`(单项读取为名字数组,列表为按对象名分组的同名键)——这是 Clause-② yes 的协议新增,键名由你定。 ## What changes The action twin of `registration` (#23316, PR #23358), served beside the item and never inside it. - **Spec** (`@objectstack/spec`, minor). `GetMetaItemResponseSchema` and `GetMetaItemCachedResponseSchema` gain the optional `disabledActions: string[]`; `GetMetaItemsResponseSchema` gains the optional `disabledActions: Record<objectName, string[]>`. `IObjectQLEngine` (`contracts/objectql-engine.ts`, the engine contract the dispatch doors already reach) gains the optional `getDisabledActions(): string[] | undefined`. Docblocks state the four choices below. - **The fact** (`@objectstack/objectql`). `ObjectQL.getDisabledActions()` answers the names the engine's `ActionActivationProjection` switches off (the projection both dispatch doors consult before the 409), or `undefined` while no ledger is attached. `listDisabledActions()` keeps answering `[]` for both cases. - **The seam** (`@objectstack/metadata-protocol`). `protocol-action-activation-reads.ts` reads `getServicesRegistry().get('objectql').getDisabledActions` per call, the way `getFlowRegistration` is read from `automation`. `metadata-protocol` imports nothing from `objectql`. The item read (served face, not on draft returns) spreads `disabledActions` beside `lock`; the list spreads it beside `items`, one entry per listed non-draft object; `getMetaItemCached` carries it beside `data` and skips the 304 when it is present. - **The default door** (`@objectstack/rest`). The cached branch of `GET /meta/:type/:name` rebuilds the envelope with `disabledActions` for `object`. An object's validator is folded and compared in REST (`audienceFolds`), so the REST-side 304 also stands down for a read that carries the key. The ETag header itself is unchanged. - **The plain sentence** (`@objectstack/objectql`, `@objectstack/runtime`). `describeDisabled()` now reads: "This action is turned off for this deployment. An administrator can turn it on again under Setup › Packaged automation, or you can use another action." No table, no ADR, no tracker number. The 409 and the `ACTION_DISABLED` code are unchanged. `ObjectQL.describeDisabledAction()`, which both doors call exactly when they refuse, writes one `info` log line with the code, the action name, `sys_metadata_activation` and ADR-0126 §8 item 2. `disabledActionRefusal`'s fallback for an engine with no sentence is plain as well. ### The key name, and empty versus absent - **Key name: `disabledActions`**, the triage route's spelling, on all three reads (the list keyed by object name, as `registrations` is keyed by flow name). **The maintainer approves the key name in this PR** (Clause-② yes). - **Absent vs `[]`.** Measured on `registration`: when the engine answers, every served flow gets a verdict (`unregistered` included) and the list holds one entry per listed non-draft flow (`Object.fromEntries` over every item); the key is absent only when no engine declares the member. This PR does the same. The key is **absent** when no ledger answered: no `objectql` service, an engine without the member, or `getDisabledActions()` returning `undefined` because no store is attached. It is **`[]`** when a ledger answered and none of this object's actions is off. That leaves absence to mean "unknown, keep today's behaviour" and never "nothing is switched off". The choice and its reason are in the spec docblock. - **Which names.** The names in the served `item.actions[]` that the projection holds, in declared order. Packaged standalone actions bound to the object are merged into `actions[]` by `defineStack` / `registerApp` (`mergeActionsIntoObjects`), so they are covered. The key never names more than `item.actions` already discloses. ## Tests - `metadata-protocol` — `src/protocol.object-disabled-actions.test.ts` (new, 11 cases): the names of this object only; `item.actions` byte-identical with and without the key; `[]` for no matches and for an object with no actions; absent for no engine, an engine without the member, and an engine with no ledger; the plural type folded; other types are never asked; the execution face carries none; the list keyed by object name with `[]` entries, one engine call per list; a draft gets no entry; the cached door carries it beside `data` with the same ETag; a read that carries it is not answered 304 while the unjudged control is. - `rest` — `src/meta-object-cached-disabled-actions.test.ts` (new, 4 cases): the default cached object door carries the key, `[]` and absence; with `If-None-Match` equal to the issued ETag the judged read answers 200 and the unjudged control answers 304. - `objectql` — `src/protocol-meta-disabled-actions.test.ts` (new, 3 cases): the real `ObjectQL` and the real protocol through the service table; a `setActionActive` flip appears on the next item read, the list and the cached door; no ledger means no key. `src/action-activation.test.ts`: `getDisabledActions` (`undefined` / `[]` / names), the log line, and the plain-sentence pin. - `runtime` — `src/domains/action-activation-dispatch.test.ts`: the REST door's 409 + code + the first sentence + no table/ADR/tracker number; the MCP door serves the same sentence from the one producer; the no-sentence engine fallback is plain. The doubles there and in `api-action-forward.test.ts` now call the real `ActionActivationProjection.describeDisabled`, not a transcribed copy. - `spec` — `src/api/meta-item-response-shapes.test.ts`: type-level `Eq` pins for the three keys, parses for names / `[]` / absent, and a located refusal for a non-string name. - Pin sweep: every pin of the old sentence and `ACTION_DISABLED`'s message was flipped in one pass: the two files above, `packages/qa/dogfood/test/packaged-action-disabled-dispatch-live.dogfood.test.ts` (sentence helper), `packages/qa/dogfood/test/packaged-activation-ledger-reach.dogfood.test.ts` (`/ACTION_DISABLED|is disabled/` → the code), and `docs/qa/platform-checklist/areas/api-backend.json` (`api-backend.packaged-action-disabled-dispatch` acceptance[0], revision 9 → 10 with a history entry). `ui/` carries no pin of the sentence or the code. Full suites on the final head (merge of `origin/main` included): | Package | typecheck | test | |---|---|---| | `@objectstack/spec` | 0 | 0 — 756 files, 22483 passed, 1 todo | | `@objectstack/metadata-protocol` | 0 | 0 — 283 files (4 skipped), 21854 passed, 26 skipped | | `@objectstack/objectql` | 0 | 0 — 493 files, 9587 passed | | `@objectstack/rest` | 0 | 0 — 350 files, 6759 passed, 332 skipped | | `@objectstack/runtime` | 0 | 0 — 481 files, 7837 passed, 19 skipped | The first runtime typecheck exited 1 on `organization-ownership-boot-guard.turso-remote.kernel.test.ts` (TS2307, `@objectstack/driver-turso` had no local `dist`). That file is not in this diff. After building `driver-turso` the rerun exited 0. The two dogfood files boot example apps and were not run locally; CI's Dogfood Regression Gate runs on `main`'s push battery, not on this PR. ### Ablation (serve path) `packages/metadata-protocol/src/protocol.ts`: the item read's `...(readDisabledActions ? { disabledActions: readDisabledActions(decorated) } : {})` was replaced with `/* ABLATION-27842 */` (`scripts/ablation-replace.mjs`). Then `vitest run src/protocol.object-disabled-actions.test.ts` gave **5 failed / 6 passed**. Red: names on the item read; `[]` cases; the plural fold; the cached door carries it; no 304 while carried. Green: the absence controls, the other-type case, the execution face and the three list cases, which use their own spread. Restored by the same tool; the blob equals HEAD and `git diff HEAD` is empty. ## Acceptance notes - **The 304 trade, stated for the contract review.** The card fixes the #23316 trade: never in the ETag, never 304 when present. Any deployment that composes `sys_metadata_activation` (every `PlatformObjectsPlugin` boot) attaches a ledger, so every cached `GET /meta/object/:name` there now answers 200 with the full body. A ledger with no rows still serves `[]`. The alternative is to fold the switched-off names into the REST-side validator, as REST already folds visibility, runtime-view and audience fingerprints. That keeps 304s and stays correct. It is not done here because the card rules it out. - **The log line** is `info` and written by the engine in `describeDisabledAction`. That method is the one place both doors pass on every refusal, and it holds the host's logger. The dispatcher's `deps.logger` is not wired on `HttpDispatcher`. The sentence producer `ActionActivationProjection.describeDisabled` stays pure. - **Not changed.** The 503 `SERVICE_UNAVAILABLE` refusal of the activation write door still names `sys_metadata_activation` and ADR-0126. It answers an administrator's flip, not an end user's click, and the card does not name it. - `docs/qa/platform-checklist/areas/platform-core.json` (the ledger posture note) says "the data-API read IS the only 'what is off here' surface today". After this PR, `GET /meta/object` also answers it. Left for the checklist owner. Carrier: seat. - The flow twin's ledger refusal (`describeDisabledFlow`, `packages/services/service-automation/src/subflow-guards.ts`) still names `sys_metadata_activation` and ADR-0126 §7.2 in the `FLOW_DISABLED` message. QA keys the ledger-vs-status distinction on that message (automation checklist, negative[3]), so a change there is its own decision. Carrier: seat. ## Verification - `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` on the final head `7237921e36`: **119 commands**, each exit code recorded before any pipe. `--ran`: "119 derived, 119 run, 0 NOT-MEASURED, 0 UNRUN" (exit 0). - On the first pass: - `check:skill-examples` and `check:dual-build-cjs-loads` exited **3** (PREREQUISITE NOT MET: no `dist/` for packages outside the touched closure). After `pnpm turbo run build --filter='./packages/**'`, both exited 0. - `check:engine-double-contract` exited **1** (RETAINED: the new metadata-protocol test's pinned `findOne` double was not yet in the ledger). Fixed with `--write`, which adds only that one entry to `scripts/engine-double-contract.pinned.json`, and committed. The rerun exited 0. - That ledger commit derived 8 more `scripts/` gates. All 8 exited 0. - `node scripts/check-adr-0087-registration.mjs --base origin/main`, `check-changeset-no-major`, `check-empty-changeset`, `check:generated`, `check:api-surface` and `check:authorable-surface` are all in the 119 and all exited 0. - Diff: 23 files, +1127 / −45 (under the 3000-line human-merge threshold). - Not measured here: the CI-only jobs dispatch-gates lists outside the runnable set (Build Core, Build Docs, the type-check lanes), and the Dogfood and Temporal jobs, which run on `main` after the merge. Independent review: none run (quota); the PR waits for the seat's contract-review hand-off. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017ihL2fi9zfJhUTubyJYb6V --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent bc496bf commit 3e0fd7a

23 files changed

Lines changed: 1131 additions & 48 deletions
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/spec': minor
3+
---
4+
5+
feat(spec): the object meta reads declare `disabledActions`, the packaged actions the activation ledger switches off, beside the item
6+
7+
Clause-②: yes (widening)
8+
Metadata-protocol: added
9+
10+
`GetMetaItemResponseSchema` and `GetMetaItemCachedResponseSchema` gain the optional `disabledActions` (an array of action names), and `GetMetaItemsResponseSchema` gains the optional `disabledActions` keyed by object name. On an `object` read it names the actions in `item.actions` that this deployment's activation ledger switches off (an administrator turned them off under Setup › Packaged automation), so a call to any of them is refused 409 `ACTION_DISABLED`. It sits beside the item, never inside it: `item.actions` is served as declared, a switched-off action included. The key is absent when no activation ledger answered, which never means "nothing is switched off"; `[]` means a ledger answered and none of this object's actions is off. On the cached default door it is read live and kept out of the ETag, so a read that carries it is never answered 304. `IObjectQLEngine` gains the optional member `getDisabledActions()`, which the metadata read calls through the kernel's service table: it returns the switched-off names, or `undefined` when no ledger is attached.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@objectstack/metadata-protocol': patch
3+
'@objectstack/rest': patch
4+
'@objectstack/objectql': patch
5+
'@objectstack/runtime': patch
6+
---
7+
8+
fix: `GET /meta/object` serves which packaged actions are switched off beside the item, and a switched-off action is refused with a plain sentence
9+
10+
Clause-②: yes (widening)
11+
Metadata-protocol: none
12+
13+
- **Served beside the object** (`@objectstack/metadata-protocol`, `@objectstack/rest`). `GET /api/v1/meta/object/:name` serves `disabledActions` beside `item`: the names in `item.actions` that the deployment's activation ledger switches off. `GET /api/v1/meta/object` serves the same answer keyed by object name. The default cached door carries it too, read live on every call and kept out of the ETag, so a read that carries it is answered in full rather than `304 Not Modified`. The key is absent where no ledger answered (no engine, or an engine with no ledger attached), on a draft read, and on every type other than `object`. `item.actions` is unchanged. The protocol reads the engine's `getDisabledActions` through the kernel's service table by name and imports no engine.
14+
- **The fact it serves** (`@objectstack/objectql`). `ObjectQL.getDisabledActions()` returns the names the engine's activation projection switches off, the same projection both dispatch doors consult before they refuse a call, or `undefined` when no ledger is attached. `listDisabledActions()` is unchanged.
15+
- **The refusal sentence** (`@objectstack/objectql`, `@objectstack/runtime`). A switched-off action is still refused 409 `ACTION_DISABLED` at the REST and MCP doors, and the message now reads: "This action is turned off for this deployment. An administrator can turn it on again under Setup › Packaged automation, or you can use another action." It no longer names the ledger table or the ADR. The engine writes those, with the code and the action's name, to an `info` log line each time it refuses one.

‎content/docs/references/api/protocol.mdx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,6 +1332,7 @@ This schema accepts one of the following structures:
13321332
| **notModified** | `boolean` | optional (default: `false`) | True if resource has not been modified (304 response) |
13331333
| **version** | `string` | optional | Metadata version identifier |
13341334
| **registration** | `{ state: 'registered' } \| { state: 'refused'; reason: object } \| { state: 'unregistered' }` | optional | The automation engine's verdict on the flow in `data`, read live on every call and never part of `etag` (see `FlowRegistrationSchema`). Present only for a `flow` read answered by a process that runs an automation service; a read that carries it is never answered `notModified`. Absent otherwise, and absence means no engine judged it, never `registered`. |
1335+
| **disabledActions** | `string[]` | optional | The names in the `actions` of the object in `data` that this deployment's activation ledger switches off (a call to any of them is refused 409 `ACTION_DISABLED`), read live on every call and never part of `etag`. Present only for an `object` read answered by a process whose data engine has an activation ledger attached, `[]` when none is switched off; a read that carries it is never answered `notModified`. Absent otherwise, and absence means no ledger answered, never that nothing is switched off. |
13351336

13361337
### Nested Shape: `GetMetaItemCachedResponse.etag`
13371338

@@ -1458,6 +1459,7 @@ This schema accepts one of the following structures:
14581459
| **resettable** | `boolean` | optional | Whether the item can be reset to its packaged default — true iff it is artifact-backed, i.e. there is a baseline to reset TO. |
14591460
| **version** | `string \| null` | optional | ADR-0008 version token of the STORED row a save to this item compares against, at this read's scope (the environment's partition and `?package=`) and lifecycle (`?state=draft` reads the draft row, the plain read the active row). The same keyed token a save receipt's `version` serves for that row: send it back as the `If-Match` request header on `PUT /meta/:type/:name` (with `?mode=draft` for the draft) and a concurrent edit is refused 409 `METADATA_CONFLICT` instead of overwritten. `null` when no stored row is there — an item served from code or a package artifact, or from a row in another scope (a package-less row a package read falls back to) — so the next save creates one: pin it with `If-None-Match: *`. A `null` beside `editable: false` is no such invitation: that item takes no save at this address, so no pin is prescribed for it. ABSENT on the cached published-value branch and on a `?preview=draft` read, which publish no version: absence means "not published here", never "no row". Opaque — echo it verbatim, never parse it. |
14601461
| **registration** | `{ state: 'registered' } \| { state: 'refused'; reason: object } \| { state: 'unregistered' }` | optional | The automation engine's verdict on this flow (see `FlowRegistrationSchema`): `registered`, or `refused` with the engine's `reason` verbatim, or `unregistered`. Present only on a `flow` read answered by a process that runs an automation service; absent otherwise, and absence means no engine judged it, never `registered`. Unlike the protection keys it is published by the cached branch too, read live and never part of the ETag, so a cached read that carries it is never answered 304; it is absent on a draft read, whose pending body no engine holds. The verdict is the answering process's engine. Beside `item`, never inside it: the item's `status` stays what its author declared. |
1462+
| **disabledActions** | `string[]` | optional | The names in `item.actions` that this deployment's activation ledger switches off (an administrator turned them off under Setup › Packaged automation): a call to any of them is refused 409 `ACTION_DISABLED`. Present only on an `object` read answered by a process whose data engine has an activation ledger attached, and then `[]` when none of this object's actions is switched off. Absent otherwise, and absence means no ledger answered, never that nothing is switched off. Unlike the protection keys it is published by the cached branch too, read live and never part of the ETag, so a cached read that carries it is never answered 304; it is absent on a draft read. The ledger is the answering process's engine's. Beside `item`, never inside it: `item.actions` is served as declared, a switched-off action included. |
14611463
| **draftChanges** | `{ path: string[]; by: Enum<'copilot' \| 'mcp' \| 'studio' \| 'api'>; actor: string \| null; client?: object; … }[]` | optional | Per-key provenance of the pending draft: which authoring surface last changed each key path of `item`, under which actor, and when. The draft save records it: each draft save is compared with the body that save replaced (the previous draft, or the stored published row for the draft's first save; a draft of an item with no stored published row is recorded as `[]`, the whole body). A `migrate-stored` rewrite of a draft row records nothing, since it is not authoring. The entries are kept from the first recorded save until the draft is published or discarded, which remove the draft row and the entries with it; and no two entries share a path: a save replaces every entry at or under each path it changes, so the last write to change a key is the entry whose `path` is the longest prefix of that key's path, and entries under a key's path are changes inside it. The entries name which writes changed what; they are not a list of every difference from the published body (compare the two bodies for that). Served only on a `?state=draft` read that answers a stored draft row. ABSENT on the active read, the cached branch and a `?preview=draft` read, and for a draft row whose saves recorded none: absence means "not recorded", never "no changes". |
14621464

14631465
### Nested Shape: `GetMetaItemResponse.sortability`
@@ -1522,6 +1524,7 @@ One changed key path of the pending draft, and the last write that changed it.
15221524
| **type** | `string` | ✅ | Metadata type name |
15231525
| **items** | `any[]` | ✅ | Array of metadata items |
15241526
| **registrations** | `Record<string, { state: 'registered' } \| { state: 'refused'; reason: object } \| { state: 'unregistered' }>` | optional | The automation engine's verdict on each listed flow, keyed by the item's `name`: one entry per listed item that is not a pending draft. Present only on a `flow` list answered by a process that runs an automation service; absent otherwise, and absence means no engine judged them, never `registered`. The verdict is the answering process's engine. Beside the items, never inside one: an item's `status` stays what its author declared. |
1527+
| **disabledActions** | `Record<string, string[]>` | optional | For each listed object, keyed by the item's `name`: the names in its `actions` that this deployment's activation ledger switches off, so a call to any of them is refused 409 `ACTION_DISABLED` (the item read's `disabledActions`). One entry per listed object that is not a pending draft, `[]` when none of its actions is switched off. Present only on an `object` list answered by a process whose data engine has an activation ledger attached; absent otherwise, and absence means no ledger answered, never that nothing is switched off. Beside the items, never inside one: each item's `actions` is served as declared. |
15251528

15261529
### Nested Shape: `GetMetaItemsResponse.registrations[string][state='registered']`
15271530

‎docs/qa/platform-checklist/areas/api-backend.json‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,7 +1674,7 @@
16741674
"title": "A disabled packaged action is refused 409 ACTION_DISABLED at BOTH dispatch doors — after the capability gate (a 403 is never an oracle for the switch), before the param contract and the record load, durable across restart",
16751675
"since": "v17",
16761676
"status": "active",
1677-
"revision": 9,
1677+
"revision": 10,
16781678
"priority": "P0",
16791679
"surface": "api",
16801680
"personas": [
@@ -1706,9 +1706,9 @@
17061706
],
17071707
"acceptance": [
17081708
{
1709-
"clause": "the REST door refuses a disabled packaged action 409 ACTION_DISABLED and dispatches NOTHING: status 409, code ACTION_DISABLED (registered in the ADR-0112 ledger, error-code-ledger.zod.ts), message = the engine's own describeDisabledAction sentence naming the ledger — and no side effect lands (mark_done's declared done/progress write never ran)",
1709+
"clause": "the REST door refuses a disabled packaged action 409 ACTION_DISABLED and dispatches NOTHING: status 409, code ACTION_DISABLED (registered in the ADR-0112 ledger, error-code-ledger.zod.ts), message = the engine's own describeDisabledAction sentence, written for the end user: it says the action is turned off for this deployment and that an administrator can turn it on again under Setup › Packaged automation, and names no system table and no ADR (the engine's log line carries those) — and no side effect lands (mark_done's declared done/progress write never ran)",
17101710
"oracle": "api",
1711-
"verify": "step-3 trace: 409 + code ACTION_DISABLED + the disabled-action sentence; follow-up reads show no task mutated. packaged-action-disabled-dispatch-live.dogfood.test.ts scores it over HTTP: the exact code, the sentence (prefix \"Action 'showcase_mark_done' is disabled — \" and the ledger citation), and the real task re-read with done, progress and updated_at unchanged. packaged-activation-ledger-reach.dogfood.test.ts still asserts 409 and /ACTION_DISABLED|is disabled/ only",
1711+
"verify": "step-3 trace: 409 + code ACTION_DISABLED + the disabled-action sentence; follow-up reads show no task mutated. packaged-action-disabled-dispatch-live.dogfood.test.ts scores it over HTTP: the exact code, the sentence (first sentence \"This action is turned off for this deployment.\", the Setup › Packaged automation remedy, and no ledger table or ADR in it), and the real task re-read with done, progress and updated_at unchanged. packaged-activation-ledger-reach.dogfood.test.ts still asserts 409 and the code ACTION_DISABLED only",
17121712
"evidence": "the trace + the control re-reads"
17131713
},
17141714
{
@@ -1833,6 +1833,12 @@
18331833
"date": "2026-10-27",
18341834
"change": "acceptance[0]–[6] and negative[0]–[2] are pinned at the layer their api oracle names (the release-18.2.0 Tier 1 sweep #26468 scored a0, a3, a4, a6 and n1 partial below the HTTP layer, and a1, a5, n0 and n2 unpinned). The new packaged-action-disabled-dispatch-live.dogfood.test.ts drives the REST door, the live MCP transport and a cold boot on one database file; automated.ref names what it asserts and acceptance[0].verify names the pin that carries it. Measured at base c8583f80. No clause changed",
18351835
"ref": "#26572"
1836+
},
1837+
{
1838+
"revision": 10,
1839+
"date": "2026-10-30",
1840+
"change": "acceptance[0]'s clause and verify respelled for #27842: the disabled-action sentence is now written for the end user who clicked (what happened, that an administrator can turn the action on again under Setup › Packaged automation, or use another action) and names no system table and no ADR; the engine's describeDisabledAction writes the ledger table, ADR-0126 §8 and the ACTION_DISABLED code to its log line instead. The code and the 409 are unchanged, so every other clause stands; the clause's 'naming the ledger' was the only text that turned false. The dogfood pin's sentence helper and packaged-activation-ledger-reach.dogfood.test.ts's /ACTION_DISABLED|is disabled/ are flipped in the same change (the latter now reads the code alone)",
1841+
"ref": "#27842"
18361842
}
18371843
]
18381844
},
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
/**
4+
* [#27842] The data engine's packaged-action activation read, for the `object`
5+
* meta reads: `disabledActions` beside the item read's envelope (both doors)
6+
* and beside the list's items, keyed by object name
7+
* (`GetMetaItemResponseSchema` / `GetMetaItemsResponseSchema` in
8+
* `@objectstack/spec/api`).
9+
*
10+
* - `resolveDisabledActionsReader` — the engine's `getDisabledActions`, read
11+
* ONCE per meta read, turned into a reader of one object body; nothing for
12+
* every other type, and nothing where no ledger answered.
13+
* - `disabledActionsOf` — the list's `disabledActions`: that reader's answer
14+
* per listed, non-draft object.
15+
*
16+
* ## The seam
17+
*
18+
* The automation twin's (`protocol-automation-flow-reads.ts`,
19+
* `getFlowRegistration`): the kernel's service table, read by name and per
20+
* call, for an optional member the engine declares on its contract —
21+
* `IObjectQLEngine.getDisabledActions` in `@objectstack/spec/contracts`. This
22+
* package never imports `@objectstack/objectql` (which depends on it). The
23+
* slot is `objectql`, the one the dispatch doors resolve the engine from
24+
* before they consult the same projection, so the read and the 409 refusal
25+
* answer from one fact.
26+
*
27+
* ## What it never does
28+
*
29+
* ⛔ It never reads or rewrites the body it is given: `actions[]` is served as
30+
* declared, a switched-off action included (the Setup page lists from it to
31+
* offer the switch back on), and no `visible` / `disabled` member is written
32+
* into an action, which would ride the GET → edit → PUT round trip back into
33+
* the stored body. ⛔ It never makes up an answer: where the engine declares
34+
* no member, or answers `undefined` (no ledger attached), the read serves no
35+
* key — absence is "no ledger answered", never "nothing is switched off".
36+
*
37+
* The bodies take the host-literal shape `protocol-automation-flow-reads.ts`
38+
* documents, so the class keeps each method and its docblock.
39+
*/
40+
41+
import type { IObjectQLEngine } from '@objectstack/spec/contracts';
42+
import type { ObjectStackProtocolImplementation } from './protocol.js';
43+
import { canonicalMetaType } from './protocol.js';
44+
45+
/**
46+
* The `ObjectStackProtocolImplementation` members the functions below read —
47+
* every one of them, and no other; each function's `this` is the `Pick` of
48+
* the members it reads, typed AS the class member.
49+
*/
50+
export interface ActionActivationReadsHost {
51+
readonly getServicesRegistry: ObjectStackProtocolImplementation['getServicesRegistry'];
52+
readonly resolveDisabledActionsReader: ObjectStackProtocolImplementation['resolveDisabledActionsReader'];
53+
}
54+
55+
/**
56+
* The names of `body.actions[]` the switched-off set holds, in the order the
57+
* body declares them, each once. A body with no `actions` array holds none.
58+
*/
59+
function switchedOffActionsOf(body: unknown, off: ReadonlySet<string>): string[] {
60+
const actions = (body as { actions?: unknown } | null | undefined)?.actions;
61+
if (!Array.isArray(actions)) return [];
62+
const named = new Set<string>();
63+
for (const action of actions) {
64+
const name = (action as { name?: unknown } | null | undefined)?.name;
65+
if (typeof name === 'string' && off.has(name)) named.add(name);
66+
}
67+
return [...named];
68+
}
69+
70+
/** The body of `ObjectStackProtocolImplementation#resolveDisabledActionsReader`; the method's docblock there is its contract. */
71+
export function resolveDisabledActionsReader(
72+
this: Pick<ActionActivationReadsHost, 'getServicesRegistry'>,
73+
type: string,
74+
): ((body: unknown) => string[]) | undefined {
75+
if (canonicalMetaType(type) !== 'object') return undefined;
76+
const engine = this.getServicesRegistry?.().get('objectql') as
77+
| Pick<IObjectQLEngine, 'getDisabledActions'>
78+
| undefined;
79+
const read = engine?.getDisabledActions;
80+
if (typeof read !== 'function') return undefined;
81+
const answer = read.call(engine);
82+
if (!Array.isArray(answer)) return undefined;
83+
const off = new Set<string>(answer);
84+
return (body) => switchedOffActionsOf(body, off);
85+
}
86+
87+
/** The body of `ObjectStackProtocolImplementation#disabledActionsOf`; the method's docblock there is its contract. */
88+
export function disabledActionsOf(
89+
this: Pick<ActionActivationReadsHost, 'resolveDisabledActionsReader'>,
90+
type: string,
91+
items: readonly unknown[],
92+
): { disabledActions?: Record<string, string[]> } {
93+
const read = this.resolveDisabledActionsReader(type);
94+
if (!read) return {};
95+
const entries: Array<[string, string[]]> = [];
96+
for (const it of items) {
97+
const name = (it as { name?: unknown } | null | undefined)?.name;
98+
if (typeof name !== 'string' || (it as { _draft?: unknown })._draft === true) continue;
99+
entries.push([name, read(it)]);
100+
}
101+
return { disabledActions: Object.fromEntries(entries) };
102+
}

0 commit comments

Comments
 (0)