A full-featured CRM built with React, shadcn/ui, and Supabase.
Tell the orchestrator what to do with a red e2e, and never hand it a stale one
Jeromecf2d6f85376b
diff --git a/.claude/agents/orchestrator.md b/.claude/agents/orchestrator.mdindex f9391b50..b4d75621 100644--- a/.claude/agents/orchestrator.md+++ b/.claude/agents/orchestrator.md@@ -501,7 +501,9 @@ 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.- **e2e suite**: you do NOT launch it, and `bash-guard` refuses the command if you try. The `e2e-on-feature-review` SubagentStop hook runs it for you, on the integrated `_session` worktree, and ONLY when the feature review above APPROVED (it keys off the reviewer's own `FEATURE-quality-reviewer` verdict flag), so a `BLOCKED` review never pays for the suite. It uses an ISOLATED, slot-leased Supabase instance and tears it down. Read the outcome from `<session_dir>/e2e-result.json` (`status`: `passed` | `skipped` | `failed`, plus the last 40 output lines) after the reviewer returns; the same outcome is appended to `harness-progress.log`. A missing file means the hook did not run the suite (no session worktree, or the review did not approve).-A smoke FAIL, or `status: "failed"` in `e2e-result.json`, 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.+Reading `e2e-result.json` is MANDATORY before promotion / handoff: it is the only place the suite's verdict exists, and skipping the read is what would make a red suite "silently swallowed".++On a demo-smoke FAIL or `status: "failed"`, take the SAME action as a `BLOCKED:` feature review, with the findings replaced by the failing spec output: dispatch ONE `developer` with the SIMPLE template (`CHANGE_REQUEST` = the failing output verbatim, `BRANCH_NAME: <SESSION_SHORT_ID>/simple`, `WORKTREE_PATH: <WORKTREE_BASE>/simple`, `run_in_background: false`), merge it into `session/<SESSION_SHORT_ID>` with a SIMPLE-mode merger carrying `STAGE: a-only`, then re-run feature-review. Re-running it is what re-runs the suite: the reviewer rewrites its `FEATURE-quality-reviewer` flag, which re-triggers the hook on the fixed code. **The 2-round bound is shared with the feature-review rounds above** (2 fix rounds for the whole end-of-feature loop, review and e2e combined): past that, report the remaining failure in the handoff and proceed, never wedge the pipeline. 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/hooks/e2e-on-feature-review.mjs b/.claude/hooks/e2e-on-feature-review.mjsindex e5aa0a25..48f61cf1 100644--- a/.claude/hooks/e2e-on-feature-review.mjs+++ b/.claude/hooks/e2e-on-feature-review.mjs@@ -17,7 +17,7 @@// it lands in <session_dir>/e2e-result.json plus the progress log, and the orchestrator// reads it after the review returns. This hook never blocks a stop.-import { existsSync, readFileSync, writeFileSync } from "node:fs";+import { existsSync, readFileSync, rmSync, writeFileSync } from "node:fs";import { join } from "node:path";import { createHookContext } from "./lib/context.mjs";import { readAgentMeta } from "./lib/agent-meta.mjs";@@ -55,6 +55,15 @@ const ctx = createHookContext(input, "e2e-on-feature-review");if (!isFeatureReview(input)) process.exit(0);+// A feature review just ran, so any result from an earlier round describes code that+// has since changed. Drop it before deciding, so the orchestrator can never read a+// stale verdict as current: from here on, a missing file means "not run this round".+try {+ rmSync(e2eResultPath(ctx), { force: true });+} catch {+ // best-effort+}+const flag = reviewFlag(ctx, FEATURE_REVIEW_KEY, "quality-reviewer");if (!existsSync(flag)) {ctx.accept("feature-review not APPROVED -> e2e not launched");diff --git a/.claude/hooks/test/e2e-on-feature-review.test.mjs b/.claude/hooks/test/e2e-on-feature-review.test.mjsindex c46250f6..8ff8a474 100644--- a/.claude/hooks/test/e2e-on-feature-review.test.mjs+++ b/.claude/hooks/test/e2e-on-feature-review.test.mjs@@ -133,6 +133,27 @@ describe("e2e-on-feature-review", () => {expect(result().output).toContain("1 failed");});+ test("drops a previous round's result when the new review did not approve", () => {+ writeSmoke(SMOKE.pass);+ approve();+ run(transcriptWithMeta("Feature-review: round 1"));+ expect(result().status).toBe("passed");++ rmSync(join(sessionDir, "reviews", "FEATURE-quality-reviewer"), {+ force: true,+ });+ run(transcriptWithMeta("Feature-review: round 2"));+ expect(result()).toBe(null);+ });++ test("leaves a per-ticket review stop's result untouched", () => {+ writeSmoke(SMOKE.pass);+ approve();+ run(transcriptWithMeta("Feature-review: round 1"));+ run(transcriptWithMeta("Review TASK-003 implementation"));+ expect(result().status).toBe("passed");+ });+test("skips gracefully when the session worktree is absent", () => {writeSmoke(SMOKE.record);approve();