Skip to content

Commit 72a6ac3

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/project-thread-4jovt0
2 parents 2b9b483 + 43dd565 commit 72a6ac3

70 files changed

Lines changed: 3298 additions & 362 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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/objectql': patch
3+
'@objectstack/service-analytics': minor
4+
---
5+
6+
feat(objectql): a nested-relation condition on a read verb is an in-database subquery per relationship, up to three relationships, where that is provably the same read as the id read; analytics serves the dataset's own `filter` the same way
7+
8+
Clause-②: yes (widening) — `{ account: { status: { $ne: 'cancelled' } } }` on `find`, `findOne`, `count` and `aggregate` (and so every analytics face that hands the engine the nested form) is served whatever the number of matching related records on a driver that compiles the subquery (the SQL drivers; the in-memory driver evaluates it in process), where more than 1,000 answered `INVALID_FILTER` / 400. The related read is planned through its whole pipeline as the caller and its final `where` becomes the subquery's scope; related-object read restrictions the planned read observes are carried into the subquery, or the hop falls back to the id read (the related object read as the caller, then `$in`, under the 1,000 cap). A relation key inside the condition may now carry a condition of its own, down to ADR-0071's three relationships (`{ contact: { account: { region: { name: 'NA' } } } }`), where a second level answered `INVALID_FILTER` / 400; each hop is that object's own read, and a fourth relationship is refused by name. On the analytics engine-aggregate path a dotted `where` leaf through up to three relationships (`order.customer.tier`), and a cross-object leaf in a compiled dataset's own definition-level `filter`, reach the engine as that nested condition, where both answered `INVALID_FIELD` / 400. Still the id read, under the 1,000 cap: a related object on another datasource, a federated related object, a driver that compiles no subquery (MongoDB, OData), a related object an object-scoped middleware or an `afterFind` hook shapes, a related object read under different driver options than the outer object (decided before planning where the registry answers it: the two objects' tenancy class under a walled posture), a related read that a middleware answers itself, a multi-valued relation and the `update` / `delete` verbs. A hop that falls back after planning dispatches the related read twice: its middleware chain and `beforeFind` hooks run for the planned read and again for the id read. A per-measure `filter` carrying a cross-object leaf stays refused. The SQL echo of a dataset `filter` carrying a served cross-object leaf refuses `INVALID_FILTER` / 400 where it refused `INVALID_FIELD` / 400; neither printed a statement.
9+
Metadata-protocol: added — a compiled dataset's definition-level `filter` (`@objectstack/service-analytics`) now accepts a cross-object leaf on the engine-aggregate path, where it answered `INVALID_FIELD` / 400: a new accepted value for a dataset author.
10+
Skills-docs: `content/docs/protocol/objectql/query-syntax.mdx` and `content/docs/kernel/contracts/data-engine.mdx` describe the subquery, the three-relationship limit, where the id read and its cap still apply and which drivers compile the subquery. `skills/objectstack-query` still says "up to 1000 related ids" and one level for every relation; that is now stricter than the engine for a single-valued relation on a read verb (a follow-up skills-only change, governed).
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
'@objectstack/lint': minor
3+
'@objectstack/spec': minor
4+
---
5+
6+
fix(lint): the runtime `object_extension` publish door refuses an extension that adds a field under a label the object it extends already shows, or under the label of another field of the same extension (`field-label-duplicate`)
7+
8+
Clause-②: no (narrowing) — the `object_extension` publish door (Studio's add-field on a `.custom` pair, `PUT /api/v1/meta/object_extension/TARGET`, the MCP and AI authoring doors) now refuses an extension whose fields create a `field-label-duplicate` clash on the object it extends. No exported type or signature changes. Measured first-party: the two extension entries (`examples/app-showcase` on `showcase_account`, three fields; `packages/plugins/plugin-auth` on `sys_sso_provider`, one `secret` field) add no clash, as written or in any locale, so nothing first-party is newly refused. HotCRM: not measured.
9+
Metadata-protocol: narrowed
10+
Skills-docs: none owed — this PR edits `content/docs/deployment/validating-metadata.mdx` (the object extension door paragraph names the rule); `os explain field-label-duplicate` names the door; `skills/objectstack-data` teaches `defineObjectExtension({ extend, fields })` and reusing `owner_id` instead of a second owner field without saying the runtime door is exempt, so the door now gives the verdict the build already gives.
11+
12+
<!-- adr-0087: registered object-extension-door-field-label-duplicate-refused -->
13+
14+
**BREAKING** accept-set narrowing of the runtime `object_extension` publish door (`lintDuplicateFieldLabels` joins its `runtimeTypes`).
15+
16+
`os build`, `os validate` and `os lint` refuse an object whose visible fields share one label, extension fields of the same stack folded in, and the publish door refused it on an `object` write. An `object_extension` write ran no such judgment, so an extension could add a field under a label its target already shows (a `user` field labelled 负责人 beside the injected `owner_id`, which a `zh-CN` reader is served as 负责人), or two fields of its own under one label, and publish with a 200: two columns of one name in every grid, card and form of the object.
17+
18+
- On an `object_extension` write the rule judges the target as it will be served after the write: the door's live target without the package's own stored extension (which the write replaces), the written entry folded in among the target's other packages' extensions by priority, as `os build` folds every package's entry. A field two packages add at the priority that decides it is left out, as at the build. The injected columns are read as the platform's, so the finding names `owner_id` as the platform's column.
19+
- A refusal is the gate's `422 INVALID_METADATA` with issue rule `field-label-duplicate`, located on the extended object (`objects.TARGET.fields`), naming the object, every field of the group, the shared label and, when only some locales clash, those locales: the message the build gives for the same entry.
20+
- The write is charged only with a clash its entry creates: a clash the target already carries is not the extension's to answer for, nor is what is left of one after the entry took a field out of it (a new label, `hidden: true`, or a tie at the deciding priority); an entry that joins one changes the group and is refused.
21+
- Unchanged: the object save door, `os build`, `os validate`, `os lint`, a draft save (never gated), and a stored extension, which is served and is judged only when it is published again.
22+
23+
Migration: before publishing an extension again, give each field it adds a label the extended object does not already show and no other field of the same extension carries, set `hidden: true` on it, or drop it and use the field the object already has (the platform's `owner_id` for an owner). The door compares labels as written and as the platform translates its own columns; it reads no translation bundle, so a bundle edit neither raises nor clears a refusal there (`os build` and `os validate` judge the bundle). Upgrade-guide entry `object-extension-door-field-label-duplicate-refused`.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@objectstack/scenarios': patch
3+
---
4+
5+
feat(scenarios): a roll-up the build leaves readable over child data the card withholds is a failed Build check
6+
7+
Clause-②: yes (widening) — through `./runner`: the new exports `rollupSourceCharges`, `readRollupSourceFinding`, `RollupSourceCharge` and `RollupSourceReading` (`orchestrate.ts`) and `rollupSourceFindings` and `rollupSourceChecks` (`scorecard.ts`); the new optional field `BuildHalf.rollupSourceUnreadable` (`orchestrate.ts`); a new runtime dependency on `@objectstack/lint`. An answer that moves: the Build score of a matching build (`buildTally`'s `total`, the record's `build` / `iterate-build` verdict) and `buildPassed`, so such a build is no longer installed as the verified build of template and ask modes
8+
Metadata-protocol: none
9+
10+
`os build` reports `security-rollup-source-unreadable` as an advisory warning when a permission set can read a parent's roll-up summary but not the child object, the aggregated child field, or a child field the roll-up's filter tests; the build still succeeds. The scenario runner passed such a build with the warning standing, so a card that withholds that child from a persona scored full on Build while the built app still showed that persona an aggregate of the data the card hides.
11+
12+
The Build half now runs the rule itself (`validateRollupSourceVisibility` from `@objectstack/lint`) on the built artifact — never on the bounded tail of `os build`'s output it keeps — in every build that produces one: scratch, its iterate, and template mode's iterate on what the app serves. A finding is charged when its permission set is a card persona's own and that persona's `hidden` withholds the roll-up's child object, or the child field the finding names. Each charge is one failed Build check (in total, never in passed; `rollup-source-unreadable:PERSONA:PARENT.FIELD` in the run record's evidence, with the rule's own report on `BuildHalf.rollupSourceUnreadable`) and one Build finding naming the persona, the roll-up and the withheld child. A finding on a set no persona holds, on a child the card lets the persona read, or the rule's `info` row-scope arm is not charged. Ask mode authors nothing and is never charged. A build with no such finding scores, renders and records exactly as before.
13+
14+
The remedy is the rule's own: mask the parent summary on the persona's set (`fields["PARENT.SUMMARY"]: { readable: false }`).
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@objectstack/service-settings': patch
3+
'@objectstack/cloud-connection': patch
4+
'@object-ui/app-shell': patch
5+
---
6+
7+
fix(console): the console asks the deployment notice, install-local and a page's lookup targets only of a host that serves them
8+
9+
Clause-②: yes (widening)
10+
Metadata-protocol: none
11+
12+
A hosted environment's console asked three routes its host does not serve, and each answered an error in the network log on every load.
13+
14+
- **The deployment notice.** `GET /api/v1/runtime/config` now serves `features.deploymentNotice`. It is true exactly when the deployment notice is composed on this host: `SettingsServicePlugin` registers the notice's door as the kernel service `settings.deployment-notice` when it mounts the settings routes with it, and `RuntimeConfigPlugin` reads that registration per request. A host that mounts the settings routes itself, with no door, answers `GET /api/settings/deployment/notice` with `503` and now reports `false`. The route table is the same on both hosts, so it cannot answer this. A host's `resolveFeatures` policy cannot override the key. The console's home and System Overview read the notice only when the key is true. A runtime that serves no key is older than this change and still serves the notice, so the console keeps reading it there; only an explicit `false` stops the read.
15+
- **Install-local on the marketplace catalog.** The catalog's side load reads `GET /api/v1/marketplace/install-local` only when `features.installLocal` is true, the gate the package page already reads. A host without it no longer answers a `404` on every load and Refresh, and the catalog list draws as before.
16+
- **A page's lookup targets.** In an app with no package, a page and an object's route asked each lookup target's definition by name, and a target the host does not register (`sys_business_unit` on the control plane's Members page) answered `404` on every open. The targets the route has not asked already are now asked first in one `GET /api/v1/meta/object?names=` read, which leaves an absent object out, and only the ones it serves are then read by name. A registered target still resolves as before. An app with a package reads its lookup targets as before.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/console': patch
4+
---
5+
6+
fix(app-shell): an object list page reads its object once per load
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
An object list page sent two reads of its object on every load: the list's own `GET data/OBJECT?top=50&…` and a `GET data/OBJECT?top=0` record-count probe, and the probe was sent again on every refresh. The probe's number fed a page-level count that nothing drew any more. The footer it once fed was retired with the split pane, and the one panel prop it still reached was never read. The record-count bar under the list and the view count in the title both take the `total` from the list's own answer, which carries the view's filters and search. The probe is gone, so a list page load sends one `data/OBJECT` read, and a refresh sends one. The numbers on the page do not change.

‎content/docs/deployment/validating-metadata.mdx‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,11 @@ every package's entry (#33494), so both judge the same definition of each
629629
field: the written entry's where its priority decides the field (a name the
630630
target already serves included), another package's where that one outranks it.
631631
On a declared object neither judges a field two packages add at the priority
632-
that decides it.
632+
that decides it. A field the entry adds under a label the target already shows,
633+
the platform's `owner_id` included, or under the label of another field of the
634+
same entry, is refused as `field-label-duplicate` (#33644), judged on the target as it will be served after the write, so only a
635+
clash the entry creates is charged: not one the target already carried, nor
636+
what is left of one after the entry took a field out of it.
633637

634638
**Declared enforcement that cannot run** is two rows for the mirror-image
635639
reason, and #4716 is where it split. That heading covers four rule ids, and

‎content/docs/kernel/contracts/data-engine.mdx‎

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,43 @@ multiple). The engine serves it in `where`, the same on every driver: it reads t
193193
related object with the condition **as the caller** — that object's row scope and field
194194
permissions apply, so a condition on a field the caller cannot read is refused
195195
(`PERMISSION_DENIED` / 403), never answered with an empty list — and then matches the
196-
relation field against the ids that read returns: `$in` on a single-valued relation, any
197-
member on a multi-valued one (`multiple: true`). No related record matching selects no
196+
relation field against what that read selects: on a read verb, a single-valued relation is
197+
one subquery inside the read's own statement where that is provably the same read (the
198+
related read is planned, not run: its read scope and the condition become the subquery's
199+
`WHERE`, so no id list is read and none is capped — the related object's read restrictions
200+
the planned read observes are carried into the subquery, or the hop falls back to the id
201+
read); otherwise `$in` on the
202+
ids that read returns, any member on a multi-valued one (`multiple: true`). No related record matching selects no
198203
rows; under `$not`, a record whose relation is empty satisfies the negation.
199204

200-
It reaches **one level**: every key must be a field the related object declares
201-
(`{ account: { owner: { region: 'NA' } } }` and the dotted `{ account: { 'owner.region': 'NA' } }`
202-
are refused), and a condition matching more than 1,000 related records is refused with
203-
`INVALID_FILTER` / 400 rather than run over a cut-off list. For either, run the two steps
204-
yourself — filter the related object, then match its ids:
205+
It reaches **up to three relationships** (ADR-0071's hop limit): every key must be a field
206+
the related object declares, and a relation key may carry a condition of its own
207+
(`{ account: { owner: { region: 'NA' } } }`), each hop read as the caller with its own read
208+
scope; a fourth relationship and the dotted `{ account: { 'owner.region': 'NA' } }` are
209+
refused. Where ids are read (a multi-valued relation, `update`, `delete`) a
210+
condition matching more than 1,000 related records is refused with `INVALID_FILTER` / 400
211+
rather than run over a cut-off list. The id read, with that cap, is also what serves a
212+
single-valued relation on a read verb in each of these cases:
213+
214+
- a related object on another datasource;
215+
- a federated related object;
216+
- a driver that compiles no subquery (MongoDB, OData — the SQL drivers compile it, the
217+
in-memory driver evaluates it in process);
218+
- a related object whose reads an object-scoped middleware or an `afterFind` hook shapes;
219+
- a related object read under different driver options than the outer object (its tenant
220+
scope, most commonly) — decided before the related read is planned where the registry
221+
answers it (the two objects' tenancy class under a walled posture), at the executor
222+
boundary otherwise;
223+
- a related read that a middleware answers itself (or adds rows to after the driver call).
224+
225+
A read rule that narrows a related object's rows after its driver call bounds a relation
226+
condition on that object only when it is registered for that object — as an object-keyed
227+
middleware or an `afterFind` hook; registered that way, the hop keeps the id read.
228+
229+
A hop that falls back after planning (a middleware answering the related read, or driver
230+
options only the request decides) dispatches the related read twice: its middleware chain and `beforeFind` hooks run for the
231+
planned read and again for the id read. Past the cap, run the two steps yourself — filter
232+
the related object, then match its ids:
205233

206234
```typescript
207235
const tech = await engine.find('account', { where: { industry: 'tech' }, fields: ['id'] });

0 commit comments

Comments
 (0)