Skip to content

Commit 9ddbf39

Browse files
committed
docs(spec): describe the view filter any-of group as live, not planned
The console half landed (toFilterNode lowers a group to one or node inside the list's AND, and the builder edits a one-group filter), so ViewFilterOrGroupSchema's PLANNED docblock and describe, the $or refusal prose in filter-rule-array.ts and the view liveness note now state the live behaviour. Tests that pinned the old wording are updated. Claude-Session: https://claude.ai/code/session_01JQwxbYCMdGp2Cju6A39cTB Co-authored-by: Claude <noreply@anthropic.com>
1 parent 94d3e25 commit 9ddbf39

6 files changed

Lines changed: 35 additions & 24 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@objectstack/spec': patch
3+
---
4+
5+
docs(spec): the view filter any-of group is described as live, not planned
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The console now applies a view filter's any-of group `{ or: [rule, ...] }`: the list query lowers it to one `or` node ANDed with the filter's other elements, and the filter builder edits a filter that is exactly one group. Two author-facing texts still said otherwise and are corrected:
11+
12+
- `ViewFilterOrGroupSchema`'s description (what `/meta/types` and the generated reference show) no longer starts with `[PLANNED — not yet rendered]` and no longer says a view that stores a group is refused when it loads.
13+
- The refusal for a MongoDB-style `$or` on a rule-array `filter` still prescribes the any-of group element, and no longer adds that no console applies it.
14+
15+
Nothing an author can write changes: the schema accepts and refuses exactly what it did.

‎packages/spec/liveness/view.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
},
5050
"filter": {
5151
"status": "live",
52-
"note": "objectui: ListView.tsx client-side filter shaping (audit L15); no list-render prop reaches the server query (audit data-flow note). The console's filter rows carry a React list key that the wire door removes before the parse (packages/spec/src/ui/view.zod.ts, the VIEW_CONSOLE_ROW_DECORATIONS header and the ViewFilterRule docblock; moved out of spec source, #23434): `id: crypto.randomUUID()` is stamped on each new row by objectui @b9814b334 packages/components/src/custom/filter-builder.tsx#FilterBuilder (its `addCondition`), and again on a stored filter read back into the builder by objectui @b9814b334 packages/plugin-view/src/config/view-config-utils.ts#parseTriplet and objectui @b9814b334 packages/plugin-view/src/config/view-config-utils.ts#parseSingleOrNested (both reached from that file's parseSpecFilter); re-read 2026-10-15, first cited by line, sha-less. One element kind rides this live verdict at PLANNED strength (#28020, 2026-10-31): the any-of group `{ or: [rule, ...] }` (ViewFilterOrGroupSchema, its describe marked `[PLANNED — not yet rendered]`) has no console reader yet — the list query build (ui/packages/plugin-list/src/ListView.tsx, buildEffectiveFilter; ui/packages/core/src/utils/filter-converter.ts, convertFiltersToAST) and the builder save fold (ui/packages/app-shell/src/views/viewFilterFold.ts, which refuses an OR group) read flat rules only, read on this tree at 22ce3d13fe. The console half is #28370; amend this note, citing the group read, when it lands."
52+
"note": "objectui: ListView.tsx client-side filter shaping (audit L15); no list-render prop reaches the server query (audit data-flow note). The console's filter rows carry a React list key that the wire door removes before the parse (packages/spec/src/ui/view.zod.ts, the VIEW_CONSOLE_ROW_DECORATIONS header and the ViewFilterRule docblock; moved out of spec source, #23434): `id: crypto.randomUUID()` is stamped on each new row by objectui @b9814b334 packages/components/src/custom/filter-builder.tsx#FilterBuilder (its `addCondition`), and again on a stored filter read back into the builder by objectui @b9814b334 packages/plugin-view/src/config/view-config-utils.ts#parseTriplet and objectui @b9814b334 packages/plugin-view/src/config/view-config-utils.ts#parseSingleOrNested (both reached from that file's parseSpecFilter); re-read 2026-10-15, first cited by line, sha-less. The any-of group element `{ or: [rule, ...] }` (ViewFilterOrGroupSchema, #28020, 2026-10-31) rides this live verdict at full strength since its console half landed (#28370, PR #28475): the list query build lowers it to one `or` node inside the list's AND (ui/packages/core/src/utils/filter-converter.ts, toFilterNode via viewFilterOrGroupToNode, reached from ui/packages/plugin-list/src/ListView.tsx buildEffectiveFilter through mergeFilterNodes and ui/packages/plugin-view/src/ObjectView.tsx), the builder save fold writes an OR group over two or more rules as one group (ui/packages/app-shell/src/views/viewFilterFold.ts) and builderRulesOfSpecFilter reads exactly-one-group back as the builder's OR logic; read on this tree at 94d3e254, 2026-11-02. Its describe lost the `[PLANNED — not yet rendered]` marker in the same change (#28522)."
5353
},
5454
"sort": {
5555
"status": "live",

‎packages/spec/src/ui/filter-rule-array-guidance.test.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,8 @@ describe('§1 the record form is refused WITH the new spelling', () => {
165165
expect(issue.code).toBe('invalid_type');
166166
expect(issue.message).not.toContain("field: '$or'");
167167
expect(issue.message).toContain('`$or` is a combinator, not a field, and the rule array spells a combinator only as its own elements');
168-
// [#28020] The one combinator the rule array can spell is named, with its
169-
// status: the any-of group is declared but no console applies it yet.
168+
// [#28020] The one combinator the rule array can spell is named.
170169
expect(issue.message).toContain('`$or` over flat rules is one any-of group element');
171-
expect(issue.message).toContain('no console applies it yet');
172170
expect(issue.message).toContain('`$not` cannot be written at all');
173171
expect(issue.message).toContain('flattening one changes which rows the filter selects');
174172
expect(issue.message).toContain('decide which rows this filter should select');

‎packages/spec/src/ui/filter-rule-array.ts‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,14 @@ export function ruleArrayFilterError(options: RuleArrayFilterErrorOptions): z.co
188188
}
189189
const named = combinators.map((key) => `\`${key}\``).join(' and ');
190190
// [#28020] The rule array gained ONE combinator spelling, the any-of group
191-
// element, and this sentence names it — with its status, because no console
192-
// applies it yet: prescribing it bare would send an author to a filter that
193-
// does not narrow the rows (`ViewFilterOrGroupSchema`'s PLANNED note).
191+
// element, and this sentence names it as the shape a `$or` over flat rules
192+
// is written in (`ViewFilterOrGroupSchema`).
194193
const combinatorSentence = combinators.length === 0
195194
? ''
196195
: ` ${named} ${combinators.length === 1 ? 'is a combinator, not a field' : 'are combinators, not fields'}, `
197196
+ `and the rule array spells a combinator only as its own elements: they AND, so \`$and\` is `
198197
+ `the separate rules it joins, \`$or\` over flat rules is one any-of group element `
199-
+ `\`{ or: [{ field, operator, value }, ...] }\` (declared, but no console applies it yet, so it `
200-
+ `does not narrow the rows today), and \`$not\` cannot be written at all. Nothing rewrites a `
198+
+ `\`{ or: [{ field, operator, value }, ...] }\`, and \`$not\` cannot be written at all. Nothing rewrites a `
201199
+ `combinator for you — flattening one changes which rows the filter selects — so decide which `
202200
+ `rows this filter should select, and write the rules that select exactly those.`;
203201

‎packages/spec/src/ui/view-filter-or-group.test.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,15 +233,16 @@ describe('the wire door and the published shape', () => {
233233
expect(issues[0]!.message).toContain('`id` is a console row key');
234234
});
235235

236-
it('the element publishes both kinds, and the group says it is not yet rendered', () => {
236+
it('the element publishes both kinds, and the group carries no PLANNED marker', () => {
237237
const json = z.toJSONSchema(ViewFilterElementSchema, { io: 'input', unrepresentable: 'any' }) as {
238238
anyOf?: Array<{ properties?: Record<string, unknown> }>;
239239
};
240240
expect(json.anyOf?.map((branch) => Object.keys(branch.properties ?? {}).sort())).toEqual([
241241
['field', 'operator', 'value'],
242242
['or'],
243243
]);
244-
expect(ViewFilterOrGroupSchema.description?.startsWith('[PLANNED — not yet rendered]')).toBe(true);
244+
expect(ViewFilterOrGroupSchema.description?.startsWith('An any-of group:')).toBe(true);
245+
expect(ViewFilterOrGroupSchema.description).not.toContain('[PLANNED');
245246
});
246247

247248
it('`isViewFilterOrGroup` tells the element kinds apart by the own `or` key', () => {

‎packages/spec/src/ui/view.zod.ts‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,16 +1163,16 @@ export function isViewFilterOrGroup(value: unknown): value is { [VIEW_FILTER_OR_
11631163
* rule never carries `or`, so it is routed to {@link ViewFilterRuleSchema}
11641164
* exactly as before.
11651165
*
1166-
* ## [PLANNED — not yet rendered]
1166+
* ## Applied by the console
11671167
*
1168-
* No reader applies the group yet. The query a list view runs is built by the
1169-
* console (`ui/packages/core/src/utils/filter-converter.ts#toFilterNode`), which
1170-
* lowers flat rules only and passes a group through untouched, so the server
1171-
* refuses the query as a malformed filter (400 `INVALID_FILTER`) and the list
1172-
* shows that error and no rows. It fails closed: a stored group never widens
1173-
* what a view, a related list or a picker shows. The describe below says so,
1174-
* so no author is told it works.
1175-
* The console half is #28370; the marker leaves when it lands.
1168+
* The query a list view runs is built by the console
1169+
* (`ui/packages/core/src/utils/filter-converter.ts#toFilterNode`), which lowers
1170+
* a group to one `or` node of its rules, a child of the list's AND like any
1171+
* rule, so a group is ANDed with its sibling elements. The console's filter
1172+
* builder edits a filter that is exactly one group as its OR logic, and saves
1173+
* its OR logic over two or more rules as one group; a filter holding a group
1174+
* beside other elements is applied, and shown read-only in the builder rather
1175+
* than flattened on save (`builderRulesOfSpecFilter`).
11761176
*
11771177
* @example
11781178
* ```ts
@@ -1214,13 +1214,12 @@ export const ViewFilterOrGroupSchema = lazySchema(() => strictObject({
12141214
+ 'each judged exactly as a rule at the top level of the filter. A group cannot hold a group.',
12151215
),
12161216
}).describe(
1217-
'[PLANNED — not yet rendered] An any-of group: `{ or: [rule, ...] }` matches a record when ANY of its '
1217+
'An any-of group: `{ or: [rule, ...] }` matches a record when ANY of its '
12181218
+ 'rules matches. It sits in the filter list beside plain rules, and the list still ANDs every element, '
12191219
+ 'so `[{ or: [{ field: "status", operator: "equals", value: "open" }, { field: "completed_at", '
12201220
+ 'operator: "after", value: "{7_days_ago}" }] }]` selects the open records and the ones completed in the '
1221-
+ 'last 7 days. One level only: its members are flat rules. No console reads it yet: until the list '
1222-
+ 'query build reads the group, a view that stores one is refused when it loads (the list reports a '
1223-
+ 'malformed filter and shows no rows).',
1221+
+ 'last 7 days. One level only: its members are flat rules. The console applies it, ANDed with its '
1222+
+ 'sibling elements, and its filter builder edits a filter that is exactly one group.',
12241223
));
12251224

12261225
export type ViewFilterOrGroup = z.input<typeof ViewFilterOrGroupSchema>;

0 commit comments

Comments
 (0)