A full-featured CRM built with React, shadcn/ui, and Supabase.
Feature-smoke e2e runs the session worktree, not the base checkout (D5/D7)
Jerome4ad6cf8eb049
diff --git a/.claude/agents/orchestrator.md b/.claude/agents/orchestrator.mdindex 0dbf064c..0492b61b 100644--- a/.claude/agents/orchestrator.md+++ b/.claude/agents/orchestrator.md@@ -469,7 +469,7 @@ Agent({After feature-review passes, confirm the integrated feature RUNS before promotion / handoff. Two parts, both reported in the handoff:- **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("bash $CLAUDE_PROJECT_DIR/.claude/scripts/e2e-smoke.sh")`. It runs the Playwright suite against 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.+- **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 (D2: 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.diff --git a/.claude/scripts/e2e-smoke.sh b/.claude/scripts/e2e-smoke.shindex 6b179aba..4a0b13e9 100755--- a/.claude/scripts/e2e-smoke.sh+++ b/.claude/scripts/e2e-smoke.sh@@ -16,11 +16,16 @@set -uo pipefailREPO="${CLAUDE_PROJECT_DIR:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}"+# Where to read the app + specs + schema FROM. A feature-smoke must run the INTEGRATED+# session code, not the base-branch checkout ($REPO) - so the orchestrator passes+# E2E_SMOKE_SRC=<WORKTREE_BASE>/_session (the session worktree, on session/<short>, with+# node_modules already provisioned). Default $REPO = a base-branch baseline check.+SRC="${E2E_SMOKE_SRC:-$REPO}"SLOTS="${E2E_SMOKE_SLOTS:-5}"MIN_MB="${E2E_SMOKE_MIN_MB:-2500}"DRY="${E2E_SMOKE_DRY:-0}"SLOT_LOCK_DIR="/tmp/atomic-crm-e2e-slots"-CONFIG_SRC="$REPO/supabase/config.e2e.toml"+CONFIG_SRC="$SRC/supabase/config.e2e.toml"mkdir -p "$SLOT_LOCK_DIR"skip() { echo "SKIP: $*"; exit 0; } # graceful: not run here, not a failure@@ -73,10 +78,10 @@ perl -pe "s/^(project_id\s*=\s*).*/\$1\"$project\"/;# Supabase needs the schema/migrations/seed to build the DB on first start.for d in migrations schemas functions templates; do- [ -d "$REPO/supabase/$d" ] && cp -r "$REPO/supabase/$d" "$workdir/supabase/$d"+ [ -d "$SRC/supabase/$d" ] && cp -r "$SRC/supabase/$d" "$workdir/supabase/$d"donefor f in seed.sql signing_keys.json; do- [ -f "$REPO/supabase/$f" ] && cp "$REPO/supabase/$f" "$workdir/supabase/$f"+ [ -f "$SRC/supabase/$f" ] && cp "$SRC/supabase/$f" "$workdir/supabase/$f"doneif [ "$DRY" = "1" ]; then@@ -105,14 +110,14 @@ export VITE_SUPABASE_ANON_KEY="$ANON_KEY"export SERVICE_ROLE_KEY# --- serve the app (dev server reads env at start, so no per-slot build) -----( cd "$REPO" && VITE_SUPABASE_URL="$VITE_SUPABASE_URL" npx vite --port "$app_port" --strictPort --mode e2e >"$workroot/app.log" 2>&1 ) &+( cd "$SRC" && VITE_SUPABASE_URL="$VITE_SUPABASE_URL" npx vite --port "$app_port" --strictPort --mode e2e >"$workroot/app.log" 2>&1 ) &APP_PID=$!npx wait-on -t 120000 "http-get://127.0.0.1:$api_port/auth/v1/health" "http-get://127.0.0.1:$app_port" >/dev/null 2>&1 \|| skip "isolated stack did not become ready in time."# --- run the suite ----------------------------------------------------------echo "e2e-smoke: running Playwright against the isolated stack..."-( cd "$REPO" && CI=true PLAYWRIGHT_BASE_URL="http://127.0.0.1:$app_port" npx playwright test )+( cd "$SRC" && CI=true PLAYWRIGHT_BASE_URL="http://127.0.0.1:$app_port" npx playwright test )result=$?echo "e2e-smoke: suite exit=$result (slot $slot)"exit $result