Skip to content

Commit d2bff97

Browse files
committed
docs(changeset,spec): anchor the empty-projection notes to 18.2.0, name the stored-flow consequence and the superseded 26954 sentence
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfMG4xAptDoRoz9kyT
1 parent 4dbe788 commit d2bff97

3 files changed

Lines changed: 32 additions & 20 deletions

File tree

‎.changeset/27166-query-get-record-empty-projection.md‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ Skills-docs: none — `skills/**` teaches `fields` and nested `expand` `fields`
1111

1212
<!-- adr-0087: registered query-and-get-record-empty-projection-refused -->
1313

14-
**BREAKING** for a flow `get_record` node, or a query you build, that carries an empty projection. The in-process engine already refuses `fields: []` at its `find` / `findOne` entry, top level and at any `expand` depth; these two declarations still admitted it, so such a `get_record` node saved clean and failed at its first run.
14+
**BREAKING** for a flow `get_record` node, or a query you build, that carries an empty projection. In this same release the in-process engine starts refusing `fields: []` at its `find` / `findOne` entry, top level and at any `expand` depth; without this change the two declarations below would still admit it, so such a `get_record` node would save clean and fail at its first run.
1515

16-
- **Before.** `QuerySchema.fields` and `GetRecordConfigSchema.fields` admitted any list of strings: `[]`, and a list with a blank or whitespace-only name. A `get_record` node with `fields: []` passed `os validate`, `defineStack` and `registerFlow`, and its run failed with the engine's refusal. A `POST /data/:object/query` body with `fields: []` was refused by the Data API's normalizer (`400 VALIDATION_ERROR`).
17-
- **Now.** A list must hold at least one name, and no name may be blank (JSON Schema `minItems: 1`, and a non-blank pattern on each name). Both read the rule from the declaration `EngineQueryOptionsSchema.fields` and `QueryTransportParamsSchema.$select` read, so the refusal says the same thing: "Name at least one field", or "A field name cannot be blank" for a blank member. A `get_record` node with `fields: []` is refused where a flow is saved or registered, at `flows.N.nodes.M.config.fields` (`STACK_SCHEMA_INVALID` from `defineStack`), and its executor refuses the config before any read. An `expand` entry with `fields: []` is refused at `expand.<field>.fields`. A `POST /data/:object/query` body with `fields: []` is now refused by the body schema, `400 VALIDATION_FAILED` at `query.fields`, which is the answer its `$select: []` spelling already got.
16+
- **Before (`@objectstack/spec@18.2.0`, the last release).** `QuerySchema.fields` and `GetRecordConfigSchema.fields` admitted any list of strings: `[]`, and a list with a blank or whitespace-only name. A `get_record` node with `fields: []` passed `os validate`, `defineStack` and `registerFlow`, and its run read every column of the row. A `POST /data/:object/query` body with `fields: []`, top level or on an `expand` entry, answered `200` with every column.
17+
- **Now.** A list must hold at least one name, and no name may be blank (JSON Schema `minItems: 1`, and a non-blank pattern on each name). Both read the rule from the declaration `EngineQueryOptionsSchema.fields` and `QueryTransportParamsSchema.$select` read, so the refusal says the same thing: "Name at least one field", or "A field name cannot be blank" for a blank member. A `get_record` node with `fields: []` is refused where a flow is saved or registered, at `flows.N.nodes.M.config.fields` (`STACK_SCHEMA_INVALID` from `defineStack`), and its executor refuses the config before any read. An `expand` entry with `fields: []` is refused at `expand.<field>.fields`. A `POST /data/:object/query` body with `fields: []` is refused by the body schema, `400 VALIDATION_FAILED` at `query.fields`, which is the answer its `$select: []` spelling gets; an `expand` entry's `fields: []` in that body is refused the same way, at `query.expand.<field>.fields`.
1818
- **`@objectstack/service-automation`.** The `get_record` node's designer form (`configSchema`) declares `fields` with `minItems: 1`, as its `limit` already mirrors the contract's floor, so the form no longer offers an empty list the save refuses.
19-
- **Unchanged.** The inferred types (`string[]`), a named projection, and leaving `fields` out to read every column. Stored flows are not rewritten.
19+
- **Stored flows.** They are not rewritten, and there is no conversion for `os migrate meta --stored` to apply. A stored flow whose `get_record` node carries `fields: []` is refused by `registerFlow` on every pull of the stored definitions, so it stays unregistered, and its triggers unbound, until the row is edited: name the fields, or remove the key.
20+
- **Unchanged.** The inferred types (`string[]`), a named projection, and leaving `fields` out to read every column.
21+
22+
**Supersedes, in the same release:** `26954-engine-projection-empty.md` says, under **Unchanged**, that the in-process ObjectQL engine does not parse its options with that schema and that `engine.find(object, { fields: [] })` still reads every column, as before. The engine change in this release (`27008-engine-empty-projection-refused.md`) refuses that call at its `find` / `findOne` entry, so that sentence no longer holds: an empty projection is refused by the declarations and by the engine alike, and leaving `fields` out is the one way to read every column.
2023

2124
**The remedy.** Name the fields to read, or remove `fields` to read every field; on an `expand` entry, the same for the related record. There is no mechanical rewrite: dropping the key reads every column, which is the widening the rule refuses, so the choice is the author's.

‎packages/rest/src/data-empty-projection-count-door.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ const REFUSED_POST_AT_SCHEMA: ReadonlyArray<readonly [string, Record<string, unk
7373
// so it answers what its `$select` alias answers.
7474
['fields: []', { fields: [] }, 'query.fields'],
7575
['fields: ["label", " "] (the blank member)', { fields: ['label', ' '] }, 'query.fields.1'],
76+
// An `expand` entry is the same `QuerySchema`, so its empty projection is
77+
// refused at the body schema too, before the engine door would see it.
78+
['expand entry fields: []', { expand: { owner: { object: 'sys_user', fields: [] } } }, 'query.expand.owner.fields'],
7679
];
7780

7881
function createMockServer() {

‎packages/spec/src/migrations/entries/semantic/18.query-and-get-record-empty-projection-refused.ts‎

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,32 @@ export const entry: SemanticMigration = {
2222
+ 'refuses, so the platform must not pick for the author.',
2323
reason:
2424
'One rule for every published declaration of a read\'s projection: a projection names at least '
25-
+ 'one field, none blank, and an empty one is refused rather than read as every column. The REST '
26-
+ 'doors, the transport spellings (select, $select) and the engine-side declarations '
27-
+ '(EngineQueryOptionsSchema.fields and its RPC and legacy siblings) already refused it, and the '
28-
+ 'in-process engine refuses it at its find / findOne entry, top level and at any expand depth. Two '
29-
+ 'declarations still admitted it: the QueryAST\'s own fields, which is the value type of every '
30-
+ 'expand entry, and the get_record node\'s fields, which the executor hands to the engine as '
31-
+ 'written. So a get_record node with fields: [] saved clean and failed at its first run with the '
32-
+ 'engine\'s refusal, and an expand entry with fields: [] validated against the declaration the '
33-
+ 'engine then refused. Both now take the same array arm, with the same sentence ("Name at least '
34-
+ 'one field"; "A field name cannot be blank" for a blank member). A side effect at the REST door: '
35-
+ 'a POST /data/:object/query body whose canonical fields is empty is now refused by the body '
36-
+ 'schema (400 VALIDATION_FAILED at query.fields), the answer its $select alias already got, '
37-
+ 'instead of by the normalizer (400 VALIDATION_ERROR). Either way it was refused; only the code '
38-
+ 'moves. Stored flows are not rewritten and there is no D2 conversion: the only mechanical '
39-
+ 'rewrite is dropping the key, which reads every column. ADR-0049 / ADR-0087.',
25+
+ 'one field, none blank, and an empty one is refused rather than read as every column. Measured '
26+
+ 'against the published @objectstack/spec 18.2.0: a get_record node with fields: [] saved, '
27+
+ 'registered and ran reading every column of the row, and a POST /data/:object/query body with '
28+
+ 'fields: [], top level or on an expand entry, answered 200 with every column. In the same release '
29+
+ 'as this entry, the REST doors, the transport spellings (select, $select), the engine-side '
30+
+ 'declarations (EngineQueryOptionsSchema.fields and its RPC and legacy siblings) and the '
31+
+ 'in-process engine\'s find / findOne entry (top level and at any expand depth) refuse it. Two '
32+
+ 'declarations would otherwise still admit it: the QueryAST\'s own fields, which is the value '
33+
+ 'type of every expand entry, and the get_record node\'s fields, which the executor hands to the '
34+
+ 'engine as written, so a get_record node with fields: [] would save clean and fail at its first '
35+
+ 'run. Both now take the same array arm, with the same sentence ("Name at least one field"; "A '
36+
+ 'field name cannot be blank" for a blank member). At the REST door a POST /data/:object/query '
37+
+ 'body whose fields is empty, top level or on an expand entry, is refused by the body schema (400 '
38+
+ 'VALIDATION_FAILED at query.fields or query.expand.<field>.fields), the answer its $select alias '
39+
+ 'gets. Stored flows are not rewritten and there is no D2 conversion: the only mechanical rewrite '
40+
+ 'is dropping the key, which reads every column. A stored flow carrying such a node is therefore '
41+
+ 'refused by registerFlow on every pull of the stored definitions and stays unregistered, its '
42+
+ 'triggers unbound, until the row is edited; os migrate meta --stored has no conversion to apply '
43+
+ 'to it. ADR-0049 / ADR-0087.',
4044
acceptanceCriteria:
4145
'Search flow definitions (metadata files and stored sys_metadata flow rows) for a get_record node '
4246
+ 'whose config.fields is an empty list or carries a blank name, and every query you build in code '
4347
+ '(engine.find / findOne options, an expand entry at any depth, a POST /data/:object/query body) '
44-
+ 'for the same. Name the fields, or remove the key. The sweep is mechanical for authored '
48+
+ 'for the same. Name the fields, or remove the key. For STORED flow rows the search is the '
49+
+ 'catch-all: a stored flow carrying such a node is not registered at boot, and its triggers do '
50+
+ 'not fire, until the row is edited. The sweep is mechanical for authored '
4551
+ 'metadata: os validate and defineStack refuse such a node at flows.N.nodes.M.config.fields '
4652
+ '(STACK_SCHEMA_INVALID), registerFlow refuses it when the flow is registered, and '
4753
+ 'QuerySchema.safeParse / GetRecordConfigSchema.safeParse answer one issue at the fields path '

0 commit comments

Comments
 (0)