Repository navigation
Commit 1b2043e
docs(lint): dashboard-filter-binding-unknown explanation counts a globalFilters entry named dateRange as declared (#29525)
<!-- claude-projects-attribution: {"github_login":"os-warren"} -->
_Requested by **Warren** · [project
thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8UFVez1aipH3zDDpgxd3umQ)_
Fixes #29382
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:`os explain dashboard-filter-binding-unknown` 的一句说明,和
`validate-widget-bindings.ts` 里两段注释;规则代码不变,新增一个测试。
- 为什么改:旧说明称「没声明 `dateRange` 的仪表盘上,`dateRange` 绑定一律报错」;实测规则接受名为
`dateRange` 的 `globalFilters` 条目,说明与行为不符。
- 风险与回滚:只改说明文字与注释,行为零变化;回滚即 revert 本 PR。
- 先看:`packages/lint/src/rule-explanations.ts`(第 407–410
行那句)、`packages/lint/src/validate-widget-bindings.test.ts`(新测试)。
- 两分钟验证:`pnpm --filter @objectstack/lint exec vitest run
src/validate-widget-bindings.test.ts -t
dashboard-filter-binding-unknown`,预期 13 个用例全绿。
- 需要你做的:无,席位落地。
## What changes
- `packages/lint/src/rule-explanations.ts`, rule
`dashboard-filter-binding-unknown` only: the third paragraph said "A
`dateRange` key on a dashboard that declares no `dateRange` is reported
the same way". It now says a `dateRange` key is reported only when the
dashboard declares neither `dateRange` nor a `globalFilters` entry named
`dateRange`, because either one is a declared filter under that name.
- `packages/lint/src/validate-widget-bindings.ts`: the rule family
docblock and the `DASHBOARD_FILTER_BINDING_UNKNOWN` docblock say the
same. No code line changed.
- `packages/lint/src/validate-widget-bindings.test.ts`: one new case in
the `dashboard-filter-binding-unknown` block. The dashboard has no
`dateRange`, a `globalFilters` entry `{ name: 'dateRange', field:
'signed_at', type: 'date' }`, and a widget with `filterBindings: {
dateRange: false }`. It expects zero findings.
- `.changeset/29382-filter-binding-daterange-prose.md`: a patch for
`@objectstack/lint`, because the explanation text ships in its `dist/`.
## Why
The card asked for a measurement first. The rule takes its declared
names from `dashboardFilterDefs`, which adds every `globalFilters` entry
under its `name`. So a `globalFilters` entry named `dateRange` is
declared even when the dashboard has no `dateRange`. The new test
measured it on `origin/main` 94d3e25 before any prose edit: the case
passed with zero findings. The rule accepts the binding, so this PR
takes the prose-only arm and leaves the rule body alone. The runtime
agrees: objectui `resolveDashboardFilterDefs`
(`ui/packages/core/src/utils/dashboard-filters.ts`) builds the same name
set.
## Tests
- Measurement, before any prose edit, tree 94d3e25 plus the new test
only: `pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2
src/validate-widget-bindings.test.ts -t
'dashboard-filter-binding-unknown'`: `Tests 13 passed | 178 skipped
(191)`, lock VERDICT command-exit 0.
- Final head: see Verification.
## Acceptance notes
- `packages/spec/src/ui/dashboard.zod.ts` still says `dateRange` is
"reserved for the built-in dashboard date range" (the
`globalFilters[].name` TSDoc) and "(dateRange only when declared)" (the
`filterBindings` describe). Both are on the spec side that open PR
#29370 owns, which keeps a `globalFilters` entry named `dateRange`
accepted on a dashboard without `dateRange`. They are outside this
card's file surface. carrier: PR #29370.
- The finding's hint for an undeclared `dateRange` key still reads
"Declare `dateRange` on the dashboard, or delete the `dateRange` entry."
It is reached only when neither declaration exists, so it is accurate;
it does not mention the `globalFilters` spelling. Not changed, because
the claim limits the rule body to the false-positive arm.
## Verification
All readings are on head `abff9a05` (`b6d1ad0e` plus a merge of
`origin/main` 86d36e9).
<details><summary>Package tests and typecheck</summary>
- `pnpm --filter @objectstack/lint test`: `Test Files 190 passed (190)`,
`Tests 7858 passed (7858)`, lock VERDICT command-exit 0.
- `pnpm --filter @objectstack/lint typecheck`: lock VERDICT command-exit
0.
</details>
<details><summary>Derived gates (dispatch-gates --commands, 58
families)</summary>
- 57 of 58 exit 0, each captured before any pipe.
- `pnpm check:dual-build-cjs-loads`: exit 3, PREREQUISITE NOT MET (it
needs every package's `dist/`). NOT MEASURED locally; CI's `Lint & Repo
Gates` runs it on a full build.
- `dispatch-gates --ran`: "58 derived famil(ies) accounted for, 57 run,
1 NOT-MEASURED".
- `node scripts/check-nul-bytes.mjs`: exit 0.
</details>
Repo-wide `pnpm lint` and every other CI family: read from this PR's
check-runs.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(no spec change)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes. (repo-wide lint is CI's
run)
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: not touched.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English (the maintainer brief
is Chinese by the repo's communication rule).
Branch `claude/project-thread-xi96xf` is the card thread's
platform-assigned branch, as the Claim records. Written by
`domain:spec#5 · os-warren · session_01JQwxbaAMsVe1WU74CypjTZ`.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01JQwxbaAMsVe1WU74CypjTZ)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 7f368f5 commit 1b2043e
4 files changed
Lines changed: 29 additions & 6 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 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
408 | | - | |
409 | | - | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
410 | 411 | | |
411 | 412 | | |
412 | 413 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
948 | 948 | | |
949 | 949 | | |
950 | 950 | | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
951 | 959 | | |
952 | 960 | | |
953 | 961 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
84 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
85 | 88 | | |
86 | 89 | | |
87 | 90 | | |
| |||
450 | 453 | | |
451 | 454 | | |
452 | 455 | | |
453 | | - | |
| 456 | + | |
| 457 | + | |
454 | 458 | | |
455 | 459 | | |
456 | 460 | | |
| |||
0 commit comments