Repository navigation
Commit c801993
fix(lint): kanban group-field hint offers a grid grouping only where the engine accepts it (#38635)
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9JeHmqv6CKCkW8ewrPBLekk)_
Refs #38433 (items 1, 2)
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 作者与智能体在校验或保存看板视图时看到的修复建议变了:分组字段是多值、JSON
存储或公式字段时,不再建议改用表格分组,而是建议改用表格列;普通文本、数字、日期字段的建议不变。
- 属于看板分组字段校验规则的复核跟进:原建议会把作者引到一个打开即报错的表格分组。
- 只是提示文字和规则说明变了,不改任何校验结论或严重级别;出错时作者只会读到不准确的建议,可直接撤回。
- 无。
## What changes
`list-view-kanban-group-field-uncategorical` now offers the
grid-grouping remedy only on the branch where it holds.
- **Hint** (`checkKanbanGroupField`,
`packages/lint/src/validate-list-view-field-refs.ts`): the tail is keyed
on the engine's own refusal set, read from the same spec predicates the
two `engine.aggregate` doors use:
- multi-valued (`isMultiValueField`, the multi branch) and
structured-JSON (`STRUCTURED_JSON_TYPES`) are refused by
`assertGroupByNamesNoJsonStoredField`;
- virtual `formula` (`isVirtualSearchField`) is refused by
`assertGroupByTargetsAreStored`;
- both answer `400 INVALID_FIELD`. A list view `grouping` compiles to
that group-header query (`compileListViewGroupQuery`), which the grid
sends.
- For those three classes the hint now ends `or show "FIELD" as a grid
column (a list cannot be grouped by REASON)`; every other warned field
(text, number, date and the rest of the stored single-valued scalars)
keeps `or show "FIELD" as a grid grouping`.
- **Explanation** (`rule-explanations.ts`, this rule's entry only): the
fix paragraph now says the same, branch by branch: stored single-valued
field gives grid grouping; multi-valued, JSON-stored or `formula` gives
grid column only, with the reason.
- Measured from the rule's code: before this PR a JSON-stored or
`formula` group field already warned, on the **single-valued** branch
(it is not in `KANBAN_CATEGORICAL_TYPES`), and got the grid-grouping
tail. No finding, severity or accept set changes.
- **N2 (item 4), decided: keep the short list deliberately.** `select`,
boolean and lookup are the heads of the three families the rule accepts
(`select`/`radio`, `BOOLEAN_VALUE_TYPES`, `REFERENCE_VALUE_TYPES`).
Naming each member would hand-copy `KANBAN_CATEGORICAL_TYPES` into prose
that drifts from it, and would lengthen a hint held to 200 characters.
Read first, by risk:
1. `packages/lint/src/validate-list-view-field-refs.ts`, the
`ungroupable` / `gridRemedy` hunk in `checkKanbanGroupField`: this is
where the set is keyed.
2. `packages/lint/src/validate-list-view-kanban-lanes.test.ts`, the new
per-field `it.each`.
Two-minute check: `pnpm --filter @objectstack/lint exec vitest run
--maxWorkers=2 src/validate-list-view-kanban-lanes.test.ts`. Expect 34
passed. The `tags`, `watchers`, `meta`, `address` and `score` rows
assert a grid column; `amount`, `due_date` and `subject` assert a grid
grouping.
## Tests
At head `e0e643722a`:
<details><summary>@objectstack/lint: full suite and typecheck</summary>
- `pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2`: Test
Files 246 passed (246), Tests 9962 passed, 5 skipped (9967).
- `pnpm --filter @objectstack/lint typecheck`: exit 0;
check:test-typecheck OK.
- `src/validate-list-view-kanban-lanes.test.ts`: 34 passed.
</details>
<details><summary>Ablation</summary>
Forced `gridRemedy` to always take the grid-grouping arm, on disk, then
ran the target file: 5 failed / 29 passed. The failures were exactly the
five ungroupable rows (`tags`, `watchers`, `meta`, `address`, `score`).
Restored with `git checkout HEAD --`, tree clean.
</details>
## Acceptance notes
- Item 3 of the card (a finding of its own for a
`grouping.fields[].field` naming a multi-value, JSON-stored or
non-stored field) is not in this PR. It is a narrowing and stays on the
card.
- `engine.aggregate` also refuses a `groupBy` on a credential or
`internal`-flagged column (`rejectCredentialEvaluation`,
`rejectInternalFieldEvaluation`). The hint is not keyed on those,
because the refusal comes from a flag and not from the storage class. A
kanban board grouped by a password field is not a realistic producer.
Noted only.
## Verification
<details><summary>Derived local gates (dispatch-gates --commands, 70
families)</summary>
- `dispatch-gates --ran`: 70 derived, 67 run with exit 0, 3 NOT MEASURED
(exit 3, prerequisite), 0 unrun.
- NOT MEASURED: `check-plugin-teardown-shape --self-test` (shallow clone
cannot reach its pinned fixture commit), `check:dual-build-cjs-loads`
and `check:lean-entry-closure` (need dist of packages outside this
diff's closure). Left to CI.
- `check:docs-transcript-drift` was re-run after building
`@objectstack/lint`: exit 0. `check:type-check-debt` and
`check:query-options-erasure`: exit 0.
- `overlap-check --branch=HEAD`: clean against origin/main and #38628,
#38605, #38594, #38550.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01ADHkmSwS4mQyXWrddL4r6B)_
<!-- signed: repo:objectstack#3 · os-steve ·
session_01ADHkmSwS4mQyXWrddL4r6B -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent f3028c5 commit c801993
4 files changed
Lines changed: 64 additions & 3 deletions
File tree
- .changeset
- packages/lint/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1558 | 1558 | | |
1559 | 1559 | | |
1560 | 1560 | | |
1561 | | - | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
1562 | 1565 | | |
1563 | 1566 | | |
1564 | 1567 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
506 | 506 | | |
507 | 507 | | |
508 | 508 | | |
| 509 | + | |
509 | 510 | | |
510 | 511 | | |
511 | 512 | | |
| |||
1471 | 1472 | | |
1472 | 1473 | | |
1473 | 1474 | | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
1474 | 1489 | | |
1475 | 1490 | | |
1476 | 1491 | | |
| |||
1482 | 1497 | | |
1483 | 1498 | | |
1484 | 1499 | | |
1485 | | - | |
1486 | | - | |
| 1500 | + | |
1487 | 1501 | | |
1488 | 1502 | | |
1489 | 1503 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
168 | 171 | | |
169 | 172 | | |
170 | 173 | | |
| |||
197 | 200 | | |
198 | 201 | | |
199 | 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 | + | |
200 | 236 | | |
201 | 237 | | |
202 | 238 | | |
| |||
0 commit comments