Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/vi-mock-inherit-slice2.md
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Record<string, unknown>>()),
DashboardRenderer: (props: any) => {
cap.props = props;
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Record<string, unknown>>()),
DashboardRenderer: (props: any) => {
cap.props = props;
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Record<string, unknown>>()),
ObjectChart: (props: any) => {
capturedChartSchema = props.schema;
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Record<string, unknown>>()),
DrillDownDrawer: () => null,
}));
vi.mock('./ReportConfigPanel', () => ({
ReportConfigPanel: (props: any) => {
cap.panel = props;
Expand Down
28 changes: 25 additions & 3 deletions scripts/check-vi-mock-inherit.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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`:
*
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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. */
Expand Down
Loading