From 5b7451723bfdf351de4e037542892c74492cec53 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 6 Sep 2026 15:53:06 +0000 Subject: [PATCH 1/2] test(vi-mock): inherit the real @object-ui/plugin-form surface in 31 vi.mock factories Part of #6892 (slice 5). Every frozen `vi.mock('@object-ui/plugin-form', ...)` factory in the tree now obtains the real module and spreads it FIRST, with the file's own stubs applied as overrides afterwards, and `@object-ui/plugin-form` joins the `check-vi-mock-inherit` gate's `COVERED_SPECIFIERS` in the same commit. Three syntactic shapes, across three owning packages: 16 single-line object literals and 11 multi-line ones under `packages/plugin-view` and `packages/app-shell`, plus 4 `packages/plugin-designer` sites that delegated the whole factory to a shared manual mock module and so inherited nothing. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr --- .changeset/vi-mock-inherit-slice5.md | 7 +++ ...AppContent.declaredVisibilityKeys.test.tsx | 3 +- .../expressionUser.mountParity.test.tsx | 3 +- ...rdFormPage.declaredVisibilityKeys.test.tsx | 3 +- .../src/views/RecordFormPage.i18n.test.tsx | 3 +- .../RecordFormPage.predicateScope.test.tsx | 3 +- .../__tests__/FlowRunner.suspense.test.tsx | 3 +- .../previews/ScreenPreview.test.tsx | 3 +- .../DashboardEditor.rootTitleRetired.test.tsx | 5 +- ...eldDesigner.formulaControlRetired.test.tsx | 5 +- .../src/__tests__/ObjectManager.test.tsx | 5 +- .../bareKeysNoProviderFallback.test.tsx | 5 +- .../ObjectView.calendarBinding-7029.test.tsx | 5 +- .../ObjectView.canonicalTableKeys.test.tsx | 5 +- .../ObjectView.contractEnvelope-6726.test.tsx | 5 +- .../ObjectView.contractEnvelope-6840.test.tsx | 5 +- ...ew.dataSourceContextFallback-7842.test.tsx | 3 +- .../__tests__/ObjectView.expandGate.test.tsx | 5 +- .../ObjectView.filterSources.test.tsx | 5 +- .../ObjectView.formTitleI18n.test.tsx | 3 +- ...tView.formTitleNoProviderFallback.test.tsx | 3 +- .../ObjectView.ganttBinding-7070.test.tsx | 5 +- .../ObjectView.hostOnlyViewTypes.test.tsx | 5 +- ...tView.kanbanConditionalFormatting.test.tsx | 5 +- .../__tests__/ObjectView.mapFlatten.test.tsx | 5 +- .../ObjectView.refreshSignal.test.tsx | 5 +- .../ObjectView.rowColorRelay-7218.test.tsx | 5 +- .../__tests__/ObjectView.sortSink.test.tsx | 5 +- ...ObjectView.tableColumnsForwarding.test.tsx | 5 +- .../src/__tests__/ObjectView.test.tsx | 3 +- .../ObjectView.timelineBinding-7070.test.tsx | 5 +- .../ObjectView.viewIdentityDeps.test.tsx | 5 +- scripts/check-vi-mock-inherit.mjs | 55 +++++++++++++++++-- 33 files changed, 159 insertions(+), 36 deletions(-) create mode 100644 .changeset/vi-mock-inherit-slice5.md diff --git a/.changeset/vi-mock-inherit-slice5.md b/.changeset/vi-mock-inherit-slice5.md new file mode 100644 index 0000000000..6e196b5151 --- /dev/null +++ b/.changeset/vi-mock-inherit-slice5.md @@ -0,0 +1,7 @@ +--- +--- + +Test-infrastructure only: sweep `@object-ui/plugin-form`'s 31 frozen `vi.mock` +factories to the inheriting form across `plugin-view`, `app-shell` and +`plugin-designer`, and add the specifier to the `check-vi-mock-inherit` gate's +covered set. No published behaviour changes. diff --git a/packages/app-shell/src/console/__tests__/AppContent.declaredVisibilityKeys.test.tsx b/packages/app-shell/src/console/__tests__/AppContent.declaredVisibilityKeys.test.tsx index 791882ed1f..e8ff431911 100644 --- a/packages/app-shell/src/console/__tests__/AppContent.declaredVisibilityKeys.test.tsx +++ b/packages/app-shell/src/console/__tests__/AppContent.declaredVisibilityKeys.test.tsx @@ -45,7 +45,8 @@ import { MemoryRouter, Routes, Route } from 'react-router-dom'; const { modalSchemas } = vi.hoisted(() => ({ modalSchemas: [] as any[] })); /** The probe: the global modal's schema is where the filtered field list lands. */ -vi.mock('@object-ui/plugin-form', () => ({ +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), ModalForm: ({ schema }: any) => { modalSchemas.push(schema); return
; diff --git a/packages/app-shell/src/providers/expressionUser.mountParity.test.tsx b/packages/app-shell/src/providers/expressionUser.mountParity.test.tsx index 5854562480..b317511e6f 100644 --- a/packages/app-shell/src/providers/expressionUser.mountParity.test.tsx +++ b/packages/app-shell/src/providers/expressionUser.mountParity.test.tsx @@ -115,7 +115,8 @@ vi.mock('@object-ui/auth', async (importOriginal) => ({ * inside its `ExpressionProvider`, so what it reads is what a real descendant * of that provider reads — no interception, no spy on the provider. */ -vi.mock('@object-ui/plugin-form', () => ({ +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), ObjectForm: ({ schema }: any) => { formSchemas.push(schema); publishedScopes.push(usePredicateScope()); diff --git a/packages/app-shell/src/views/RecordFormPage.declaredVisibilityKeys.test.tsx b/packages/app-shell/src/views/RecordFormPage.declaredVisibilityKeys.test.tsx index 6673ec63b4..832afb8d3c 100644 --- a/packages/app-shell/src/views/RecordFormPage.declaredVisibilityKeys.test.tsx +++ b/packages/app-shell/src/views/RecordFormPage.declaredVisibilityKeys.test.tsx @@ -104,7 +104,8 @@ vi.mock('@object-ui/auth', async (importOriginal) => ({ }), })); -vi.mock('@object-ui/plugin-form', () => ({ +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), ObjectForm: ({ schema }: any) => { formSchemas.push(schema); return h('div', { 'data-testid': 'object-form' }); diff --git a/packages/app-shell/src/views/RecordFormPage.i18n.test.tsx b/packages/app-shell/src/views/RecordFormPage.i18n.test.tsx index 032a692ebc..d092bcb101 100644 --- a/packages/app-shell/src/views/RecordFormPage.i18n.test.tsx +++ b/packages/app-shell/src/views/RecordFormPage.i18n.test.tsx @@ -80,7 +80,8 @@ vi.mock('@object-ui/auth', async (importOriginal) => ({ // Stand-in for the real form: records the schema the page builds (so the // `submitText` / `cancelText` it translates are observable) and exposes a // button that fires `onSuccess`, which is what raises the toast under test. -vi.mock('@object-ui/plugin-form', () => ({ +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), ObjectForm: ({ schema }: any) => { formSchemas.push(schema); return h( diff --git a/packages/app-shell/src/views/RecordFormPage.predicateScope.test.tsx b/packages/app-shell/src/views/RecordFormPage.predicateScope.test.tsx index 78959bb1a6..78353bd142 100644 --- a/packages/app-shell/src/views/RecordFormPage.predicateScope.test.tsx +++ b/packages/app-shell/src/views/RecordFormPage.predicateScope.test.tsx @@ -71,7 +71,8 @@ vi.mock('@object-ui/auth', async (importOriginal) => ({ }), })); -vi.mock('@object-ui/plugin-form', () => ({ +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), ObjectForm: ({ schema }: any) => { formSchemas.push(schema); return h('div', { 'data-testid': 'object-form' }); diff --git a/packages/app-shell/src/views/__tests__/FlowRunner.suspense.test.tsx b/packages/app-shell/src/views/__tests__/FlowRunner.suspense.test.tsx index 82e4fe8af4..805a02e830 100644 --- a/packages/app-shell/src/views/__tests__/FlowRunner.suspense.test.tsx +++ b/packages/app-shell/src/views/__tests__/FlowRunner.suspense.test.tsx @@ -27,7 +27,8 @@ import userEvent from '@testing-library/user-event'; let releaseForm: () => void = () => {}; const formLoaded = new Promise((resolve) => { releaseForm = resolve; }); -vi.mock('@object-ui/plugin-form', () => ({ +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), ObjectForm: lazy(async () => { await formLoaded; return { default: ({ schema }: any) => }; diff --git a/packages/app-shell/src/views/metadata-admin/previews/ScreenPreview.test.tsx b/packages/app-shell/src/views/metadata-admin/previews/ScreenPreview.test.tsx index bf12277421..8c1612b7aa 100644 --- a/packages/app-shell/src/views/metadata-admin/previews/ScreenPreview.test.tsx +++ b/packages/app-shell/src/views/metadata-admin/previews/ScreenPreview.test.tsx @@ -11,7 +11,8 @@ const { objectFormSpy, adapterRef, objectsRef } = vi.hoisted(() => ({ objectsRef: { current: [] as unknown[] }, })); -vi.mock('@object-ui/plugin-form', () => ({ +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), ObjectForm: ({ schema }: { schema: unknown }) => { objectFormSpy(schema); return
; diff --git a/packages/plugin-designer/src/__tests__/DashboardEditor.rootTitleRetired.test.tsx b/packages/plugin-designer/src/__tests__/DashboardEditor.rootTitleRetired.test.tsx index 79ffa7f8cf..c323a10250 100644 --- a/packages/plugin-designer/src/__tests__/DashboardEditor.rootTitleRetired.test.tsx +++ b/packages/plugin-designer/src/__tests__/DashboardEditor.rootTitleRetired.test.tsx @@ -33,7 +33,10 @@ import type { DashboardComponentSchema } from '@object-ui/types'; import { DashboardEditor } from '../DashboardEditor'; vi.mock('@object-ui/plugin-grid', () => import('./__mocks__/plugin-grid')); -vi.mock('@object-ui/plugin-form', () => import('./__mocks__/plugin-form')); +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), + ...(await import('./__mocks__/plugin-form')), +})); afterEach(cleanup); diff --git a/packages/plugin-designer/src/__tests__/FieldDesigner.formulaControlRetired.test.tsx b/packages/plugin-designer/src/__tests__/FieldDesigner.formulaControlRetired.test.tsx index 01eda18906..cfa1decb51 100644 --- a/packages/plugin-designer/src/__tests__/FieldDesigner.formulaControlRetired.test.tsx +++ b/packages/plugin-designer/src/__tests__/FieldDesigner.formulaControlRetired.test.tsx @@ -56,7 +56,10 @@ import type { DesignerFieldDefinition } from '@object-ui/types'; import { FieldDesigner } from '../FieldDesigner'; vi.mock('@object-ui/plugin-grid', () => import('./__mocks__/plugin-grid')); -vi.mock('@object-ui/plugin-form', () => import('./__mocks__/plugin-form')); +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), + ...(await import('./__mocks__/plugin-form')), +})); /** * A formula field as it exists after this card: a real, authorable field TYPE diff --git a/packages/plugin-designer/src/__tests__/ObjectManager.test.tsx b/packages/plugin-designer/src/__tests__/ObjectManager.test.tsx index 2e0ad17bdd..fc088de414 100644 --- a/packages/plugin-designer/src/__tests__/ObjectManager.test.tsx +++ b/packages/plugin-designer/src/__tests__/ObjectManager.test.tsx @@ -13,7 +13,10 @@ import type { ObjectDefinition } from '@object-ui/types'; // Mock standard components — tested separately in their own packages vi.mock('@object-ui/plugin-grid', () => import('./__mocks__/plugin-grid')); -vi.mock('@object-ui/plugin-form', () => import('./__mocks__/plugin-form')); +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), + ...(await import('./__mocks__/plugin-form')), +})); const MOCK_OBJECTS: ObjectDefinition[] = [ { diff --git a/packages/plugin-designer/src/__tests__/bareKeysNoProviderFallback.test.tsx b/packages/plugin-designer/src/__tests__/bareKeysNoProviderFallback.test.tsx index 3c385009ca..d223c16590 100644 --- a/packages/plugin-designer/src/__tests__/bareKeysNoProviderFallback.test.tsx +++ b/packages/plugin-designer/src/__tests__/bareKeysNoProviderFallback.test.tsx @@ -53,7 +53,10 @@ import { DashboardEditor } from '../DashboardEditor'; import { ObjectManager } from '../ObjectManager'; vi.mock('@object-ui/plugin-grid', () => import('./__mocks__/plugin-grid')); -vi.mock('@object-ui/plugin-form', () => import('./__mocks__/plugin-form')); +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), + ...(await import('./__mocks__/plugin-form')), +})); const DASHBOARD = { type: 'dashboard', diff --git a/packages/plugin-view/src/__tests__/ObjectView.calendarBinding-7029.test.tsx b/packages/plugin-view/src/__tests__/ObjectView.calendarBinding-7029.test.tsx index d96d856704..3191613f52 100644 --- a/packages/plugin-view/src/__tests__/ObjectView.calendarBinding-7029.test.tsx +++ b/packages/plugin-view/src/__tests__/ObjectView.calendarBinding-7029.test.tsx @@ -52,7 +52,10 @@ vi.mock('@object-ui/react', async (importOriginal) => { }; }); vi.mock('@object-ui/plugin-grid', () => ({ ObjectGrid: () =>
})); -vi.mock('@object-ui/plugin-form', () => ({ ObjectForm: () =>
})); +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), + ObjectForm: () =>
, +})); async function renderCalendarView(view: Record) { rendered.length = 0; diff --git a/packages/plugin-view/src/__tests__/ObjectView.canonicalTableKeys.test.tsx b/packages/plugin-view/src/__tests__/ObjectView.canonicalTableKeys.test.tsx index dbc7f50115..a7172db6ee 100644 --- a/packages/plugin-view/src/__tests__/ObjectView.canonicalTableKeys.test.tsx +++ b/packages/plugin-view/src/__tests__/ObjectView.canonicalTableKeys.test.tsx @@ -74,7 +74,10 @@ vi.mock('@object-ui/plugin-grid', () => ({ return
; }, })); -vi.mock('@object-ui/plugin-form', () => ({ ObjectForm: () =>
})); +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), + ObjectForm: () =>
, +})); const mockDataSource = () => ({ find: vi.fn().mockResolvedValue({ data: [], total: 0 }), diff --git a/packages/plugin-view/src/__tests__/ObjectView.contractEnvelope-6726.test.tsx b/packages/plugin-view/src/__tests__/ObjectView.contractEnvelope-6726.test.tsx index 191ca2ddd4..0c5b42dbc3 100644 --- a/packages/plugin-view/src/__tests__/ObjectView.contractEnvelope-6726.test.tsx +++ b/packages/plugin-view/src/__tests__/ObjectView.contractEnvelope-6726.test.tsx @@ -61,7 +61,10 @@ vi.mock('@object-ui/react', async (importOriginal) => { }; }); vi.mock('@object-ui/plugin-grid', () => ({ ObjectGrid: () =>
})); -vi.mock('@object-ui/plugin-form', () => ({ ObjectForm: () =>
})); +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), + ObjectForm: () =>
, +})); const ROWS = [{ id: 'r1', name: 'Ada' }, { id: 'r2', name: 'Grace' }]; diff --git a/packages/plugin-view/src/__tests__/ObjectView.contractEnvelope-6840.test.tsx b/packages/plugin-view/src/__tests__/ObjectView.contractEnvelope-6840.test.tsx index d027470315..66ea15c2bc 100644 --- a/packages/plugin-view/src/__tests__/ObjectView.contractEnvelope-6840.test.tsx +++ b/packages/plugin-view/src/__tests__/ObjectView.contractEnvelope-6840.test.tsx @@ -90,7 +90,10 @@ vi.mock('@object-ui/react', async (importOriginal) => { }; }); vi.mock('@object-ui/plugin-grid', () => ({ ObjectGrid: () =>
})); -vi.mock('@object-ui/plugin-form', () => ({ ObjectForm: () =>
})); +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), + ObjectForm: () =>
, +})); const ROWS = [{ id: 'r1', name: 'Ada' }, { id: 'r2', name: 'Grace' }]; diff --git a/packages/plugin-view/src/__tests__/ObjectView.dataSourceContextFallback-7842.test.tsx b/packages/plugin-view/src/__tests__/ObjectView.dataSourceContextFallback-7842.test.tsx index d6359ba2e5..533dcec7cd 100644 --- a/packages/plugin-view/src/__tests__/ObjectView.dataSourceContextFallback-7842.test.tsx +++ b/packages/plugin-view/src/__tests__/ObjectView.dataSourceContextFallback-7842.test.tsx @@ -76,7 +76,8 @@ vi.mock('@object-ui/plugin-grid', () => ({ ), })); -vi.mock('@object-ui/plugin-form', () => ({ +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), ObjectForm: () =>
, })); diff --git a/packages/plugin-view/src/__tests__/ObjectView.expandGate.test.tsx b/packages/plugin-view/src/__tests__/ObjectView.expandGate.test.tsx index 2260716108..ea13a9920e 100644 --- a/packages/plugin-view/src/__tests__/ObjectView.expandGate.test.tsx +++ b/packages/plugin-view/src/__tests__/ObjectView.expandGate.test.tsx @@ -102,7 +102,10 @@ vi.mock('@object-ui/react', async (importOriginal) => { }; }); vi.mock('@object-ui/plugin-grid', () => ({ ObjectGrid: () =>
})); -vi.mock('@object-ui/plugin-form', () => ({ ObjectForm: () =>
})); +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), + ObjectForm: () =>
, +})); /** * One field of every expandable type, plus non-expandable neighbours. The diff --git a/packages/plugin-view/src/__tests__/ObjectView.filterSources.test.tsx b/packages/plugin-view/src/__tests__/ObjectView.filterSources.test.tsx index 7990b6a9d9..91fc69b000 100644 --- a/packages/plugin-view/src/__tests__/ObjectView.filterSources.test.tsx +++ b/packages/plugin-view/src/__tests__/ObjectView.filterSources.test.tsx @@ -47,7 +47,10 @@ vi.mock('@object-ui/react', async (importOriginal) => { }; }); vi.mock('@object-ui/plugin-grid', () => ({ ObjectGrid: () =>
})); -vi.mock('@object-ui/plugin-form', () => ({ ObjectForm: () =>
})); +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), + ObjectForm: () =>
, +})); function renderCalendar(schema: Partial) { const find = vi.fn().mockResolvedValue({ data: [], total: 0 }); diff --git a/packages/plugin-view/src/__tests__/ObjectView.formTitleI18n.test.tsx b/packages/plugin-view/src/__tests__/ObjectView.formTitleI18n.test.tsx index 3f169dae82..c93ec2f7a9 100644 --- a/packages/plugin-view/src/__tests__/ObjectView.formTitleI18n.test.tsx +++ b/packages/plugin-view/src/__tests__/ObjectView.formTitleI18n.test.tsx @@ -99,7 +99,8 @@ vi.mock('@object-ui/plugin-grid', () => ({ ), })); -vi.mock('@object-ui/plugin-form', () => ({ +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), ObjectForm: ({ schema }: any) => (
Form ({schema?.mode}) diff --git a/packages/plugin-view/src/__tests__/ObjectView.formTitleNoProviderFallback.test.tsx b/packages/plugin-view/src/__tests__/ObjectView.formTitleNoProviderFallback.test.tsx index fd0d7f39bc..371cbeb1fa 100644 --- a/packages/plugin-view/src/__tests__/ObjectView.formTitleNoProviderFallback.test.tsx +++ b/packages/plugin-view/src/__tests__/ObjectView.formTitleNoProviderFallback.test.tsx @@ -78,7 +78,8 @@ vi.mock('@object-ui/plugin-grid', () => ({ ), })); -vi.mock('@object-ui/plugin-form', () => ({ +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), ObjectForm: ({ schema }: any) => (
Form ({schema?.mode}) diff --git a/packages/plugin-view/src/__tests__/ObjectView.ganttBinding-7070.test.tsx b/packages/plugin-view/src/__tests__/ObjectView.ganttBinding-7070.test.tsx index ab0170177f..19fa1020a2 100644 --- a/packages/plugin-view/src/__tests__/ObjectView.ganttBinding-7070.test.tsx +++ b/packages/plugin-view/src/__tests__/ObjectView.ganttBinding-7070.test.tsx @@ -43,7 +43,10 @@ vi.mock('@object-ui/react', async (importOriginal) => { }; }); vi.mock('@object-ui/plugin-grid', () => ({ ObjectGrid: () =>
})); -vi.mock('@object-ui/plugin-form', () => ({ ObjectForm: () =>
})); +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), + ObjectForm: () =>
, +})); async function renderGanttView(view: Record) { rendered.length = 0; diff --git a/packages/plugin-view/src/__tests__/ObjectView.hostOnlyViewTypes.test.tsx b/packages/plugin-view/src/__tests__/ObjectView.hostOnlyViewTypes.test.tsx index 2d50852397..1913c21606 100644 --- a/packages/plugin-view/src/__tests__/ObjectView.hostOnlyViewTypes.test.tsx +++ b/packages/plugin-view/src/__tests__/ObjectView.hostOnlyViewTypes.test.tsx @@ -71,7 +71,10 @@ vi.mock('@object-ui/react', async (importOriginal) => { }; }); vi.mock('@object-ui/plugin-grid', () => ({ ObjectGrid: () =>
})); -vi.mock('@object-ui/plugin-form', () => ({ ObjectForm: () =>
})); +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), + ObjectForm: () =>
, +})); // The switcher is captured rather than rendered: the claim is about the icon // NAME this component computes, and reading it off the props is the only way to // see it without going through lucide's rendering. diff --git a/packages/plugin-view/src/__tests__/ObjectView.kanbanConditionalFormatting.test.tsx b/packages/plugin-view/src/__tests__/ObjectView.kanbanConditionalFormatting.test.tsx index 651f699e5a..a51e0b50d9 100644 --- a/packages/plugin-view/src/__tests__/ObjectView.kanbanConditionalFormatting.test.tsx +++ b/packages/plugin-view/src/__tests__/ObjectView.kanbanConditionalFormatting.test.tsx @@ -67,7 +67,10 @@ vi.mock('@object-ui/react', async (importOriginal) => { }; }); vi.mock('@object-ui/plugin-grid', () => ({ ObjectGrid: () =>
})); -vi.mock('@object-ui/plugin-form', () => ({ ObjectForm: () =>
})); +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), + ObjectForm: () =>
, +})); const dataSource = (): any => ({ find: vi.fn().mockResolvedValue({ data: [], total: 0 }), diff --git a/packages/plugin-view/src/__tests__/ObjectView.mapFlatten.test.tsx b/packages/plugin-view/src/__tests__/ObjectView.mapFlatten.test.tsx index 2c355d4dfc..3cabac03a0 100644 --- a/packages/plugin-view/src/__tests__/ObjectView.mapFlatten.test.tsx +++ b/packages/plugin-view/src/__tests__/ObjectView.mapFlatten.test.tsx @@ -56,7 +56,10 @@ vi.mock('@object-ui/react', async (importOriginal) => { }; }); vi.mock('@object-ui/plugin-grid', () => ({ ObjectGrid: () =>
})); -vi.mock('@object-ui/plugin-form', () => ({ ObjectForm: () =>
})); +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), + ObjectForm: () =>
, +})); async function renderMapView(mapOptions: Record) { rendered.length = 0; diff --git a/packages/plugin-view/src/__tests__/ObjectView.refreshSignal.test.tsx b/packages/plugin-view/src/__tests__/ObjectView.refreshSignal.test.tsx index a576bcaf76..0890ca145e 100644 --- a/packages/plugin-view/src/__tests__/ObjectView.refreshSignal.test.tsx +++ b/packages/plugin-view/src/__tests__/ObjectView.refreshSignal.test.tsx @@ -54,7 +54,10 @@ vi.mock('@object-ui/react', async (importOriginal) => { }; }); vi.mock('@object-ui/plugin-grid', () => ({ ObjectGrid: () =>
})); -vi.mock('@object-ui/plugin-form', () => ({ ObjectForm: () =>
})); +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), + ObjectForm: () =>
, +})); /** * A DataSource whose `onMutation` hands the registered callback back to the diff --git a/packages/plugin-view/src/__tests__/ObjectView.rowColorRelay-7218.test.tsx b/packages/plugin-view/src/__tests__/ObjectView.rowColorRelay-7218.test.tsx index 8f6d7caaf4..9ff75b1c49 100644 --- a/packages/plugin-view/src/__tests__/ObjectView.rowColorRelay-7218.test.tsx +++ b/packages/plugin-view/src/__tests__/ObjectView.rowColorRelay-7218.test.tsx @@ -75,7 +75,10 @@ vi.mock('@object-ui/react', async (importOriginal) => { }; }); vi.mock('@object-ui/plugin-grid', () => ({ ObjectGrid: () =>
})); -vi.mock('@object-ui/plugin-form', () => ({ ObjectForm: () =>
})); +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), + ObjectForm: () =>
, +})); const mockDataSource = () => ({ find: vi.fn().mockResolvedValue({ data: [], total: 0 }), diff --git a/packages/plugin-view/src/__tests__/ObjectView.sortSink.test.tsx b/packages/plugin-view/src/__tests__/ObjectView.sortSink.test.tsx index ccbc5fa165..44a23dd181 100644 --- a/packages/plugin-view/src/__tests__/ObjectView.sortSink.test.tsx +++ b/packages/plugin-view/src/__tests__/ObjectView.sortSink.test.tsx @@ -72,7 +72,10 @@ vi.mock('@object-ui/react', async (importOriginal) => { }; }); vi.mock('@object-ui/plugin-grid', () => ({ ObjectGrid: () =>
})); -vi.mock('@object-ui/plugin-form', () => ({ ObjectForm: () =>
})); +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), + ObjectForm: () =>
, +})); const mockDataSource = () => ({ find: vi.fn().mockResolvedValue({ data: [], total: 0 }), diff --git a/packages/plugin-view/src/__tests__/ObjectView.tableColumnsForwarding.test.tsx b/packages/plugin-view/src/__tests__/ObjectView.tableColumnsForwarding.test.tsx index f33c5a1151..d04c532b88 100644 --- a/packages/plugin-view/src/__tests__/ObjectView.tableColumnsForwarding.test.tsx +++ b/packages/plugin-view/src/__tests__/ObjectView.tableColumnsForwarding.test.tsx @@ -96,7 +96,10 @@ vi.mock('@object-ui/plugin-grid', () => ({ return
; }, })); -vi.mock('@object-ui/plugin-form', () => ({ ObjectForm: () =>
})); +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), + ObjectForm: () =>
, +})); const mockDataSource = () => ({ find: vi.fn().mockResolvedValue({ data: [], total: 0 }), diff --git a/packages/plugin-view/src/__tests__/ObjectView.test.tsx b/packages/plugin-view/src/__tests__/ObjectView.test.tsx index cd072222c8..2bb0785a38 100644 --- a/packages/plugin-view/src/__tests__/ObjectView.test.tsx +++ b/packages/plugin-view/src/__tests__/ObjectView.test.tsx @@ -43,7 +43,8 @@ vi.mock('@object-ui/plugin-grid', () => ({ })); // Mock @object-ui/plugin-form -vi.mock('@object-ui/plugin-form', () => ({ +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), ObjectForm: ({ schema }: any) => (
Form ({schema?.mode}) diff --git a/packages/plugin-view/src/__tests__/ObjectView.timelineBinding-7070.test.tsx b/packages/plugin-view/src/__tests__/ObjectView.timelineBinding-7070.test.tsx index 3ebef08191..66efd43669 100644 --- a/packages/plugin-view/src/__tests__/ObjectView.timelineBinding-7070.test.tsx +++ b/packages/plugin-view/src/__tests__/ObjectView.timelineBinding-7070.test.tsx @@ -58,7 +58,10 @@ vi.mock('@object-ui/react', async (importOriginal) => { }; }); vi.mock('@object-ui/plugin-grid', () => ({ ObjectGrid: () =>
})); -vi.mock('@object-ui/plugin-form', () => ({ ObjectForm: () =>
})); +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), + ObjectForm: () =>
, +})); async function renderTimelineView(view: Record) { rendered.length = 0; diff --git a/packages/plugin-view/src/__tests__/ObjectView.viewIdentityDeps.test.tsx b/packages/plugin-view/src/__tests__/ObjectView.viewIdentityDeps.test.tsx index 84eefe5c6b..a4ffa83082 100644 --- a/packages/plugin-view/src/__tests__/ObjectView.viewIdentityDeps.test.tsx +++ b/packages/plugin-view/src/__tests__/ObjectView.viewIdentityDeps.test.tsx @@ -77,7 +77,10 @@ vi.mock('@object-ui/react', async (importOriginal) => { }; }); vi.mock('@object-ui/plugin-grid', () => ({ ObjectGrid: () =>
})); -vi.mock('@object-ui/plugin-form', () => ({ ObjectForm: () =>
})); +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), + ObjectForm: () =>
, +})); const TASK_SCHEMA = { name: 'task', diff --git a/scripts/check-vi-mock-inherit.mjs b/scripts/check-vi-mock-inherit.mjs index 857bd03657..fe59509ea6 100644 --- a/scripts/check-vi-mock-inherit.mjs +++ b/scripts/check-vi-mock-inherit.mjs @@ -82,7 +82,7 @@ * - **Workspace specifiers not in `COVERED_SPECIFIERS`.** See below. * * `COVERED_SPECIFIERS` holds the workspace packages whose frozen sites have - * actually been SWEPT to zero. Today that is nine, and each joined by sweep + * actually been SWEPT to zero. Today that is ten, and each joined by sweep * rather than by judgement. Running this file's classifier over all 1,499 * `vi.mock` call sites in the tree at `9ce20233f`: * @@ -204,10 +204,54 @@ * later slice on a specifier with 0 inheriting sites should expect the same and * budget the full suite accordingly. * - * The remaining 178 stay on objectui#6892: `@object-ui/plugin-form` (31), - * `@object-ui/components` (27), `@object-ui/plugin-grid` (24) and - * `@object-ui/app-shell` (23, still only after objectui#6580 -- which is now - * CLOSED, so that reading is a git-history read rather than an open card). + * `@object-ui/plugin-form` joined as objectui#6892's FIFTH slice, re-derived + * on `d5c1f527e` by the same `scan()` method, the constant below again never + * widened-and-reverted: + * + * @object-ui/plugin-form 32 judged, 1 inheriting, 31 frozen -> 0 + * + * with the population moving 178 -> 147 frozen over 643 judged and no site + * moving the other way -- every other one of the 21 rows byte-identical between + * the two runs. This is the first slice whose sites span THREE owning packages + * (20 under `packages/plugin-view`, 8 under `packages/app-shell`, 4 under + * `packages/plugin-designer`) and the first to meet a THIRD syntactic shape: + * four `plugin-designer` sites delegated the whole factory to a shared manual + * mock module (`() => import('./__mocks__/plugin-form')`), which inherits + * nothing. Those become an async factory that spreads the real barrel FIRST and + * the manual mock module SECOND, so the hand-written `ModalForm` / `DrawerForm` + * still win and every other export is the real one. + * + * STEP 0 was taken again rather than inherited, and here it found what the two + * previous barrels did not: `packages/plugin-form/src` is NOT inert. Its + * 28-module static import graph from `index.tsx` holds 75 module-scope + * statements, and six of them are `ComponentRegistry.register(...)` calls in + * the barrel itself (`object-form`, `form`, `embeddable-form`, + * `form-analytics`, `object-master-detail-form`, `line_items`). The slice + * proceeded anyway, and the reason is the class of the effect rather than its + * absence: `register()` is a `Map.set` into an in-memory registry plus a + * `console.warn` on the un-namespaced spelling, all six pass a namespace, and + * this is the same effect slice 2 absorbed for `plugin-charts` and + * `plugin-dashboard`. The other 69 statements are pure allocation -- `Set`s of + * literal strings, style and threshold literals, one regular expression, four + * `createSafeTranslation(...)` factory calls (already measured pure by slice 3) + * and four `elementDataSourceBlock(...)` marks into a module-level `Set` in + * `@object-ui/core`. ZERO timers, globals, storage, `fetch`, connections, and + * zero side-effect-only imports; two column-anchored greps over all 28 modules + * agree with the walk exactly. The registry question the ruling asks was also + * answered on the CONSUMING side: of the 31 converted files exactly one names + * `ComponentRegistry` at all, and it READS one entry (`get('object-view')`) + * rather than asserting emptiness or a count, so no converted assertion can be + * broken by the six new entries. + * + * ⭐ Unlike `@object-ui/collaboration`, this specifier DID have the free + * confirmation: `packages/app-shell/src/views/studio-design/StudioDesignSurface.formFields.test.tsx` + * already inherited the real barrel on `main` and passed, so the real module + * was known to load in that environment before anything was converted. + * + * The remaining 147 stay on objectui#6892: `@object-ui/components` (27), + * `@object-ui/plugin-grid` (24), `@object-ui/app-shell` (23, still only after + * objectui#6580 -- which is now CLOSED, so that reading is a git-history read + * rather than an open card) and `@object-ui/permissions` (23). * * **The precondition for widening is a sweep, not a judgement.** Convert a * specifier's frozen factories to the inheriting form, confirm this gate reads @@ -298,6 +342,7 @@ export const COVERED_SPECIFIERS = Object.freeze([ '@object-ui/plugin-dashboard', '@object-ui/auth', '@object-ui/collaboration', + '@object-ui/plugin-form', ]); /** Files the walk reads at all. */ From 52019690dd036cc1353547bf390a9f8880ae8758 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 6 Sep 2026 16:31:08 +0000 Subject: [PATCH 2/2] test(vi-mock): sweep the @object-ui/plugin-form site main added mid-slice MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Part of #6892 (slice 5). Merging `origin/main` brought in one more frozen factory on this specifier — `ObjectView.expandFls-7429.test.tsx`, landed by objectui#7429 while this slice was being verified. It is swept the same way, so the gate reads zero frozen for `@object-ui/plugin-form` on the tree this pull request actually ships. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr --- .changeset/vi-mock-inherit-slice5.md | 5 +++-- .../__tests__/ObjectView.expandFls-7429.test.tsx | 5 ++++- scripts/check-vi-mock-inherit.mjs | 15 ++++++++++++--- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.changeset/vi-mock-inherit-slice5.md b/.changeset/vi-mock-inherit-slice5.md index 6e196b5151..b285f11f6d 100644 --- a/.changeset/vi-mock-inherit-slice5.md +++ b/.changeset/vi-mock-inherit-slice5.md @@ -1,7 +1,8 @@ --- --- -Test-infrastructure only: sweep `@object-ui/plugin-form`'s 31 frozen `vi.mock` +Test-infrastructure only: sweep `@object-ui/plugin-form`'s frozen `vi.mock` factories to the inheriting form across `plugin-view`, `app-shell` and -`plugin-designer`, and add the specifier to the `check-vi-mock-inherit` gate's +`plugin-designer` — 31 derived on the merge base plus one more that landed on +`main` mid-slice — and add the specifier to the `check-vi-mock-inherit` gate's covered set. No published behaviour changes. diff --git a/packages/plugin-view/src/__tests__/ObjectView.expandFls-7429.test.tsx b/packages/plugin-view/src/__tests__/ObjectView.expandFls-7429.test.tsx index d56bcdfd76..31c612b698 100644 --- a/packages/plugin-view/src/__tests__/ObjectView.expandFls-7429.test.tsx +++ b/packages/plugin-view/src/__tests__/ObjectView.expandFls-7429.test.tsx @@ -106,7 +106,10 @@ vi.mock('@object-ui/react', async (importOriginal) => { }; }); vi.mock('@object-ui/plugin-grid', () => ({ ObjectGrid: () =>
})); -vi.mock('@object-ui/plugin-form', () => ({ ObjectForm: () =>
})); +vi.mock('@object-ui/plugin-form', async (importOriginal) => ({ + ...(await importOriginal>()), + ObjectForm: () =>
, +})); import { ObjectView } from '../ObjectView'; diff --git a/scripts/check-vi-mock-inherit.mjs b/scripts/check-vi-mock-inherit.mjs index fe59509ea6..19c16c2521 100644 --- a/scripts/check-vi-mock-inherit.mjs +++ b/scripts/check-vi-mock-inherit.mjs @@ -212,7 +212,16 @@ * * with the population moving 178 -> 147 frozen over 643 judged and no site * moving the other way -- every other one of the 21 rows byte-identical between - * the two runs. This is the first slice whose sites span THREE owning packages + * the two runs. Merging `origin/main` mid-slice then brought in a THIRTY-SECOND + * frozen site on this same specifier (`plugin-view`'s + * `ObjectView.expandFls-7429.test.tsx` -- landed by objectui#7429), swept in the + * same PR: on the merged head the specifier reads 33 judged, 33 inheriting, 0 + * frozen and the population reads 148 over 654. That is the growth warning + * above firing for the THIRD consecutive slice, and it is the reason the + * constant may only be widened by a run of this gate on the tree that ships, + * never by the derivation taken on the base. + * + * This is the first slice whose sites span THREE owning packages * (20 under `packages/plugin-view`, 8 under `packages/app-shell`, 4 under * `packages/plugin-designer`) and the first to meet a THIRD syntactic shape: * four `plugin-designer` sites delegated the whole factory to a shared manual @@ -248,8 +257,8 @@ * already inherited the real barrel on `main` and passed, so the real module * was known to load in that environment before anything was converted. * - * The remaining 147 stay on objectui#6892: `@object-ui/components` (27), - * `@object-ui/plugin-grid` (24), `@object-ui/app-shell` (23, still only after + * The remaining 148 stay on objectui#6892: `@object-ui/components` (27), + * `@object-ui/plugin-grid` (25), `@object-ui/app-shell` (23, still only after * objectui#6580 -- which is now CLOSED, so that reading is a git-history read * rather than an open card) and `@object-ui/permissions` (23). *