3.3 KiB
Why
A repo-wide audit on 2026-05-03 found 19 packages importing test-runner primitives (describe, it, expect, vi) directly from vitest instead of from the canonical @suaveplan/testing/runner re-export wrapper. The wrapper exists precisely so the runner can swap (vitest ↔ bun:test ↔ future runners) via a single conditional export — but a package that bypasses it pins itself to vitest and breaks the dual-runner contract already specified in testing spec → "Central runner subpath". The drift accumulated silently during the bitpacker port, network rewrite, and voice/third-party-elevenlabs split because nothing in CI flags it.
What Changes
- Migrate 19 packages from
from "vitest"tofrom "@suaveplan/testing/runner"(and the equivalentbun:testdirect imports where present in non-infra packages).- bitpacker (7):
bitpacker-compressed,bitpacker-crypto,bitpacker-delta,bitpacker-network,bitpacker-schema,bitpacker-strategies,bitpacker-streaming - network (7):
network,network-failover,network-governance,network-plugin-protocol,network-plugin-registry,network-plugin-webrtc,network-topology - crypto (2):
crypto/crypto,crypto/crypto-cli - other (3):
media/voice,storage/storage,audio/third-party-elevenlabs
- bitpacker (7):
- Codify the rule as a new requirement in the
monorepo-structurecapability (forbid directvitest/bun:testimports outside an exempt allowlist of testing-infra packages). - Add a CI grep gate (alongside the existing §13 barrel-export gate) that fails the build if a non-exempt package imports
vitestorbun:testdirectly. - Document the rule in
CLAUDE.md(Critical Rules) andopenspec/AGENTS.md(§6b or adjacent to §6a) with the verification grep. - Treat the rule as a migration prerequisite: when porting a package from upstream, runner imports MUST be rewritten as part of the port (mirrors the §6a "convert
export *during migration, not as follow-up" pattern).
This is not a breaking change for runtime consumers — it only reshapes test-file imports. Test behaviour, test counts, and coverage MUST be byte-identical after migration.
Capabilities
New Capabilities
(none)
Modified Capabilities
monorepo-structure: ADD a requirement that forbids directvitest/bun:testimports from non-exempt packages and codifies the testing-infra exemption list. Existing requirements unchanged.
Impact
- Test files only. No runtime / production source touched. No public API changes.
- Affected files: ~150–250
*.test.tsfiles across the 19 packages (count to be confirmed during apply). - CI pipeline: one new grep-based check in the lint/typecheck stage, mirrors the existing barrel-export gate. Expected runtime <1s.
- Docs:
CLAUDE.mdCritical Rules section gains a new rule (numbered after current rule 10);openspec/AGENTS.mdgains a sibling rule next to §6a.MANIFEST.mdunchanged (rule is repo-level, not per-package). - Risk: low. The
@suaveplan/testing/runnersubpath is already battle-tested by the 107 packages that use it today. Migration is a mechanical sed-style rewrite verified bybunx turbo test --filter=<pkg>post-migration. - Out of scope: dev/testing-* infra packages (5) keep their direct
vitest/bun:testimports — they author the wrapper.