Commit e5ce2ed
feat(actions): durable packaged-action disable — same activation ledger, dispatch-time consult (#12348)
* feat(actions): durable packaged-action disable — same activation ledger, dispatch-time consult
Generalizes the packaged-flow disable machinery to actions (ADR-0126 §8 item 2,
maintainer amendment ruling 3). A packaged action can be switched off for an
installation; the flip writes an install-level row to the SAME
`sys_metadata_activation` object with `metadata_type: 'action'` — no schema
change, no new column, no clone machinery.
The consult sits at action DISPATCH, on every door that dispatches a declared
action: the REST `/actions/:object/:action` route and the MCP `run_action`
bridge, both through one shared guard. A disabled action is refused
`409 ACTION_DISABLED` before the handler body runs (it executes trusted), before
a flow-type action reaches the automation engine, before the param contract and
before the record load — and after the ADR-0066 D4 capability gate, so the
switch is not an oracle for unentitled callers.
The code is registered rather than borrowed: `FLOW_DISABLED` would tell an
operator to go hunting for a flow that does not exist. It is one census row in
the ADR-0112 ledger, in the `*_DISABLED` family that already names which thing
is off.
The projection lives on the ObjectQL engine and is hydrated at boot by its
plugin — the component ADR-0110 D5 already established as unconditionally
present wherever actions execute — so a disable survives a restart and the
handler re-registration every metadata reload performs. A ledger object absent
from the composition is read as absent, not probed, and re-checked on the next
reload rather than recorded as a verdict.
The write door is `POST /actions/_activation/:object/:action`, its segment
reserved because machine names cannot begin with `_`. It carries the same two
authority tiers as the flow toggle — `manage_metadata`, then the ADR-0126 §5
posture rule — now sharing ONE gate implementation with
`POST /automation/:name/toggle` instead of a second copy; the flow refusal text
is byte-identical to what it shipped with. An ambiguous action name is refused
`409 RESOURCE_CONFLICT` rather than switching off artifacts the caller did not
name, and a flip that cannot be made durable is reported as a failure instead
of a 200.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KWRU3s15AJz7PGW7a7wdCh
* fix(actions): pin the ledger fake's update dispatch, and declare how the activation door is actually served
Two CI failures, both real.
1. `check-engine-double-contract` — the activation-ledger fake's `update()` did
not route through ObjectQL's own dispatch predicate, so the double could
accept call shapes the engine refuses. Opened with
`assertEngineUpdateDispatch(data, options)` from `@objectstack/metadata-core`
(the predicate's home since #5619; importing objectql's own re-export from
inside objectql would be a self-import), matching the flow twin's fake. The
new pinned coverage is recorded in the pinned ledger via the sanctioned
`--write`; the shrink-only baseline is untouched.
2. `route-ledger-live-mount-parity` (#7526) — the activation door was
"LEDGERED BUT NOT MOUNTED, and DISGUISED". Root-caused on a booted showcase
rather than guessed: nothing registers `/api/v1/actions/_activation/:object/:action`,
and a 3-segment activation path is matched by
`/api/v1/actions/:object/:action/:recordId` with `_activation` bound to
`:object`. It still reaches the activation arm because that mount rebuilds
the dispatch path from its matched params, byte for byte — measured on the
wire: the 2-segment shape answers this door's own 400 naming the required
shape, and a 3-segment undeclared action answers its own 404 ("nothing to
switch off"), neither of which the invocation path can produce; a 4-segment
path resolves to nothing and 404s at the router.
So the honest fix is the declaration, not a second mount: the ledger row
carries `servedBy: /api/v1/actions/:object/:action/:recordId` with the
mechanism written down. Because a `servedBy` note cannot say the arm still
ANSWERS — and the unit suites drive the domain handler directly, which is
why they stayed green through this — the two wire assertions are pinned
end-to-end in the actions dogfood suite, on a boot that already exists.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KWRU3s15AJz7PGW7a7wdCh
* fix(objectql): make the activation-ledger fake REFUSE the WHERE combinators it does not implement
`pnpm check:where-matcher` flagged the double's `matches` as silently wrong:
with no combinator branch it read `$or` / `$in` as a FIELD NAME, compared
`row.$or` (undefined) against the operand, matched nothing, and would have left
a suite asserting on an empty result set with nothing erroring — the ABSENCE
shape of that defect class, which no syntactic guard can see.
Took the gate's own preferred remedy for a double that only ever sees scalar
equality (the store's two reads are `{ metadata_type }` and
`{ metadata_type, name }`): refuse rather than implement. The predicate now
throws on a `$`-prefixed key or an object-valued comparand, the same refusal the
flow twin's fake carries. ⛔ The gate's baseline is untouched.
The matcher also moved to MODULE scope, and that is load-bearing rather than
tidying: the gate judges a matcher by LIFTING it — transpiling it with the
declarations it references and running a combinator battery against it. Declared
inside the factory, the lift carried that factory's scope, reached `vi` and could
not evaluate, so the first attempt at this fix turned the verdict from "silently
wrong" into "unjudged" — which the gate never treats as passing.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KWRU3s15AJz7PGW7a7wdCh
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent d516483 commit e5ce2ed
20 files changed
Lines changed: 2619 additions & 90 deletions
File tree
- .changeset
- content/docs/references/api
- packages
- objectql/src
- qa/dogfood/test
- runtime/src
- domains
- spec/src/api
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| 196 | + | |
196 | 197 | | |
197 | 198 | | |
198 | 199 | | |
| |||
0 commit comments