A full-featured CRM built with React, shadcn/ui, and Supabase.
Align the harness docs and hooks with e2e being end-of-feature only
Jerome94f6c0706bea
diff --git a/.claude/agents/orchestrator.md b/.claude/agents/orchestrator.mdindex d94235ab..607aa991 100644--- a/.claude/agents/orchestrator.md+++ b/.claude/agents/orchestrator.md@@ -33,7 +33,7 @@ When your dispatch prompt carries `PERSONA: technical` (the `#technical-harness`1. **Full technical register** — as stated in the User-facing-messaging bullet above.2. **Raw reporting.** Your final report is not a summary; it is the mechanical truth. Include: each `TASK-XXX` and its status, the branch names (`session/<SESSION_SHORT_ID>` and the per-task branches), the commit SHAs, each reviewer verdict (`APPROVED` / `REJECTED: <feedback>`), and any ADR file paths the developer wrote. Do not soften or omit failures.3. **Stop at the session branch — never auto-promote.** The session branch is your terminal point. Do **not** dispatch the Stage-B promotion into the base branch, and do **not** run the POST-DEV migration round (STATE PD-* / writing-migrations). Merge every ticket into `session/<SESSION_SHORT_ID>` (Stage A only) and stop. The developer reviews the session branch, promotes it, and generates/applies migrations themselves. Still run the `pending-deploys.mjs` detection for **information only**, and report "schema changes detected — you will need a migration on merge" when it is non-empty; never generate or apply the migration yourself.-4. **Live progress log.** Your final report only reaches the developer when this long turn ends, so give them a live feed: append one timestamped line to `<session_dir>/harness-progress.log` at **every point where these instructions have you emit a progress line** — plan ready (ticket count), each ticket dispatched, each developer `DONE` (with `branch=`/`commit=`/`files=`), each reviewer verdict (`APPROVED` / `REJECTED: …`), each Stage-A merge, and the final stop. Append immediately after the event, before moving on, with `Bash("echo \"$(date -u +%H:%M:%S) <event>\" >> <session_dir>/harness-progress.log")` (substitute the real `<session_dir>` from your context). Overwrite nothing, append only. The developer runs `tail -f` on this file (or a `Monitor` on it) to watch the harness in real time. The `validate-on-stop` hook additionally auto-appends each validation step as it runs (`[validate:TASK-XXX] typecheck…`, `… checks passed` / `… FAILED`), so the otherwise-silent minutes while a developer's SubagentStop runs typecheck / lint / vitest / e2e show up in the same feed, so you do NOT log those yourself.+4. **Live progress log.** Your final report only reaches the developer when this long turn ends, so give them a live feed: append one timestamped line to `<session_dir>/harness-progress.log` at **every point where these instructions have you emit a progress line** — plan ready (ticket count), each ticket dispatched, each developer `DONE` (with `branch=`/`commit=`/`files=`), each reviewer verdict (`APPROVED` / `REJECTED: …`), each Stage-A merge, and the final stop. Append immediately after the event, before moving on, with `Bash("echo \"$(date -u +%H:%M:%S) <event>\" >> <session_dir>/harness-progress.log")` (substitute the real `<session_dir>` from your context). Overwrite nothing, append only. The developer runs `tail -f` on this file (or a `Monitor` on it) to watch the harness in real time. The `validate-on-stop` hook additionally auto-appends each validation step as it runs (`[validate:TASK-XXX] typecheck…`, `… checks passed` / `… FAILED`), so the otherwise-silent minutes while a developer's SubagentStop runs typecheck / lint / vitest show up in the same feed, so you do NOT log those yourself.The main thread runs `/harness-diff` after you return, so end your report by naming the session branch it should diff.@@ -501,7 +501,7 @@ After feature-review passes, confirm the integrated feature RUNS before promotio- **Demo smoke** (when the diff changes UI under `src/components/`): dispatch the quality-reviewer with `MODE: feature-smoke` (foreground, `run_in_background: false`) to drive the feature's key user flows in demo mode via the Playwright MCP and report PASS/FAIL. Runs for any UI change; needs no Supabase.- **Supabase e2e** (conditional): if the diff changed `e2e/**` OR touches behavior the specs assert (`src/components/**` / `supabase/**`), run `Bash("E2E_SMOKE_SRC=<WORKTREE_BASE>/_session bash $CLAUDE_PROJECT_DIR/.claude/scripts/e2e-smoke.sh")`. `E2E_SMOKE_SRC` MUST point at the `_session` worktree (on `session/<SESSION_SHORT_ID>`, node_modules provisioned) so the suite runs the INTEGRATED FEATURE's code + specs, NOT the base-branch checkout (`$REPO`) - without it the smoke is only a base-branch baseline and never exercises the feature. Per-ticket validation does NOT run e2e (e2e is end-of-feature only), so this is the one place the e2e specs actually run. It uses an ISOLATED, slot-leased Supabase instance and tears it down (guaranteed via `trap`). Exit 0 = passed OR gracefully skipped (it prints `SKIP: ...` when there is no free slot / too little RAM / the stack cannot start); exit 1 = the suite FAILED.-A smoke FAIL is surfaced (like a feature-review finding; it may drive a bounded fix), never silently swallowed. A skip is fine (deferred to a human `make test-e2e`). `#technical-harness` runs feature-smoke before its stop and reports the result; it does not promote.+A smoke FAIL is surfaced (like a feature-review finding; it may drive a bounded fix), never silently swallowed. A skip is fine (deferred to a human `make test-e2e-ci`, the headless target; `make test-e2e` opens the Playwright UI and needs a display). `#technical-harness` runs feature-smoke before its stop and reports the result; it does not promote.**`PERSONA: technical` → stop here.** Every reconciled ticket is already on `session/<SESSION_SHORT_ID>`. Do NOT promote and do NOT run POST-DEV: emit the raw per-ticket report (statuses, branches, SHAs, verdicts, ADR paths), run the `pending-deploys.mjs` detection for information only (add "schema changes detected — migration needed on merge" when non-empty), name the session branch for `/harness-diff`, and enter STATE DONE. The rest of this Promotion block is skipped.diff --git a/.claude/agents/quality-reviewer.md b/.claude/agents/quality-reviewer.mdindex 76efdc7c..cadafc87 100644--- a/.claude/agents/quality-reviewer.md+++ b/.claude/agents/quality-reviewer.md@@ -454,9 +454,10 @@ interactively via the Playwright MCP against a demo-mode server you start inside(`kill <pid>` of the `dev:demo` process you started). Leaving it runningstalls the SubagentStop validation chain.-A red criterion verified here is a `[FAIL]` → REJECTED. The `npx playwright-screenshot <url> out.png` CLI remains a fallback for a single static shot when no-interaction is needed (it is headless by default).+A red criterion verified here is a `[FAIL]` → REJECTED. For a single static shot+with no interaction, use `browser_navigate` + `browser_take_screenshot` as above:+there is no `npx playwright screenshot` CLI in the pinned Playwright (1.60 exposes+only `playwright trace screenshot`).### C.4 e2e spec sanity (read-only)diff --git a/.claude/hooks/lib/validation.mjs b/.claude/hooks/lib/validation.mjsindex 48453eb2..c6c29ff0 100644--- a/.claude/hooks/lib/validation.mjs+++ b/.claude/hooks/lib/validation.mjs@@ -122,7 +122,8 @@ const TAIL_LINES = { format: 15, typecheck: 20, lint: 30, unit: 40, e2e: 50 };// A step is skipped when its `condition` is not met. `pathExists` gates on a// path under the repo (e.g. the supabase/functions unit-fn gate); `modeNot`-// skips when MODE equals the given value (e.g. e2e in demo mode).+// skips when MODE equals the given value (no step uses it today, and MODE is set+// only by a managed launcher, never by this repo's settings.json).function stepSkipped(ctx, step) {const c = step.condition;if (!c) return false;diff --git a/.claude/hooks/validate-on-stop.mjs b/.claude/hooks/validate-on-stop.mjsindex 2419f6f7..45dcb5c4 100755--- a/.claude/hooks/validate-on-stop.mjs+++ b/.claude/hooks/validate-on-stop.mjs@@ -1,5 +1,5 @@#!/usr/bin/env node-// SubagentStop — full validation chain (prettier auto-fix, typecheck, unit app/functions, e2e) on active worktrees with changes; exit 2 keeps the subagent alive to fix and commit. VALIDATE_DRY_RUN=1 skips the chain; =fail simulates a failure.+// SubagentStop — full validation chain (prettier auto-fix, typecheck, lint, unit app/functions) on active worktrees with changes; exit 2 keeps the subagent alive to fix and commit. e2e is NOT in this chain (end-of-feature only, run by the orchestrator via e2e-smoke.sh). VALIDATE_DRY_RUN=1 skips the chain; =fail simulates a failure.import { existsSync, readFileSync } from "node:fs";import { createHookContext } from "./lib/context.mjs";diff --git a/.claude/scripts/e2e-smoke.sh b/.claude/scripts/e2e-smoke.shindex 363b1c2a..14fc1c4d 100755--- a/.claude/scripts/e2e-smoke.sh+++ b/.claude/scripts/e2e-smoke.sh@@ -32,10 +32,10 @@ skip() { echo "SKIP: $*"; exit 0; } # graceful: not run here, not a failure# --- memory preflight -------------------------------------------------------# Each Supabase stack is ~2-3 GB. Don't attempt a boot the host can't hold; skip-# gracefully so the caller defers to a human `make test-e2e` instead of OOM-ing.+# gracefully so the caller defers to a human `make test-e2e-ci` instead of OOM-ing.avail_mb="$(free -m 2>/dev/null | awk '/^Mem:/{print $7}')"if [ "$DRY" != "1" ] && [ -n "$avail_mb" ] && [ "$avail_mb" -lt "$MIN_MB" ]; then- skip "only ${avail_mb}MB free, need ~${MIN_MB}MB for a Supabase e2e stack; run 'make test-e2e' locally."+ skip "only ${avail_mb}MB free, need ~${MIN_MB}MB for a Supabase e2e stack; run 'make test-e2e-ci' locally."fi# --- lease a slot (flock; also the concurrency cap) -------------------------@@ -99,7 +99,7 @@ docker ps -aq --filter "name=${project}" 2>/dev/null | xargs -r docker rm -f >/d# --- start the isolated stack ----------------------------------------------echo "e2e-smoke: starting isolated Supabase (slot $slot, api :$api_port, project $project)..."-if ! npx supabase start --workdir "$workdir" >/"$workroot/supabase.log" 2>&1; then+if ! npx supabase start --workdir "$workdir" >"$workroot/supabase.log" 2>&1; thencat "$workroot/supabase.log" >&2 || trueskip "isolated Supabase failed to start (see log); deferring e2e to a human run."fidiff --git a/.claude/settings.json b/.claude/settings.jsonindex b5f4f730..2cc9bfa9 100644--- a/.claude/settings.json+++ b/.claude/settings.json@@ -231,7 +231,7 @@"type": "command","command": "$CLAUDE_PROJECT_DIR/.claude/hooks/validate-on-stop.mjs","timeout": 900,- "statusMessage": "Running validation (prettier, typecheck, lint, unit, e2e)..."+ "statusMessage": "Running validation (prettier, typecheck, lint, unit)..."}]},