{"slug":"strategy/business-strategy/TEST_STRATEGY","title":"Test Strategy — Unit CI vs Live Verification","section":"strategy","sectionLabel":"Strategy","status":"unclassified","type":"document","path":"strategy/business-strategy/TEST_STRATEGY.mdx","bytes":3901,"description":null,"updated":null,"source":"integratewise/Integratewise-docs-wiki","content":"\n> **Tier:** B (Derived). References Canon: `AGENTS.md`, `docs/CANON.md`.\n> **Date:** June 12, 2026\n\n## The split (Option A)\n\n```text\nUnit CI  (.github/workflows/ci.yml)          — runs on every push/PR, BLOCKING on guardrails\n  Validate (blocking):  typecheck · lint · build      ← all green\n  Unit Tests (non-blocking signal): active-package vitest        ← see harness debt below\n\nLive Verification  (.github/workflows/live-verification.yml)     — manual / post-deploy\n  e2e:          Projection-context regression (CS persona) + Playwright suite\n                (onboarding · workspace · gateway-wiring)\n  integration:  Flow A/B/C (needs deployed infra)\n```\n\n### First-class guard: Projection Context (CS persona)\n\n`apps/web/e2e/projection-context.spec.ts` runs as the **first** step of the `e2e` job. It asserts a\nCUSTOMER_SUCCESS persona resolves to ONE context across header/nav/workbench\n(`data-iw-projection-department` === `data-iw-active-domain` === `CUSTOMER_SUCCESS`; no\n\"Business Operations\" leak). Proven **bidirectional locally**: it passes with the single-authority\nseed in `useProjection()` and **fails** if that seed regresses (falls back to `bizops`). This moves\nthe `CUSTOMER_SUCCESS → Business Operations` defect from known-bug to guarded regression\n(`PROJECTION_MODEL.md` §5, `CURRENT_CONTEXT_FLOW.md`).\n\nRuntime env note: the test boots the full SPA, which needs runtime config. Locally it uses the\nrepo `.env`. In CI the `e2e` job is **non-blocking** (`continue-on-error`) and reads\n`PLAYWRIGHT_BASE_URL` / `VITE_*` from secrets — point it at a deployed app for true live\nverification, or supply the `VITE_*` secrets so the dev server boots. `playwright.config.ts` starts\nthe dev server unless `PLAYWRIGHT_BASE_URL` is set. The local run is the authoritative guard today.\n\n**Why:** deprecated services and integration tests cannot pass on a bare runner, so they must not\nfail \"Build & Validate.\" The real guardrails (doctrine/typecheck/lint/build) are green and block\nmerges; everything that needs a deployed stack or full runtime moves to Live Verification.\n\n## Excluded from unit CI (run in Live Verification or deprecated)\n\n- **Deprecated services** (merged per v3.6, `AGENTS.md`): `act`, `normalizer`, `think`, `govern`,\n  `store`, `loader`, `agents`.\n- **integration-tests**: Flow A/B/C E2E — require deployed endpoints + secrets.\n\n## Known unit-test harness debt (tracked — non-blocking until fixed)\n\nThese are **test-environment** issues, not product regressions. Unit tests run as a non-blocking\nsignal until each is repaired:\n\n| Package         | Symptom                                                                    | Fix direction                                    |\n| --------------- | -------------------------------------------------------------------------- | ------------------------------------------------ |\n| `mcp-connector` | module calls `process.exit` when `CODA_API_TOKEN` unset at import          | guard import / inject test env                   |\n| `intelligence`  | vitest cannot resolve `cloudflare:workers` (bulk-swarm.ts)                 | `@cloudflare/vitest-pool-workers` or alias/mocks |\n| `gateway`       | Node-22 fetch requires `duplex` on body; content-type assertion drift      | update test harness to Node-22 fetch semantics   |\n| `pipeline`      | `pipeline.test.ts` routing mock — `spine/index` mock missing named exports | complete the `vi.mock` exports                   |\n\nWhen a package's harness is fixed, it should pass in unit CI; once all are green, flip the\n`unit-tests` job to blocking (remove `continue-on-error`).\n\n## Local commands\n\n```bash\npnpm run typecheck     # 37 packages + web — green\npnpm run lint          # green\npnpm run build         # green\npnpm exec turbo test --continue   # full test signal (includes known-debt suites)\n```\n"}