Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

Commit 97b0177

Browse files
claude[bot]claude
andauthored
test(vi-mock): inherit the real @object-ui/plugin-detail surface in 13 vi.mock factories (#8184)
* test(vi-mock): inherit the real @object-ui/plugin-detail surface in 13 vi.mock factories objectui#6892 slice 9. Every frozen `vi.mock('@object-ui/plugin-detail', ...)` factory now obtains the real module through `importOriginal` and spreads it FIRST, with the file's existing overrides after it, so a new export on the barrel can no longer resolve to `undefined` and kill the file during collection. `@object-ui/plugin-detail` joins the gate's `COVERED_SPECIFIERS` in the same PR (13 -> 14), which is the documented widening precondition. Census re-derived through the gate's own `scan()` on 310c0ab: 17 judged, 4 already inheriting, 13 frozen -> 0. All 13 sit in one syntactic shape (zero-parameter object-literal arrows) across three packages: plugin-gantt 8, plugin-calendar 4, plugin-tree 1. No test assertion changed. STEP 0 measured rather than assumed, and the two measurements disagree. The barrel's graph is the largest this worklist has walked -- 564 modules, 6181 module-scope statements, 127 ComponentRegistry registrations, 99 bare side-effect imports -- and timed cold in an EMPTY test file `importOriginal` of it costs a median 8.8s, which is objectui#6580's app-shell STOP range. Measured in the real files it is roughly free: -0.1s to +1.0s per file, because those files already import `@object-ui/react` plus their own view component, whose combined 572-module graph is a strict SUPERSET of the barrel's 564 (zero marginal modules). The cost of inheriting a barrel is a property of the consuming file, not of the barrel. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr * test(vi-mock): inherit through `<any>` in plugin-tree, which declares no plugin-detail edge Fix-up on the slice-9 sweep. `check-phantom-dependencies` reads a type-position `import('@object-ui/plugin-detail')` as a real specifier, and `packages/plugin-tree` neither declares that package nor needs to: measured, `ObjectTree`'s module graph reaches ZERO plugin-detail modules, against 50 each from `ObjectGantt` and `ObjectCalendar`. That factory therefore mocks a module nothing under test ever loads, and the typed spelling would have made the package declare a dependency its runtime does not have. `<any>` inherits the same surface without asserting the edge, and it is the spelling this tree's three already-inheriting plugin-detail factories use. The twelve siblings keep the typed form, where the edge is real and declared. A comment on the factory records the measurement so the difference is not read as drift and "corrected" back. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent daf9d57 commit 97b0177

15 files changed

Lines changed: 96 additions & 20 deletions
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
---
3+
4+
Test-only change: the 13 `vi.mock('@object-ui/plugin-detail', ...)` factories that hand-listed the barrel's exports now inherit the real module and override after it, and `@object-ui/plugin-detail` joins the `check-vi-mock-inherit` gate's covered set. No published behaviour changes.

‎packages/plugin-calendar/src/ObjectCalendar.colorFieldLadder-7243.test.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ import { describe, it, expect, vi } from 'vitest';
9292
import { ObjectCalendar } from './ObjectCalendar';
9393
import { __resolveEventColorForTest as resolveEventColor } from './CalendarView';
9494

95-
vi.mock('@object-ui/plugin-detail', () => ({
95+
vi.mock('@object-ui/plugin-detail', async (importOriginal) => ({
96+
...(await importOriginal<typeof import('@object-ui/plugin-detail')>()),
9697
RecordDetailDrawer: () => null,
9798
deriveRecordPageHref: () => null,
9899
}));

‎packages/plugin-calendar/src/ObjectCalendar.externalDataCeiling-7507.test.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ import { describe, it, expect, vi } from 'vitest';
4040
import { NON_GRID_ROW_CEILING } from '@object-ui/react';
4141
import { ObjectCalendar } from './ObjectCalendar';
4242

43-
vi.mock('@object-ui/plugin-detail', () => ({
43+
vi.mock('@object-ui/plugin-detail', async (importOriginal) => ({
44+
...(await importOriginal<typeof import('@object-ui/plugin-detail')>()),
4445
RecordDetailDrawer: () => null,
4546
deriveRecordPageHref: () => null,
4647
}));

‎packages/plugin-calendar/src/ObjectCalendar.rowCeiling-7210.test.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ import { describe, it, expect, vi } from 'vitest';
4949
import { NON_GRID_ROW_CEILING, NON_GRID_ROW_CEILING_TOP } from '@object-ui/react';
5050
import { ObjectCalendar } from './ObjectCalendar';
5151

52-
vi.mock('@object-ui/plugin-detail', () => ({
52+
vi.mock('@object-ui/plugin-detail', async (importOriginal) => ({
53+
...(await importOriginal<typeof import('@object-ui/plugin-detail')>()),
5354
RecordDetailDrawer: () => null,
5455
deriveRecordPageHref: () => null,
5556
}));

‎packages/plugin-calendar/src/ObjectCalendar.unscheduled-7071.test.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ afterEach(cleanup);
5353
// The overlay drawer is irrelevant here and drags in a per-record permission
5454
// probe that would leave the process for real (see the propsContract suite's
5555
// own note on that probe). Stub it out.
56-
vi.mock('@object-ui/plugin-detail', () => ({
56+
vi.mock('@object-ui/plugin-detail', async (importOriginal) => ({
57+
...(await importOriginal<typeof import('@object-ui/plugin-detail')>()),
5758
RecordDetailDrawer: () => null,
5859
deriveRecordPageHref: () => null,
5960
}));

‎packages/plugin-gantt/src/ObjectGantt.apifetch.test.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ vi.mock('./GanttView', () => ({
2626
),
2727
}));
2828

29-
vi.mock('@object-ui/plugin-detail', () => ({
29+
vi.mock('@object-ui/plugin-detail', async (importOriginal) => ({
30+
...(await importOriginal<typeof import('@object-ui/plugin-detail')>()),
3031
RecordDetailDrawer: () => null,
3132
deriveRecordPageHref: () => null,
3233
}));

‎packages/plugin-gantt/src/ObjectGantt.colorFieldLadder-7243.test.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ import { ObjectGantt } from './ObjectGantt';
104104

105105
vi.mock('sonner', () => ({ toast: { error: vi.fn() } }));
106106

107-
vi.mock('@object-ui/plugin-detail', () => ({
107+
vi.mock('@object-ui/plugin-detail', async (importOriginal) => ({
108+
...(await importOriginal<typeof import('@object-ui/plugin-detail')>()),
108109
RecordDetailDrawer: () => null,
109110
deriveRecordPageHref: () => null,
110111
}));

‎packages/plugin-gantt/src/ObjectGantt.drawerfetch.test.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ vi.mock('./GanttView', () => ({
3131
}));
3232

3333
let drawerProps: any = null;
34-
vi.mock('@object-ui/plugin-detail', () => ({
34+
vi.mock('@object-ui/plugin-detail', async (importOriginal) => ({
35+
...(await importOriginal<typeof import('@object-ui/plugin-detail')>()),
3536
RecordDetailDrawer: (props: any) => {
3637
drawerProps = props;
3738
return (

‎packages/plugin-gantt/src/ObjectGantt.drawerlock.test.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ vi.mock('./GanttView', () => ({
2929
),
3030
}));
3131

32-
vi.mock('@object-ui/plugin-detail', () => ({
32+
vi.mock('@object-ui/plugin-detail', async (importOriginal) => ({
33+
...(await importOriginal<typeof import('@object-ui/plugin-detail')>()),
3334
RecordDetailDrawer: (props: any) => (
3435
<div
3536
data-testid="drawer-probe"

‎packages/plugin-gantt/src/ObjectGantt.elementDataSource.test.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ vi.mock('./GanttView', () => ({
3939
GanttView: ({ tasks }: any) => <div data-testid="gantt-view">{tasks.length}</div>,
4040
}));
4141

42-
vi.mock('@object-ui/plugin-detail', () => ({
42+
vi.mock('@object-ui/plugin-detail', async (importOriginal) => ({
43+
...(await importOriginal<typeof import('@object-ui/plugin-detail')>()),
4344
RecordDetailDrawer: () => null,
4445
deriveRecordPageHref: () => null,
4546
}));

0 commit comments

Comments
 (0)