From 35a32c092c85f699271774b2ca0084576856ae62 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 6 Sep 2026 11:25:10 +0000 Subject: [PATCH] test(app-shell): inherit the real surface in plugin-charts / plugin-dashboard vi.mock factories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit objectui#6892 slice 2. The four frozen factories on `@object-ui/plugin-charts` (1 site) and `@object-ui/plugin-dashboard` (3 sites) now obtain the real module and spread it before their overrides, and both specifiers join `COVERED_SPECIFIERS` in `scripts/check-vi-mock-inherit.mjs` in the same commit — the gate's documented widening precondition. Counts re-derived on this tree through the guard's exported `scan()` with `covered` set to all 22 workspace specifiers, never by widening the constant: plugin-charts 1 judged / 1 frozen -> 0, plugin-dashboard 3 judged / 3 frozen -> 0, all-specifier population 315 -> 311 frozen with zero sites moving the other way. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr --- .changeset/vi-mock-inherit-slice2.md | 7 +++++ .../views/DashboardView.modalTarget.test.tsx | 9 ++++-- .../DashboardView.rootTitleRetired.test.tsx | 3 +- ...bjectView.chartConfigForward-7891.test.tsx | 3 +- .../ReportView.dataSourceObjectKey.test.tsx | 5 +++- scripts/check-vi-mock-inherit.mjs | 28 +++++++++++++++++-- 6 files changed, 46 insertions(+), 9 deletions(-) create mode 100644 .changeset/vi-mock-inherit-slice2.md diff --git a/.changeset/vi-mock-inherit-slice2.md b/.changeset/vi-mock-inherit-slice2.md new file mode 100644 index 0000000000..fbe8d6d86b --- /dev/null +++ b/.changeset/vi-mock-inherit-slice2.md @@ -0,0 +1,7 @@ +--- +--- + +Test-only change: the four frozen `vi.mock` factories on `@object-ui/plugin-charts` +and `@object-ui/plugin-dashboard` now inherit the real module's export surface, and +those two specifiers join `COVERED_SPECIFIERS` in `scripts/check-vi-mock-inherit.mjs` +(objectui#6892 slice 2). No published behaviour changes. diff --git a/packages/app-shell/src/views/DashboardView.modalTarget.test.tsx b/packages/app-shell/src/views/DashboardView.modalTarget.test.tsx index d43ecc222d..2e4cab2603 100644 --- a/packages/app-shell/src/views/DashboardView.modalTarget.test.tsx +++ b/packages/app-shell/src/views/DashboardView.modalTarget.test.tsx @@ -45,10 +45,13 @@ import { MetadataCtx } from '@object-ui/react'; // Captured props of the (stubbed) DashboardRenderer — `modalHandler` is the // handler the view really installs on the dashboard's ActionRunner, which is -// the thing under test. Stubbing the renderer also keeps this file out of the -// ComponentRegistry-heavy setup. +// the thing under test. The factory inherits the real module and overrides only +// `DashboardRenderer`, so the package's own `ComponentRegistry.register` calls +// DO run now (objectui#6892). The stub no longer avoids that setup; it replaces +// the one component this file asserts on. const cap = vi.hoisted(() => ({ props: null as any })); -vi.mock('@object-ui/plugin-dashboard', () => ({ +vi.mock('@object-ui/plugin-dashboard', async (importOriginal) => ({ + ...(await importOriginal>()), DashboardRenderer: (props: any) => { cap.props = props; return null; diff --git a/packages/app-shell/src/views/DashboardView.rootTitleRetired.test.tsx b/packages/app-shell/src/views/DashboardView.rootTitleRetired.test.tsx index bcb0b44709..291f2981bf 100644 --- a/packages/app-shell/src/views/DashboardView.rootTitleRetired.test.tsx +++ b/packages/app-shell/src/views/DashboardView.rootTitleRetired.test.tsx @@ -42,7 +42,8 @@ import { MetadataCtx } from '@object-ui/react'; // and capturing the props also proves the widgets (with their own `title`) // reach the renderer untouched. const cap = vi.hoisted(() => ({ props: null as any })); -vi.mock('@object-ui/plugin-dashboard', () => ({ +vi.mock('@object-ui/plugin-dashboard', async (importOriginal) => ({ + ...(await importOriginal>()), DashboardRenderer: (props: any) => { cap.props = props; return null; diff --git a/packages/app-shell/src/views/ObjectView.chartConfigForward-7891.test.tsx b/packages/app-shell/src/views/ObjectView.chartConfigForward-7891.test.tsx index 44b32ce7ae..a278550d77 100644 --- a/packages/app-shell/src/views/ObjectView.chartConfigForward-7891.test.tsx +++ b/packages/app-shell/src/views/ObjectView.chartConfigForward-7891.test.tsx @@ -112,7 +112,8 @@ vi.mock('sonner', () => ({ * is what the dynamic import resolves to. */ let capturedChartSchema: any = null; -vi.mock('@object-ui/plugin-charts', () => ({ +vi.mock('@object-ui/plugin-charts', async (importOriginal) => ({ + ...(await importOriginal>()), ObjectChart: (props: any) => { capturedChartSchema = props.schema; return null; diff --git a/packages/app-shell/src/views/ReportView.dataSourceObjectKey.test.tsx b/packages/app-shell/src/views/ReportView.dataSourceObjectKey.test.tsx index 6995e8c750..d066f8194e 100644 --- a/packages/app-shell/src/views/ReportView.dataSourceObjectKey.test.tsx +++ b/packages/app-shell/src/views/ReportView.dataSourceObjectKey.test.tsx @@ -64,7 +64,10 @@ vi.mock('@object-ui/plugin-report', async (importOriginal) => ({ return null; }, })); -vi.mock('@object-ui/plugin-dashboard', () => ({ DrillDownDrawer: () => null })); +vi.mock('@object-ui/plugin-dashboard', async (importOriginal) => ({ + ...(await importOriginal>()), + DrillDownDrawer: () => null, +})); vi.mock('./ReportConfigPanel', () => ({ ReportConfigPanel: (props: any) => { cap.panel = props; diff --git a/scripts/check-vi-mock-inherit.mjs b/scripts/check-vi-mock-inherit.mjs index e83c20ffa4..e022b5453f 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 five, and each joined by sweep + * actually been SWEPT to zero. Today that is seven, 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`: * @@ -115,8 +115,28 @@ * * 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. + * way. + * + * The next two joined as objectui#6892's SECOND slice, re-derived on + * `689127723` by the same method -- `scan()` imported with `covered` set to + * every workspace specifier the tree names, so the constant below was never + * widened-and-reverted: + * + * @object-ui/plugin-charts 1 judged, 0 inheriting, 1 frozen -> 0 + * @object-ui/plugin-dashboard 3 judged, 0 inheriting, 3 frozen -> 0 + * + * with the same population moving 315 -> 311 frozen and, again, no site moving + * the other way. `@object-ui/plugin-charts` never appeared on the worklist's + * table at all, and the reason is a THIRD way that table goes stale, distinct + * from both the recogniser fix and the sweeps: its only call site did not yet + * exist. `ObjectView.chartConfigForward-7891.test.tsx` was ADDED by `38158c6bb` + * (2026-09-06), a week AFTER the `9ce20233f` snapshot (2026-08-30) -- verified + * by `git cat-file -e 9ce20233f:PATH` against a control path that resolves at + * the same commit. So the population GROWS while the worklist is being worked, + * and a slice scoped from the table alone would have missed this specifier + * entirely. Re-derive per slice; never inherit. The remaining 311 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 @@ -203,6 +223,8 @@ export const COVERED_SPECIFIERS = Object.freeze([ '@object-ui/plugin-markdown', '@object-ui/data-objectstack', '@object-ui/plugin-report', + '@object-ui/plugin-charts', + '@object-ui/plugin-dashboard', ]); /** Files the walk reads at all. */