Skip to content

Commit 47cde9b

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/issue-24822-update-repoint-honoured
2 parents 19388d7 + c67f244 commit 47cde9b

23 files changed

Lines changed: 1720 additions & 61 deletions
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
"@objectstack/lint": minor
3+
---
4+
5+
fix(lint)!: `os build`, `os validate`, `os lint` and the page save door refuse a page component whose `properties` is present but not an object, nested components included (#24991)
6+
7+
Clause-②: no (narrowing: `os lint --strict` refuses a nested page component whose `properties` is `null` or an array)
8+
9+
A page component's `properties` is a record on every node. `PageComponentSchema` refuses anything else, but that parse only reaches the top-level components (`regions[].components[]` and `slots.*`). A nested component, in a container's `children`, a tab or accordion panel's `items[].children` or a card's `footer`, sits in an untyped slot that no parse judges. The component-props rule (`validateComponentProps`) then skipped a nested node whose bag was `null`, an array or a scalar. So a nested `record:related_list` with `properties: null`, or a nested `object-metric` with `properties: []`, passed `os lint --strict`, `os validate` and `tsc`, and the page published a component that had lost every prop it was authored with. An absent bag was already judged as `{}`; this was the present-but-not-an-object residual of the same skip.
10+
11+
The rule now refuses such a bag on every walked node, whatever its `type`, with one `component-props-invalid` error located at the node's `properties` path (for example `pages[0].regions[0].components[0].properties.children[0].properties`). The message names what was received (`null`, an array, a string). No per-prop verdicts are added beside it.
12+
13+
**BREAKING — what moves for consumers.**
14+
15+
- `os build`, `os validate` and `os lint` fail on a page whose nested component carries `properties: null`, `properties: []` or a scalar `properties`. Before, they passed.
16+
- A page write in publish mode that carries such a component answered 200. It now answers `422 INVALID_METADATA` with a `component-props-invalid` issue at that path, because the page save door runs this same rule.
17+
18+
**Remedy.** Write the bag as an object of the props the component reads (`properties: { … }`), or omit the key when the component needs none. An omitted bag is judged as `{}`, so a component with required props still has to name them.
19+
20+
**Unchanged.**
21+
22+
- A top-level component's non-object bag is refused by the page parse, as before, and that parse runs before any authoring rule at both doors, so no second finding appears beside it.
23+
- An absent bag keeps its earlier verdict: it is judged as `{}`.
24+
- A valid bag is judged exactly as before. An unregistered component `type` with an object bag is still skipped.
25+
- The finding takes the rule's existing id and severity (`component-props-invalid`, `error`). No public export or signature moves.
26+
- Stored pages are not migrated and are not refused on read. A stored page with such a component keeps loading until it is next saved, and that save is judged.
27+
- Measured before crossing: no page this repository ships authors a non-object `properties` bag.
28+
29+
<!-- adr-0087: not-required (no-migration-prescription) a refusal at the CLI doors and the page save door of a page component whose properties bag is present but not an object: no authorable key, spelling, export or stored shape moves, and no stored row is read, rewritten or converted. A stored page with such a component keeps loading until it is next saved, and the repair is the author restoring the props the component lost, which no ledger entry can derive. The other categories are closed on facts: the package publishes (not unpublished); no ADR-0087 id covers this verdict (not already-registered); and the change is a lint verdict, not a declaration (not runtime-interface-only or type-surface-only). -->
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
'@objectstack/spec': minor
3+
---
4+
5+
feat(spec)!: `defineStack` refuses a stack that declares a webhook while `requires` lacks `'webhooks'` or `'realtime'`, with `STACK_WEBHOOK_CAPABILITY_REQUIRED`
6+
7+
A declared webhook is dispatched by two capabilities together: `'webhooks'` mounts `@objectstack/plugin-webhooks`, whose auto-enqueuer turns a record event into a delivery, and `'realtime'` mounts `@objectstack/service-realtime`, that auto-enqueuer's only source of record events. Neither token implies the other, and a scaffolded app's `requires` is `['automation', 'triggers']`, which carries neither. So a stack that declared a webhook without both validated, built and booted; the activation door answered `enabled: true`; every record write answered `200`; and no delivery was ever enqueued. The only trace was one boot `error`, after deploy. `defineStack` now refuses such a stack at load, the third declared-capability refusal beside `STACK_HIERARCHY_SCOPE_CAPABILITY_REQUIRED` and `STACK_TRIGGER_CAPABILITY_REQUIRED`, so every door that loads it (`os validate`, `os build`, `os serve` / `os dev`, an app's own `bootStack` tests) stops with the same sentence.
8+
9+
Clause-②: no (narrowing)
10+
11+
<!-- adr-0087: not-required (no-migration-prescription) No metadata moves: no spec key, authorable spelling, object definition or stored shape is added, removed, renamed or re-shaped, and no exported declaration is removed or narrowed, so there is nothing for `objectstack migrate meta` to rewrite. What changes is which `defineStack` input is accepted: a stack that declares a webhook and lacks one of two capability tokens is refused at load. The remedy is a capability declaration the author makes in their own `requires`, never a rewrite of a key or a stored row, and no token is implied or added for them, deliberately (ruling A on #24910). The other categories are closed on facts: the package publishes (not unpublished); no ADR-0087 id is named or touched (not registered or already-registered); and nothing exported is removed or narrowed (not runtime-interface-only, type-surface-only or runtime-export-retired). -->
12+
13+
**BREAKING** (the `defineStack` accept set narrows), shipped as `minor` under the launch-window convention for breaking changes.
14+
15+
- **FROM:** a stack with a non-empty top-level `webhooks:` collection and a `requires` missing `'webhooks'`, `'realtime'` or both (an absent `requires` included) was accepted, and its webhooks never delivered.
16+
- **TO:** `defineStack` throws `STACK_WEBHOOK_CAPABILITY_REQUIRED` (`status: 422`), header `defineStack webhook capability validation failed (N issues):`, with one `issues` entry per declared webhook naming the webhook and the missing token or tokens. One code for every arm: which token is missing is in the finding, not in the code.
17+
- **Unchanged:** a stack with no declared webhook owes neither token; `defineStack(config, { strict: false })` skips the judgement by contract; the activation door answers as before; and the boot `error` that `@objectstack/plugin-webhooks` logs for a host that wires a stack by hand, past `defineStack`, stays. Every declared webhook counts, `isActive: false` included, because the activation door can switch it on.
18+
- **The fix for an author:** add both tokens to the stack's `requires`, beside whatever it already declares, for example `requires: ['automation', 'triggers', 'webhooks', 'realtime']`. The refusal's own line names exactly the tokens to add.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@objectstack/objectql': minor
3+
---
4+
5+
feat(objectql): the engine composes a `ReadableIds` leaf that sits inside a composed read scope — the nested master chain (ADR-0139 D6 as amended)
6+
7+
Clause-②: no
8+
9+
**Before.** The executor boundary composed every `ReadableIds` leaf in a read's own `where` with the parent's read scope, and handed the driver that scope as answered. A scope that itself carried a leaf — a parent whose read scope is derived from ITS master, `{ master_fk: { $in: ReadableIds.of(G) } }`, the shape a two-level `controlled_by_parent` chain takes once its scope is spelled as a leaf — reached the driver uncomposed inside the parent's subquery, and the driver refused it, `INTERNAL_ERROR` / 500 (measured on driver-sql).
10+
11+
**Now.** Every leaf a composed scope carries is composed the same way, before the leaf that encloses it — the same five steps, the same caller context at every level (a delegated context included), recursively. The driver receives one composed leaf whose scope holds composed leaves and compiles one statement with the subqueries nested; a two-level chain serves exactly the rows today's id-list pre-scan serves, for a direct and for a delegated caller (measured on the real stack: `find` and `count` agree, one statement per read). Each parent is asked once per read, at whichever level it first appears. The closed doors hold at every level: `canReadObject` false, the deny sentinel, a throw on either half, or a parent the registry does not hold answer `$in: []` inside the composed scope. Refused by name, `INTERNAL_ERROR` / 500, before any driver is asked: D5's two classes at a nested level (a middleware-gated or federated master), a nested leaf outside a `$in` comparand or a composed leaf the engine did not compose inside a scope, a chain that returns to a parent already on its branch, and a chain deeper than 8 scopes (the same cut as the `controlled_by_parent` derivation's).
12+
13+
**What a reader sees.** No shipped security service answers a read scope carrying a leaf yet — `controlled_by_parent`'s scope is still the pre-resolved id list (ADR-0055 §2 mechanism (b)) until the plugin-security switch lands on its own card — so every shipped read is served as before. The six consumers' leaves compose exactly as they did: a scope with no leaf is composed by reference, one level asked.
14+
15+
**Unchanged.** `controlled_by_parent`'s own read scope and the id-list pre-scan, ADR-0055, every consumer's probe routing, and the drivers' compilation of the composed leaf (driver-sql and driver-memory already compile a scope that holds a composed leaf, through their own filter path).

‎content/docs/automation/webhooks.mdx‎

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,13 @@ A webhook reaches the dispatcher one of two ways:
101101
own `active` field.
102102

103103
**The capabilities a declared webhook needs.** A stack that declares a webhook
104-
must name two tokens in `requires`, beside whatever else it declares:
104+
must name two tokens in `requires`, `'webhooks'` and `'realtime'`, beside
105+
whatever else it declares. A stack that declares one while `requires` lacks
106+
either token is **refused**: `defineStack` throws
107+
`STACK_WEBHOOK_CAPABILITY_REQUIRED` (status 422), naming each declared webhook
108+
and the missing token or tokens, so `os validate`, `os build`, `os serve` /
109+
`os dev` and an app's own `bootStack` tests all stop at load with the same
110+
sentence. Neither token is added for you:
105111

106112
```ts
107113
requires: ['automation', 'triggers', 'webhooks', 'realtime'],
@@ -113,14 +119,18 @@ requires: ['automation', 'triggers', 'webhooks', 'realtime'],
113119
- `'realtime'` mounts the realtime service, which is the auto-enqueuer's only
114120
source of record events: the engine publishes `data.record.*` through it, and
115121
nothing else feeds the enqueuer (§4.1). With `'webhooks'` and without
116-
`'realtime'` the declaration is read but never dispatched. Record writes still
117-
succeed and no delivery is ever enqueued. The boot logs one `error` that names
118-
each declared webhook and the missing token. Switching a declared webhook on
119-
through the activation door delivers nothing on such a deployment either.
122+
`'realtime'` the declaration would be read but never dispatched: record
123+
writes would succeed and no delivery would ever be enqueued. That is why
124+
`defineStack` refuses the stack. A host that wires a stack by hand, past
125+
`defineStack`, still gets one boot `error` that names each declared webhook
126+
and the missing token; switching a declared webhook on through the activation
127+
door delivers nothing on such a deployment.
120128

121129
The outbox itself comes from `messaging`, which every boot mounts unless it runs
122130
with `--preset minimal`. A scaffolded app's `requires` is
123-
`['automation', 'triggers']`, so it carries neither of the two tokens above.
131+
`['automation', 'triggers']`, so it carries neither of the two tokens above:
132+
add both before you declare its first webhook. Every declared webhook counts,
133+
`isActive: false` included, because the activation door can switch it on.
124134

125135
On a database an 18.0 pre-release (`18.0.0-next.*`) created, the rows that release's boot seeder
126136
wrote for declared webhooks (`managed_by: 'package'`) are still there. Until the

‎content/docs/references/api/automation-api.mdx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ const result = AutomationApiErrorCode.parse(data);
352352

353353
| Property | Type | Required | Description |
354354
| :--- | :--- | :--- | :--- |
355-
| **code** | `Enum<'VALIDATION_ERROR' \| 'INVALID_FIELD' \| 'MISSING_REQUIRED_FIELD' \| 'INVALID_FORMAT' \| 'VALUE_TOO_LONG' \| 'VALUE_TOO_SHORT' \| 'VALUE_OUT_OF_RANGE' \| … +340 more>` | ✅ | The inner refusal's code in its WIRE spelling - the ADR-0112 member a record save of the same write answers in `error.code` (e.g. `UNIQUE_VIOLATION`); the closed set `ApiErrorSchema.code` parses against |
355+
| **code** | `Enum<'VALIDATION_ERROR' \| 'INVALID_FIELD' \| 'MISSING_REQUIRED_FIELD' \| 'INVALID_FORMAT' \| 'VALUE_TOO_LONG' \| 'VALUE_TOO_SHORT' \| 'VALUE_OUT_OF_RANGE' \| … +341 more>` | ✅ | The inner refusal's code in its WIRE spelling - the ADR-0112 member a record save of the same write answers in `error.code` (e.g. `UNIQUE_VIOLATION`); the closed set `ApiErrorSchema.code` parses against |
356356
| **message** | `string` | ✅ | The inner refusal's own diagnostic text, verbatim, without the node and operation prefixes the run's failure text adds |
357357

358358
### Allowed Values: `FlowInnerRefusal.code`
@@ -673,6 +673,7 @@ const result = AutomationApiErrorCode.parse(data);
673673
* `STACK_SINGLE_APP_VIOLATION`
674674
* `STACK_TRIGGER_CAPABILITY_REQUIRED`
675675
* `STACK_UNMANAGED_INSTALL_UNCOPYABLE`
676+
* `STACK_WEBHOOK_CAPABILITY_REQUIRED`
676677
* `STORED_TYPE_NOT_CANONICAL`
677678
* `STORE_UNAVAILABLE`
678679
* `SUGGESTION_CONFIRM_FAILED`

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const result = ApiErrorSchema.parse(data);
2828

2929
| Property | Type | Required | Description |
3030
| :--- | :--- | :--- | :--- |
31-
| **code** | `Enum<'VALIDATION_ERROR' \| 'INVALID_FIELD' \| 'MISSING_REQUIRED_FIELD' \| 'INVALID_FORMAT' \| 'VALUE_TOO_LONG' \| 'VALUE_TOO_SHORT' \| 'VALUE_OUT_OF_RANGE' \| … +340 more>` | ✅ | Error code (e.g. VALIDATION_ERROR; StandardErrorCode ∪ the ledger the serving side registers — ERROR_CODE_LEDGER for framework packages) |
31+
| **code** | `Enum<'VALIDATION_ERROR' \| 'INVALID_FIELD' \| 'MISSING_REQUIRED_FIELD' \| 'INVALID_FORMAT' \| 'VALUE_TOO_LONG' \| 'VALUE_TOO_SHORT' \| 'VALUE_OUT_OF_RANGE' \| … +341 more>` | ✅ | Error code (e.g. VALIDATION_ERROR; StandardErrorCode ∪ the ledger the serving side registers — ERROR_CODE_LEDGER for framework packages) |
3232
| **declaredCode** | `string` | optional | The producer-declared code, verbatim, when it is not a member of the closed `code` vocabulary — the open, author-authored channel (app-specific spellings; ADR-0112) |
3333
| **message** | `string` | ✅ | Readable error message |
3434
| **userMessage** | `string` | optional | Producer-marked user-facing refusal text, verbatim. Present exactly when the producer opted in at throw time; consumers render it to end users and keep their generic substitution for anything unmarked. Status-agnostic; never replaces `message`. |
@@ -356,6 +356,7 @@ const result = ApiErrorSchema.parse(data);
356356
* `STACK_SINGLE_APP_VIOLATION`
357357
* `STACK_TRIGGER_CAPABILITY_REQUIRED`
358358
* `STACK_UNMANAGED_INSTALL_UNCOPYABLE`
359+
* `STACK_WEBHOOK_CAPABILITY_REQUIRED`
359360
* `STORED_TYPE_NOT_CANONICAL`
360361
* `STORE_UNAVAILABLE`
361362
* `SUGGESTION_CONFIRM_FAILED`

‎content/docs/references/api/error-code-ledger.mdx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,7 @@ const result = ErrorCode.parse(data);
523523
* `STACK_SINGLE_APP_VIOLATION`
524524
* `STACK_TRIGGER_CAPABILITY_REQUIRED`
525525
* `STACK_UNMANAGED_INSTALL_UNCOPYABLE`
526+
* `STACK_WEBHOOK_CAPABILITY_REQUIRED`
526527
* `STORED_TYPE_NOT_CANONICAL`
527528
* `STORE_UNAVAILABLE`
528529
* `SUGGESTION_CONFIRM_FAILED`

0 commit comments

Comments
 (0)