Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
perf(ci): reduce frontend validation overhead (MUL-8789) (#10145)
Bohan Jiangdc8f5fbff949
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 89a89c0127..4682b67119 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -217,6 +217,11 @@ jobs:- name: Checkoutuses: actions/checkout@v6+ - name: Report runner CPU+ run: |+ nproc+ lscpu+- name: Setup pnpmuses: pnpm/action-setup@v4diff --git a/e2e/lazy-calendar-smoke.spec.ts b/e2e/lazy-calendar-smoke.spec.tsnew file mode 100644index 0000000000..e0c8d80efe--- /dev/null+++ b/e2e/lazy-calendar-smoke.spec.ts@@ -0,0 +1,53 @@+import { expect, test } from "@playwright/test";+import { createTestApi, loginAsDefault } from "./helpers";+import { mkdirSync } from "node:fs";++test("calendar lazy loading in issue details, custom properties and date-range filters", async ({ page }) => {+ await page.setViewportSize({ width: 1440, height: 1000 });+ const api = await createTestApi();+ try {+ await api.createProperty("Review date", "date");+ const issue = await api.createIssue("Calendar loading verification", { due_date: "2026-11-05" });+ const slug = await loginAsDefault(page);+ await page.goto(`/${slug}/issues/${issue.id}`);+ const sidebar = page.locator("[data-right-sidebar-panel]");+ const date = sidebar.getByRole("button", { name: "Nov 5", exact: true });+ await date.click();+ await expect(page.getByRole("grid")).toBeVisible({ timeout: 15_000 });+ if (process.env.SHOTS_DIR) {+ mkdirSync(process.env.SHOTS_DIR, { recursive: true });+ await page.screenshot({ path: `${process.env.SHOTS_DIR}/calendar-after.png`, animations: "disabled" });+ }+ const target = new Date(2026, 10, 6).toLocaleDateString("en-US");+ await page.locator(`button[data-day="${target}"]`).click();+ await expect(page.getByRole("grid")).toBeHidden();+ await expect(sidebar.getByRole("button", { name: "Nov 6", exact: true })).toBeVisible();+ await sidebar.getByRole("button", { name: "Nov 6", exact: true }).click();+ await page.getByRole("button", { name: "No due date", exact: true }).click();+ await expect(page.getByRole("grid")).toBeHidden();++ await sidebar.getByRole("button", { name: "Add property", exact: true }).click();+ await page.getByTestId("add-property-popover").getByRole("button", { name: "Review date", exact: true }).click();+ await expect(page.getByRole("grid")).toBeVisible();+ const today = await page.evaluate(() => new Date().toLocaleDateString());+ await page.locator(`button[data-day="${today}"]`).click();+ await expect(page.getByRole("grid")).toBeHidden();++ await page.goto(`/${slug}/issues`);+ await page.getByRole("button", { name: "Filter", exact: true }).click();+ await page.getByRole("menuitem", { name: /^Date\b/ }).hover();+ await page.getByRole("button", { name: "Custom date or range", exact: true }).click();+ await expect(page.getByRole("grid")).toBeVisible();+ await expect(page.locator("button[data-day]:focus")).toHaveCount(1);+ await page.keyboard.press("ArrowRight");+ await page.keyboard.press("Enter");+ await expect(page.getByRole("button", { name: "Apply", exact: true })).toBeEnabled();+ if (process.env.SHOTS_DIR) {+ await page.screenshot({ path: `${process.env.SHOTS_DIR}/range-after.png`, animations: "disabled" });+ }+ await page.getByRole("button", { name: "Apply", exact: true }).click();+ await expect(page.getByRole("grid")).toBeHidden();+ } finally {+ await api.cleanup();+ }+});diff --git a/packages/ui/components/ui/lazy-calendar.test.tsx b/packages/ui/components/ui/lazy-calendar.test.tsxnew file mode 100644index 0000000000..9a02f86705--- /dev/null+++ b/packages/ui/components/ui/lazy-calendar.test.tsx@@ -0,0 +1,47 @@+import type { ComponentProps } from "react";+import { act, render, screen, waitFor } from "@testing-library/react";+import { expect, it, vi } from "vitest";+import type { Calendar } from "./calendar";+import { LazyCalendar } from "./lazy-calendar";++const imports = vi.hoisted(() => ({+ count: 0,+ ready: Promise.withResolvers<void>(),+ render: vi.fn(),+}));+vi.mock("./calendar", async () => {+ imports.count++;+ await imports.ready.promise;+ return {+ Calendar: (props: ComponentProps<typeof Calendar>) => {+ imports.render(props);+ return <div data-testid="loaded-calendar" />;+ },+ };+});++it("defers loading until mount and forwards calendar props after resolution", async () => {+ const selected = new Date(2026, 10, 5);+ const onSelect = vi.fn();+ const { rerender, container } = render(<div />);+ expect(imports.count).toBe(0);++ rerender(<LazyCalendar mode="single" selected={selected} onSelect={onSelect} />);+ await waitFor(() => expect(imports.count).toBe(1));+ expect(container.querySelector("[aria-busy=true]")).toBeInTheDocument();+ expect(screen.queryByTestId("loaded-calendar")).not.toBeInTheDocument();+ await act(async () => {+ imports.ready.resolve();+ await vi.dynamicImportSettled();+ });+ expect(await screen.findByTestId("loaded-calendar")).toBeInTheDocument();+ expect(container.querySelector("[aria-busy=true]")).not.toBeInTheDocument();+ expect(imports.render).toHaveBeenLastCalledWith({ mode: "single", selected, onSelect });+ expect(imports.count).toBe(1);++ rerender(<div />);+ const range = { from: selected, to: new Date(2026, 10, 6) };+ rerender(<LazyCalendar mode="range" selected={range} autoFocus />);+ expect(imports.render).toHaveBeenLastCalledWith({ mode: "range", selected: range, autoFocus: true });+ expect(imports.count).toBe(1);+});diff --git a/packages/ui/components/ui/lazy-calendar.tsx b/packages/ui/components/ui/lazy-calendar.tsxnew file mode 100644index 0000000000..3991d38c17--- /dev/null+++ b/packages/ui/components/ui/lazy-calendar.tsx@@ -0,0 +1,18 @@+"use client";++import { lazy, Suspense, type ComponentProps } from "react";+import type { Calendar } from "./calendar";+import { Skeleton } from "./skeleton";++const CalendarContent = lazy(() =>+ import("./calendar").then((module) => ({ default: module.Calendar })),+);++/** Keep the date library out of the import graph until a calendar is mounted. */+export function LazyCalendar(props: ComponentProps<typeof Calendar>) {+ return (+ <Suspense fallback={<Skeleton className="h-64 w-56" aria-busy="true" />}>+ <CalendarContent {...props} />+ </Suspense>+ );+}diff --git a/packages/views/agents/components/agent-setup-checklist.test.ts b/packages/views/agents/components/agent-setup-checklist.test.tsindex 4ff98714cd..fd27e3fb8f 100644--- a/packages/views/agents/components/agent-setup-checklist.test.ts+++ b/packages/views/agents/components/agent-setup-checklist.test.ts@@ -1,3 +1,5 @@+// @vitest-environment node+import { describe, expect, it } from "vitest";import { agentSetupSteps } from "./agent-setup-checklist";diff --git a/packages/views/agents/components/agents-page-bulk-access-dialog-state.test.ts b/packages/views/agents/components/agents-page-bulk-access-dialog-state.test.tsindex 7e6cfc1367..cf248334f2 100644--- a/packages/views/agents/components/agents-page-bulk-access-dialog-state.test.ts+++ b/packages/views/agents/components/agents-page-bulk-access-dialog-state.test.ts@@ -1,3 +1,5 @@+// @vitest-environment node+import { describe, it, expect } from "vitest";import { isAccessChangeReady } from "@multica/core/agents";import type { AccessChange } from "./inspector/access-picker";diff --git a/packages/views/autopilots/components/autopilot-dialog-i18n.test.ts b/packages/views/autopilots/components/autopilot-dialog-i18n.test.tsindex 9e9a9db274..4e356651a1 100644--- a/packages/views/autopilots/components/autopilot-dialog-i18n.test.ts+++ b/packages/views/autopilots/components/autopilot-dialog-i18n.test.ts@@ -1,3 +1,5 @@+// @vitest-environment node+import { describe, expect, it } from "vitest";import type { TFunction } from "i18next";import { createI18n } from "@multica/core/i18n/react";diff --git a/packages/views/autopilots/components/schedule-editor/describe.test.ts b/packages/views/autopilots/components/schedule-editor/describe.test.tsindex e501979263..93dc897b28 100644--- a/packages/views/autopilots/components/schedule-editor/describe.test.ts+++ b/packages/views/autopilots/components/schedule-editor/describe.test.ts@@ -1,3 +1,5 @@+// @vitest-environment node+import { describe, expect, it } from "vitest";import type { TFunction } from "i18next";import { createI18n } from "@multica/core/i18n/react";diff --git a/packages/views/autopilots/components/schedule-editor/validate.test.ts b/packages/views/autopilots/components/schedule-editor/validate.test.tsindex a032414240..05e3d0cf49 100644--- a/packages/views/autopilots/components/schedule-editor/validate.test.ts+++ b/packages/views/autopilots/components/schedule-editor/validate.test.ts@@ -1,3 +1,5 @@+// @vitest-environment node+import { describe, it, expect, vi } from "vitest";import { QueryClient } from "@tanstack/react-query";import { ApiError } from "@multica/core/api";diff --git a/packages/views/common/date-only-picker.test.tsx b/packages/views/common/date-only-picker.test.tsxindex e9f0bc3cc9..2472ec8c1f 100644--- a/packages/views/common/date-only-picker.test.tsx+++ b/packages/views/common/date-only-picker.test.tsx@@ -1,4 +1,4 @@-import { screen } from "@testing-library/react";+import { act, fireEvent, screen, waitFor } from "@testing-library/react";import { describe, expect, it, vi } from "vitest";import { renderWithI18n } from "../test/i18n";import { DateOnlyPicker } from "./date-only-picker";@@ -7,8 +7,20 @@ describe("date picker progressive disclosure", () => {it("keeps the calendar mounted when its one-shot defaultOpen flag clears", async () => {const props = { value: null, onChange: vi.fn(), icon: <span />, placeholder: "Start date", emptyLabel: "No date" };const { rerender } = renderWithI18n(<DateOnlyPicker {...props} defaultOpen />);+ await act(() => vi.dynamicImportSettled());expect(await screen.findByRole("grid")).toBeVisible();rerender(<DateOnlyPicker {...props} defaultOpen={false} />);expect(screen.getByRole("grid")).toBeVisible();});++ it("selects a calendar day after loading and closes the picker", async () => {+ const onChange = vi.fn();+ renderWithI18n(<DateOnlyPicker value="2026-11-05" onChange={onChange} icon={<span />} placeholder="Start date" emptyLabel="No date" defaultOpen />);+ await act(() => vi.dynamicImportSettled());+ await screen.findByRole("grid");+ const target = new Date(2026, 10, 6);+ fireEvent.click(document.querySelector(`button[data-day="${target.toLocaleDateString()}"]`)!);+ expect(onChange).toHaveBeenCalledWith("2026-11-06");+ await waitFor(() => expect(screen.queryByRole("grid")).not.toBeInTheDocument());+ });});diff --git a/packages/views/common/date-only-picker.tsx b/packages/views/common/date-only-picker.tsxindex 13cc849290..d39108162b 100644--- a/packages/views/common/date-only-picker.tsx+++ b/packages/views/common/date-only-picker.tsx@@ -8,7 +8,7 @@ import {isPastDateOnly,} from "@multica/core/issues/date";import { Check } from "@multica/ui/icons";-import { Calendar } from "@multica/ui/components/ui/calendar";+import { LazyCalendar } from "@multica/ui/components/ui/lazy-calendar";import {Popover,PopoverTrigger,@@ -176,7 +176,7 @@ function DateOnlyPickerImpl({</span><Check className={`h-3.5 w-3.5 shrink-0 text-muted-foreground ${date ? "invisible" : ""}`} /></button>- <Calendar+ <LazyCalendarmode="single"selected={date}onSelect={(d: Date | undefined) => {diff --git a/packages/views/common/task-transcript/trace-issue-labels.test.ts b/packages/views/common/task-transcript/trace-issue-labels.test.tsindex cdfb841f01..512ed12ecc 100644--- a/packages/views/common/task-transcript/trace-issue-labels.test.ts+++ b/packages/views/common/task-transcript/trace-issue-labels.test.ts@@ -1,3 +1,5 @@+// @vitest-environment node+import { describe, expect, it } from "vitest";import { collectTraceIssueIds, replaceTraceIssueIds } from "./trace-issue-labels";import { traceEventCopyText, traceEventDetail, traceToolArgSummary } from "./trace-event-presenter";diff --git a/packages/views/editor/utils/issue-identifiers.test.ts b/packages/views/editor/utils/issue-identifiers.test.tsindex c9c52de4c6..fe17aee5c2 100644--- a/packages/views/editor/utils/issue-identifiers.test.ts+++ b/packages/views/editor/utils/issue-identifiers.test.ts@@ -1,3 +1,5 @@+// @vitest-environment node+import { describe, expect, it } from "vitest";import {preprocessIssueIdentifiers,diff --git a/packages/views/editor/utils/preprocess-channel-media.test.ts b/packages/views/editor/utils/preprocess-channel-media.test.tsindex e33e32b187..28a6eb4ad5 100644--- a/packages/views/editor/utils/preprocess-channel-media.test.ts+++ b/packages/views/editor/utils/preprocess-channel-media.test.ts@@ -1,3 +1,5 @@+// @vitest-environment node+import { describe, expect, it } from "vitest";import { preprocessMarkdown } from "./preprocess";diff --git a/packages/views/issues/components/issues-header.tsx b/packages/views/issues/components/issues-header.tsxindex 6340679d5a..4682062847 100644--- a/packages/views/issues/components/issues-header.tsx+++ b/packages/views/issues/components/issues-header.tsx@@ -52,7 +52,7 @@ import {PopoverTrigger,PopoverContent,} from "@multica/ui/components/ui/popover";-import { Calendar } from "@multica/ui/components/ui/calendar";+import { LazyCalendar } from "@multica/ui/components/ui/lazy-calendar";import { Switch } from "@multica/ui/components/ui/switch";import {Select,@@ -823,7 +823,8 @@ function DateSubContent({}/><PopoverContent align="start" side="right" className="w-auto gap-0 p-0">- <Calendar+ <LazyCalendar+ autoFocusmode="range"selected={range}onSelect={(next) => setRange(next)}diff --git a/packages/views/issues/components/pickers/custom-property-picker.tsx b/packages/views/issues/components/pickers/custom-property-picker.tsxindex 597e72a91f..9f1f7c2c56 100644--- a/packages/views/issues/components/pickers/custom-property-picker.tsx+++ b/packages/views/issues/components/pickers/custom-property-picker.tsx@@ -14,7 +14,7 @@ import {dateOnlyToLocalDate,formatDateOnly,} from "@multica/core/issues/date";-import { Calendar } from "@multica/ui/components/ui/calendar";+import { LazyCalendar } from "@multica/ui/components/ui/lazy-calendar";import {Popover,PopoverTrigger,@@ -335,7 +335,7 @@ export function CustomPropertyValueInput({</span><Check className={`h-3.5 w-3.5 shrink-0 text-muted-foreground ${date ? "invisible" : ""}`} /></button>- <Calendar+ <LazyCalendarmode="single"selected={date}onSelect={(d: Date | undefined) => {diff --git a/packages/views/issues/components/table-view-model.test.ts b/packages/views/issues/components/table-view-model.test.tsindex f60126b432..2ded17f1fa 100644--- a/packages/views/issues/components/table-view-model.test.ts+++ b/packages/views/issues/components/table-view-model.test.ts@@ -1,3 +1,5 @@+// @vitest-environment node+import { describe, expect, it } from "vitest";import type { Issue } from "@multica/core/types";import {diff --git a/packages/views/issues/components/wakeup-activity.test.tsx b/packages/views/issues/components/wakeup-activity.test.tsxindex 3cca8a46b3..4cf121c691 100644--- a/packages/views/issues/components/wakeup-activity.test.tsx+++ b/packages/views/issues/components/wakeup-activity.test.tsx@@ -2,7 +2,7 @@ import { describe, expect, it, vi } from "vitest";import { renderHook } from "@testing-library/react";import type { TimelineEntry } from "@multica/core/types";import { I18nProvider } from "@multica/core/i18n/react";-import { RESOURCES } from "../../test/i18n";+import { getTestResources } from "../../test/i18n";import { useT } from "../../i18n";import { useWakeupText } from "./wakeup-presentation";import { formatWakeupActivity, wakeupActivityChip } from "./wakeup-activity";@@ -21,7 +21,7 @@ const reply = { id: "w", kind: "event", mode: "once", event_types: ["comment.crefunction helpers() {const { result } = renderHook(() => ({ t: useT("issues").t, text: useWakeupText() }), {wrapper: ({ children }) => (- <I18nProvider locale="zh-Hans" resources={RESOURCES}>+ <I18nProvider locale="zh-Hans" resources={getTestResources("zh-Hans")}>{children}</I18nProvider>),diff --git a/packages/views/issues/surface/activity.test.ts b/packages/views/issues/surface/activity.test.tsindex dff53b3cb5..5295dab297 100644--- a/packages/views/issues/surface/activity.test.ts+++ b/packages/views/issues/surface/activity.test.ts@@ -1,3 +1,5 @@+// @vitest-environment node+import { describe, expect, it } from "vitest";import type { AgentTask } from "@multica/core/types";import { deriveIssueSurfaceActivity, selectIssueTasks } from "./activity";diff --git a/packages/views/issues/utils/drag-utils.test.ts b/packages/views/issues/utils/drag-utils.test.tsindex eae97b1aff..7d098d8cdc 100644--- a/packages/views/issues/utils/drag-utils.test.ts+++ b/packages/views/issues/utils/drag-utils.test.ts@@ -1,3 +1,5 @@+// @vitest-environment node+import { describe, expect, it } from "vitest";import type { Issue } from "@multica/core/types";import type { BoardColumnGroup } from "../components/board-column";diff --git a/packages/views/issues/utils/sort.test.ts b/packages/views/issues/utils/sort.test.tsindex e26cca31cc..51107778f4 100644--- a/packages/views/issues/utils/sort.test.ts+++ b/packages/views/issues/utils/sort.test.ts@@ -1,3 +1,5 @@+// @vitest-environment node+import { describe, expect, it } from "vitest";import type { Issue } from "@multica/core/types";import { sortIssues } from "./sort";diff --git a/packages/views/onboarding/templates/index.test.ts b/packages/views/onboarding/templates/index.test.tsindex 5d5695aa3a..fae9a2e7cb 100644--- a/packages/views/onboarding/templates/index.test.ts+++ b/packages/views/onboarding/templates/index.test.ts@@ -1,3 +1,5 @@+// @vitest-environment node+import { describe, expect, it } from "vitest";import { pickContentLang } from "./index";diff --git a/packages/views/search/delegate/detect-instruction.test.ts b/packages/views/search/delegate/detect-instruction.test.tsindex 143a1fd81f..e6d1e762d1 100644--- a/packages/views/search/delegate/detect-instruction.test.ts+++ b/packages/views/search/delegate/detect-instruction.test.ts@@ -1,3 +1,5 @@+// @vitest-environment node+import { describe, expect, it } from "vitest";import { detectInstruction, type NamedActor } from "./detect-instruction";diff --git a/packages/views/settings/components/seat-invite-purchase.test.ts b/packages/views/settings/components/seat-invite-purchase.test.tsindex 031f715127..6f64b388f6 100644--- a/packages/views/settings/components/seat-invite-purchase.test.ts+++ b/packages/views/settings/components/seat-invite-purchase.test.ts@@ -1,3 +1,5 @@+// @vitest-environment node+import { describe, expect, it } from "vitest";import type {WorkspaceSeatPurchasePreview,diff --git a/packages/views/settings/components/wecom-scan-install-dialog.test.tsx b/packages/views/settings/components/wecom-scan-install-dialog.test.tsxindex a116d8e3ec..799d9997fb 100644--- a/packages/views/settings/components/wecom-scan-install-dialog.test.tsx+++ b/packages/views/settings/components/wecom-scan-install-dialog.test.tsx@@ -1,8 +1,7 @@// @vitest-environment jsdomimport { describe, it, expect, beforeEach, afterEach, vi } from "vitest";-import { cleanup, render, screen, waitFor } from "@testing-library/react";-import userEvent from "@testing-library/user-event";+import { act, cleanup, fireEvent, render, screen } from "@testing-library/react";import { I18nProvider } from "@multica/core/i18n/react";import enCommon from "../../locales/en/common.json";import enSettings from "../../locales/en/settings.json";@@ -63,17 +62,27 @@ import { WecomScanInstallDialog } from "./wecom-scan-install-dialog";const TEST_RESOURCES = { en: { common: enCommon, settings: enSettings } };-afterEach(cleanup);+afterEach(() => {+ cleanup();+ vi.useRealTimers();+});-function renderDialog(onClose = vi.fn()) {- return render(- <I18nProvider locale="en" resources={TEST_RESOURCES}>- <WecomScanInstallDialog wsId="workspace-1" agentId="agent-1" onClose={onClose} />- </I18nProvider>,- );+async function renderDialog(onClose = vi.fn()) {+ await act(async () => {+ render(+ <I18nProvider locale="en" resources={TEST_RESOURCES}>+ <WecomScanInstallDialog wsId="workspace-1" agentId="agent-1" onClose={onClose} />+ </I18nProvider>,+ );+ });+}++async function advanceTime(milliseconds: number) {+ await act(() => vi.advanceTimersByTimeAsync(milliseconds));}beforeEach(() => {+ vi.useFakeTimers();vi.clearAllMocks();// jsdom has no crypto.randomUUID in every environment version.if (!globalThis.crypto?.randomUUID) {@@ -101,10 +110,14 @@ describe("WecomScanInstallDialog", () => {poll_interval_seconds: 2,});- renderDialog();+ await renderDialog();- expect(await screen.findByTestId("wecom-scan-starting")).toBeTruthy();- const qr = await screen.findByTestId("qr", {}, { timeout: 5000 });+ expect(screen.getByTestId("wecom-scan-starting")).toBeTruthy();+ await advanceTime(1000);+ expect(mockStatus).toHaveBeenCalledTimes(1);+ expect(screen.queryByTestId("qr")).toBeNull();+ await advanceTime(1000);+ const qr = screen.getByTestId("qr");expect(qr.getAttribute("data-value")).toContain("scode=abc");expect(screen.getByTestId("wecom-scan-expiry").textContent).toContain("240");});@@ -122,13 +135,17 @@ describe("WecomScanInstallDialog", () => {poll_interval_seconds: 2,});- renderDialog(onClose);+ await renderDialog(onClose);+ await advanceTime(1000);- await waitFor(() => expect(mockToastSuccess).toHaveBeenCalled(), { timeout: 5000 });+ expect(mockToastSuccess).toHaveBeenCalled();expect(mockInvalidate).toHaveBeenCalledWith({queryKey: ["wecom", "installations", "workspace-1"],});- await waitFor(() => expect(onClose).toHaveBeenCalled(), { timeout: 5000 });+ await advanceTime(799);+ expect(onClose).not.toHaveBeenCalled();+ await advanceTime(1);+ expect(onClose).toHaveBeenCalledTimes(1);});it("renders the reason for a terminal error and stops polling", async () => {@@ -143,13 +160,14 @@ describe("WecomScanInstallDialog", () => {poll_interval_seconds: 2,});- renderDialog();+ await renderDialog();+ await advanceTime(1000);- const err = await screen.findByTestId("wecom-scan-error", {}, { timeout: 5000 });+ const err = screen.getByTestId("wecom-scan-error");expect(err.textContent).toBe(enSettings.wecom.scan_error_expired);const callsAfterError = mockStatus.mock.calls.length;- await new Promise((r) => setTimeout(r, 300));+ await advanceTime(6000);expect(mockStatus.mock.calls.length).toBe(callsAfterError);});@@ -166,9 +184,10 @@ describe("WecomScanInstallDialog", () => {poll_interval_seconds: 2,});- renderDialog();+ await renderDialog();+ await advanceTime(1000);- const err = await screen.findByTestId("wecom-scan-error", {}, { timeout: 5000 });+ const err = screen.getByTestId("wecom-scan-error");expect(err.textContent).toContain(enSettings.wecom.scan_error_internal_error);});@@ -189,9 +208,10 @@ describe("WecomScanInstallDialog", () => {poll_interval_seconds: 2,});- renderDialog();+ await renderDialog();+ await advanceTime(1000);- const err = await screen.findByTestId("wecom-scan-error", {}, { timeout: 5000 });+ const err = screen.getByTestId("wecom-scan-error");expect(err.textContent).toBe(enSettings.wecom[key]);});@@ -205,18 +225,19 @@ describe("WecomScanInstallDialog", () => {});mockStatus.mockRejectedValue(new FakeApiError(404, "install session not found"));- renderDialog();+ await renderDialog();+ await advanceTime(1000);- const err = await screen.findByTestId("wecom-scan-error", {}, { timeout: 5000 });+ const err = screen.getByTestId("wecom-scan-error");expect(err.textContent).toContain(enSettings.wecom.scan_error_session_lost);});it("surfaces a 503 begin as the unconfigured reason", async () => {mockBegin.mockRejectedValue(new FakeApiError(503, "wecom scan install not enabled"));- renderDialog();+ await renderDialog();- const err = await screen.findByTestId("wecom-scan-error", {}, { timeout: 5000 });+ const err = screen.getByTestId("wecom-scan-error");expect(err.textContent).toContain(enSettings.wecom.scan_error_integration_unconfigured);// Nothing to poll when begin never produced a session.expect(mockStatus).not.toHaveBeenCalled();@@ -234,12 +255,15 @@ describe("WecomScanInstallDialog", () => {poll_interval_seconds: 2,});- renderDialog();- await screen.findByTestId("wecom-scan-error", {}, { timeout: 5000 });+ await renderDialog();+ await advanceTime(1000);+ expect(screen.getByTestId("wecom-scan-error")).toBeTruthy();const beginCalls = mockBegin.mock.calls.length;- await userEvent.click(screen.getByTestId("wecom-scan-retry"));- await waitFor(() => expect(mockBegin.mock.calls.length).toBe(beginCalls + 1));+ await act(async () => {+ fireEvent.click(screen.getByTestId("wecom-scan-retry"));+ });+ expect(mockBegin.mock.calls.length).toBe(beginCalls + 1);// A fresh idempotency key, or "get a new code" would replay the expired// session instead of starting over.const firstKey = mockBegin.mock.calls[0]?.[2];@@ -259,9 +283,9 @@ describe("WecomScanInstallDialog", () => {const sentence = "the server's own English sentence";mockBegin.mockRejectedValue(new FakeApiError(status, sentence, { error: sentence, code }));- renderDialog();+ await renderDialog();- const err = await screen.findByTestId("wecom-scan-error", {}, { timeout: 5000 });+ const err = screen.getByTestId("wecom-scan-error");expect(err.textContent).toBe(enSettings.wecom[key]);expect(screen.queryByText(sentence, { exact: false })).toBeNull();expect(mockStatus).not.toHaveBeenCalled();@@ -271,9 +295,9 @@ describe("WecomScanInstallDialog", () => {// parseWithFallback degrades an unparseable body to an empty session id.mockBegin.mockResolvedValue({ session_id: "", status: "error", poll_interval_seconds: 1 });- renderDialog();+ await renderDialog();- expect(await screen.findByTestId("wecom-scan-error", {}, { timeout: 5000 })).toBeTruthy();+ expect(screen.getByTestId("wecom-scan-error")).toBeTruthy();expect(mockStatus).not.toHaveBeenCalled();});@@ -299,9 +323,9 @@ describe("WecomScanInstallDialog", () => {poll_interval_seconds: 1,});- renderDialog();+ await renderDialog();- await waitFor(() => expect(mockBegin).toHaveBeenCalled(), { timeout: 5000 });+ expect(mockBegin).toHaveBeenCalled();const key = mockBegin.mock.calls[0]?.[2];expect(typeof key).toBe("string");expect(key).toBeTruthy();diff --git a/packages/views/test/README.md b/packages/views/test/README.mdnew file mode 100644index 0000000000..470e86cd12--- /dev/null+++ b/packages/views/test/README.md@@ -0,0 +1,22 @@+Views CI keeps two isolated Vitest shards. `balanced-sequencer.ts` assigns files+by estimated total cost (environment, setup, imports, tests and hooks), placing+the longest files on the lightest shard first. Each shard still uses Vitest's+default ordering within its assigned files.++All runners use the same committed `shard-timings.json`, never a runner's local+result cache. Discovery order and checkout paths do not affect assignment.+New or renamed files are included using a file-size estimate; removed files in+the snapshot are ignored. The snapshot affects scheduling only, not coverage.++To refresh the snapshot after substantial test changes, run the whole suite+from the repository root on an otherwise idle machine:++```sh+pnpm --filter @multica/views exec vitest run --maxWorkers=3 --no-cache --reporter=default --reporter=./test/timing-reporter.ts+```++The reporter only writes a snapshot after a successful, unsharded run. Review+and commit it with the change. Ordinary test runs and CI do not rewrite it.+The initial snapshot was measured locally on Node 24.11.1, macOS arm64, with+three workers after introducing the lazy calendar. Absolute times vary across+machines; these values are weights, not a CI performance promise.diff --git a/packages/views/test/balanced-sequencer.ts b/packages/views/test/balanced-sequencer.tsnew file mode 100644index 0000000000..e7ec59f93f--- /dev/null+++ b/packages/views/test/balanced-sequencer.ts@@ -0,0 +1,23 @@+import { statSync } from "node:fs";+import { relative } from "node:path";+import { BaseSequencer, type TestSpecification } from "vitest/node";+import { balancedShards } from "./balanced-shards";+import timings from "./shard-timings.json";++export default class BalancedSequencer extends BaseSequencer {+ async shard(files: TestSpecification[]) {+ const { shard, root } = this.ctx.config;+ if (!shard) return files;++ // A versioned input gives every runner the same assignment, independent of cache state.+ const weights: Record<string, number> = timings.files;+ return balancedShards(files.map((file) => {+ const path = relative(root, file.moduleId).replaceAll("\\", "/");+ return {+ path,+ cost: weights[path] ?? Math.max(1, statSync(file.moduleId).size * timings.millisecondsPerByte),+ test: file,+ };+ }), shard.count)[shard.index - 1]!;+ }+}diff --git a/packages/views/test/balanced-shards.test.ts b/packages/views/test/balanced-shards.test.tsnew file mode 100644index 0000000000..35cf7f746d--- /dev/null+++ b/packages/views/test/balanced-shards.test.ts@@ -0,0 +1,35 @@+// @vitest-environment node++import { describe, expect, it } from "vitest";+import { balancedShards } from "./balanced-shards";++const files = [+ { path: "a", cost: 12, test: "a" },+ { path: "b", cost: 10, test: "b" },+ { path: "c", cost: 4, test: "c" },+ { path: "d", cost: 3, test: "d" },+ { path: "e", cost: 1, test: "e" },+];++describe("balanced test shards", () => {+ it("balances work instead of file counts", () => {+ const shards = balancedShards(files, 2);+ const costs = shards.map((shard) =>+ files.filter((file) => shard.includes(file.test)).reduce((sum, file) => sum + file.cost, 0),+ );+ expect(costs).toEqual([15, 15]);+ expect(shards.map((shard) => shard.length).sort()).toEqual([2, 3]);+ });++ it.each([1, 2, 3, 7])("runs every discovered file once with %i shards, including new files", (count) => {+ const discovered = files.filter((file) => file.path !== "c").concat({ path: "new", cost: 5, test: "new" });+ const shards = balancedShards(discovered, count);+ expect(shards).toHaveLength(count);+ expect(shards.flat().sort()).toEqual(discovered.map((file) => file.test).sort());+ });++ it("assigns equal-cost files deterministically regardless of discovery order", () => {+ const tied = files.map((file) => ({ ...file, cost: 1 }));+ expect(balancedShards(tied, 2)).toEqual(balancedShards([...tied].reverse(), 2));+ });+});diff --git a/packages/views/test/balanced-shards.ts b/packages/views/test/balanced-shards.tsnew file mode 100644index 0000000000..abafb0e32c--- /dev/null+++ b/packages/views/test/balanced-shards.ts@@ -0,0 +1,25 @@+interface WeightedTest<T> {+ path: string;+ cost: number;+ test: T;+}++/** Longest files first, each assigned to the currently lightest shard. */+export function balancedShards<T>(files: WeightedTest<T>[], count: number): T[][] {+ const shards = Array.from({ length: count }, () => ({ cost: 0, tests: [] as T[] }));+ const ordered = [...files].sort((a, b) =>+ b.cost - a.cost || (a.path < b.path ? -1 : a.path > b.path ? 1 : 0),+ );+ for (const file of ordered) {+ let target = shards[0]!;+ for (const shard of shards) {+ if (shard.cost < target.cost ||+ (shard.cost === target.cost && shard.tests.length < target.tests.length)) {+ target = shard;+ }+ }+ target.tests.push(file.test);+ target.cost += file.cost;+ }+ return shards.map((shard) => shard.tests);+}diff --git a/packages/views/test/i18n.test.ts b/packages/views/test/i18n.test.tsnew file mode 100644index 0000000000..7a616a9de2--- /dev/null+++ b/packages/views/test/i18n.test.ts@@ -0,0 +1,18 @@+// @vitest-environment node+import { describe, expect, it } from "vitest";+import { SUPPORTED_LOCALES } from "@multica/core/i18n";+import { RESOURCES } from "../locales";+import { getTestResources } from "./i18n";++describe("test locale resources", () => {+ for (const locale of SUPPORTED_LOCALES) {+ it(`loads every production namespace for ${locale} with the English fallback`, () => {+ const resources = getTestResources(locale);+ expect(Object.keys(resources).sort()).toEqual(+ [...new Set(["en", locale])].sort(),+ );+ expect(resources.en).toEqual(RESOURCES.en);+ expect(resources[locale]).toEqual(RESOURCES[locale]);+ });+ }+});diff --git a/packages/views/test/i18n.tsx b/packages/views/test/i18n.tsxindex 8c9a0ff044..1e1baf563e 100644--- a/packages/views/test/i18n.tsx+++ b/packages/views/test/i18n.tsx@@ -1,3 +1,6 @@+import { readFileSync, readdirSync } from "node:fs";+import { dirname, join } from "node:path";+import { fileURLToPath } from "node:url";import {render,type RenderOptions,@@ -5,19 +8,36 @@ import {} from "@testing-library/react";import { I18nProvider } from "@multica/core/i18n/react";import type { ReactElement, ReactNode } from "react";-import { RESOURCES } from "../locales";-import type { SupportedLocale } from "@multica/core/i18n";+import type { LocaleResources, SupportedLocale } from "@multica/core/i18n";++// Load the requested locale and its English fallback synchronously so render+// keeps Testing Library's API without importing every language into each file.+// Discover namespaces from disk; the parity test checks production registration.+const localesDir = join(dirname(fileURLToPath(import.meta.url)), "../locales");+const namespaces = readdirSync(join(localesDir, "en"))+ .filter((name) => name.endsWith(".json"));+const localeCache = new Map<SupportedLocale, LocaleResources>();++function loadLocale(locale: SupportedLocale): LocaleResources {+ let resources = localeCache.get(locale);+ if (!resources) {+ resources = Object.fromEntries(namespaces.map((filename) => [+ filename.slice(0, -5),+ JSON.parse(readFileSync(join(localesDir, locale, filename), "utf8")),+ ]));+ localeCache.set(locale, resources);+ }+ return resources;+}++export function getTestResources(+ locale: SupportedLocale = "en",+): Record<string, LocaleResources> {+ return locale === "en"+ ? { en: loadLocale("en") }+ : { en: loadLocale("en"), [locale]: loadLocale(locale) };+}-// Single i18n test wrapper for the whole package. Wraps the production-// `RESOURCES` map (every namespace registered there is available to the-// component under test) so when a new namespace lands the test never-// silently renders translation keys-as-text — the test sees the same-// resource set users do. The previous pattern of inlining a per-file-// `TEST_RESOURCES` slice meant every test author had to remember to-// extend the slice when their component started using a new namespace.-//-// Use `renderWithI18n` like the standard `render`. Pass `locale: "zh-Hans"`,-// `locale: "ko"`, or `locale: "ja"` to verify localized strings; default is "en".type RenderArgs = Omit<RenderOptions, "wrapper"> & {locale?: SupportedLocale;};@@ -27,14 +47,13 @@ export function renderWithI18n(options: RenderArgs = {},): RenderResult {const { locale = "en", ...rest } = options;+ const resources = getTestResources(locale);function Wrapper({ children }: { children: ReactNode }) {return (- <I18nProvider locale={locale} resources={RESOURCES}>+ <I18nProvider locale={locale} resources={resources}>{children}</I18nProvider>);}return render(ui, { wrapper: Wrapper, ...rest });}--export { RESOURCES };diff --git a/packages/views/test/shard-timings.json b/packages/views/test/shard-timings.jsonnew file mode 100644index 0000000000..b621293025--- /dev/null+++ b/packages/views/test/shard-timings.json@@ -0,0 +1,582 @@+{+ "millisecondsPerByte": 0.1437132211572247,+ "files": {+ "agents/agents-i18n-parity.test.ts": 109,+ "agents/components/access-picker-bulk-commit.test.tsx": 940,+ "agents/components/agent-activity-hover-content.test.tsx": 677,+ "agents/components/agent-advanced-settings.test.tsx": 1823,+ "agents/components/agent-batch-toolbar.test.tsx": 1673,+ "agents/components/agent-detail-inspector.labels.test.tsx": 1004,+ "agents/components/agent-detail-inspector.qoder.test.tsx": 1321,+ "agents/components/agent-detail-inspector.runtime-access.test.tsx": 1693,+ "agents/components/agent-detail-inspector.starters.test.tsx": 3010,+ "agents/components/agent-detail-page.test.tsx": 3248,+ "agents/components/agent-live-peek-card.test.tsx": 942,+ "agents/components/agent-profile-card.test.tsx": 702,+ "agents/components/agent-properties-panel.test.tsx": 1859,+ "agents/components/agent-row-actions.test.tsx": 1521,+ "agents/components/agent-setup-checklist.test.ts": 226,+ "agents/components/agents-page-access-cell.test.tsx": 1305,+ "agents/components/agents-page-bulk-access-dialog-state.test.ts": 253,+ "agents/components/agents-page-filter-predicate.test.ts": 1144,+ "agents/components/agents-page.test.tsx": 1849,+ "agents/components/conversation-starters-editor.test.tsx": 1286,+ "agents/components/create-agent-dialog.test.tsx": 2584,+ "agents/components/inspector/access-picker.test.tsx": 1049,+ "agents/components/inspector/model-capability.test.ts": 81,+ "agents/components/inspector/model-change-cleanup.test.ts": 65,+ "agents/components/inspector/model-picker.test.tsx": 1425,+ "agents/components/inspector/runtime-picker.test.tsx": 1608,+ "agents/components/inspector/service-tier-setting-field.test.tsx": 1482,+ "agents/components/inspector/thinking-picker.test.tsx": 1583,+ "agents/components/inspector/thinking-prop-row.test.tsx": 3100,+ "agents/components/model-dropdown.test.tsx": 1528,+ "agents/components/new-chat-preview.test.tsx": 853,+ "agents/components/runtime-machine-filter-dropdown.test.tsx": 925,+ "agents/components/runtime-picker.test.tsx": 1000,+ "agents/components/sparkline.test.tsx": 731,+ "agents/components/tabs/activity-tab.render.test.tsx": 2142,+ "agents/components/tabs/activity-tab.test.ts": 1769,+ "agents/components/tabs/agent-mcp-tab.test.tsx": 1384,+ "agents/components/tabs/custom-args-tab.test.tsx": 1887,+ "agents/components/tabs/env-file.test.ts": 63,+ "agents/components/tabs/env-tab.test.tsx": 1792,+ "agents/components/tabs/instructions-tab.test.tsx": 1895,+ "agents/components/tabs/integrations-tab.test.tsx": 1110,+ "agents/components/tabs/mcp-config-model.test.ts": 80,+ "agents/components/tabs/mcp-config-tab.test.tsx": 5016,+ "agents/components/tabs/mcp-server-dialog.test.tsx": 4244,+ "agents/components/tabs/qoder-agent-tab.test.tsx": 943,+ "agents/components/tabs/skills-tab.test.tsx": 1369,+ "agents/components/tabs/task-failure.test.ts": 286,+ "agents/components/use-conversation-starters-focus.test.tsx": 739,+ "agents/create/agent-execution-overrides.test.tsx": 1594,+ "agents/create/builder-workspace-layout.test.tsx": 1298,+ "agents/create/builder-workspace-runtime-binding.test.tsx": 1332,+ "agents/create/builder-workspace.test.tsx": 1075,+ "agents/create/create-agent-ui.test.ts": 1212,+ "agents/create/create-flow-chrome.test.tsx": 1158,+ "agents/create/manual-create-agent-page.test.tsx": 938,+ "agents/create/runtime-choice-list.test.tsx": 1244,+ "agents/create/runtime-choice.test.ts": 394,+ "agents/create/use-builder-session-cache.test.tsx": 926,+ "agents/create/use-create-agent-form.test.tsx": 1125,+ "agents/create/use-create-agent-submit.test.tsx": 672,+ "agents/create/use-duplicate-draft-seed.test.tsx": 1017,+ "agents/create/use-manual-draft-sync.test.tsx": 775,+ "attachments/attachment-preview-page.test.tsx": 1747,+ "attachments/use-html-preview-scroll-restore.test.tsx": 745,+ "auth/login-page.test.tsx": 8998,+ "auth/use-logout.test.ts": 637,+ "autopilots/components/autopilot-detail-page.test.tsx": 2593,+ "autopilots/components/autopilot-dialog-i18n.test.ts": 123,+ "autopilots/components/autopilot-dialog.project.test.tsx": 2174,+ "autopilots/components/autopilot-dialog.schedule.test.tsx": 2479,+ "autopilots/components/autopilot-dialog.validation.test.tsx": 2702,+ "autopilots/components/autopilots-page.test.tsx": 1930,+ "autopilots/components/edit-schedule-trigger-dialog.test.tsx": 2147,+ "autopilots/components/run-now-toast.test.ts": 75,+ "autopilots/components/schedule-editor/cron-grammar.test.ts": 3782,+ "autopilots/components/schedule-editor/cron-mapping.test.ts": 162,+ "autopilots/components/schedule-editor/describe.test.ts": 139,+ "autopilots/components/schedule-editor/schedule-editor.test.tsx": 6613,+ "autopilots/components/schedule-editor/transitions.test.ts": 71,+ "autopilots/components/schedule-editor/validate.test.ts": 247,+ "autopilots/components/trigger-row.test.tsx": 1882,+ "autopilots/components/webhook-event-filter-section.test.tsx": 1001,+ "autopilots/components/webhook-payload-preview.test.tsx": 851,+ "autopilots/components/webhook-url-field.test.tsx": 1036,+ "autopilots/components/workspace-wakeups.test.tsx": 2606,+ "billing/billing-return-page.test.tsx": 953,+ "chat/chat-page.test.tsx": 1347,+ "chat/components/chat-column.test.tsx": 1730,+ "chat/components/chat-empty-state.test.tsx": 920,+ "chat/components/chat-input-draft-isolation.test.tsx": 1363,+ "chat/components/chat-input.test.tsx": 2791,+ "chat/components/chat-message-list.autoscroll.test.tsx": 1621,+ "chat/components/chat-message-list.test.tsx": 2556,+ "chat/components/chat-new-chat-button.test.tsx": 1373,+ "chat/components/chat-queue.test.tsx": 1249,+ "chat/components/chat-session-header.test.tsx": 1080,+ "chat/components/chat-thread-list.test.tsx": 1420,+ "chat/components/chat-window-messages.test.tsx": 1052,+ "chat/components/session-rename-input.test.tsx": 773,+ "chat/components/stick-to-bottom.test.ts": 78,+ "chat/components/task-status-pill.test.ts": 132,+ "chat/components/use-chat-controller.test.ts": 855,+ "chat/components/use-chat-controller.test.tsx": 645,+ "chat/components/use-chat-controller.workspace.test.tsx": 863,+ "chat/components/use-chat-draft-restore.test.tsx": 1925,+ "chat/components/use-chat-input-focus.test.ts": 623,+ "chat/components/use-chat-open-reveal.test.ts": 599,+ "chat/components/use-chat-project-context-support.test.tsx": 908,+ "chat/components/use-chat-resize.test.tsx": 665,+ "chat/components/use-visual-viewport-keyboard.test.ts": 833,+ "chat/floating-chat-visibility.test.ts": 106,+ "chat/lib/copy-text.test.ts": 92,+ "chat/lib/quick-actions.test.ts": 64,+ "common/actor-avatar-profile-link.test.tsx": 809,+ "common/actor-issues-panel.test.tsx": 966,+ "common/agent-status-dot-i18n.test.tsx": 873,+ "common/avatar-crop-dialog.test.tsx": 1241,+ "common/avatar-crop.test.ts": 91,+ "common/avatar-upload-control.test.tsx": 1876,+ "common/cli-install-command.test.tsx": 1497,+ "common/color-picker.test.tsx": 1391,+ "common/color-utils.test.ts": 99,+ "common/composio-toolkit-logo.test.tsx": 625,+ "common/date-only-picker.test.tsx": 2892,+ "common/deferred-popup.test.tsx": 811,+ "common/docs-locale.test.ts": 79,+ "common/expandable-description.test.tsx": 801,+ "common/format-in-time-zone.test.ts": 88,+ "common/github-url.test.ts": 91,+ "common/mcp-server-row.test.tsx": 861,+ "common/picker-keys.test.ts": 523,+ "common/rich-content-sanitize-contract.test.tsx": 1006,+ "common/row-actions-menu.test.tsx": 1537,+ "common/select.test.tsx": 755,+ "common/shortcut-keycaps.test.tsx": 763,+ "common/task-transcript/agent-transcript-dialog.test.tsx": 2497,+ "common/task-transcript/build-steps.test.ts": 164,+ "common/task-transcript/build-timeline.test.ts": 81,+ "common/task-transcript/run-outcome.test.ts": 90,+ "common/task-transcript/trace-event-presenter.test.ts": 89,+ "common/task-transcript/trace-issue-labels.test.ts": 75,+ "common/task-transcript/transcript-button.test.tsx": 730,+ "common/task-transcript/transcript-follow.test.ts": 86,+ "common/type-scale-merge.test.ts": 93,+ "common/use-app-foreground.test.ts": 603,+ "common/use-language-switch.test.tsx": 1248,+ "common/use-viewing-timezone.test.ts": 878,+ "common/virtuoso-seed.test.tsx": 733,+ "dashboard/components/dashboard-page.test.tsx": 2678,+ "dashboard/utils.test.ts": 540,+ "editor/attachment-card.test.tsx": 852,+ "editor/attachment-preview-modal.test.tsx": 4137,+ "editor/attachment.test.tsx": 1816,+ "editor/bubble-menu.test.tsx": 1006,+ "editor/code-block-static.test.tsx": 743,+ "editor/content-editor-current-issue.test.tsx": 1695,+ "editor/content-editor-quick-actions.test.tsx": 2813,+ "editor/content-editor.test.tsx": 1289,+ "editor/dynamic-block.test.tsx": 975,+ "editor/extensions/autolink-policy.test.ts": 1936,+ "editor/extensions/code-block-view.clipboard.test.tsx": 1257,+ "editor/extensions/code-block-view.test.tsx": 848,+ "editor/extensions/code-block.test.ts": 1837,+ "editor/extensions/code.test.ts": 1696,+ "editor/extensions/file-card-markdown.test.ts": 1104,+ "editor/extensions/file-card.test.tsx": 1151,+ "editor/extensions/file-upload.test.ts": 1976,+ "editor/extensions/heading-levels.test.ts": 1643,+ "editor/extensions/highlight.test.ts": 930,+ "editor/extensions/image-markdown-roundtrip.test.ts": 1618,+ "editor/extensions/issue-identifier-autolink.test.ts": 1159,+ "editor/extensions/list-item.test.ts": 728,+ "editor/extensions/list-keyboard.test.ts": 1573,+ "editor/extensions/markdown-paste.test.ts": 1421,+ "editor/extensions/math.test.ts": 669,+ "editor/extensions/mention-boundary.test.ts": 905,+ "editor/extensions/mention-extension.test.ts": 918,+ "editor/extensions/mention-suggestion.test.tsx": 3032,+ "editor/extensions/mention-view.test.tsx": 1094,+ "editor/extensions/pinyin-match.test.ts": 113,+ "editor/extensions/select-all-delete.test.ts": 1806,+ "editor/extensions/slash-command-extension.test.ts": 126,+ "editor/extensions/slash-command-suggestion.test.tsx": 921,+ "editor/extensions/submit-shortcut.test.ts": 705,+ "editor/extensions/suggestion-popup.test.tsx": 1333,+ "editor/extensions/suggestion-trigger-arming.test.ts": 649,+ "editor/extensions/table-view.test.tsx": 2264,+ "editor/extensions/task-list-markdown.test.ts": 764,+ "editor/extensions/underline.test.ts": 1554,+ "editor/file-card-href.test.ts": 774,+ "editor/hooks/use-attachment-download-state.test.tsx": 592,+ "editor/hooks/use-html-preview-location.test.tsx": 615,+ "editor/html-block-preview.test.tsx": 1362,+ "editor/html-viewport-frame.test.tsx": 583,+ "editor/mermaid-diagram.test.tsx": 1528,+ "editor/mermaid-viewer.test.tsx": 2891,+ "editor/preview-sequence-context.test.tsx": 1560,+ "editor/readonly-content-math.test.tsx": 2193,+ "editor/readonly-content.test.tsx": 1985,+ "editor/structured-tree.test.tsx": 925,+ "editor/syntax-highlight.test.ts": 143,+ "editor/table-preview.test.tsx": 1160,+ "editor/text-anchor.test.ts": 422,+ "editor/title-editor.shortcut.test.tsx": 786,+ "editor/title-editor.test.tsx": 663,+ "editor/use-composer-submit.test.tsx": 839,+ "editor/use-coordinated-uploads.test.tsx": 826,+ "editor/use-download-attachment.test.tsx": 674,+ "editor/use-editor-upload.test.tsx": 1120,+ "editor/use-lazy-editor.test.ts": 615,+ "editor/utils/clipboard.test.ts": 544,+ "editor/utils/escape-markdown-label.test.ts": 64,+ "editor/utils/hash-string.test.ts": 77,+ "editor/utils/highlight-markdown.test.ts": 124,+ "editor/utils/highlight-match.test.ts": 117,+ "editor/utils/html-block-document.test.ts": 83,+ "editor/utils/iframe-fragment-nav.test.ts": 598,+ "editor/utils/iframe-location-bridge.test.ts": 475,+ "editor/utils/iframe-scroll-bridge.test.ts": 571,+ "editor/utils/iframe-width-bridge.test.ts": 816,+ "editor/utils/issue-identifiers.test.ts": 516,+ "editor/utils/link-handler.test.ts": 846,+ "editor/utils/mermaid-export.test.ts": 575,+ "editor/utils/parse-delimited.test.ts": 73,+ "editor/utils/parse-markdown-chunked.test.ts": 175,+ "editor/utils/parse-structured.test.ts": 101,+ "editor/utils/preprocess-channel-media.test.ts": 336,+ "editor/utils/preprocess-code.test.ts": 2841,+ "editor/utils/preprocess-links.test.ts": 141,+ "editor/utils/preview.test.ts": 114,+ "editor/utils/repair-list-items.test.ts": 1637,+ "editor/utils/zoom-transform.test.ts": 78,+ "eslint-i18n-guard.test.ts": 573,+ "inbox/components/autopilot-quota-notice.test.tsx": 779,+ "inbox/components/inbox-context-menu.test.tsx": 1238,+ "inbox/components/inbox-detail-label.test.tsx": 616,+ "inbox/components/inbox-display.test.ts": 77,+ "inbox/components/inbox-filter-menu.test.tsx": 2234,+ "inbox/components/inbox-list-item.test.tsx": 759,+ "inbox/components/inbox-list.test.tsx": 959,+ "inbox/components/inbox-page-query.test.tsx": 1463,+ "inbox/components/inbox-page.test.tsx": 2267,+ "invitations/invitations-page.test.tsx": 943,+ "issue-views/all-views-page.test.tsx": 1906,+ "issue-views/view-header.test.tsx": 1219,+ "issues/actions/__tests__/inbox-restore.test.tsx": 1466,+ "issues/actions/__tests__/issue-actions-menu.test.tsx": 2590,+ "issues/actions/__tests__/use-issue-actions.test.tsx": 725,+ "issues/actions/run-confirm-gate.test.ts": 485,+ "issues/blocked-trigger-copy.test.ts": 88,+ "issues/components/active-task-order.test.ts": 79,+ "issues/components/attribution-badge.test.tsx": 569,+ "issues/components/batch-action-toolbar.confirm.test.tsx": 1547,+ "issues/components/batch-action-toolbar.test.tsx": 1045,+ "issues/components/board-card-assignee-picker.test.tsx": 1457,+ "issues/components/board-card-peek.test.tsx": 1046,+ "issues/components/board-view-project-grouping.test.tsx": 1037,+ "issues/components/comment-annotation-selection.test.ts": 685,+ "issues/components/comment-card-actions-menu.test.tsx": 1960,+ "issues/components/comment-card-copy-link.test.tsx": 1772,+ "issues/components/comment-card-deleted.test.tsx": 2017,+ "issues/components/comment-card-edit-gate.test.tsx": 3068,+ "issues/components/comment-card.test.tsx": 1581,+ "issues/components/comment-composers.test.tsx": 5780,+ "issues/components/comment-runs.test.ts": 179,+ "issues/components/comment-selection-bubble.test.tsx": 746,+ "issues/components/comment-trigger-chips.test.tsx": 1128,+ "issues/components/create-renderers.test.tsx": 1417,+ "issues/components/custom-status-chip.test.tsx": 932,+ "issues/components/data-table-resize.test.tsx": 887,+ "issues/components/data-table-sticky.test.tsx": 774,+ "issues/components/deliverables/deliverables.test.tsx": 1147,+ "issues/components/description-preview.test.ts": 73,+ "issues/components/execution-log-section.test.tsx": 2350,+ "issues/components/filter-chips-bar.test.ts": 1276,+ "issues/components/find-bar.test.tsx": 986,+ "issues/components/gantt-view.test.tsx": 1102,+ "issues/components/infinite-scroll-sentinel.test.tsx": 629,+ "issues/components/inline-comment-run.focus.test.tsx": 1435,+ "issues/components/inline-comment-run.test.tsx": 2186,+ "issues/components/issue-agent-activity-indicator.test.tsx": 788,+ "issues/components/issue-agent-header-chip.focus.test.tsx": 2066,+ "issues/components/issue-agent-header-chip.test.tsx": 940,+ "issues/components/issue-chip.test.tsx": 907,+ "issues/components/issue-detail-route-comment-links.test.tsx": 1910,+ "issues/components/issue-detail-route.test.tsx": 2370,+ "issues/components/issue-detail.test.tsx": 10836,+ "issues/components/issue-duplicates.test.tsx": 1073,+ "issues/components/issue-hover-card.test.tsx": 1382,+ "issues/components/issue-load-failure.test.tsx": 3917,+ "issues/components/issue-mention-card.test.tsx": 950,+ "issues/components/issue-peek.test.tsx": 2071,+ "issues/components/issue-run-timeline.test.ts": 352,+ "issues/components/issue-runs-dialog.test.tsx": 2771,+ "issues/components/issue-sidebar-section.test.tsx": 781,+ "issues/components/issue-wakeup-header-chip.test.tsx": 847,+ "issues/components/issues-cold-load-loop.test.tsx": 1096,+ "issues/components/issues-header.advanced-filter.test.tsx": 5742,+ "issues/components/issues-header.agent-running-filter.test.tsx": 3252,+ "issues/components/issues-header.display-columns.test.tsx": 3352,+ "issues/components/issues-header.display-layout.test.tsx": 2505,+ "issues/components/issues-header.host-open.test.tsx": 3075,+ "issues/components/issues-header.property-filter.test.tsx": 8070,+ "issues/components/issues-header.status-filter.test.tsx": 3658,+ "issues/components/issues-page.test.tsx": 2410,+ "issues/components/list-row-peek.test.tsx": 1314,+ "issues/components/list-view-recovery.test.tsx": 3092,+ "issues/components/list-view.test.tsx": 1443,+ "issues/components/metadata-section.test.tsx": 1411,+ "issues/components/pickers/actor-property-picker.test.ts": 1347,+ "issues/components/pickers/assignee-picker.keyboard.test.tsx": 1136,+ "issues/components/pickers/custom-property-picker.list.test.tsx": 2531,+ "issues/components/pickers/custom-property-picker.scalar.test.tsx": 2888,+ "issues/components/pickers/custom-property-picker.select.test.tsx": 2634,+ "issues/components/pickers/custom-property-picker.test.ts": 956,+ "issues/components/pickers/deferred-trigger.test.tsx": 1068,+ "issues/components/pickers/label-picker.test.tsx": 1482,+ "issues/components/pickers/stage-picker.test.tsx": 646,+ "issues/components/pickers/status-picker.test.tsx": 1580,+ "issues/components/pull-request-list.test.tsx": 1687,+ "issues/components/pull-requests-section.test.tsx": 1738,+ "issues/components/quick-actions-section.test.tsx": 1291,+ "issues/components/reply-annotations.test.tsx": 1792,+ "issues/components/revision-conflict-compare.test.tsx": 701,+ "issues/components/source-context-viewer.test.tsx": 2652,+ "issues/components/status-icon.test.tsx": 1582,+ "issues/components/steer-receipts.test.tsx": 1045,+ "issues/components/sub-issues-agent-working-chip.test.tsx": 614,+ "issues/components/swimlane-view.test.tsx": 3565,+ "issues/components/table-column-picker.test.tsx": 1339,+ "issues/components/table-group-row.test.tsx": 1286,+ "issues/components/table-inline-title.test.tsx": 1524,+ "issues/components/table-issue-search.test.tsx": 1227,+ "issues/components/table-view-editing.test.tsx": 2704,+ "issues/components/table-view-model.test.ts": 86,+ "issues/components/table-view-project-grouping.test.tsx": 1527,+ "issues/components/table-view-virtualized-hierarchy.test.tsx": 2863,+ "issues/components/task-run-labels.test.ts": 237,+ "issues/components/thread-minimap.test.tsx": 1276,+ "issues/components/thread-utils.test.ts": 65,+ "issues/components/use-board-drag-pan.test.tsx": 603,+ "issues/components/use-comment-annotations.test.tsx": 1429,+ "issues/components/use-drag-settle.test.tsx": 606,+ "issues/components/use-run-comment-motion.test.tsx": 789,+ "issues/components/wakeup-activity.test.tsx": 1607,+ "issues/components/wakeup-create.test.tsx": 2831,+ "issues/components/wakeup-draft.test.ts": 75,+ "issues/components/wakeup-instruction-editor.test.tsx": 1268,+ "issues/components/wakeup-presentation.test.ts": 947,+ "issues/components/wakeups-section.test.tsx": 2892,+ "issues/components/workspace-agent-working-chip.test.tsx": 661,+ "issues/hooks/issue-delete-mutations.test.tsx": 724,+ "issues/hooks/use-comment-trigger-preview.test.ts": 1181,+ "issues/hooks/use-in-page-find.test.ts": 693,+ "issues/hooks/use-issue-detail-scroll-restore.test.tsx": 661,+ "issues/hooks/use-issue-subscribers.test.tsx": 1227,+ "issues/hooks/use-issue-timeline.test.tsx": 813,+ "issues/hooks/use-jump-to-latest.test.tsx": 625,+ "issues/hooks/use-mark-issue-inbox-read-while-viewing.test.tsx": 1260,+ "issues/hooks/use-mark-issue-read-while-viewing.test.tsx": 1054,+ "issues/hooks/use-sticky-composer.test.tsx": 678,+ "issues/surface/activity.test.ts": 408,+ "issues/surface/issue-surface.test.tsx": 2468,+ "issues/surface/peek-context.test.ts": 292,+ "issues/surface/selection-context.test.tsx": 613,+ "issues/surface/use-issue-group-branches.category.test.tsx": 970,+ "issues/surface/use-issue-group-branches.test.tsx": 1037,+ "issues/surface/use-issue-status-branches.category.test.tsx": 975,+ "issues/surface/use-issue-status-branches.test.tsx": 822,+ "issues/surface/use-issue-surface-catalog.test.tsx": 1208,+ "issues/surface/use-issue-surface-controller.test.tsx": 4910,+ "issues/utils/drag-utils.test.ts": 124,+ "issues/utils/filter.test.ts": 181,+ "issues/utils/sort-direction.test.ts": 82,+ "issues/utils/sort.test.ts": 90,+ "issues/utils/status-options.test.tsx": 710,+ "issues/utils/strip-mention-markdown.test.ts": 74,+ "issues/utils/workflow-columns.test.ts": 77,+ "lark/bind-page.test.tsx": 962,+ "layout/animated-right-sidebar.test.tsx": 746,+ "layout/app-rail.test.tsx": 1243,+ "layout/app-shell-context.test.tsx": 918,+ "layout/collection-page.test.tsx": 1342,+ "layout/compact-nav-sheet.test.tsx": 1113,+ "layout/feature-intro.test.tsx": 979,+ "layout/global-actions.test.tsx": 890,+ "layout/global-shortcuts.chat.test.tsx": 698,+ "layout/global-shortcuts.history.test.tsx": 831,+ "layout/global-shortcuts.test.ts": 829,+ "layout/help-launcher.test.tsx": 841,+ "layout/issue-page-refresh.test.tsx": 1022,+ "layout/list-column.test.tsx": 936,+ "layout/navigation-progress.test.tsx": 623,+ "layout/object-page.test.tsx": 1310,+ "layout/page-header.test.tsx": 1199,+ "layout/panels/autopilots-panel.test.tsx": 1459,+ "layout/panels/pinned-section.test.tsx": 1551,+ "layout/panels/show-in-sidebar.test.tsx": 850,+ "layout/panels/sidebar-settings.test.tsx": 2659,+ "layout/panels/sidebar-tree.test.tsx": 1250,+ "layout/panels/team-panel.test.tsx": 1814,+ "layout/panels/team-status.test.ts": 401,+ "layout/panels/views-section.test.tsx": 1513,+ "layout/panels/views-section.unread.test.tsx": 1511,+ "layout/panels/work-panel.test.tsx": 3391,+ "layout/panels/work-tree.catalog.test.tsx": 1303,+ "layout/panels/work-tree.test.tsx": 1824,+ "layout/rail-workspaces.test.tsx": 2073,+ "layout/refreshable-page-icon.test.tsx": 1362,+ "layout/route-data-prefetch.test.tsx": 1020,+ "layout/route-icon-components.test.tsx": 786,+ "layout/sidebar-auto-collapse.test.tsx": 809,+ "layout/sidebar-resize.test.tsx": 753,+ "layout/space-panel.test.tsx": 1008,+ "layout/tab-presentation.test.tsx": 2597,+ "locales/mcp.test.ts": 488,+ "locales/parity.test.ts": 1241,+ "locales/russian-plurals.test.ts": 1298,+ "members/member-detail-page.test.tsx": 1273,+ "modals/copy-parent-fields.test.tsx": 1714,+ "modals/create-issue-batch-continuation.test.tsx": 2792,+ "modals/create-issue-dialog.test.tsx": 792,+ "modals/create-issue.test.tsx": 8390,+ "modals/create-project-local-mode.test.tsx": 2576,+ "modals/create-project.test.tsx": 3565,+ "modals/create-squad.test.tsx": 1362,+ "modals/delete-issue-confirm.test.tsx": 928,+ "modals/feedback.test.tsx": 1002,+ "modals/issue-limit-upgrade-dialog.test.tsx": 1236,+ "modals/issue-parent-modals.test.tsx": 736,+ "modals/issue-picker-modal.test.tsx": 1797,+ "modals/mark-duplicate-issue.test.tsx": 3588,+ "modals/quick-create-issue.test.tsx": 1842,+ "modals/rename-issue.test.tsx": 1155,+ "modals/run-confirm.test.tsx": 1371,+ "modals/source-context-preview.test.tsx": 1748,+ "navigation/app-link.test.tsx": 784,+ "navigation/current-path.test.ts": 80,+ "navigation/use-back-or-replace.test.tsx": 990,+ "navigation/use-row-link.test.tsx": 608,+ "onboarding/components/onboarding-logout-button.test.tsx": 944,+ "onboarding/components/step-shell.test.tsx": 1086,+ "onboarding/onboarding-flow-mode.test.tsx": 2204,+ "onboarding/onboarding-flow-skip.test.tsx": 1896,+ "onboarding/source-backfill-merge.test.ts": 86,+ "onboarding/source-backfill-modal.test.tsx": 1658,+ "onboarding/steps/cli-install-instructions.test.tsx": 1205,+ "onboarding/steps/step-about-you.test.tsx": 1268,+ "onboarding/steps/step-platform-fork.test.tsx": 1635,+ "onboarding/steps/step-runtime-connect.test.tsx": 1165,+ "onboarding/steps/step-welcome.test.tsx": 1327,+ "onboarding/steps/step-workspace.test.tsx": 1158,+ "onboarding/templates/index.test.ts": 82,+ "platform/scroll-restoration.test.tsx": 594,+ "plugins/plugin-hook-actions.test.ts": 610,+ "plugins/plugin-hook-activity.test.ts": 255,+ "plugins/plugin-mcp-approval.test.ts": 277,+ "plugins/plugin-modal-surface.test.ts": 399,+ "plugins/plugin-panel-section.test.tsx": 1340,+ "plugins/plugin-sdk-handshake.test.ts": 177,+ "plugins/plugin-sdk-protocol.test.ts": 72,+ "plugins/surface-bridge.test.ts": 815,+ "plugins/surface-document.test.ts": 75,+ "projects/components/local-directory-hint.test.tsx": 865,+ "projects/components/local-directory-label.test.ts": 72,+ "projects/components/local-directory-mode-dialog.test.tsx": 959,+ "projects/components/project-date-pickers.test.tsx": 2767,+ "projects/components/project-detail.test.tsx": 1907,+ "projects/components/project-picker.open-state.test.tsx": 2105,+ "projects/components/project-picker.test.tsx": 1476,+ "projects/components/project-resources-github-ref.test.tsx": 1968,+ "projects/components/project-resources-local-directory.test.tsx": 1019,+ "projects/components/projects-page-delete.test.tsx": 3322,+ "projects/components/projects-page.test.tsx": 3727,+ "quick-actions/components/quick-action-dialog.test.tsx": 1363,+ "rich-content/app-url-link-routing.test.tsx": 1258,+ "rich-content/cdn-config-reactivity.test.tsx": 1160,+ "rich-content/current-issue-rendering.test.tsx": 1442,+ "rich-content/entity-link-unfurl.test.tsx": 1423,+ "rich-content/image-preview-sequence.test.tsx": 1842,+ "rich-content/lazy-rich-block.test.tsx": 607,+ "rich-content/package-exports.test.ts": 78,+ "rich-content/project-mention-a11y.test.tsx": 1349,+ "rich-content/rich-content-parity.test.tsx": 2071,+ "rich-content/rich-fence-block-ssr.test.tsx": 1132,+ "rich-content/rich-table-model.test.ts": 605,+ "rich-content/rich-table.test.tsx": 1884,+ "rich-content/streaming-fence.test.ts": 124,+ "runtimes/components/charts/activity-heatmap.test.tsx": 756,+ "runtimes/components/connect-remote-dialog.test.tsx": 3996,+ "runtimes/components/delete-runtime-dialog.test.tsx": 1094,+ "runtimes/components/machine-cli-section.test.tsx": 653,+ "runtimes/components/mika-runtime-choice.test.tsx": 1889,+ "runtimes/components/pending-runtime.test.ts": 74,+ "runtimes/components/qoder-configuration.test.tsx": 1512,+ "runtimes/components/qoder-detail-page.test.tsx": 2431,+ "runtimes/components/revoke-runtime-access-dialog.test.tsx": 1242,+ "runtimes/components/runtime-concurrency-field.test.tsx": 900,+ "runtimes/components/runtime-detail-page.test.tsx": 1492,+ "runtimes/components/runtime-detail-visibility.test.tsx": 2655,+ "runtimes/components/runtime-docs.test.ts": 75,+ "runtimes/components/runtime-list.test.ts": 1140,+ "runtimes/components/runtime-machines.test.ts": 204,+ "runtimes/components/runtime-profile-catalog.test.ts": 90,+ "runtimes/components/runtime-profiles-dialog.test.tsx": 1987,+ "runtimes/components/runtime-row-menu.test.tsx": 1409,+ "runtimes/components/runtime-settings-page.test.ts": 2060,+ "runtimes/components/runtimes-page.test.tsx": 3039,+ "runtimes/components/update-section.test.tsx": 841,+ "runtimes/components/usage-section.test.tsx": 1284,+ "runtimes/utils.test.ts": 128,+ "search/command-input.test.tsx": 901,+ "search/delegate/detect-instruction.test.ts": 81,+ "search/issue-target.test.tsx": 1546,+ "search/search-command.test.tsx": 13344,+ "search/search-command.visibility.test.tsx": 2050,+ "settings/components/billing-state.test.ts": 65,+ "settings/components/billing-tab.test.tsx": 13742,+ "settings/components/channels-tab.test.tsx": 1258,+ "settings/components/code-tab.test.tsx": 1694,+ "settings/components/code-vcs.test.tsx": 1734,+ "settings/components/composio-tab.test.tsx": 769,+ "settings/components/connected-apps-tab.test.tsx": 1289,+ "settings/components/delete-workspace-dialog.test.tsx": 1228,+ "settings/components/dingtalk-tab.test.tsx": 1469,+ "settings/components/issue-statuses-tab.test.tsx": 3724,+ "settings/components/keyboard-shortcuts-tab.test.tsx": 2850,+ "settings/components/labels-tab.test.tsx": 1457,+ "settings/components/lark-tab.test.tsx": 1568,+ "settings/components/mcp-tab.test.tsx": 6709,+ "settings/components/members-tab.test.tsx": 1524,+ "settings/components/plugins-tab.test.tsx": 1364,+ "settings/components/pr-merge-status-row.test.tsx": 1405,+ "settings/components/preferences-tab.test.tsx": 3547,+ "settings/components/repositories-section.test.tsx": 2679,+ "settings/components/seat-invite-purchase.test.ts": 62,+ "settings/components/settings-navigation.test.ts": 77,+ "settings/components/settings-page.test.tsx": 3101,+ "settings/components/settings-search.test.ts": 73,+ "settings/components/slack-tab.test.tsx": 1021,+ "settings/components/telegram-tab.test.tsx": 1665,+ "settings/components/use-auto-save.test.tsx": 1422,+ "settings/components/wakeups-tab.test.tsx": 1457,+ "settings/components/wecom-scan-install-dialog.test.tsx": 1040,+ "settings/components/wecom-tab.test.tsx": 2500,+ "settings/components/workspace-tab.test.tsx": 1389,+ "skills/components/create-skill-dialog.test.tsx": 4899,+ "skills/components/file-tree.test.tsx": 1486,+ "skills/components/refresh-skill-dialog.test.tsx": 1046,+ "skills/components/runtime-local-skill-import-panel.test.tsx": 1796,+ "skills/components/skill-detail-page.test.tsx": 4694,+ "skills/components/skill-file-path.test.tsx": 1458,+ "skills/components/skill-list-actions.test.tsx": 1375,+ "skills/components/skill-versions-tab.test.tsx": 1731,+ "skills/components/skills-page-filter-predicate.test.ts": 124,+ "skills/components/skills-page.header.test.tsx": 2647,+ "skills/components/skills-page.source-link.test.tsx": 1260,+ "skills/hooks/use-can-edit-skill.test.ts": 1280,+ "skills/lib/origin.test.ts": 95,+ "squads/components/squad-detail-page.test.tsx": 2311,+ "squads/components/squads-page.test.tsx": 1522,+ "telegram/bind-page.test.tsx": 787,+ "test/balanced-shards.test.ts": 110,+ "test/i18n.test.ts": 735,+ "wecom/bind-page.test.tsx": 744,+ "whats-new/whats-new-menu-panel.test.tsx": 2022,+ "workflows/handoff-confirm-dialog.test.tsx": 1316,+ "workflows/handoff-form.test.tsx": 1720,+ "workflows/project-workflow-row.test.tsx": 889,+ "workflows/workflow-editor-page.test.tsx": 2657,+ "workflows/workflow-pill.test.tsx": 1627,+ "workflows/workflows-tab.test.tsx": 1135,+ "workspace/no-access-page.test.tsx": 907,+ "workspace/paths-hooks.test.tsx": 802,+ "workspace/slug.test.ts": 106,+ "workspace/use-workspace-seen.test.ts": 608+ }+}diff --git a/packages/views/test/timing-reporter.ts b/packages/views/test/timing-reporter.tsnew file mode 100644index 0000000000..9b7027991e--- /dev/null+++ b/packages/views/test/timing-reporter.ts@@ -0,0 +1,38 @@+import { statSync, writeFileSync } from "node:fs";+import { relative, resolve } from "node:path";+import type { Reporter, TestModule, TestRunEndReason, Vitest } from "vitest/node";++/** Explicit opt-in reporter for refreshing the versioned shard weights. */+export default class TimingReporter implements Reporter {+ private root = "";++ onInit(ctx: Vitest) {+ if (ctx.config.shard) {+ throw new Error("Refresh shard timings with an unsharded run so every file is recorded.");+ }+ this.root = ctx.config.root;+ }++ onTestRunEnd(modules: readonly TestModule[], errors: readonly unknown[], reason: TestRunEndReason) {+ if (reason !== "passed" || errors.length || modules.some((module) => !module.ok())) {+ throw new Error("Shard timings are only refreshed after a successful full run.");+ }+ let totalCost = 0;+ let totalBytes = 0;+ const files: Record<string, number> = {};+ for (const module of [...modules].sort((a, b) => a.moduleId < b.moduleId ? -1 : 1)) {+ const diagnostic = module.diagnostic();+ const cost = Math.max(1, Math.round(+ diagnostic.environmentSetupDuration + diagnostic.prepareDuration ++ diagnostic.setupDuration + diagnostic.collectDuration + diagnostic.duration,+ ));+ files[relative(this.root, module.moduleId).replaceAll("\\", "/")] = cost;+ totalCost += cost;+ totalBytes += statSync(module.moduleId).size;+ }+ writeFileSync(resolve(this.root, "test/shard-timings.json"), JSON.stringify({+ millisecondsPerByte: totalCost / totalBytes,+ files,+ }, null, 2) + "\n");+ }+}diff --git a/packages/views/vitest.config.ts b/packages/views/vitest.config.tsindex d48661a415..650b18c945 100644--- a/packages/views/vitest.config.ts+++ b/packages/views/vitest.config.ts@@ -1,5 +1,6 @@import { defineConfig } from "vitest/config";import react from "@vitejs/plugin-react";+import BalancedSequencer from "./test/balanced-sequencer";export default defineConfig({plugins: [react()],@@ -8,5 +9,6 @@ export default defineConfig({globals: true,setupFiles: ["./test/setup.ts"],include: ["**/*.test.{ts,tsx}"],+ sequence: { sequencer: BalancedSequencer },},});diff --git a/scripts/check-ui-wildcard-exports.mjs b/scripts/check-ui-wildcard-exports.mjsindex 322e67d6f1..8b88fcd2ad 100755--- a/scripts/check-ui-wildcard-exports.mjs+++ b/scripts/check-ui-wildcard-exports.mjs@@ -39,14 +39,14 @@* or prose today; none currently point into packages/ui, but that is a* coincidence rather than a property.*- * Run: node scripts/check-ui-wildcard-exports.mjs+ * Run: node scripts/check-ui-wildcard-exports.mjs [repo-root]*/import { readdirSync, readFileSync, statSync } from "node:fs";import { dirname, join, relative, resolve, sep } from "node:path";import ts from "typescript";-const repoRoot = resolve(import.meta.dirname, "..");+const repoRoot = resolve(process.argv[2] ?? resolve(import.meta.dirname, ".."));const uiRoot = join(repoRoot, "packages", "ui");const pkgName = "@multica/ui";diff --git a/scripts/check-ui-wildcard-exports.test.sh b/scripts/check-ui-wildcard-exports.test.shindex a9dbeb8fe7..6ac1151dc5 100755--- a/scripts/check-ui-wildcard-exports.test.sh+++ b/scripts/check-ui-wildcard-exports.test.sh@@ -7,20 +7,34 @@# much as its proof that it still fires, hence this test.set -euo pipefail-root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"-check="$root_dir/scripts/check-ui-wildcard-exports.mjs"+source_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"+check="$source_root/scripts/check-ui-wildcard-exports.mjs"+mkdir -p "$source_root/.turbo"+root_dir="$(mktemp -d "$source_root/.turbo/ui-exports.XXXXXX")"ui_dir="$root_dir/packages/ui/components/ui"-out="$(mktemp)"-scratch=()+out="$root_dir/output.log"cleanup() {- rm -f "${scratch[@]+"${scratch[@]}"}" "$out"+ rm -rf "$root_dir"}trap cleanup EXIT-track() {- scratch+=("$1")+# Keep fixture imports and wildcard exports shaped like the real workspaces.+# The composite action checks the real repository once after these cases.+mkdir -p "$ui_dir" "$root_dir/packages/views" \+ "$root_dir/packages/ui/components/common" \+ "$root_dir/packages/ui/markdown" "$root_dir/packages/ui/hooks"+cat >"$root_dir/packages/ui/package.json" <<'EOF'+{+ "name": "@multica/ui",+ "exports": {+ "./components/ui/*": "./components/ui/*.tsx",+ "./components/common/*": "./components/common/*.tsx",+ "./markdown/*": "./markdown/*.tsx",+ "./hooks/*": "./hooks/*.ts"+ }}+EOFfail() {echo "FAIL: $*" >&2@@ -30,21 +44,19 @@ fail() {}expect_pass() {- if ! node "$check" >"$out" 2>&1; then fail "$1"; fi+ if ! node "$check" "$root_dir" >"$out" 2>&1; then fail "$1"; fi}expect_fail_naming() {- if node "$check" >"$out" 2>&1; then fail "$2"; fi+ if node "$check" "$root_dir" >"$out" 2>&1; then fail "$2"; fiif ! grep -Fq "$1" "$out"; then fail "check failed but did not name $1"; fi}-# 1. Clean tree passes. Runs first so a pre-existing dead file is reported as-# itself rather than surfacing later as a confusing probe failure.+# 1. The empty fixture passes before adding unused guarded files.expect_pass "check should pass on a clean tree"# 2. A component nothing imports fails the check and is named.probe="$ui_dir/zz-unused-export-probe.tsx"-track "$probe"cat >"$probe" <<'EOF'export function UnusedExportProbe() {return null@@ -56,20 +68,22 @@ expect_fail_naming "zz-unused-export-probe.tsx" \# 3. Importing it from a consumer clears the check — the guard tracks real# usage rather than just counting files.importer="$root_dir/packages/views/zz-probe-importer.tsx"-track "$importer"cat >"$importer" <<'EOF'export { UnusedExportProbe } from "@multica/ui/components/ui/zz-unused-export-probe";EOFexpect_pass "check should pass once a consumer imports the component"rm -f "$importer" "$probe"-# 4. Basename collision. 17 of the 59 guarded files share a name with some-# other file in the repo, so a check that matched relative imports by-# basename would pass this dead component. `option-card` is real:-# packages/views/onboarding/components/option-card.tsx is imported as-# `../components/option-card` and must not vouch for the packages/ui file.+# 4. A relative import of a same-named file outside UI cannot vouch for it.+mkdir -p "$root_dir/packages/views/onboarding/components" \+ "$root_dir/packages/views/onboarding/steps"+cat >"$root_dir/packages/views/onboarding/components/option-card.tsx" <<'EOF'+export function OptionCard() { return null; }+EOF+cat >"$root_dir/packages/views/onboarding/steps/welcome.tsx" <<'EOF'+export { OptionCard } from "../components/option-card";+EOFcollide="$ui_dir/option-card.tsx"-track "$collide"cat >"$collide" <<'EOF'export function OptionCard() {return null@@ -83,8 +97,6 @@ rm -f "$collide"# from outside the guarded directories, not a reference count.pair_a="$ui_dir/zz-cycle-a.tsx"pair_b="$ui_dir/zz-cycle-b.tsx"-track "$pair_a"-track "$pair_b"cat >"$pair_a" <<'EOF'import { CycleB } from "./zz-cycle-b";export function CycleA() {@@ -107,8 +119,6 @@ rm -f "$pair_a" "$pair_b"# scan would keep vouching for it exactly when it stops being used.comment_probe="$ui_dir/zz-comment-probe.tsx"mention="$root_dir/packages/views/zz-probe-mention.ts"-track "$comment_probe"-track "$mention"cat >"$comment_probe" <<'EOF'export function CommentProbe() {return null@@ -134,9 +144,6 @@ for entry in components/ui:tsx components/common:tsx markdown:tsx hooks:ts; dotest_file="$root_dir/packages/ui/$dir/zz-unused-runtime.test.$ext"product="$root_dir/packages/ui/$dir/zz-unused-runtime.$ext"spec="$root_dir/packages/ui/$dir/zz-not-discovered.spec.$ext"- track "$test_file"- track "$product"- track "$spec"cat >"$test_file" <<'EOF'import { it, expect } from "vitest";it("discovered", () => { expect(true).toBe(true); });@@ -184,7 +191,6 @@ rm -f "$pair_a" "$pair_b" "$importer"# 9. Mock-only mentions do not import a product module.mock_probe="$ui_dir/zz-mock-only.tsx"-track "$mock_probe"cat >"$mock_probe" <<'EOF'export function MockOnly() { return null; }EOF