4.7 KiB
Why
The genesis monorepo already ships six @suaveplan/testing-integration-* plugin packages (SurrealDB, Redis, Postgres, Mailpit, Typesense, Garage S3) implementing the ServiceFixture<TConfig> interface from @suaveplan/testing-integration. The 2026-04-25 test-suite documentation audit at /mnt/s/web/genesis/docs/superpowers/specs/2026-04-25-test-suite-audit.md (§1, "Coverage gaps in service fixtures") flags the existing plugin set as too narrow for the published package list:
@suaveplan/oauth-clientships an Authorization Code + PKCE / Client Credentials / OIDC discovery client, but there is no OIDC issuer fixture, so its integration suite cannot exercise a real flow against a real issuer.@suaveplan/db-sqliteexists, but no fixture covers MongoDB or MySQL — both are in the standard data-tier surface for downstream apps.@suaveplan/garage-s3is the only object-store fixture; Garage's quirks (admin-port health, layout assignment, custom init sequence) mask AWS-S3 surface differences that show up against MinIO.@suaveplan/eventsplus future stream-processing work has no broker fixture; NATS is the lightest option for a first wave.
Per CLAUDE.md rule 5 ("preserve the full public surface") and rule 2 ("complete all implementations — no stubs"), each of these plugins must be specified normatively before code is written, mirroring the existing six-plugin pattern (image policy, env-bridge, healthcheck, config shape, error-code prefix, injectable fakes, plugin-specific scenarios).
What Changes
This change adds five new capabilities, one per plugin package, using the same shape as the existing testing-integration-* capabilities:
testing-integration-oidc— Keycloak (preferred) oroauth2-mock-server(lighter alt), exercised by@suaveplan/oauth-clientintegration tests.testing-integration-mongodb—mongo:7.0, with optional replica-set initialisation for transactions/change-streams.testing-integration-mysql—mysql:8.4, with charset/collation override andmysqladmin pinghealth.testing-integration-minio—minio/miniowith random keys and bucket pre-seeding via the admin API; lives alongside the Garage S3 fixture to expose AWS-S3 surface differences.testing-integration-nats—nats:2.10-alpine, optional JetStream + cluster + auth modes, NATS-CLI seeding via injectableexecFn.
Each plugin spec mandates:
- Pinned image with minor tag plus a
TODOplaceholder for the sha256 digest (preserves the existing six-plugin policy). - Env-bridge passthrough — when documented env vars are present and non-empty, no container is started; the fixture returns a config pointing at the live service.
- Healthcheck — a deterministic readiness probe with a documented default timeout.
- Config shape — TypeScript interface plus a sibling
*.schemas.tsZod schema reference. - Error-code prefix —
INTEGRATION.<SERVICE>.*(matching theINTEGRATION.SURREALDB.*,INTEGRATION.GARAGE_S3.*precedent). - Injectable fakes —
containerFactory, plus per-pluginfetchFn,execFn, ortcpPingFnso unit tests reach 100% Istanbul coverage without Docker. - Plugin-specific scenarios — at least three behavioural scenarios per fixture, expressed as
WHEN/THENpairs.
dependsOn?: string[] (the wave-1 ServiceFixture extension flagged by audit §3) is referenced where relevant, e.g. an OIDC-protected app fixture would dependsOn: ['oidc']. The field itself is specified by testing-integration (out of scope for this change); plugins MUST tolerate its presence in TestEnvironmentOptions.
Capabilities
New Capabilities
testing-integration-oidctesting-integration-mongodbtesting-integration-mysqltesting-integration-miniotesting-integration-nats
Modified Capabilities
(none — additive; existing plugin specs are untouched)
Impact
- Affected code: five new packages under
packages/testing/testing-integration-<name>/(implementation in a follow-up plan). - Affected consumers: none yet on genesis. Once shipped,
@suaveplan/oauth-client,@suaveplan/events, future@suaveplan/db-mongodb/db-mysql, and any S3-API consumer become eligible for real-service integration coverage. - Catalogs:
testcontainersalready lives incatalog:integration(added by the original six-plugin wave); no new external deps. - Pre-publish gate: unchanged —
bunx turbo lint typecheck test --filter=@suaveplan/testing-integration-<name>plus 100% Istanbul coverage peropenspec/AGENTS.md§7. - Deferred (audit §1, not in this change): Elasticsearch/OpenSearch, Vault, LocalStack, Caddy/nginx reverse-proxy, Kafka, OpenTelemetry collector. Each is a separate future change to keep this proposal scoped.