Skip to content

[finding] packages/cli's optional-package probe pays a whole-package vitest transform inside a 5000ms budget — 707ms in node, >5000ms under vitest (second instance of #16497's class) #17180

Description

@claude

Second measured instance of the class #16497 already records in packages/core ("a pin awaits a dynamic import of the whole package index under vitest's default 5000ms timeout, and timed out once in two full-suite runs on a shared box"). #16497 fixes one pin; this is a different pin, in a different package, with the same mechanism — so the maintainer may prefer to widen that card into a class fix rather than take this one on its own.

Found while running packages/cli's unit tier for objectstack#15951, whose diff touches neither packages/cli nor packages/cloud-connection.

Measured (this branch's tree, content-identical to origin/main 5d12b16e for both files involved; 2026-09-09)

packages/cli/src/utils/optional-package.test.ts:108"resolves a real workspace package rather than mistaking it for absent" — calls loadOptionalPackage('@objectstack/cloud-connection') under vitest's default 5000ms budget.

  • With packages/cloud-connection/dist absent: the test fails with state: 'broken' (the honest unbuilt-artifact reading).
  • With that dist built: the failure changes shape to Error: Test timed out in 5000ms, and it reproduces on a warm re-run — 5004ms, 5010ms across two runs.
  • The same import in plain node, from the same directory, same built dist: 707ms.

⇒ The 7x gap is not import cost. It is the hazard scripts/check-test-source-alias.mjs documents in its own header: every workspace package here is a pnpm link whose realpath contains no /node_modules/ segment, so vitest's default server.deps.external inlines it — dist/ included. Under vitest the call therefore pays a whole-package source-graph transform, not a dist import, and the test's budget was sized against the latter.

Control, and what it says

CI is green on origin/main 5d12b16e for this content (Test Core, all six shards, success). ⇒ This is not a red main and not a broken test — it is a budget with no headroom, which spends it all on a shared, contended box and none on an idle CI runner. That is exactly #16497's reading, one package over.

⛔ Recording the shape rather than proposing the fix: raising a timeout is the reflex, and the two candidate reads (raise the budget vs. stop paying a source-graph transform for what is meant to be a dist-resolution probe) are not the same decision. The second one is the one that also makes the test measure what its name says.

Not in this card

objectstack#15951's own suites; anything in @objectstack/verify.

Refs: #16497 (same class, packages/core) - #11412 (the inlining hazard, measured) - scripts/check-test-source-alias.mjs header - objectstack#15951 (where this was found).


Generated by Claude Code

Activity

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

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions