Initial Commit

This commit is contained in:
2026-05-27 23:29:53 +01:00
commit fbc70f96e6
10000 changed files with 1102152 additions and 0 deletions

View File

@@ -0,0 +1,84 @@
> Spec-coherence change. Most implementation work is already done in the 2026-04-24 wave; tasks marked `[x]` reflect that. Tasks marked `[ ]` are normative or cleanup work this change introduces.
## 0. Pre-flight (non-negotiable)
- [ ] 0.1 Confirm clean working tree (`git status` reports nothing) and no in-flight worktrees with uncommitted work (`git worktree list` then `git status` in each)
- [ ] 0.2 If any worktrees exist under `.claude/worktrees/`, account for each one: still-active agent, work-pending-merge, or stale-and-prune. Stale worktrees MUST be removed (`git worktree remove`) before opening a new one — code that has been lost twice on main is the failure mode this guards against.
- [ ] 0.3 Confirm the package set in `MANIFEST.md` matches `find packages -maxdepth 3 -name package.json` count. Drift here means a prior change archived without regenerating the manifest.
## 1. Audit-driven prep
- [x] 1.1 Read the umbrella design at `/mnt/s/web/genesis/docs/superpowers/specs/2026-04-24-enterprise-testbed-design.md`.
- [x] 1.2 Read the three implementation plans at `/mnt/s/web/genesis/docs/superpowers/plans/2026-04-24-testing-integration-core.md`, `/mnt/s/web/genesis/docs/superpowers/plans/2026-04-24-testing-integration-plugins.md`, `/mnt/s/web/genesis/docs/superpowers/plans/2026-04-24-testbed-pages-and-e2e.md`.
- [x] 1.3 Read the audit at `/mnt/s/web/genesis/docs/superpowers/specs/2026-04-25-test-suite-audit.md`.
- [x] 1.4 Confirm the seven packages exist on disk under `packages/testing/`.
## 2. `testing-integration` (core) — already implemented
- [x] 2.1 `ServiceFixture<TConfig>` interface + `InferConfig<F>` utility.
- [x] 2.2 `HealthPoller` with configurable interval / timeout / sleep injection.
- [x] 2.3 `TestEnvironment` with parallel-start / reverse-stop and the `started` double-start guard.
- [x] 2.4 `skipIfUnavailable()` helper (Vitest `inject()`).
- [x] 2.5 `createIntegrationSetup()` factory + Vitest global-setup bridge.
- [x] 2.6 OTel counters / histograms / spans for every public entrypoint.
- [x] 2.7 100 % Istanbul coverage on the package.
## 3. `testing-integration` (core) — new normative work landed by this change
- [ ] 3.1 Add `dependsOn?: readonly string[]` to `ServiceFixture<TConfig>` and topo-sort in `TestEnvironment.setupAll()`. Stop reverses the same order.
- [ ] 3.2 Extend `TestEnvironmentOptions` with `clock?: Clock; rng?: Rng; signal?: AbortSignal` and propagate to fixture configs whose options declare `acceptsContext: true`.
- [ ] 3.3 Implement leak / handle-tracker assertion at end of `teardownAll()`; emit warning + `testing.integration.leak.count` increment on detection.
- [ ] 3.4 Implement `markFlaky({ retries, reason })` wrapper + per-package `quarantine.json` enumeration.
- [ ] 3.5 Rename inject-key `__integration_failed__` → `__suaveplan_integration_failed__` across `create-integration-setup.ts`, `skip-if-unavailable.ts`, and tests.
- [ ] 3.6 Replace every literal `95 %` in `docs/superpowers/plans/2026-04-24-*.md` with `100 %` (sed-style sweep).
- [ ] 3.7 Add property-based round-trip tests for `HealthPoller` retry arithmetic and `TestEnvironment` topo-sort using `fast-check`.
## 4. Per-plugin specs (already implemented; this change only lifts to spec)
- [x] 4.1 `testing-integration-surrealdb` v3.0.4 image, HTTP `/health`, random password, three env vars.
- [x] 4.2 `testing-integration-redis` Redis 7, TCP PING, `REDIS_URL` parsing.
- [x] 4.3 `testing-integration-postgres` PostgreSQL 16, `pg_isready` exec, `POSTGRES_URL`.
- [x] 4.4 `testing-integration-mailpit` API health, `assertMail()` partial-subject + exact-address matching, two env vars.
- [x] 4.5 `testing-integration-typesense` Typesense 27, `{ ok: true }` health, random API key.
- [x] 4.6 `testing-integration-garage-s3` Garage v2.0.0, dual-port 3900/3902, 7-step init, four env vars.
## 5. Per-plugin normative work landed by this change
- [ ] 5.1 Each plugin's package surface MUST expose `INTEGRATION.<PLUGIN>.*` error codes via a `codes` const re-exported from the barrel (audit alignment with the testing-error pattern).
- [ ] 5.2 Each plugin's `ServiceFixture` config schema (Zod) lists every env-bridge variable name; spec scenarios assert `env()` returns the full set.
- [ ] 5.3 Each plugin marks the `acceptsContext: true` option (where the config can deterministically take a `clock` / `rng`).
## 6. `testing-e2e` — already implemented
- [x] 6.1 `attachConsoleMonitor(page)` with `errors`, `warnings`, `assertNoErrors()`, `assertNoWarnings()`, filter options.
- [x] 6.2 `attachNetworkMonitor(page)` with `failures`, `assertNoFailures()`.
- [x] 6.3 Multi-session WebRTC fixture (`createMultiSessionFixture`).
- [x] 6.4 Extension fixture (`extendTestWithExtension`).
## 7. `testing-e2e` — new normative work landed by this change
- [ ] 7.1 Extend `attachNetworkMonitor` with `assertNoMissingAssets()`, `assertNoMixedContent()`, `assertNoCorsErrors()`.
- [ ] 7.2 Default-deny network sandbox in `createPlaywrightConfig`: `page.route('**/*')` blocks external origins unless `allowedOrigins` is provided.
- [ ] 7.3 Multi-session fixture exposes `disableSignalingRoute()` chaos hook (already partial in plan).
## 8. `testing` capability — coverage / property / determinism updates
- [ ] 8.1 In the canonical spec delta, replace `≥ 95 %` with `100 %` on every dimension; remove the foundation carve-out language.
- [ ] 8.2 Broaden the property-based requirement from "the `@suaveplan/testing` package" to every pure-function `@suaveplan/*` package (citing `crypto-utils`, `diff`, `pagination`, `validation`).
- [ ] 8.3 Add a clarifying scenario tying the deterministic `Clock`/`Rng`/`AbortSignal` contract to `TestEnvironmentOptions` propagation.
## 9. Spec validation
- [ ] 9.1 `openspec validate enterprise-testing-integration --type change` passes.
- [ ] 9.2 Diff each plugin spec against the implementation plan to confirm no requirement contradicts shipped code.
## 10. Pre-publish gate per package (run when each plugin next ships)
- [ ] 10.1 `bunx turbo lint typecheck test --filter=@suaveplan/testing-integration` green.
- [ ] 10.2 `bunx turbo test:coverage --filter=@suaveplan/testing-integration` at 100 %.
- [ ] 10.3 Repeat 10.1 / 10.2 for each of `testing-integration-{surrealdb,redis,postgres,mailpit,typesense,garage-s3}`.
## 11. Archive
- [ ] 11.1 Fold each spec delta into the matching `openspec/specs/<capability>/spec.md` (creating the file for new capabilities, MODIFIED-merging for `testing` and `testing-e2e`).
- [ ] 11.2 Move `openspec/changes/enterprise-testing-integration/` → `openspec/archive/<yyyy-mm-dd>-enterprise-testing-integration/`.