Skip to content

Commit e8b3c7c

Browse files
claude[bot]claude
andcommitted
docs(cli): stamp the vitest mock-target census, and name all three mocked workspace packages
The `server.deps.external` COSTS paragraph told the next editor to re-check whether a package they externalise is mocked here, then named its census in the present tense: three targets, one of them a workspace package. There are eight targets over eleven sites, and three of them are workspace packages (`@objectstack/cloud-connection`, `@objectstack/platform-objects/plugin`, `@objectstack/lint`) — so the re-check's own starting point said that externalising a workspace package was free of mock conflicts. Comment-only. Stamped with the commit it was taken on, matching the convention this file adopted after #12499 and re-used by #13872's import-term section. Also records the case trap that makes a naive `vi\.(do)?mock\(` grep drop every `vi.doMock` site — a third of the census, silently. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UngCYXF98BVpYA9hfz6NYk
1 parent 55519d5 commit e8b3c7c

1 file changed

Lines changed: 40 additions & 5 deletions

File tree

packages/cli/vitest.config.ts

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -414,11 +414,46 @@
414414
//
415415
// COSTS, so the next person extending this list knows what they buy: an
416416
// externalised package cannot be `vi.mock`ed and is not instrumented for
417-
// coverage. Both were checked against this package when the entry landed —
418-
// `packages/cli` has no `vi.mock` of `@objectstack/types` (its only mock targets
419-
// are `../utils/optional-package.js`, `node:fs/promises` and
420-
// `@objectstack/cloud-connection`) — but neither is free, and a package added
421-
// here later must be re-checked for both.
417+
// coverage. Both were checked against this package when the entry landed, and
418+
// a package added here later must be re-checked for both — so the census that
419+
// re-check starts from is stated below, on the commit it was taken on.
420+
//
421+
// ## THE MOCK-TARGET CENSUS (#13873) — 55519d5036, 2026-08-31
422+
//
423+
// `@objectstack/types`, the one package externalised below, is NOT mocked here.
424+
// Zero sites — and the zero is not vacuous: 10 test files import it (both
425+
// `@objectstack/types` and `@objectstack/types/node`), so a mock of it is a
426+
// thing that could exist here and does not. That half has held since #11775.
427+
//
428+
// What a reader externalising something ELSE needs: 11 mock sites over 8
429+
// distinct targets. Five are relative or node-builtin specifiers, which this
430+
// predicate cannot reach. THREE are workspace packages, which it can:
431+
//
432+
// @objectstack/cloud-connection src/commands/doctor-ledger-read-failure.test.ts
433+
// @objectstack/platform-objects/plugin src/commands/secret/orphans.guards.test.ts
434+
// @objectstack/lint test/i18n-flow-screen-coverage.test.ts
435+
//
436+
// ⭐ THREE, not the one this paragraph named until #13873 — and naming one was
437+
// worse than naming none. The sentence above sends the reader here to do a
438+
// re-check and then tells them what they will find, so a reader who trusted it
439+
// concluded that externalising a workspace package is free of mock conflicts in
440+
// this package. Externalising any of the three breaks the file that mocks it,
441+
// with an error pointing at that test rather than at the entry below that
442+
// caused it. Same shape as #12529 on this file.
443+
//
444+
// ⚠️ RE-TAKING IT: match the capital M, or you silently lose a third of the
445+
// census and get a plausible number back.
446+
//
447+
// git grep -nE "vi[.](do)?[Mm]ock[(]" -- 'packages/cli/**/*.test.ts'
448+
//
449+
// `vi.(do)?mock(` — the obvious spelling — matches no `vi.doMock` call at all,
450+
// so it drops all four `doMock` sites, among them `@objectstack/cloud-connection`:
451+
// the ONE workspace package the old parenthesis did name. #13873 shipped that
452+
// spelling as its reproduce command while its table was taken another way, and
453+
// the two disagree by exactly those two targets — re-run on the card's own
454+
// commit, the command returns 6 where the table says 8. Whoever re-takes this:
455+
// print your commit here, and keep the census in exactly one place in this
456+
// file (#12499).
422457
//
423458
// ## WHY THE SPAWN SWAP IS NOT THIS GATE'S TRADE TO REFUSE (#11707, #12460)
424459
//

0 commit comments

Comments
 (0)