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
4 changes: 4 additions & 0 deletions .changeset/vi-mock-inherit-slice1.md
Original file line number Diff line number Diff line change
@@ -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.
3 changes: 2 additions & 1 deletion apps/console/src/pages/docs-portal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<Record<string, unknown>>()),
MarkdownRenderer: ({ schema }: { schema: { content?: string } }) => (
<div data-testid="doc-content">{schema.content}</div>
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Record<string, unknown>>()),
getSharedDiscovery: (_baseUrl: string, fetcher: () => Promise<unknown>) => fetcher(),
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Record<string, unknown>>()),
ReportRenderer: (props: any) => {
cap.renderer = props;
return null;
Expand Down
25 changes: 23 additions & 2 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 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`:
*
Expand All @@ -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
Expand Down Expand Up @@ -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?$/;
Expand Down
Loading