Skip to content

test(plugin-detail): type-check its tests and clear its TEST_DEBT entry (#4040) - #4326

Merged
yinlianghui merged 3 commits into
mainfrom
claude/issue-4040-plugin-detail
Aug 11, 2026
Merged

test(plugin-detail): type-check its tests and clear its TEST_DEBT entry (#4040)#4326
yinlianghui merged 3 commits into
mainfrom
claude/issue-4040-plugin-detail

Conversation

@yinlianghui

Copy link
Copy Markdown
Collaborator

Part of #4040 — one package per PR, per the standing objectstack#4118 ruling. @object-ui/plugin-detail now type-checks its 77 test files; its TEST_DEBT entry is gone.

Measured, not trusted

The registry declared 5 errors. At this branch point the package has 11 — 0 config-tier, so 11 real. Tranche 2 established the registry is stale by up to 8x, and the full re-measure of every remaining entry is reported separately to the PM; plugin-detail is 2.2x.

The tsconfig.test.json needs no lib bump and no @testing-library/jest-dom in types (three files import it explicitly, and a global augmentation reached by an import applies program-wide). It does need types: ["node"] for the one parity test that reads spec sources off disk.

Two public shapes that contradicted the code under them

RecordRelatedListRendererProps.schema required objectName. The exported RecordRelatedListRenderer is the ElementDataSourceGate wrapper, and the gate maps the per-element binding's object onto objectName before RecordRelatedListBody sees the schema. So { relationshipField, dataSource: { object, view } } — the exact authoring shape objectstack#6953 added — was legal input at runtime and illegal to the type of the component that exists to accept it. The body already reads the key defensively (objectName && …, objectName || '') precisely because it can arrive unbound; the declaration now agrees with that code. Optional on the wrapper's input only; the spec's RecordRelatedListProps keeps it required, which is correct — one describes what an author writes, the other what the block reads.

ObjectDefLike.fieldGroups restated the spec's authorable group, and had drifted off it. The hand-written list carried key/label/collapse plus the deprecated collapsible/collapsed pair, but not icon, description or defaultExpanded. Two of those three are read by the same file: deriveFieldGroupDetailSections passes s.icon/s.description through to the section descriptors under a comment citing #2548 ("Dropping them here made the spec keys silently inert on detail pages"). So an object definition declaring the group icon the synthesizer honours did not type-check against the synthesizer. It is derived from ServiceObject['fieldGroups'] now — the key is a pass-through (deriveFieldGroupLayout is the real reader), so the members it should admit are by definition the ones the spec declares. Partial is the one shape difference, and it is the reason the type exists: a raw object definition that has not been through a spec parse.

The test-side seven

  • DetailView.permissions.test.tsx — the role config spelled its object grants as objectPermissions: { read: true, … } beside a roleName echo of its own map key. Neither key exists on ObjectPermissionConfig['roles'][string], so both were inert and the role granted nothing at all. Rewritten to the actions channel evaluatePermission actually reads. No assertion moves, and that is worth stating rather than hiding: the field gate runs through checkField, which reads fieldPermissions directly and never consults actions, so these cases were testing what they claim even while the object grant was empty; the write gate reads actions and stays false either way. The RoleDefinition fixture gains label + permissions: [] following the convention fix(permissions): type-check its tests (#4040 tranche 1) #4287 set (the dormancy itself is RoleDefinition.permissions is required and read by nothing — every consumer uses only name/inherits #4288).
  • Two spies declared ReturnType<typeof vi.spyOn> — the bare generic resolves its type parameters to their constraints, erasing the call signature, so every mock.calls entry was an implicit any. Now MockInstance<typeof console.warn>.
  • Two mocks in record-quick-actions.actionText-i18n.test.tsx had no parameters while every case reads mock.calls[0][0] to check which string the provider was handed — calls[0] was the empty tuple. Derived from ActionProvider's own props rather than restated.
  • One unused parameter; one retired-spelling negative case (compactLayout, framework#2536) that now models its untyped source instead of asking the type to re-admit a deliberately retired key.
  • RelatedList.longFormColumns.test.tsx's @object-ui/fields/widgets/MarkdownContent pre-load resolves only through the repo vitest alias — fields publishes no such subpath. The import is load-bearing (the negative cases assert synchronously against a React.lazy chunk, so without it a wrongly-derived column reads as absent while loading — green for the wrong reason), so it stays, and tsconfig.test.json restates the alias as a paths entry scoped to widgets/*. Packaging gap filed as @object-ui/fields deep subpaths resolve only through the repo vitest alias — its exports map publishes none of them #4325. Its comment also claimed "Same specifier the component uses", which was false — the component imports ./widgets/MarkdownContent relatively from inside fields. Corrected.

Discrimination proof

A — the config actually runs. This is objectui#3009's third failure mode (config exists, nothing invokes it). A provably-false line in a file only the new project reads; the first two compilers pass it and the third reports it:

> tsc --noEmit && tsc -p tsconfig.typetests.json && tsc -p tsconfig.test.json
src/__tests__/RelatedList.longFormColumns.test.tsx(49,7): error TS2322: Type 'string' is not
assignable to type 'number'.
Exit status 2

B — the fieldGroups derivation is real, not a widening. Paste a key the spec does not declare and it is still rejected — and the message quotes the spec's own member list, which is what proves nothing was hand-copied and no index signature was added:

buildDefaultPageSchema.test.ts(978,11): error TS2561: Object literal may only specify known
properties, but 'iconn' does not exist in type 'Partial< { key: string; label: string;
icon?: string | undefined; description?: string | undefined; collapse?: "none" | "collapsed" |
"expanded" | undefined; defaultExpanded?: boolean | undefined; collapsible?: boolean |
undefined; collapsed?: boolean | undefined; } >'. Did you mean to write 'icon'?

C — exactly one key was made optional. Drop relationshipField from the same literal and it is still rejected:

RecordRelatedListRenderer.elementDataSource.test.tsx(65,34): error TS2322: ...
Property 'relationshipField' is missing in type '{ [x: string]: any; }' but required in
type 'Omit< RecordRelatedListComponentProps, "objectName" >'.

Verification

pnpm --workspace-concurrency=2 --filter @object-ui/plugin-detail type-check → exit 0
npx vitest run packages/plugin-detail --maxWorkers=2 → 77 files, 759 tests passed
node scripts/check-type-check-coverage.mjs
✅ test type-check coverage: 34/40 packages compile their tests, 6 declared debt

Merged origin/main to resolve the expected check-type-check-coverage.mjs conflict (tranche 2's #4297/#4317 plus #4283 landed while this was in flight): took main's registry, removed only this package's line, re-ran the script, re-ran type-check after the merge. GitHub silently disables auto-merge on a conflict, so this PR needs it re-armed.

Changeset: patch for @object-ui/plugin-detail — the two source type corrections are user-visible.


Generated by Claude Code

…ry (#4040)
Wires `tsconfig.test.json` into the package's `type-check` script and fixes
the 11 errors that surfaced (registry declared 5).
Two were public shapes that contradicted the code under them:
- `RecordRelatedListRendererProps.schema` required `objectName`, rejecting
the authoring shape objectstack#6953 added — `ElementDataSourceGate` maps
the binding's `object` onto it before the body runs, and the body already
read it defensively because it can arrive unbound.
- `ObjectDefLike.fieldGroups` restated the spec's authorable group and had
drifted off it, omitting `icon`/`description` — the two keys
`deriveFieldGroupDetailSections` passes through to section descriptors
(#2548). Derived from `ServiceObject['fieldGroups']` now, so it cannot
drift again.
The rest are test-side: a permissions fixture whose object grants were spelled
in two keys `ObjectPermissionConfig` never declared (inert — rewritten to the
`actions` channel the evaluator reads, with no assertion moving), two spies
typed through the bare `ReturnType<typeof vi.spyOn>` generic that erased their
call signatures, two mocks with no parameters whose cases inspect
`mock.calls[0][0]`, an unused parameter, and a retired-spelling negative case
that now models its untyped source instead of asking the type to admit a key
that was deliberately retired.
Refs #4040
…gin-detail
# Conflicts:
#	scripts/check-type-check-coverage.mjs
@vercel

vercelBot commented Aug 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
objectuiIgnoredIgnoredAug 11, 2026 3:13pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

MetricValueBudget
Main entry (gzip)29.5 KB350 KB
Entry fileindex-9cNcaoXg.js
StatusPASS

📦 Bundle Size Report

PackageSizeGzipped
app-shell (index.js)9.56KB3.59KB
app-shell (runtime-config.js)7.42KB2.32KB
app-shell (types.js)0.01KB0.04KB
app-shell (urlParams.js)8.92KB3.41KB
auth (AuthContext.js)0.31KB0.24KB
auth (AuthGuard.js)1.17KB0.53KB
auth (AuthProvider.js)22.10KB4.37KB
auth (AuthShell.js)3.49KB1.40KB
auth (ForgotPasswordForm.js)12.21KB3.45KB
auth (LoginForm.js)18.13KB5.39KB
auth (PreviewBanner.js)0.90KB0.50KB
auth (RegisterForm.js)6.64KB2.21KB
auth (SocialSignInButtons.js)9.60KB3.89KB
auth (UserMenu.js)3.40KB1.22KB
auth (auth-gate-events.js)1.29KB0.66KB
auth (authStyles.js)5.04KB1.72KB
auth (createAuthClient.js)35.76KB9.11KB
auth (createAuthenticatedFetch.js)4.37KB1.69KB
auth (index.js)2.35KB1.07KB
auth (org-roles.js)6.66KB2.78KB
auth (phone-identifier.js)1.11KB0.66KB
auth (types.js)0.59KB0.35KB
auth (useAuth.js)4.91KB0.87KB
auth (useIsWorkspaceAdmin.js)1.61KB0.85KB
collaboration (CommentThread.js)26.07KB7.56KB
collaboration (LiveCursors.js)3.17KB1.27KB
collaboration (PresenceAvatars.js)6.49KB2.64KB
collaboration (PresenceProvider.js)2.79KB1.13KB
collaboration (index.js)1.65KB0.73KB
collaboration (useCollaborationTranslation.js)6.05KB2.52KB
collaboration (useCommentSearch.js)1.98KB0.88KB
collaboration (useConflictResolution.js)7.75KB1.86KB
collaboration (useMentionNotifications.js)1.81KB0.68KB
collaboration (usePresence.js)6.33KB1.84KB
collaboration (useRealtimeSubscription.js)7.91KB2.01KB
components (index.js)489.10KB108.43KB
core (index.js)3.04KB1.15KB
create-plugin (index.js)10.08KB3.26KB
data-objectstack (index.js)150.04KB39.79KB
fields (index.js)228.45KB56.62KB
i18n (LocalizationContext.js)1.76KB0.96KB
i18n (currency.js)1.22KB0.64KB
i18n (i18n.js)4.32KB1.77KB
i18n (index.js)2.65KB1.06KB
i18n (pickLocalized.js)1.70KB0.83KB
i18n (provider.js)16.38KB5.47KB
i18n (useObjectLabel.js)27.59KB6.63KB
i18n (useSafeTranslation.js)4.52KB1.96KB
layout (index.js)38.98KB10.85KB
mobile (MobileProvider.js)0.92KB0.49KB
mobile (ResponsiveContainer.js)0.94KB0.38KB
mobile (breakpoints.js)1.51KB0.70KB
mobile (createOfflineDataSource.js)5.61KB1.74KB
mobile (index.js)1.50KB0.62KB
mobile (offlineQueue.js)3.91KB1.35KB
mobile (pwa.js)0.97KB0.49KB
mobile (serviceWorker.js)1.48KB0.62KB
mobile (serviceWorkerSource.js)3.41KB1.48KB
mobile (useBreakpoint.js)1.54KB0.65KB
mobile (useGesture.js)6.96KB1.98KB
mobile (useOfflineSync.js)1.99KB0.72KB
mobile (usePullToRefresh.js)2.53KB0.85KB
mobile (useResponsive.js)0.71KB0.42KB
mobile (useResponsiveConfig.js)1.36KB0.63KB
mobile (useSpecGesture.js)4.32KB1.64KB
mobile (useTouchTarget.js)1.01KB0.54KB
permissions (MePermissionsProvider.js)8.75KB3.06KB
permissions (PermissionContext.js)0.31KB0.25KB
permissions (PermissionGuard.js)0.89KB0.45KB
permissions (PermissionProvider.js)3.67KB1.12KB
permissions (evaluator.js)4.41KB1.44KB
permissions (index.js)0.91KB0.41KB
permissions (store.js)0.91KB0.42KB
permissions (useFieldPermissions.js)1.28KB0.52KB
permissions (usePermissions.js)1.55KB0.71KB
plugin-ai (index.js)15.71KB3.79KB
plugin-calendar (index.js)45.23KB12.45KB
plugin-charts (index.js)61.73KB17.54KB
plugin-chatbot (index.js)180.33KB42.79KB
plugin-dashboard (index.js)121.07KB31.39KB
plugin-designer (index.js)210.91KB42.67KB
plugin-detail (index.js)238.95KB59.76KB
plugin-editor (index.js)2.46KB1.10KB
plugin-form (index.js)114.58KB27.68KB
plugin-gantt (index.js)164.14KB39.98KB
plugin-grid (index.js)188.00KB49.94KB
plugin-kanban (index.js)48.60KB13.41KB
plugin-list (index.js)109.93KB26.65KB
plugin-map (index.js)17.00KB5.32KB
plugin-markdown (index.js)13.72KB4.69KB
plugin-report (index.js)40.60KB10.58KB
plugin-timeline (index.js)26.21KB7.52KB
plugin-tree (index.js)8.50KB2.88KB
plugin-view (index.js)84.03KB20.55KB
providers (DataSourceProvider.js)0.75KB0.39KB
providers (MetadataProvider.js)1.37KB0.59KB
providers (ThemeProvider.js)1.90KB0.85KB
providers (UploadProvider.js)11.71KB3.53KB
providers (index.js)0.44KB0.22KB
providers (types.js)0.01KB0.04KB
react-runtime (index.js)5.67KB2.37KB
react (LazyPluginLoader.js)3.77KB1.33KB
react (SchemaRenderer.js)23.71KB7.96KB
react (data-invalidation.js)5.05KB2.08KB
react (index.js)1.23KB0.66KB
react (spec-input.js)0.20KB0.18KB
sdui-parser (codegen.js)4.09KB1.74KB
sdui-parser (index.js)4.47KB2.03KB
sdui-parser (parse.js)10.04KB2.82KB
sdui-parser (types.js)0.29KB0.24KB
sdui-parser (validate.js)4.69KB1.48KB
types (ai.js)0.20KB0.17KB
types (api-types.js)0.20KB0.18KB
types (app.js)2.87KB0.99KB
types (base.js)0.20KB0.18KB
types (blocks.js)0.20KB0.18KB
types (complex.js)0.20KB0.18KB
types (crud.js)0.20KB0.18KB
types (dashboard-filter-alias.js)6.23KB2.74KB
types (data-display.js)0.20KB0.18KB
types (data-protocol.js)0.20KB0.19KB
types (data.js)0.20KB0.18KB
types (designer.js)1.87KB0.85KB
types (disclosure.js)0.20KB0.18KB
types (error-code.js)1.54KB0.88KB
types (feedback.js)0.20KB0.18KB
types (field-types.js)0.20KB0.18KB
types (form.js)0.20KB0.18KB
types (http-retry.js)4.32KB2.02KB
types (index.js)3.05KB1.52KB
types (layout.js)0.20KB0.18KB
types (managed-by.js)0.19KB0.18KB
types (mobile.js)2.59KB1.31KB
types (navigation.js)0.20KB0.18KB
types (objectql.js)0.20KB0.18KB
types (overlay.js)0.20KB0.18KB
types (permissions.js)0.20KB0.18KB
types (plugin-scope.js)0.20KB0.18KB
types (record-components.js)0.20KB0.19KB
types (record-semantics.js)1.28KB0.67KB
types (registry.js)0.20KB0.18KB
types (reports.js)0.20KB0.18KB
types (spec-report.js)5.05KB1.93KB
types (system-fields.js)3.33KB1.54KB
types (theme.js)0.20KB0.18KB
types (ui-action.js)3.40KB1.71KB
types (views.js)0.20KB0.18KB
types (widget.js)0.20KB0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

@yinlianghui
yinlianghui marked this pull request as ready for review August 11, 2026 17:18
@yinlianghui
yinlianghui added this pull request to the merge queueAug 11, 2026
Merged via the queue into main with commit 63fe8fdAug 11, 2026
21 checks passed
@yinlianghui
yinlianghui deleted the claude/issue-4040-plugin-detail branch August 11, 2026 17:19
yinlianghui pushed a commit that referenced this pull request Aug 11, 2026
…il removal landed in #4326, plugin-list removal is this PR's)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@yinlianghui@claude