This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
Commit 8bfc001
fix(plugin-dashboard): an object-metric with a structured groupBy and a rule-list filter draws its number (objectui#11526) (#11535)
Fixes #11526
Clause-②: no
## What this changes
An authored `object-metric` whose `aggregate.groupBy` is the structured
node (`{ field, dateGranularity }`) and whose `filter` is the bag's rule
list (`ViewFilterRule[]`, as `ObjectMetricPropsSchema` in
`@objectstack/spec/ui` declares it) passes both authoring faces
(`safeValidateSchema`, which `objectui validate` runs, and
`StrictAnyComponentSchema`; the pin asserts both, beside the block's own
arm `ObjectMetricBlockSchema`), and on `ObjectStackAdapter` it drew
`UnloweredAggregateWhereError` instead of its number.
`ObjectMetricWidget` now lowers the rule list for the spec-shape
aggregate query only, in a new module function `specShapeWhere` in
`packages/plugin-dashboard/src/ObjectMetricWidget.tsx`.
Files:
- `packages/plugin-dashboard/src/ObjectMetricWidget.tsx`:
`specShapeWhere`, called at the one spec-shape call site in
`computeOne`.
-
`packages/plugin-dashboard/src/__tests__/ObjectMetricWidget.ruleFilterSpecShape-11526.test.tsx`:
the pins.
- `.changeset/11526-object-metric-rule-filter-spec-shape.md`:
`@object-ui/plugin-dashboard` patch.
No `@object-ui/core` edit, no adapter edit, no exported type moves (so
`Clause-②: no` holds).
## The lowering, named
- **What the legacy aggregate wire applies** (string or absent
`groupBy`, the control that draws the number):
`lowerAnalyticsFilterForWire` in
`packages/data-objectstack/src/index.ts`. It runs `translateFilterArray`
(rule list to filter AST, same file) and then `parseFilterAST` from
`@objectstack/spec/data` (filter AST to `FilterCondition`). Both adapter
functions are module-private.
- **Why it is not imported or re-exported.**
`@object-ui/data-objectstack` depends on `@object-ui/core`, so a
re-export from core would be a dependency cycle. `plugin-dashboard` does
not depend on the adapter package and reads any `DataSource` (AGENTS.md
#1). Moving the translator into core would be a logic move in a package
this claim does not cover. The brief's re-export fallback is therefore
not available; see Acceptance notes.
- **What the widget uses instead:** the same two stages, from where they
are public. Stage 1 is `toFilterNode`
(`packages/core/src/utils/filter-converter.ts`, exported from
`@object-ui/core`). It is core's sink for a `ViewFilterRule[]`, and
`object-grid` lowers its own rule-list `filter` through it (via
`toFilterNodeSafely`). Stage 2 is `parseFilterAST`, the call the adapter
makes. No conversion is written in the widget. The `isFilterAST` gate
between them hands an array that is not a filter on unparsed, because
`parseFilterAST` answers `undefined` for it, which would post an
unfiltered aggregate. Handed on, the adapter's refusal answers it.
- **One-time measurement (not a standing pin), real adapter, fetch
stubbed, `@objectstack/spec` 17.5.0.** I compared
`parseFilterAST(toFilterNode(rules))` with the `where` the legacy wire
posts for the same rules. They are byte-equal for each operator in
`VIEW_FILTER_OPERATORS` (20 at this spec version), for a two-rule list
(`$and`), and for the legacy alias `eq`. Where a rule is refused, both
paths refuse. An array comparand on `equals` and an empty `icontains`
comparand are refused by both, with different error classes: the
adapter's `UnlowerableAnalyticsFilterError` / `MalformedFilterError`,
and core's `FilterOperatorError`. A scalar on `in` is refused by
`parseFilterAST` on both paths. Nothing in this repo re-derives this
equality, and the docblock says so.
## Reverse verification and ablation
One-time proofs, run from the committed fix (`b60869195`). The probe
that drives a real `ObjectStackAdapter` lived in the worktree only
during these runs and is not in this PR.
**Prediction, written before the runs:** BASE and the ablation are both
red on the pin's four lowering rows (structured groupBy plus rules;
multi-rule count; every operator; empty list) and green on the boundary
row and the two controls. With the real adapter, the structured groupBy
plus rules document draws the refusal, and both controls draw 42.
| leg | new pin | real adapter: structured groupBy, rule list | real
adapter: string groupBy, rule list | real adapter: structured groupBy,
record filter |
| --- | --- | --- | --- | --- |
| BASE (`ObjectMetricWidget.tsx` at `58d1f5f4b`) | 4 failed, 3 passed |
draws "aggregate('opportunity'): the spec-shape branch received a
`where` array that is not a filter ..."; nothing posted | 42; analytics
`where` `{"stage":"won"}` | 42; spec-shape `where` `{"stage":"won"}` |
| ablation (`specShapeWhere(filterForRun)` replaced by `filterForRun`) |
4 failed, 3 passed | draws the same refusal; nothing posted | 42 | 42 |
| fix (`b60869195`) | 7 passed | 42; spec-shape `where`
`{"stage":"won"}`, the same bytes the legacy wire posts | 42 | 42 |
Observed matches predicted. The empty-list row's BASE red is a change in
the posted body (`where: []` becomes no `where`), not the card's defect.
The platform engine reads `where: []` as no filter (objectstack's
`engine-filter-array-lowering.test.ts`, the row 'an empty array is "no
filter", exactly as before').
Landing and restore evidence:
- **Ablation** (objectstack's `scripts/ablation-replace.mjs`): anchor
count went from 1 to 0, and the blob went from `041e0f5d` to `42c7914d`.
Restore gave blob equal to HEAD `041e0f5d` with `git diff HEAD` empty.
- **BASE leg:** restored with `git checkout HEAD --` on the absolute
path. Blob equality with HEAD and an empty `git diff HEAD` were checked
by the leg script, which carries a `trap` restore.
- **No build/dist leg:** the pin imports the widget by relative path,
and `@object-ui/*` resolve to `src` through the vitest alias.
## Tests and gates
The final head is `fea8ccb0e`. From `b60869195` to `fea8ccb0e`, only
comment lines changed (a docblock correction and a test comment).
| at | command | verdict |
| --- | --- | --- |
| `fea8ccb0e` | `pnpm exec vitest run` on the new pin,
`objectMetricStructuredGroupBy-8613`,
`ObjectMetricWidget.drillRoutedToSharedDrawer-8970`,
`ObjectMetricWidget.compareTo`, `objectMetricQueryMembers-8071`, and
`data-objectstack`'s `aggregate-spec-shape-where` | Test Files 6 passed
(6), Tests 59 passed (59) |
| `fea8ccb0e` | `pnpm --filter @object-ui/plugin-dashboard type-check`
(`tsc --noEmit` and `tsc -p tsconfig.test.json`; the new pin is in the
test program per `--listFiles`) | exit 0 |
| `fea8ccb0e` | `pnpm check:control-bytes` / `check:new-line-citations`
/ `node scripts/check-changeset-presence.mjs` / `changeset:check` /
`check:changeset-claims` / `check:pending-changeset-literals` | OK / 0
new citation(s) / 1 changeset for 1 released package / OK / OK / OK |
| `fea8ccb0e` | eslint, narrowed (below) | 2 files, 0 errors |
| `b60869195` | `pnpm exec vitest run packages/plugin-dashboard/` | Test
Files 163 passed (163), Tests 1554 passed, 6 skipped (1560) |
| `b60869195` | the 33 tests outside `plugin-dashboard` that name
`ObjectMetricWidget`, `object-metric` or `objectAggregateSpecQuery`
(`git grep -l`, `apps/console` and `packages/core` included), plus
`aggregate-spec-shape-where` | Test Files 34 passed (34), Tests 2193
passed (2193) |
| `b60869195` | `pnpm turbo run build --filter='./packages/*'`, then
`pnpm --filter @object-ui/console build` (the Bundle Analysis type
program) | 39 of 39 tasks successful; exit 0 |
| `b60869195` | `check:phantom-deps`, `check:spec-symbols`,
`check:test-path-roots`, `check:vi-mock-specifiers` / `-inherit` /
`-override-shape`, `check:unused-deps`,
`check:component-surface-parity`, `check:handler-key-reads`,
`check:unreferenced-sources` | exit 0 each |
| | `node scripts/check-governed-queue-guard.mjs --test` (the 3 paths) |
NOT GOVERNED |
ESLint narrowing, as a measurement:
1. **Population:** `eslint.config.js` lints `**/*.{ts,tsx}` with
`tseslint.configs.recommended` and sets no parser `project`, so linting
is not type-aware.
2. **Count:** `--format json` lists 2 files. `ObjectMetricWidget.tsx`
has 0 errors and 11 warnings, and its BASE blob linted the same way also
has 0 errors and 11 warnings, from the same two rules. The new pin has 0
errors and 0 warnings.
3. **Invariance:** with no type-aware rules, and no `fs` read in any
`eslint-rules/*.js` (grep returns 0 matches; the same pattern hits
`scripts/check-control-bytes.mjs`, the positive control), this diff
cannot move a verdict on an untouched file. Repo-wide lint is CI's.
- Patch round 1 (head `e37c484be`, at the seat's request): both
authoring faces measured and pinned. The card's document, the
showcase-shaped document and all 20 per-operator documents pass
`ObjectMetricBlockSchema`, `safeValidateSchema` (the tolerant face
`objectui validate` runs) and `StrictAnyComponentSchema`. The probe's
controls show each face can refuse: an unknown `properties` key is
refused by all three, and an unknown node-level key is refused by the
strict face only. The changeset and the pin comment now say "passes both
authoring faces" instead of "the strict face". The pin passes 7 of 7,
`plugin-dashboard` type-check is green, and there is no source change.
## Acceptance notes
- **The legacy wire is untouched.** The control pins the raw rule list
on the legacy bag; the adapter lowers that wire.
- **The drill drawer is unchanged.** It still receives `resolvedFilter`,
and the 8970 pin is green. objectui#11506's drill path is not touched.
- **`UnloweredAggregateWhereError` and its check are untouched.** The
refusal of a caller that skips the lowering is pinned by
`data-objectstack`'s `aggregate-spec-shape-where.test.ts` ("throws
UnloweredAggregateWhereError instead of posting a rule array"). The
ablation above shows the refusal coming back end to end once the
lowering call is removed. That file also pins the other half of the
seam: "a FilterCondition OBJECT is not an array, and this gate leaves it
alone".
- **The committed pin uses a recording adapter, not the real one.**
`plugin-dashboard` does not declare `@object-ui/data-objectstack`, and
declaring it (a `package.json` and lockfile edit) is outside this
claim's file surface. The pin therefore asserts the posted `where` is a
`FilterCondition` (`FilterConditionSchema` from
`@objectstack/spec/data`). The adapter's acceptance of that shape is
pinned on the adapter's side, as above.
- **The brief's mechanism assumption 2 was falsified.** The legacy
wire's lowering lives in the adapter package, and a re-export from core
is a cycle. The route changed to the two public stages, per the ruling's
intent: lower at the producer, no hand-written conversion, the refusal
stays, and the bag is not narrowed.
- **Observation, not filed:** this repo has two rule-list translators,
`translateFilterArray` (adapter-private) and `toFilterNode` (core). They
agreed after `parseFilterAST` across the declared vocabulary in the
measurement above, and on refused rules they differ only in error class.
No defect was measured. Carrier: none.
- **Not measured:** `object-chart` makes the same spec-shape call. Its
declared `filter` is a `FilterArray` or a record
(`ObjectChartSchema.filter`), not a rule list, so this card's dialect
does not reach it.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01YLg8XqWGJ785fwQ5v4pH37)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent c73cdb5 commit 8bfc001
3 files changed
Lines changed: 347 additions & 3 deletions
File tree
- .changeset
- packages/plugin-dashboard/src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
108 | 156 | | |
109 | 157 | | |
110 | 158 | | |
| |||
419 | 467 | | |
420 | 468 | | |
421 | 469 | | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
422 | 475 | | |
423 | | - | |
| 476 | + | |
424 | 477 | | |
425 | 478 | | |
426 | 479 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
0 commit comments