Skip to content

finding(test-infra): 298 more vi.mock factories freeze a workspace package's export surface — the per-specifier sweep worklist #6892

Description

@os-sam

Surfaced while implementing #6849. Filed unassigned. Deliberately not fixed there — that card installs the ratchet on the one specifier that has been swept; this is the population the ratchet cannot cover yet.

What was measured

#6849's guard (scripts/check-vi-mock-inherit.mjs) classifies every vi.mock factory in the tree by whether it OBTAINS the real module (a callback parameter under any name, or vi.importActual of the same specifier) and SPREADS it. Run over all 1,499 call sites at 9ce20233f, restricted to workspace specifiers:

workspace-specifier call sites : 545
  inherits                     : 240
  frozen                       : 299   <- 1 on @object-ui/react (fixed in #6849), 298 elsewhere

Per specifier:

specifier frozen
@object-ui/auth 92
@object-ui/i18n 34
@object-ui/collaboration 25
@object-ui/plugin-form 24
@object-ui/components 22
@object-ui/permissions 20
@object-ui/app-shell 20
@object-ui/plugin-grid 17
@object-ui/plugin-chatbot 11
@object-ui/plugin-designer 10
@object-ui/fields 8
@object-ui/plugin-list 6
@object-ui/plugin-detail 4
@object-ui/plugin-dashboard 2
@object-ui/plugin-markdown, @object-ui/data-objectstack, @object-ui/plugin-report 1 each

Reproduce with the guard on this tree:

node scripts/check-vi-mock-inherit.mjs --list

...and widen COVERED_SPECIFIERS locally to re-derive the table. ⛔ Do not commit a widened list without the sweep — see below.

Why each of these is the same defect

A factory that hand-lists its exports pins the mock at whatever was typed that day. The next export any module in the file's import graph reads AT MODULE SCOPE resolves to undefined and the file dies during COLLECTION. Measured on #6768: Test Files 3 failed | 546 passed with Tests 6694 passedzero failed assertions, because those files' tests never ran. It reads as flake, and the bill lands on whoever added the export, in a red suite that does not point at them.

@object-ui/auth at 92 sites is worth its own sentence: it is the single largest frozen population in the tree and it is a package whose surface grows.

Why the guard cannot simply be widened today

Triage's ruling on #6849 (R+34) was NARROW, on the explicit ground that the gate is free while the tree is at zero — "窄口径今天是免费的。树在 0/106,门以棘轮起步". That is true of @object-ui/react and of nothing else: pointing the same gate at every @object-ui/* specifier lands it RED on 298 sites, which is a sweep, not a ratchet.

Triage also ruled out the escape hatch, and was right to: "宽了以后要收窄,是在一堆红里做例外表 —— 那正是例外表长成沼泽的路径". A 298-entry exemption ledger is exactly that swamp.

So the guard's COVERED_SPECIFIERS is grow-only and its documented widening precondition is a sweep, per specifier: convert that specifier's frozen factories to the inheriting form, confirm the guard reads zero for it, and add it to the list in the same PR. That is what this card is the worklist for.

Suggested shape

One card per specifier rather than one card for 298 sites — each is independently landable, each ends with a one-line addition to COVERED_SPECIFIERS, and a stalled one blocks nothing. @object-ui/auth first, on population; @object-ui/plugin-markdown / @object-ui/data-objectstack / @object-ui/plugin-report are one site each and are effectively free.

PR #6847 is the worked example of the conversion (25 sites, with a two-leg ablation demonstrating the failure and its removal).

⚠️ Re-derive the numbers before acting on them. They are a snapshot at 9ce20233f, taken with the guard rather than with a grep — and the whole reason #6849 exists is that the previous figures came from a grep and were wrong in both directions.

Related: #6580 (a different importOriginal concern — the ~10s cost of inheriting through the source-aliased @object-ui/app-shell barrel). Worth reading before sweeping @object-ui/app-shell's 20, since inheriting is what that card measures the cost of.

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-repofindingpm:queuepriority:p2tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions