Skip to content

Commit e87866d

Browse files
Merge branch 'main' into claude/project-thread-y7k7x9
2 parents 7c7c5ba + 43dd565 commit e87866d

249 files changed

Lines changed: 11613 additions & 1388 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: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
'@objectstack/metadata-protocol': patch
3+
'@objectstack/rest': patch
4+
---
5+
6+
fix(metadata-protocol, rest)!: the layered read of a name two packages hold refuses as the plain read does, naming the holders as `details.candidates` (ADR-0150 D3/D5)
7+
8+
Clause-②: no (narrowing)
9+
Metadata-protocol: none
10+
11+
<!-- adr-0087: not-required (no-migration-prescription) No key of any schema is added, removed, renamed or re-shaped, and no export changes shape. The moved answers are reads of a name two packages hold, which now refuse as the plain read of that name already did: no stored row, layer, registry key or authored value changes, so there is nothing for a migration to rewrite and no tombstone. -->
12+
13+
**BREAKING** for a reader of the layers, or of the REST published view, of a name two or more served packages register in code, naming no package. Such a name has no one holder (ADR-0150 D3/D5), and the plain read already refused it. Three answers move, measured in both registration orders:
14+
15+
- FROM: on a host that wires no engine for the REST door chain, `GET /meta/:type/:name/layers` (and `?layers=true`) answered 200 with the layers of the holder that registered first. TO: it answers `409 RESOURCE_CONFLICT` naming both holders as `details.candidates`.
16+
- FROM: in process, the protocol's `getMetaItemLayered({ type, name })` with no `packageId` resolved the holder that registered first. TO: it throws `PackageScopedNameRefusedError` (`RESOURCE_CONFLICT`, 409) naming both, as `getMetaItem` does.
17+
- FROM: on a REST host with no `objectQLProvider`, `GET /meta/:type/:name/published` served the name's package-unbound active row (200) when one stands. With no such row, it went on past its overlay read to the published exit: what the host's metadata service `getPublished` answers, or `501 NOT_IMPLEMENTED` when the host resolves no metadata service. TO: it answers `409 RESOURCE_CONFLICT`, without `details.candidates`. The dispatcher's `/published`, where its engine registry is not reachable, swallows the same refusal. With no such row it serves its snapshot as before. With one, it served that row and now serves the code snapshot instead.
18+
19+
**Not moved.** A name one package holds, and every read naming the package (`?package=`, `packageId`), answer as before. On a host whose door chain has an engine, `/layers` already refused 409; it now also names the holders. The save and delete doors do not move.
20+
21+
The fix for a caller: name the package whose layers it means.
22+
23+
`GET /meta/:type/:name/layers` (and the deprecated `?layers=true`) of a name two or more packages hold, read naming no package, now answers like the plain read on every exit and on both transports: `409 RESOURCE_CONFLICT` with the holders as `details.candidates` (`[{ kind: 'package', packageId }, …]`), never one holder's layers.
24+
25+
- A name two served packages register in code: the protocol's layered read (`getMetaItemLayered`) asks the registry's package-scoped resolver before it reads any layer, as `getMetaItem` does, so it throws the same `PackageScopedNameRefusedError` naming both, in process too, whatever the metadata service holds. It used to answer the holder that registered first, and so did the REST door on a host that wires no engine for its door chain. `?package=` still reads each holder's layers; a name one package holds is unchanged.
26+
- The REST `/layers` route's catch carries the candidates of a package-scoped refusal, as the plain read's catch does. Before, it answered the refusal by its sentence alone (the dispatcher already carried them).
27+
- A name whose active rows two packages hold keeps the package-less writes' refusal (its sentence, code, status and `?package=` remedy) and gains the same `details.candidates`. The save and delete doors' answer does not move.
28+
- Stored-row holders beside a disabled package keep their in-process answer: the protocol's layered read still serves its in-process readers there, and the door refuses.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/metadata-protocol': patch
3+
---
4+
5+
fix(metadata-protocol): the layered read naming no package serves an App pair's declared override of a bundle addition's own member as `effective`
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
An App's customization pair (`<app>.custom`) can store a row that declares `overrides: { package: Z }` for the bundle member a bundle addition Z ships, for example the `fr-FR` locale Z adds to an email template another package of the App ships in `en-US`. The plain read naming no package (`?member=fr-FR`) and `?package=Z&member=fr-FR&layers=true` already served that row. The layered read naming no package (`?member=fr-FR&layers=true`, `getMetaItemLayered` without a package) answered Z's shipped `fr-FR` as `effective`, with no `overlay`, and so disagreed with the read it describes.
11+
12+
It now reads such a member at the one enabled package that ships it, as the plain read does: `code` is Z's shipped member, `overlay` the pair's row, `effective` the override, and the envelope names Z. The pending draft layer stays the one the strict draft read serves. Nothing else moves: a member two packages ship, a row declaring another package, an undeclared pair row, the environment's own item and a disabled shipper answer as before. No stored row changes shape.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): `objectstack-data` states what `writeRequiresMasterRead` asks when a master is set or emptied, and whose ownership floor binds an on-behalf-of write
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
objectstack-data's `rules/relationships.md` is more exact about a `controlled_by_parent` detail's two write opt-ins. Under `sharing.controlledByParent.writeRequiresMasterRead`, setting a master on a row and emptying one both ask read (the sentence read as if only emptying did), and both still ask edit under `ownerMayEdit`. On an on-behalf-of update or delete the ownership floor binds for both users, not one. The `ownerMayEdit` bullet now says "every other write, on-behalf-of included, still needs master edit" where it listed the writes, which pays for the added words: the file is the same size. The eval case for the key also fails an answer that writes `ownerMayEdit: true` beside it, in either order, or puts the key on the `master_detail` field.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
'@objectstack/lint': minor
3+
'@objectstack/spec': minor
4+
---
5+
6+
fix(lint)!: `os build` refuses a flow or hook condition that orders or does arithmetic on an injected column a stored row can hold null in, as the publish gate already does
7+
8+
Clause-②: no (narrowing)
9+
Metadata-protocol: narrowed
10+
Skills-docs: none — no skill under `skills/**` teaches a condition over an injected column or the null guard on one; `content/docs/automation/flows.mdx` and `content/docs/automation/hooks.mdx` gain the rule in this change.
11+
12+
<!-- adr-0087: registered flow-hook-condition-injected-column-null-guard-at-build -->
13+
14+
**BREAKING** for a stack whose record-triggered flow (start `condition`, edge `condition`, `decision` branch `expression`) or hook `condition` applies `<`, `<=`, `>`, `>=` or `+ - * / %` to an injected system column the object does not declare itself, with no `!= null` guard in the same branch. `os build` judged the null guard over the declared fields only and accepted these; the runtime publish gate, which reads the object as served with those columns declared, refused them. A stored row holds `null` there: a system-context insert stores `null` in `owner_id`, `created_by` and `updated_by`, a seeded row keeps `created_by` and `updated_by` `null`, nothing stamps `owning_business_unit_id` yet, `queue` is `null` until a queue write names one, a `beforeInsert` hook reads `organization_id` before it is resolved, and a `beforeInsert` hook with a `priority` below 10 reads `created_at` and `updated_at` before they are stamped. On such a row the flow run fails at the condition while the write that fired it lands, and a hook condition fails the write.
15+
16+
What moves (each line FROM → TO):
17+
18+
- `record.owner_id > 'a'` (or `created_by`, `updated_by`, `owning_business_unit_id`, `queue`, `organization_id`; bare in a flow too) at a record-triggered flow's start, edge or branch, or at a hook's `condition`: FROM accepted by `os build` and `os validate` TO refused with the publish gate's `expression-invalid` null-guard finding.
19+
- `record.created_at > timestamp('2025-01-01T00:00:00Z')` (or `updated_at`) at a hook whose `events` include `beforeInsert`: FROM accepted by `os build` TO refused, as the publish gate refuses it.
20+
- The MCP `validate_expression` tool at site `flow_condition` (it judges the object as authored): FROM a clean answer TO the publish gate's null-guard finding for the same conditions.
21+
- A `publish-drafts` batch that carries a draft of the flow's or hook's own object (the draft body, which holds no injected column, replaces the served object): FROM published TO refused, as the single-item publish already refused it over the served object.
22+
23+
The fix: guard the column in the same branch, `record.owner_id != null && record.owner_id > 'a'`. A flow's start-condition guard holds at every edge and branch; `has()` is no guard.
24+
25+
Unchanged: the single-item publish gate's verdicts, and a batch's when it carries no draft of the flow's or hook's object; a column the object declares itself, which keeps the verdict its own keys give; `created_at` / `updated_at` at every other hook event and flow slot; equality (`==`, `!=`) on any column; and validation rules and `requiredWhen`, which both doors judge over the declared fields only.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/objectql': patch
3+
---
4+
5+
fix(objectql): the bare-name refusal and cold-boot warning say a narrowed type holds one name per namespace
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The reason a `Bare-name conflict` refusal and the `Bare-name conflict at boot` warning carry (`bareNameReason`) said, for every covered type, that it "holds one name per deployment ... with no package to tell two definitions apart, so with two holders every caller is served the same one, chosen by registration order". Every covered type (picklist, mapping, dataset, API, object-less action, function, flow, webhook, connector, email template, agent, skill, tool) has since narrowed to the namespace (ADR-0150 D2/D9, `NAMESPACE_SCOPED_BARE_NAME_TYPES`), so an administrator refused for one of them was told a rule the doors no longer apply. The reason for a narrowed type now states its rule: a package of another namespace may ship the same name, but within one namespace, or beside a package that declares no namespace, a name has one holder, and a bare name two holders share is refused naming both. For an email template the reason also names the two holdings that still meet whatever the namespaces, after "save the exceptions below": a name the platform requests by its bare spelling (the `auth.*` mails, such as `auth.password_reset`) keeps one holder per deployment, and a package that depends on the name's holder (which does not depend on it back) and ships the name only in locales the holder does not ship is refused as an addition to the holder's email template, as before. A type that joins the covered list before its own narrowing keeps the one-name-per-deployment sentence. No rule changes: the refusals fire where they did, with the same `NAMESPACE_CONFLICT` code and `422` status.
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`.

0 commit comments

Comments
 (0)