Skip to content

[finding] packages/cli/vitest.config.ts says this package has three vi.mock targets — there are eight, and two more are workspace packages the same paragraph tells you to re-check #13873

Description

@claude

Found while re-measuring the packages/cli suite for #13504, on origin/main at
f532630d02. Not that card's defect and not fixed there: different defect class (a stale
claim in a docblock, not suite cost), and the card it was found on is a measurement card.

The claim

packages/cli/vitest.config.ts, in the server.deps.external section (lines 415-421):

// COSTS, so the next person extending this list knows what they buy: an
// externalised package cannot be `vi.mock`ed and is not instrumented for
// coverage. Both were checked against this package when the entry landed —
// `packages/cli` has no `vi.mock` of `@objectstack/types` (its only mock targets
// are `../utils/optional-package.js`, `node:fs/promises` and
// `@objectstack/cloud-connection`) — but neither is free, and a package added
// here later must be re-checked for both.

What is actually there today

The half about @objectstack/types is still TRUE — nothing in this package mocks it. The
parenthesis is not. git grep over packages/cli/**/*.test.ts returns eight distinct
mock targets, not three:

target kind site
../utils/optional-package.js relative 3 sites
node:fs/promises node builtin 1
@objectstack/cloud-connection workspace src/commands/doctor-ledger-read-failure.test.ts:754
@objectstack/platform-objects/plugin workspace src/commands/secret/orphans.guards.test.ts:48
@objectstack/lint workspace test/i18n-flow-screen-coverage.test.ts:57
../../utils/api-client.js relative 2 sites
../../utils/secret-reference-union.js relative 1
../../utils/schema-migrate.js relative 1

Reproduce:

git grep -ohE "vi\.(do)?mock\(\s*'[^']+'" -- 'packages/cli/**/*.test.ts' | sort -u

Why the staleness is load-bearing rather than cosmetic

The sentence exists to be READ BY THE NEXT EDITOR, and it says so in its own last clause:
"a package added here later must be re-checked for both." The list is the re-check's
starting point. As written it names exactly one workspace package, so a reader doing that
re-check honestly concludes that externalising a workspace package is free of mock
conflicts. Two more workspace packages are mocked today — @objectstack/lint and
@objectstack/platform-objects/plugin — and externalising either would break the file
that mocks it, with an error that points at the test rather than at the config entry that
caused it.

That is the same failure shape as #12529 on this very file: a document that sends the
reader to the right place and then tells them what they will find, so they do not look.

Not claimed here

This is not an argument that anything should be externalised — the #13504 measurement
found no speed warrant for widening that list, and the #11775 resolution warrant is
untouched. The defect is only that the parenthesis is a 2026-era census presented in the
present tense.

Suggested shape of a fix

Either drop the enumeration and give the reader the command (the list will rot again), or
keep the census and stamp it with the commit it was taken on, which is the convention the
rest of this file already adopted after #12499.


Generated by Claude Code

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions