Repository navigation
Commit ab0c5df
refactor(plugin-list): ListView reads its view blocks through ListViewSchema, not a (schema as any) cast (#28335)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuRHF1GswWyuFi1iHok1ht8c)_
Part of #25918
Clause-②: no
Metadata-protocol: none
Skills-docs: none
## 维护者速读
- 改了什么:`ListView.tsx` 里 26 处 `(schema as any)` 读取(19 行代码;卡上数的 21 行另含 2
行注释)全部去掉。kanban、calendar、gallery、timeline、gantt、tree、chart 和
`bulkActionDefs` 都是 `ListViewSchema` 已声明的键,改成直接的类型读取;唯一未声明的
`rowActionDefs`(宿主拼的键,规范在列表面按名拒收)改走一个窄类型转换
`hostRowActionDefsOf`,类型取自消费它的 `object-grid` 节点。加了一个源码扫描测试,防止 `(schema
as any)` 再回来。
- 为什么改:`any` 转换把类型检查整段关掉了,键名拼错或用法不对都照样编译通过;这些键其实都有类型,转换什么也没挡住,只挡住了类型。
- 风险与回滚:运行时行为不变,列表渲染和取数都不变(只是读法变了;新增的小函数返回同一个值)。回滚即还原本 PR。
- 先看:`ui/packages/plugin-list/src/ListView.tsx`(`hostRowActionDefsOf` 与
3360、4210 附近两处 `rowActionDefs`
读取)、`ui/packages/plugin-list/src/__tests__/ListView.noAnySchemaCast.test.ts`。
- 两分钟验证:`pnpm --dir ui exec vitest run
packages/plugin-list/src/__tests__/ListView.noAnySchemaCast.test.ts
packages/plugin-list/src/__tests__/listViewNonAuthorKeys-8653.test.tsx`,预期全绿:扫描找不到
`(schema as any)`,`rowActionDefs` 仍传到表格节点并进入 `$select`。
- 需要你做的:无,席位落地
## What changes
- `ListView.tsx` reads every key it used to read through `(schema as
any)` as a typed member of `ListViewSchema`: `kanban`, `calendar`,
`gallery`, `timeline`, `gantt` (the projection and expand collectors and
the fetch effect's dependencies), `tree` and `chart` (the capability
gate and the tree branch), and `bulkActionDefs` (the predicate harvest
and the grid hand-off). Each is a declared member, checked with the
TypeScript checker against the built `@object-ui/types` declarations
(index signature stripped), not by grep.
- `rowActionDefs` is the one key declared on no list mirror: the spec
refuses it by name on the list surface, and the objectui#8653 ruling
keeps the read (the host composes it; it reaches the child `object-grid`
node and `$select`). It is now read through one module-level helper,
`hostRowActionDefsOf`, that casts to `Pick<DataTableSchema,
'rowActionDefs'>`, the type the consuming grid node declares. The
predicate-key site's own `{ rowActionDefs?: readonly unknown[] }` cast
uses the same helper, so the file has one spelling for that read.
- No key is declared in `@object-ui/types` or `@objectstack/spec`; no
exported type changes (the helper is module-private).
- Two comments still quote the old spelling (the `userActions` collision
note and the retired `title` arm). They are prose describing reads that
must not come back, not reads, and are left as written.
## Tests
- New `ListView.noAnySchemaCast.test.ts`: a TypeScript AST walk of
`ListView.tsx` finds no `schema as any` / `props.schema as any` cast. A
firing control on a probe shows it catches the plain,
double-parenthesised and `props.schema` shapes, and skips comments,
typed casts and other objects.
- Ablation, after committing the fix: `scripts/ablation-replace.mjs` put
back one cast (`(schema as any).tree?.parentField`) and the new test
went red naming that line; restored blob equals HEAD. With
`origin/main`'s `ListView.tsx` written over the file, the scan names 26
casts on 19 lines (the card's 21 grep lines less the 2 comment lines;
some lines carry two casts); restored, `git diff --quiet HEAD` clean.
- The existing pins on these reads stay green unchanged,
`listViewNonAuthorKeys-8653` (`rowActionDefs` still relayed to the grid
and harvested into `$select`) and `ListView.harvestInputsFetchKey-10689`
among them.
## Acceptance notes
- Out of scope and untouched, per triage 6407890835: "⛔ Out of scope
until the maintainer names it: `no-explicit-any: 'error'` on
`packages/types/src`." No ESLint config change.
- Noted only: the predicate-key site still reads `bulkActionDefs`
through a narrow `{ bulkActionDefs?: readonly unknown[] }` cast. It is
not an `any` cast and is outside this card's surface;
`schema.bulkActionDefs` would also compile there.
- The branch is the platform-assigned card-thread branch
(`claude/project-thread-epslnx`), the measured exception to
`claude/issue-N-slug` named in the claim.
## Verification
Head `0a1ec22650` (main `b33946512c` merged in, which brought the kanban
`lanes` change to `ListView.tsx`; the merge was clean and added no
cast). Every reading below is on this head unless it says otherwise.
<details><summary>type-check, tests, lint</summary>
- Closure `pnpm --workspace-concurrency=2 --filter
'@object-ui/plugin-list^...' build` under os-verify-lock: VERDICT
command-exit 0 (also on the two earlier heads).
- `pnpm --filter @object-ui/plugin-list run type-check` (`tsc --noEmit
&& tsc -p tsconfig.test.json`): exit 0 (also on the two earlier heads).
- `pnpm --dir ui exec vitest run --maxWorkers=3 packages/plugin-list/`
plus the 27 out-of-package test files that read `ListView.tsx` off disk,
under os-verify-lock, VERDICT command-exit 0, `Test Files 202 passed
(202)`, `Tests 2337 passed (2337)` (201 / 2335 on `09ae34358a`, before
main's new kanban test arrived).
- `eslint` on `ListView.tsx` and the new test: 0 errors. `ListView.tsx`
warnings 190 to 150 (`no-explicit-any` 132 to 106,
`react-hooks/exhaustive-deps` 11 to 4, `react-hooks/use-memo` 7 to 0);
the new test has none.
- `node scripts/check-sdui-manifest.mjs`: exit 0, manifest intact.
</details>
<details><summary>dispatch gates</summary>
- `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` on `0a1ec22650`: 34 commands derived (3
changed paths, 138 changed lines, under the 3000-line threshold); each
run with its exit code captured before any pipe: all 34 exit 0.
- `--ran`: 34 derived, 34 run, 0 NOT-MEASURED, 0 UNRUN (a derived zero:
every entry carries an exit code).
- The same 34 also ran on `e4ac205e62` and `09ae34358a`: all exit 0.
- `dispatch-gates --tier`: no path-derived mandate (as quoted in the
claim).
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L6bhgTB22iDFvxkkThZWCa)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L6bhgTB22iDFvxkkThZWCa
Co-authored-by: Claude <noreply@anthropic.com>1 parent 6762dd9 commit ab0c5df
3 files changed
Lines changed: 117 additions & 21 deletions
File tree
- .changeset
- ui/packages/plugin-list/src
- __tests__
| 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 | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
1270 | 1270 | | |
1271 | 1271 | | |
1272 | 1272 | | |
1273 | | - | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
1274 | 1283 | | |
1275 | 1284 | | |
1276 | 1285 | | |
| |||
2587 | 2596 | | |
2588 | 2597 | | |
2589 | 2598 | | |
2590 | | - | |
2591 | | - | |
2592 | | - | |
2593 | | - | |
2594 | | - | |
| 2599 | + | |
| 2600 | + | |
| 2601 | + | |
| 2602 | + | |
| 2603 | + | |
2595 | 2604 | | |
2596 | 2605 | | |
2597 | 2606 | | |
| |||
2656 | 2665 | | |
2657 | 2666 | | |
2658 | 2667 | | |
2659 | | - | |
2660 | | - | |
2661 | | - | |
2662 | | - | |
2663 | | - | |
| 2668 | + | |
| 2669 | + | |
| 2670 | + | |
| 2671 | + | |
| 2672 | + | |
2664 | 2673 | | |
2665 | 2674 | | |
2666 | 2675 | | |
| |||
2913 | 2922 | | |
2914 | 2923 | | |
2915 | 2924 | | |
2916 | | - | |
| 2925 | + | |
2917 | 2926 | | |
2918 | 2927 | | |
2919 | 2928 | | |
| |||
3353 | 3362 | | |
3354 | 3363 | | |
3355 | 3364 | | |
3356 | | - | |
3357 | | - | |
| 3365 | + | |
| 3366 | + | |
3358 | 3367 | | |
3359 | 3368 | | |
3360 | 3369 | | |
| |||
3645 | 3654 | | |
3646 | 3655 | | |
3647 | 3656 | | |
3648 | | - | |
| 3657 | + | |
3649 | 3658 | | |
3650 | 3659 | | |
3651 | 3660 | | |
| |||
3723 | 3732 | | |
3724 | 3733 | | |
3725 | 3734 | | |
3726 | | - | |
| 3735 | + | |
3727 | 3736 | | |
3728 | 3737 | | |
3729 | 3738 | | |
| |||
3764 | 3773 | | |
3765 | 3774 | | |
3766 | 3775 | | |
3767 | | - | |
| 3776 | + | |
3768 | 3777 | | |
3769 | 3778 | | |
3770 | 3779 | | |
| |||
4199 | 4208 | | |
4200 | 4209 | | |
4201 | 4210 | | |
4202 | | - | |
| 4211 | + | |
4203 | 4212 | | |
4204 | | - | |
| 4213 | + | |
4205 | 4214 | | |
4206 | 4215 | | |
4207 | 4216 | | |
| |||
4630 | 4639 | | |
4631 | 4640 | | |
4632 | 4641 | | |
4633 | | - | |
| 4642 | + | |
4634 | 4643 | | |
4635 | 4644 | | |
4636 | 4645 | | |
| |||
| 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 | + | |
0 commit comments