refactor(plugin-grid): dismantle the emit-side fitContent cast, re-point the 6458 anti-vacuity control - #6734
Merged
Conversation
…int the 6458 control Maintainer ruling 2026-08-29 (option 甲) completes its declare branch: with `TableColumn` declaring `fitContent` since PR #6673, the `(col as any).fitContent` read in `ObjectGrid`'s grouped-width pass loses its cast. What that buys is measured rather than assumed: nothing at the type level. The receiver is `any` either way — `applyColumnChrome` is `(col: any)`, so `orderedColumns` is `any[]` and the loop widens it a second time. The TypeScript checker reports `isAny=true` for the receiver both before and after the cast, against a control in the same query shape that reports a non-`any` type. The load-bearing half is the guard. `columnReadBoundary-6458.test.ts` used that cast as anti-vacuity control 3 — its only proof that the scanner can find a real cast in the real file at real scale — and that control's own comment requires it to be re-pointed at another real cast and never deleted. Its scanner hard-coded the receiver to `col`, and the dismantling left zero `col` casts outside the guarded region, so the receiver becomes a parameter (defaulting to `col`, leaving every bound assertion unchanged) and the anchor moves to `(schema as any).hideRowHeightToggle`. That anchor is picked on a principle, not merely moved: a deliberately held non-authoring key (objectui#5091) that `gridNonAuthorKeys.test.tsx` independently pins, so it cannot expire silently the way `fitContent` just did. Control 2 gains assertions pinning that the receiver parameter is honoured, so the bound assertions' `col` scoping cannot quietly become a fiction. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CRJge11jso9TpXRWFt1Z49
Contributor
✅ Console Performance Budget
The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it. 📦 Bundle Size Report
Size Limits
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #6424
Maintainer ruling 2026-08-29 (live director session batch 6, verbatim 「其他同意」) adopted option 甲 (declare) and ordered the
(col as any).fitContentsites dismantled in the same PR. The declare half had already landed —headerIconby PR #6615,fitContentby PR #6673 — and this branch verified that onorigin/mainrather than taking it on report:The two
data-table.tsxcast sites went with PR #6673 (they readcol.fitContentdirectly now). This lands the remaining emit-side one.What this buys, measured rather than asserted: nothing at the type level
The cast bought zero type safety, and that is a measurement from the TypeScript checker, not a reading of the source.
applyColumnChromeis(col: any), soorderedColumnsisany[], and the grouped-width loop widens it a second time withas any[]:The control in the same query shape reports a non-
anytype, soisAny=trueis a reading and not a stuck instrument. The only observable effect of the removal is at the lint layer:ObjectGrid.tsxper-file eslint warnings go 212 to 211, with the test file at 0/0 on both refs.Line-number note for anyone tracking this on the card: the site is at
:3675on this ref. All three circulating numbers —:3418,:3587,:3606— are stale.The load-bearing half is the guard, and one inherited finding needed correcting
columnReadBoundary-6458.test.tsused this exact cast as anti-vacuity control 3 — its only proof that the scanner can find a real cast in the real file at real scale. Removing the cast alone turns it red, re-measured here before any edit:That control's own comment requires it to be re-pointed at another real cast and never deleted. The prior round recorded that there was no other candidate in the file and that executing the ruling literally would therefore require weakening a gate.
That finding is narrower than it reads, and re-measuring changed the answer. It is true only for the receiver
col. Scanning the whole file with the guard's own regex shape generalised over the receiver finds 35 cast reads, 14 of them outside the guarded region. After the dismantling, 13 remain outside it, across six receivers:So a re-point is possible; only the scanner's hard-coded
colstood in the way. That is this card family's own lesson landing on itself a third time — cast count is not the instrument, and neither is a cast census taken through a receiver-specific pattern.The re-point, and why this anchor rather than one of the twelve others
The receiver becomes a parameter defaulting to
col, so every bound assertion is unchanged: same regex construction, same region, same meaning. Control 3's anchor moves to(schema as any).hideRowHeightToggle.Chosen on a principle, not merely moved: it is the only kind here that cannot expire silently.
hideRowHeightToggleis a deliberately held non-authoring key (#5091) — a host-written switch thatComponentPropsMap['object-grid']'sstrictObjectrefuses by name, so the cast is load-bearing rather than incidental — and it is independently pinned bygridNonAuthorKeys.test.tsx, in that file's key table and in a behavioural test. If it is ever retired, that guard goes red in the same run and names it. That is exactly the failure the old anchor had:fitContentwas nothing else's premise, so dismantling it broke this control with no other signal — the silent-expiry shape this family keeps recording.Control 2 gains a pair of assertions pinning that the receiver parameter is honoured rather than ignored, in both directions. Without them a receiver-blind pattern would leave control 3 passing while the bound assertions' scoping to
colquietly became a fiction.The re-pointed control proved able to fail
Both legs proved the mutation on disk by anchored text counts plus a moved blob hash, ran under
trap ... EXIT INT TERMwith absolute paths, restored via explicitgit checkout HEAD -- ABSOLUTE_PATH, and proved the restore by observation (blob hash back to the HEAD blob andgit diff HEADempty) rather than by an editor's exit code.D1 — retire the new anchor the way
fitContent's was retired. Control 3 goes red:The returned array is non-empty, which is the part worth reading: the control is pinned to that specific key, not merely to "some cast on
schema" — it would still fail if the anchor alone went.D2 — make the scanner ignore its receiver parameter. Control 2 goes red by name, and so does a bound assertion, showing the exact failure mode the new pins exist to catch:
A receiver-blind pattern drags unrelated casts into the guarded region's bound. Control 2 catches it first.
What was run
Everything heavy went through the shared verify lock; verdicts are quoted from its own VERDICT line, and gate exit codes were captured before any pipe. Union at final commit
93173fa7b:pnpm --filter @object-ui/plugin-grid type-check(tsc --noEmit && tsc -p tsconfig.test.json, script name echoed so it is not a zero-match no-op) — noerror TSlines,VERDICT command-exit 0pnpm exec vitest run --maxWorkers=2 packages/plugin-grid/from the repo root — Test Files 98 passed (98), Tests 897 passed (897)pnpm --filter @object-ui/plugin-grid lint—681 problems (0 errors, 681 warnings); per-file on the diff,ObjectGrid.tsx212 to 211 warnings and the test file 0/0 on both refspnpm --filter '@object-ui/plugin-grid^...' build) becausepackages/types/distdid not exist in a fresh worktree — without it every type reading would have been NOT MEASUREDcheck:control-bytes(5584 tracked text files, so it saw the new changeset),check:vi-mock-specifiers,check:shell-escape-residue,check:phantom-deps,check:self-import,check:spec-symbols,check:esm-specifiers,check-changeset-presence(ruled one owed at EXIT=1 first, green after),check-changeset-no-majorDeclared narrowing: the repo-wide lint and vitest farms were not run locally. The population is read from eslint's own config —
turbo run lintover per-packageeslint .units, so onlyplugin-grid's unit can move, and it ran in full. Type-aware linting is not enabled, so this diff cannot move any untouched file's verdict. CI runs the farm exactly once regardless.Changeset: empty frontmatter, the gate's own explicit exemption, since nothing published changes behaviour.
Deliberately not in this PR
as any[]on the loop at:3666andapplyColumnChrome's(col: any)— typing those is what would make this read actually checked, and it is a different question (finding(plugin-grid): ObjectGrid builds its data-table schema asconst dataTableSchema: any, so theDataTableSchemait imports is never applied #6459 territory), not a ruled item here.namealias stays exactly as deliberately held (finding(components/plugin-dashboard): data-table 的访问键归一化读一个自身类型未声明的col.name别名,而唯一在交付前解析列身份的生产者只有 RelatedList #5120).Generated by Claude Code
Generated by Claude Code