You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0346b57
Browse filesBrowse the repository at this point in the historyBrowse files
fix(lint)!: refuse a grid list view grouped by a dotted path (#38789)
<!-- claude-projects-attribution: {"github_login":"huangyiirene"} -->
_Requested by **Irene** · [project
thread](https://claude.ai/code/project/chan_01TJXtQ1tVD26ecLDZxFS67x?thread=cmsg_01TJXtQ1tVD26ecLDZxFS67x7k1r5UkqrK3zRZHZJKat5c)_Fixes#38654
Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up #38655
## 维护者速读
-
作者在命令行校验或在设计器保存表格列表视图时,若按「关联记录的某个字段」这种带点的路径分组,会被直接拒绝并给出改法;看板、日历等其它视图不受影响,运行中的用户无感。
- 属于「发布时拦下保存成功却用不了的元数据」这一组检查,补上上一张表格分组检查卡(不可分组字段)留下的最后一类:带点路径。
- 碰到的是已经这样分组的表格视图作者,下次保存会被拒(这样的视图本来一打开就报错,平台自带视图和示例应用无一受影响);撤回本合并即可恢复原状。
- 无
## What changes
- `list-view-field-dotted` (`error`) now also judges a grid list view's
`grouping.fields[].field` (a view whose `type` is `grid`, or absent,
since the schema defaults it to `grid`). The grid sends its grouping as
the group header query, and `engine.aggregate` refuses a `groupBy` entry
naming a dotted name the object does not declare verbatim, whatever its
head or leaf (`assertGroupByTargetsAreStored`,
`packages/objectql/src/aggregate-query-shape-door.ts:231`, `400
INVALID_FIELD`). Until now lint passed `account.name` there and the grid
opened on that error.
- The verdict asks the engine's own condition (dotted, and not a
declared field name), so `account.name` and `account.tags` are refused
alike. It is judged where the head resolves; a head that resolves to
nothing stays `list-view-field-unknown`, reported once.
- Same doors and same kind gate as the item-3 rule
(`list-view-group-field-ungroupable`): `os validate` / `lint` /
`compile` / `build`, and the runtime save door on `view` and `object`
writes; `kanban`, `gallery`, `calendar`, `timeline`, `gantt`, `map`,
`chart`, `tree` and `timesheet` are not judged (their grouping does not
reach the engine). `DOTTED_AXIS` is deliberately NOT given a `grouping`
row: that table has no kind gate, so a row there would refuse a kanban's
client-side swimlane field.
- The fix line reads the head the way the engine's message does: a
single-valued relation head gets "Group by `account` itself (one group
per related record)"; any other head gets "Group by a stored
single-valued field". Both also offer denormalising the value onto the
object.
- Module header corrected: `grouping.fields` left the "reach no door
this card measured" list, and a new section `[#38654] A dotted
grouping.fields[].field on a grid` states the verdict.
- `os explain list-view-field-dotted` gains the grouping-level position,
its door and its fix; `os explain list-view-group-field-ungroupable` now
names `list-view-field-dotted` as the rule for a dotted name.
- ADR-0087 semantic entry
`publish-refuses-list-view-grouping-by-a-dotted-path`
(`@objectstack/spec` patch) and a minor `@objectstack/lint` changeset
with a BREAKING banner and FROM → TO.
- A parity pin in `packages/objectql` feeds one set of names to the
engine door and to the linter and holds them to one answer (claim
amendment 7282613519; test only, no objectql runtime file changes). The
engine's predicate is inline in the door and `@objectstack/lint` may not
import a runtime, so the pin is where "the engine's own predicate as the
judge" lives.
First-party impact, measured at 8a7e65b: the 7 first-party list views
that declare a grouping (`packages/platform-objects` ×6,
`plugin-approvals` ×1) all group by an undotted stored field;
`examples/**` and `packages/apps/**` declare none;
`objectstack-ai/hotcrm` declares no dotted grouping. 0 findings.
Contract face: the lint rule's accept set narrows. This PR stays draft
for the CONTRACT_REVIEW_TIER review the seat routes.
## Read first
1. `packages/lint/src/validate-list-view-field-refs.ts`:
`checkGroupFieldDotted` and its call at the top of `checkGroupField`
(the kind gate runs before it).
2.
`packages/objectql/src/aggregate-query-shape-door.group-by-dotted-lint-parity.test.ts`:
the engine door and the linter on the same names.
3. `.changeset/38654-list-view-grouping-dotted-path.md`: the BREAKING
banner and FROM → TO.
## Two-minute check
`pnpm --filter @objectstack/lint exec vitest run
src/validate-list-view-field-refs.group-field-38433.test.ts`: 41 passed
(the 20 new `[#38654]` cases among them).
## Tests
- `validate-list-view-field-refs.group-field-38433.test.ts`, new
top-level `describe('[#38654] …')`, 20 cases: five refused paths
(`account.name`, `account.tags`, `owners.name`, `meta.x`, `title.x`),
each asserting rule, `error`, `where`, `path`, the message and the
head-specific fix line; the relation itself as a quiet control; an
unknown head stays `list-view-field-unknown` alone; an untyped (grid)
view; six non-grid kinds quiet; a multi-level grouping; `validate` and
`build` fail; the runtime `view` save door (refused, then admitted on
`account`); the runtime `object` save door through `listViews`; the `os
explain` entry. The item-3 dotted case keeps its assertion (not that
rule's verdict) and points at the new block.
- `validate-list-view-field-refs.test.ts`: the "renderer bindings stay
unjudged" pin drops its `grouping.fields` entry, which a grid now
judges.
- New
`packages/objectql/src/aggregate-query-shape-door.group-by-dotted-lint-parity.test.ts`,
9 cases: five dotted names the engine refuses (`INVALID_FIELD` / 400)
and the linter reports as `list-view-field-dotted`; an object-qualified
name both refuse (the linter as `list-view-field-unknown`); three stored
single-valued controls both accept.
<details><summary>Readings</summary>
- Head 03c61bf, merge base 8a7e65b (origin/main).
- The four list-view suites
(`validate-list-view-field-refs.group-field-38433`,
`validate-list-view-field-refs`, `rule-explanations`,
`validate-list-view-kanban-lanes`): Test Files 4 passed (4), Tests 294
passed (294).
- Whole `@objectstack/lint` suite: Test Files 253 passed (253), Tests
10122 passed (10122).
- objectql parity pin: Test Files 1 passed (1), Tests 9 passed (9).
- `packages/spec/src/migrations`: Test Files 5 passed (5), Tests 210
passed (210).
- `pnpm --filter @objectstack/lint typecheck`: `VERDICT command-exit 0`.
`pnpm --filter @objectstack/objectql typecheck`: `VERDICT command-exit
0`, test layer held at its ledger.
- Ablation 1, `scripts/ablation-replace.mjs --delete` of the
`checkGroupFieldDotted(...)` call, over the lint file: anchor 1 to 0,
blob 7efbe8a to 147d5a7679f2. 11 failed (five refused paths,
untyped view, multi-level, validate, build, view door, object door), 30
passed. Restored: blob equals HEAD, `git diff HEAD` empty.
- Ablation 2, the same deletion, over the objectql parity pin (lint
resolves to source there through the package's vitest alias): 5 failed
(the five dotted names), 4 passed. Restored the same way.
</details>
## Verification
<details><summary>Local gates on 03c61bf</summary>
- `dispatch-gates.mjs --commands`: 98 derived families. `--ran`
reconciliation: 98 accounted for, 94 run, 4 NOT MEASURED.
- 94 exit 0, among them `check-adr-0087-registration.mjs --base
origin/main`, `check-changeset-no-major.mjs --base origin/main`,
`check-empty-changeset.mjs --base origin/main`, `check:spec-changes`,
`check:upgrade-guide`, `check:docs`, `check:api-surface`,
`check:authorable-surface`, `check:cross-package-test-inputs`,
`check:test-source-alias`, `check:undeclared-dep-imports`,
`check:nul-bytes`, `check:doc-authoring`, `check:issue-citations`.
`check-plugin-teardown-shape.mjs --self-test` first exited 3 on the
shallow clone (pinned fixture commit unreachable) and exited 0 after
fetching that commit; `check:lean-entry-closure` first exited 3
(objectql dist absent) and exited 0 after building it.
- NOT MEASURED: `pnpm --filter @objectstack/cli exec vitest run
test/migrate-meta-engine-guidance.test.ts` (exit 1 MODULE_NOT_FOUND, the
CLI's dependency closure is not built here; Test Core runs it);
`check:dual-build-cjs-loads` (exit 3, needs a whole-workspace build);
`check:query-options-erasure` and `check:type-check-debt` (exit 124,
over a 280 s per-command budget on the shared box). CI runs all four.
- `node scripts/check-commit-card-trailers.mjs --range
origin/main..HEAD`: 3 commit messages clean.
</details>
## Acceptance notes
- Claim lines copied verbatim: `Clause-②: no` (the claim carries no
`(narrowing)` arm, though the title carries `!` and the changeset is
BREAKING; `check-adr-0087-registration` and `check-changeset-no-major`
pass with it). If the seat wants `no (narrowing)`, it is a one-word edit
to the PR body and the changeset.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01J8VVAnXAALduwvLNEgFqeY)_
<!-- signed: repo:objectstack@huangyiirene · huangyiirene ·
session_01J8VVAnXAALduwvLNEgFqeY -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
**BREAKING** for a `grid` list view (or one with no `type`, which defaults to `grid`) whose `grouping.fields[].field` is a dotted path such as `account.name`: it was accepted before and is refused now, with the fix named in the finding. The schema is unchanged and stored metadata is not rewritten or refused at boot; the refusal comes at the next publish of the view (a `view` write, or an `object` write through the object's own `listViews`), and from `os validate` / `lint` / `compile` / `build`.
15
+
16
+
-`list-view-field-dotted` (error) now also judges a grid list view's grouping level. A grid sends its grouping as the group header query, and the engine groups by the object's own fields by their bare names, 0 hops deep: it refuses a dotted name the object does not declare, whatever its head or leaf (`400 INVALID_FIELD`), so the view saved, then opened on that error and rendered no group. The verdict asks the engine's own condition, so `account.name` and `account.tags` are refused alike. A head that names no field stays `list-view-field-unknown`. Not judged: any other list-view kind (`kanban`, `gallery`, `calendar`, `timeline`, `gantt`, `map`, `chart`, `tree`, `timesheet`), where no door fails the view: a board's one grouped count read is refused and absorbed, and the board and the gallery read the name as a flat key of the row, so a dotted name there groups nothing.
17
+
18
+
## FROM → TO
19
+
20
+
- FROM: a `grid` list view with `grouping: { fields: [{ field: 'account.name' }] }` — saved, then the grid opened on `400 INVALID_FIELD`.
21
+
- TO: group by the relation itself when it is a single-valued lookup (`grouping: { fields: [{ field: 'account' }] }`, one group per related record), or store the value on the object (a field written when the source changes) and group by that field.
22
+
23
+
`os explain list-view-field-dotted` and `os explain list-view-group-field-ungroupable` carry the new position. `@objectstack/spec` adds only the upgrade-guide entry `publish-refuses-list-view-grouping-by-a-dotted-path`.
0 commit comments