Repository navigation
Commit 38bbc2f
refactor(plugin-view): read the three declared object-view keys without a cast (#27273)
<!-- claude-projects-attribution: {"github_login":"os-warren"} -->
_Requested by **Warren** · [project
thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ819oUQ9cjPHsHVoZ112LVMA)_
Part of #25918 (the ListView reads and the lint rule stay open on the
card).
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:ObjectView 把三个已声明键(`data`、`navigation`、`searchableFields`)的
`(schema as any)` 读法改成直接 `schema.K`;ObjectGrid 两处读法经核实都有真实生产者,保持不动。
- 为什么改:类型已经声明的键再走 `as any` 只是遮住类型检查,卡 #25918 要求删掉这类残留写法。
- 风险与回滚:零运行时变化(去掉 `as any` 后生成的 JS 相同);27 个宿主组合键的读法一个没动;回滚即 revert 本 PR。
- 先看:`ui/packages/plugin-view/src/ObjectView.tsx` 的 `renderListView`
区段;`objectViewHostSurface.test.tsx` 改过的两条断言。
- 两分钟验证:`pnpm --dir ui exec vitest run
packages/plugin-view/src/__tests__/objectViewHostSurface.test.tsx`,预期全部通过。
- 需要你做的:无,席位落地。
## What changes
- `ui/packages/plugin-view/src/ObjectView.tsx`: inside the `#region
object-view HOST-COMPOSITION SURFACE (objectui#5097)` fence, the three
keys in `OBJECT_VIEW_DECLARED_FORWARDED_KEYS` (`data`, `navigation`,
`searchableFields`) are now read as `schema.K`. All three are declared
on `ObjectViewSchema` (`data` through `BaseSchema`), so the cast hid
nothing. The 27 `OBJECT_VIEW_HOST_COMPOSITION_KEYS` reads keep their
cast, per the objectui#5097 ruling. The fence comment, the two docblocks
that described all 30 reads as casts, and the `data` rung comment (which
wrongly called node `data` one of the 27) now say what the code does.
- `objectViewHostSurface.test.tsx`: the fence pin now derives the cast
set and the uncast set separately. It asserts the cast reads are exactly
the 27 exempt keys, and that each declared key is read uncast. The
named-view section's count drops from 27+3 to 27 for the same reason.
- `object-view-unmirrored-keys-7779.test.ts` (`@object-ui/types`): three
literal source-text pins (the `searchableFields` read twice, the `data`
read once) follow the new text. Its census regex already matched both
spellings, so no count changed.
`ObjectGrid.tsx` is unchanged. Both of its `(schema as any)` reads are
on keys that a real producer writes onto an `object-grid` node, so
neither read can stop here:
- `rowActionDefs`: `DevRowActions.tsx` (console dev page, an
`object-grid` node literal), `ListView`'s grid hand-off, `RelatedList`
and app-shell's `objectViewListRenderer`. The key is declared on
`DataTableSchema` but not on `ObjectGridSchema`, and
`ComponentPropsMap['object-grid']` refuses it by name.
- `hideRowHeightToggle`: `ListView`'s `baseProps` set it to `true` on
the `object-grid` node it builds. It is declared nowhere.
Both are already recorded as ruled non-author surface (objectui#5091)
and pinned by `gridNonAuthorKeys.test.tsx`. They are reported to the
seat as findings and not filed here.
## Tests
Run on head `4c0dabbb` (merge of `origin/main` `1e8e5296`):
- Closure build `pnpm --workspace-concurrency=2 --filter
'@object-ui/plugin-view^...' build` under `os-verify-lock`: VERDICT
command-exit 0.
- `pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-view/`
plus every test outside the package that reads
`plugin-view/src/ObjectView.tsx` off disk (six `@object-ui/types` census
files, plugin-form `affordanceGrantMap-12082`, plugin-list
`ViewSwitcher.i18n-4024`, two plugin-map files, react
`navigationOverlayConsumers.onRowClickArity-9357`, schema-catalog
`catalog-gallery-render`): Test Files 89 passed (89), Tests 1738 passed
(1738).
- `pnpm --filter @object-ui/plugin-view run type-check` exit 0, and
`pnpm --filter @object-ui/types run type-check` exit 0. Both scripts
include `tsc -p tsconfig.test.json`, so the edited tests are compiled.
- No ablation: no read was stopped and no runtime behaviour changed.
Dropping an `as any` emits the same JavaScript, and the existing
`forwards all 30 reads` render test still pins every value end to end.
## Acceptance notes
- `(activeView as any)?.data` and `(activeView as any)?.rowActionDefs`
in the same fence are casts on the host `views` prop entry, not on
`schema`. They are outside this card's surface and are left as they are.
- No changeset (`skip-changeset`): the emitted code of both published
packages is unchanged. Only comments and type-level casts moved, and the
`@object-ui/types` change is test-only.
## Verification
`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived 24 gate commands on this diff, and
all 24 exited 0 (reconciled with `--ran`). Also `pnpm run
check:new-line-citations` (ui): 0 new citations. `dispatch-gates
--tier`: no path-derived mandate.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
- [x] 2. Every name I added uses the casing for its kind.
- [ ] 3. No formatter ran; `pnpm lint` passes. (No formatter ran; lint
was not run locally, CI `Lint UI` reads it.)
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [ ] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset. (Not
applicable: nothing published changes; `skip-changeset`.)
- [ ] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed. (Not applicable: `packages/spec` untouched.)
- [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 *Before Submitting* list in CONTRIBUTING.md is done.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01JQwxbaGCrvY8peSVMF3rQw
---
_Generated by [Claude
Code](https://claude.ai/code/session_01JQwxbaGCrvY8peSVMF3rQw)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent e9c88f7 commit 38bbc2f
3 files changed
Lines changed: 50 additions & 26 deletions
File tree
- ui/packages
- plugin-view/src
- __tests__
- types/src/__tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
864 | 864 | | |
865 | 865 | | |
866 | 866 | | |
867 | | - | |
868 | | - | |
869 | | - | |
| 867 | + | |
| 868 | + | |
870 | 869 | | |
871 | | - | |
| 870 | + | |
| 871 | + | |
872 | 872 | | |
873 | 873 | | |
874 | 874 | | |
| |||
986 | 986 | | |
987 | 987 | | |
988 | 988 | | |
989 | | - | |
990 | | - | |
991 | | - | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
992 | 993 | | |
993 | 994 | | |
994 | 995 | | |
| |||
2954 | 2955 | | |
2955 | 2956 | | |
2956 | 2957 | | |
2957 | | - | |
2958 | | - | |
2959 | | - | |
| 2958 | + | |
| 2959 | + | |
| 2960 | + | |
| 2961 | + | |
| 2962 | + | |
2960 | 2963 | | |
2961 | 2964 | | |
2962 | 2965 | | |
| |||
3106 | 3109 | | |
3107 | 3110 | | |
3108 | 3111 | | |
3109 | | - | |
3110 | | - | |
3111 | | - | |
3112 | | - | |
3113 | | - | |
| 3112 | + | |
| 3113 | + | |
| 3114 | + | |
| 3115 | + | |
| 3116 | + | |
3114 | 3117 | | |
3115 | | - | |
| 3118 | + | |
3116 | 3119 | | |
3117 | 3120 | | |
3118 | | - | |
| 3121 | + | |
3119 | 3122 | | |
3120 | 3123 | | |
3121 | 3124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
129 | 131 | | |
130 | 132 | | |
131 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
132 | 146 | | |
133 | 147 | | |
134 | 148 | | |
| |||
153 | 167 | | |
154 | 168 | | |
155 | 169 | | |
156 | | - | |
157 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
158 | 178 | | |
159 | 179 | | |
160 | 180 | | |
| |||
342 | 362 | | |
343 | 363 | | |
344 | 364 | | |
345 | | - | |
| 365 | + | |
346 | 366 | | |
347 | 367 | | |
348 | 368 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | | - | |
| 203 | + | |
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
| |||
1095 | 1095 | | |
1096 | 1096 | | |
1097 | 1097 | | |
1098 | | - | |
| 1098 | + | |
1099 | 1099 | | |
1100 | 1100 | | |
1101 | 1101 | | |
| |||
1656 | 1656 | | |
1657 | 1657 | | |
1658 | 1658 | | |
1659 | | - | |
1660 | | - | |
1661 | | - | |
1662 | | - | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
1663 | 1664 | | |
1664 | 1665 | | |
1665 | 1666 | | |
| |||
0 commit comments