Skip to content

finding(test-infra): packages/app-shell/src/hooks/__tests__/useAiSurface.test.ts pays +7 s to inherit the @object-ui/plugin-chatbot barrel it mocks — the only file of eleven whose graph reached none of the barrel's 454 modules #8208

Description

@baozhoutao

Filed by the domain:devx @ objectui execution seat (PM session session_01FhBNJcLRZLe8M87VcUgpKr, R46, 2026-09-07T01:03Z) from the open question in the objectui#6892 slice-10 report (PR #8207, head e104c509d). The slice shipped all eleven factories inheriting; this is the one file where the cost is real, and the narrowing it points at is a behavioural test edit outside that slice's ruling. Dedup: an MCP issue search for the file and its cost returns nothing; the control query returns objectui#8202.

What the slice measured (e104c509d, light dom project via domTsTests)

file frozen inheriting marginal
packages/app-shell/src/hooks/__tests__/useAiSurface.test.ts 0.68 s 7.77 s +7.09 s (11.4×)
the other ten converted files +0.4 … +0.8 s each
all eleven as one invocation 25.6 s 28.6 s +2.7 s (~10%), 64/64 green in both states

Mechanism, measured rather than argued: ten of the eleven files already load 422 of the barrel's 454 modules at module scope through their other imports, so inheriting adds 32 modules. This file loads zero of them — it mocks the barrel and imports only the hook — so inheriting pulls the entire 454-module graph (components 206, core 95, react 64, …) plus 58 external leaves into a spec that previously ran in under a second.

Why it shipped inheriting anyway, and what this card is for

The vi-mock gate admits a specifier only at zero frozen call sites and its header forbids a per-file exception list (objectui#8117 / objectui#8202 are about that pin), so "sweep ten, skip one" was not an available shape; the aggregate +2.7 s is what CI pays and the slice was accepted on it. The follow-up the dev proposed (option C): narrow this file's mock to the hook's own seam — mock what useAiSurface actually imports (a sub-module or a specific export path) rather than the package barrel — so the test stops depending on the barrel at all and the 7 s goes away without a frozen factory. That is a test-behaviour change: whoever takes it re-measures (vitest run <file> three runs before/after), keeps the gate green (the file may stop naming the specifier entirely, which drops it from the census — fine), and touches nothing under packages/plugin-chatbot/src/**.

Size: S. Same class as objectui#8185 (a mock of a module the test does not need), from the other direction.

Verification recipe

git fetch origin main
git grep -n "vi.mock('@object-ui/plugin-chatbot'" origin/main -- packages/app-shell/src/hooks/__tests__/useAiSurface.test.ts
git grep -n "^import" origin/main -- packages/app-shell/src/hooks/useAiSurface.ts

Refs objectui#6892, PR #8207, objectui#6580, objectui#8173.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    domain:devxobjectui devx stream: fix lands on .github/, scripts/ or release pipeline — devx lane cross-repotests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions