diff --git a/.changeset/vi-mock-inherit-slice1.md b/.changeset/vi-mock-inherit-slice1.md new file mode 100644 index 0000000000..a0667e06ba --- /dev/null +++ b/.changeset/vi-mock-inherit-slice1.md @@ -0,0 +1,4 @@ +--- +--- + +Test-only: three `vi.mock` factories now inherit the real export surface of `@object-ui/plugin-markdown`, `@object-ui/data-objectstack` and `@object-ui/plugin-report` instead of hand-listing it, and those three specifiers join `check-vi-mock-inherit`'s covered set. No published behaviour changes. diff --git a/apps/console/src/pages/docs-portal.test.tsx b/apps/console/src/pages/docs-portal.test.tsx index 79f0836692..2cc7d34f10 100644 --- a/apps/console/src/pages/docs-portal.test.tsx +++ b/apps/console/src/pages/docs-portal.test.tsx @@ -49,7 +49,8 @@ const { ADAPTER } = vi.hoisted(() => { vi.mock('@object-ui/app-shell', () => ({ useAdapter: () => ADAPTER })); -vi.mock('@object-ui/plugin-markdown', () => ({ +vi.mock('@object-ui/plugin-markdown', async (importOriginal) => ({ + ...(await importOriginal>()), MarkdownRenderer: ({ schema }: { schema: { content?: string } }) => (
{schema.content}
), diff --git a/packages/app-shell/src/chrome/ConditionalAuthWrapper.previewRetired-6654.test.tsx b/packages/app-shell/src/chrome/ConditionalAuthWrapper.previewRetired-6654.test.tsx index 0c10f4ee02..7e12f8d8fb 100644 --- a/packages/app-shell/src/chrome/ConditionalAuthWrapper.previewRetired-6654.test.tsx +++ b/packages/app-shell/src/chrome/ConditionalAuthWrapper.previewRetired-6654.test.tsx @@ -69,7 +69,8 @@ vi.mock('@object-ui/auth', () => ({ // which would make every case after the first read the first case's payload. // Calling the fetcher through keeps the wire path (envelope unwrap included) // while giving each case its own response. -vi.mock('@object-ui/data-objectstack', () => ({ +vi.mock('@object-ui/data-objectstack', async (importOriginal) => ({ + ...(await importOriginal>()), getSharedDiscovery: (_baseUrl: string, fetcher: () => Promise) => fetcher(), })); diff --git a/packages/app-shell/src/views/ReportView.dataSourceObjectKey.test.tsx b/packages/app-shell/src/views/ReportView.dataSourceObjectKey.test.tsx index f30d241229..6995e8c750 100644 --- a/packages/app-shell/src/views/ReportView.dataSourceObjectKey.test.tsx +++ b/packages/app-shell/src/views/ReportView.dataSourceObjectKey.test.tsx @@ -57,7 +57,8 @@ import { render, waitFor } from '@testing-library/react'; /** Props the (stubbed) report renderer and config panel were handed. */ const cap = vi.hoisted(() => ({ renderer: null as any, panel: null as any })); -vi.mock('@object-ui/plugin-report', () => ({ +vi.mock('@object-ui/plugin-report', async (importOriginal) => ({ + ...(await importOriginal>()), ReportRenderer: (props: any) => { cap.renderer = props; return null; diff --git a/scripts/check-vi-mock-inherit.mjs b/scripts/check-vi-mock-inherit.mjs index 1cea0ddf4a..e83c20ffa4 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 two, and each joined by sweep + * actually been SWEPT to zero. Today that is five, 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`: * @@ -103,6 +103,21 @@ * with the all-specifier population moving 315 -> 314 frozen and no site moving * the other way. * + * The next three members joined together as objectui#6892's first slice, the + * three specifiers the worklist's triage named as the flow-proving start + * because each carried exactly ONE frozen factory. Re-derived on `eeda78a780` + * with the fixed classifier -- ⛔ never from the worklist's own table, which + * predates both the recogniser fix and the `@object-ui/i18n` flip: + * + * @object-ui/plugin-markdown 1 judged, 0 inheriting, 1 frozen -> 0 + * @object-ui/data-objectstack 1 judged, 0 inheriting, 1 frozen -> 0 + * @object-ui/plugin-report 1 judged, 0 inheriting, 1 frozen -> 0 + * + * with the all-specifier population over the 22 specifiers any `vi.mock` call + * site in the tree names moving 318 -> 315 frozen, and no site moving the other + * way. The remaining 315 stay on objectui#6892, `@object-ui/auth` (102) first + * by yield and `@object-ui/app-shell` (23) only after objectui#6580. + * * **The precondition for widening is a sweep, not a judgement.** Convert a * specifier's frozen factories to the inheriting form, confirm this gate reads * zero for it, then add it to `COVERED_SPECIFIERS` in the same PR. The list only @@ -182,7 +197,13 @@ import { blank, scanSource } from './js-comment-mask.mjs'; * The workspace packages this gate judges. GROW-ONLY, and a specifier joins it * only after its frozen factories have been swept to zero -- see "Scope" above. */ -export const COVERED_SPECIFIERS = Object.freeze(['@object-ui/react', '@object-ui/i18n']); +export const COVERED_SPECIFIERS = Object.freeze([ + '@object-ui/react', + '@object-ui/i18n', + '@object-ui/plugin-markdown', + '@object-ui/data-objectstack', + '@object-ui/plugin-report', +]); /** Files the walk reads at all. */ const SOURCE_FILE_RE = /\.[cm]?[jt]sx?$/;