ubiquitous-invention/plans/Plan-multitenant-saas-hardening/Epic-test-foundation/Epic-test-foundation.md
Randall Stillwell 778fe1d321 plans: scaffold daily-driver-finish, saas-hardening, agent-coordination
Three new plan trees that fill in the gaps surfaced during repo review.
Together they map out what remains between the current scaffold-with-stubs
state and a daily-usable, multitenant, agent-coordinated app.

* Plan-daily-driver-finish (P0): turn stubs into real data. Five tasks
  covering the lint/shared-types breakage, hardcoded dashboard mocks,
  AI-page setTimeout placeholder, post-signin landing decision, and a
  cross-browser collab smoke test against the deployed Hocuspocus
  instance.

* Plan-multitenant-saas-hardening (P1): everything multitenant needs
  beyond what Plan-multitenant-cursor-sync already covers. Invites and
  role management, soft-delete + append-only audit log, rate limits on
  the auth + mutation hot paths, and a Vitest + GitHub Actions test
  foundation so PRs can't ship red.

* Plan-agent-coordination (P2): the layer that makes a Task-*.md
  runnable, not just readable. Adds workflow_prompt with task -> epic
  -> plan inheritance, an agent_runs table for auditable sessions, and
  two new MCP tools (claim_task / complete_task) that replace the
  freeform update_object composition agents do today. Includes an
  intentionally-deferred Epic-optional-orchestrator that captures the
  Symphony-shaped runner as a decision point rather than an immediate
  build.

Each task is bead-scale (one focused Cursor session) with explicit
in-scope, out-of-scope, and anti-goal sections so a future agent can
pick up a single Task-*.md and start without scrollback context.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 23:52:22 -05:00

51 lines
1.7 KiB
Markdown

---
kind: epic
slug: test-foundation
title: Test foundation — Vitest bootstrap and CI gate
plan_slug: multitenant-saas-hardening
status: ready
priority: P1
tenant_id: global
cursor_epic_id: null
updated_at: "2026-06-01"
---
# Epic objective
Get the repo to a place where `pnpm test` is a real command and a PR can't merge with broken lint/types/tests. Today there is no test runner (`AGENTS.md` is explicit about this) and no CI workflow.
## In scope / out of scope
**In scope**
- Add Vitest to the workspaces that need it most: `packages/database`, `packages/shared`, `packages/ai`.
- Add a `pnpm test` script wired through Turborepo so cached test runs work.
- Add `.github/workflows/ci.yml` running `pnpm lint && pnpm type-check && pnpm test` on PRs.
**Out of scope**
- Testing React components. Component testing in Next.js + React 19 + RSC is its own rabbit hole; defer until there's a real motivating bug.
- End-to-end (Playwright) tests. Same reason.
## Related tasks
| Task | Link |
|------|------|
| Bootstrap Vitest and GitHub Actions CI | `./Task-bootstrap-vitest-and-ci.md` |
## Dependencies
- Depends on: `Task-fix-lint-and-shared-types` from `Plan-daily-driver-finish` (CI needs lint + type-check to be green).
## Acceptance criteria
- [ ] `pnpm test` runs Vitest across at least 3 packages.
- [ ] CI workflow gates PRs on lint + type-check + test.
- [ ] At least 3 real tests exist (one in each chosen package) that catch a real regression if their target code is broken.
## Proposed timeline
| Phase | Window | Notes |
|-------|--------|-------|
| Vitest + first tests | Day 1 | Set up runner, write seed tests. |
| CI workflow | Day 2 | Pin Node 20, run lint/type/test on PR. |