A full-featured CRM built with React, shadcn/ui, and Supabase.
Fix notion of main instead of base branch
Jerome12f724dc1ff4
diff --git a/.claude/agents/chat-orchestrator.md b/.claude/agents/chat-orchestrator.mdindex b3797e58..771c087d 100644--- a/.claude/agents/chat-orchestrator.md+++ b/.claude/agents/chat-orchestrator.md@@ -147,7 +147,7 @@ SIMPLE: STATE S-DEV (turn N) → (STATE S-REVIEW if diff touched supaba→ (if cosmetic only: STATE DONE)COMPLEX: STATE A (turn N) → STATE B (same turn, synchronous waves:Stage 1 develop → Stage 2 review → Stage 3 merge,- per wave, all foreground; then promotion to main)+ per wave, all foreground; then promotion to the base branch)→ (POST-DEV check — see below)→ STATE DONE@@ -188,8 +188,8 @@ start it again here.3. Decide from what you found:- **No ticket files and no worktrees** → nothing was started. Treat the quoted original request as a brand-new request: re-enter CLASSIFICATION with it (SIMPLE, COMPLEX, SETUP, etc.).- **Tickets exist, at least one not `merged`** → resume the COMPLEX/SETUP flow the way STATE B does (no team — synchronous foreground dispatch). Non-merged means `status` is `pending`/`planned` **or** `in_progress` — dispatch ALL of them, not only those that were in_progress. Respect wave ordering: dispatch only the tickets whose `dependencies` are all `merged`; tickets with unresolved dependencies will be dispatched in subsequent waves as usual. Add to each developer prompt: `RESUME: a worktree may already hold partial work — check for uncommitted changes and existing commits and continue from there; do not restart from scratch.` Re-initialise the per-ticket state note with every non-merged ticket before entering STATE B — its Stage 1–3 loop drives develop → review → merge as usual. **Never enter POST-DEV while any ticket is not `merged`.**- - **All tickets `merged` but the session branch was never promoted** → dispatch the promotion merger (`MODE: promote`) exactly as STATE B's Promotion block (promote the session branch to main), then go to the next case.- - **All tickets `merged` AND the session branch is already on `main`** → run `Bash("node \"$CLAUDE_PROJECT_DIR/.claude/scripts/pending-deploys.mjs\" --app $CLAUDE_PROJECT_DIR --session <SESSION_SHORT_ID>")`. Empty output **with exit 0** → reply "Great, everything's set." + STATE DONE. **Non-zero exit (e.g. stderr reports a SESSION_SHORT_ID mismatch) → the deploy state is UNDETERMINED; do NOT say everything's set and do NOT enter STATE DONE surface the stderr / re-check the session id.** Non-empty → enter **STATE PD-ASK** (the open satisfaction question). **Never jump directly to STATE PD-MIG-DEV on resume** — always ask the user first.+ - **All tickets `merged` but the session branch was never promoted** → dispatch the promotion merger (`MODE: promote`) exactly as STATE B's Promotion block (promote the session branch to the base branch), then go to the next case.+ - **All tickets `merged` AND the session branch is already promoted to the base branch** → run `Bash("node \"$CLAUDE_PROJECT_DIR/.claude/scripts/pending-deploys.mjs\" --app $CLAUDE_PROJECT_DIR --session <SESSION_SHORT_ID>")`. Empty output **with exit 0** → reply "Great, everything's set." + STATE DONE. **Non-zero exit (e.g. stderr reports a SESSION_SHORT_ID mismatch) → the deploy state is UNDETERMINED; do NOT say everything's set and do NOT enter STATE DONE surface the stderr / re-check the session id.** Non-empty → enter **STATE PD-ASK** (the open satisfaction question). **Never jump directly to STATE PD-MIG-DEV on resume** — always ask the user first.4. One text line to the user in their language: e.g. *"Picking your changes back up where they stopped."***End the turn.** Re-enter the normal flow on the next turn.@@ -253,7 +253,7 @@ reply.### STATE SETUP-DONE — wrap up the setup-Reached from STATE B's SETUP branch once the last wave is done — Step 4 after the session branch is promoted to main, or Step 3 directly if nothing merged.+Reached from STATE B's SETUP branch once the last wave is done — Step 4 after the session branch is promoted to the base branch, or Step 3 directly if nothing merged.1. Build the SETUP recap, in the user's language, equivalent to:> *"Your CRM is scoped and the first features are in place. You can now@@ -380,7 +380,7 @@ touch session/<SESSION_SHORT_ID>.Output: "DONE: ROLLBACK commit=<short sha>" OR "FAILED: ROLLBACK <reason>"```-The ROLLBACK merger merges the resolved revert branch **straight into main**, leaving the session branch untouched — a rollback is a default-branch operation, not session work.+The ROLLBACK merger merges the resolved revert branch **straight into the base branch**, leaving the session branch untouched — a rollback is a base-branch operation, not session work.---@@ -412,7 +412,7 @@ One text line in the user's language: *"Working on it..."*→ On next turn: if the dev returned `FAILED: out of scope …`, re-enter CLASSIFICATION as COMPLEX (STATE A). Otherwise inspect the worktree directly — do NOT substring-match the dev's free-text `files=[...]`:```- Bash("cd <WORKTREE_BASE>/simple && git diff --name-only $(git merge-base main HEAD)..HEAD | grep -E '^supabase/' || true")+ Bash("cd <WORKTREE_BASE>/simple && git diff --name-only session-base/<SESSION_SHORT_ID>..HEAD | grep -E '^supabase/' || true")```- Non-empty (one or more `supabase/` paths) → enter STATE S-REVIEW.- Empty → enter STATE S-MERGE.@@ -463,7 +463,7 @@ Entered only from STATE S-REVIEW on `BLOCKED:`. A database-shape problem is the1. If dev returned `FAILED: <reason>` → skip merge, go to STATE S-DONE with failure.2. If reviewer returned `BLOCKED:` → you should not be here (a `BLOCKED:` routes to S-FIX). Never merge a `BLOCKED:` change.-3. Otherwise dispatch the single-shot SIMPLE merger (Stage A + promotion to main in one shot):+3. Otherwise dispatch the single-shot SIMPLE merger (Stage A + promotion to the base branch in one shot):```Agent({subagent_type: "merger",@@ -666,7 +666,7 @@ First reconcile — a ticket could be `DONE` on disk yet mis-tracked in your notthis read-only check (allowed — not a merge-class command). It mirrors theauthoritative `getUnmergedTaskBranches` helper used by `block-promote-unmerged.mjs`(that hook is the real gate; keep this snippet aligned with it): it skips-`<SESSION_SHORT_ID>/simple` (the single-shot rollback/migration branch promotes straight to main,+`<SESSION_SHORT_ID>/simple` (the single-shot rollback/migration branch promotes straight to the base branch,never into the session branch) and treats an empty/failed count as unmerged(fail-closed):```@@ -748,14 +748,14 @@ Reached when the merger reports `promote conflict`. ONE assistant message:```Agent({subagent_type: "developer",- description: "Resolve session->main promotion conflict",- prompt: "ROLE: promotion-conflict-resolver (gated $CLAUDE_PROJECT_DIR exception)\nSESSION_SHORT_ID: <id>\nUnder the promotion lock, in $CLAUDE_PROJECT_DIR on main, re-run the merge and resolve it honouring BOTH sides, then commit. Run:\ncd $CLAUDE_PROJECT_DIR && flock $CLAUDE_PROJECT_DIR/.promote.lock bash -c 'git merge --no-ff session/<id> || true'\nResolve the conflicting files, then complete the merge with a single locked commit:\nflock $CLAUDE_PROJECT_DIR/.promote.lock bash -c 'git add -A && git commit --no-edit'\nKnown limitation: between the initial merge and this final locked commit, the lock is briefly released while you resolve files; a concurrent promotion in that window is a rare, accepted edge case.\nOutput: RESOLVED: commit=<sha> or FAILED: <reason>. Never modify anything under session/<id>."+ description: "Resolve session->base-branch promotion conflict",+ prompt: "ROLE: promotion-conflict-resolver (gated $CLAUDE_PROJECT_DIR exception)\nSESSION_SHORT_ID: <id>\nUnder the promotion lock, in $CLAUDE_PROJECT_DIR on the base branch (where the failed promotion left $CLAUDE_PROJECT_DIR checked out), re-run the merge and resolve it honouring BOTH sides, then commit. Run:\ncd $CLAUDE_PROJECT_DIR && flock $CLAUDE_PROJECT_DIR/.promote.lock bash -c 'git merge --no-ff session/<id> || true'\nResolve the conflicting files, then complete the merge with a single locked commit:\nflock $CLAUDE_PROJECT_DIR/.promote.lock bash -c 'git add -A && git commit --no-edit'\nKnown limitation: between the initial merge and this final locked commit, the lock is briefly released while you resolve files; a concurrent promotion in that window is a rare, accepted edge case.\nOutput: RESOLVED: commit=<sha> or FAILED: <reason>. Never modify anything under session/<id>."})```2. (no new user line — the *"Synchronising your changes…"* line was already shown when the conflict was detected)**End this turn.** On the next turn:-- Resolver returned `RESOLVED: …` → the session branch is now on `main`. Continue where the conflict interrupted you:+- Resolver returned `RESOLVED: …` → the session branch is now promoted to the base branch. Continue where the conflict interrupted you:- from STATE PD-MIG-MERGE (migration round) → STATE PD-DEPLOY.- from STATE B's Promotion step, SETUP path → STATE SETUP-DONE.- from STATE B's Promotion step, COMPLEX path → reply with one line per ticket, then enter STATE PD-ASK (the open satisfaction question).@@ -804,7 +804,7 @@ proceeds and its output never shows in the chat):Agent({subagent_type: "documentator",description: "Capture business knowledge",- prompt: "ROLE: documentator (Mode 2)\nSESSION_LOG: <session_dir>/log.jsonl\nSESSION_DIFF_BASE: origin/main\nreason: business-knowledge\n\nFollow your Mode 2 instructions: read the session diff vs origin/main and append business-knowledge bullets to $CLAUDE_PROJECT_DIR/MEMORY.md (silently do nothing if there is nothing concrete to capture).",+ prompt: "ROLE: documentator (Mode 2)\nSESSION_LOG: <session_dir>/log.jsonl\nSESSION_SHORT_ID: <SESSION_SHORT_ID>\nSESSION_DIFF_BASE: session-base/<SESSION_SHORT_ID>..session/<SESSION_SHORT_ID>\nreason: business-knowledge\n\nFollow your Mode 2 instructions: read the session diff (the SESSION_DIFF_BASE two-dot range — the session's net change, independent of the base branch's name) and append business-knowledge bullets to $CLAUDE_PROJECT_DIR/MEMORY.md (silently do nothing if there is nothing concrete to capture).",run_in_background: true})```@@ -839,7 +839,7 @@ Dispatch ONE quality-reviewer (no team) with `MODE: migration-review` and the mi### STATE PD-MIG-MERGE — merge + promote-Dispatch the single-shot MIGRATION merger for branch `<SESSION_SHORT_ID>/simple` (Stage A + promotion to main):+Dispatch the single-shot MIGRATION merger for branch `<SESSION_SHORT_ID>/simple` (Stage A + promotion to the base branch):```Agent({@@ -907,8 +907,8 @@ Already wraps every successful PD branch with the user-facing reply. After reply## NEVER DO- ❌ `git merge`, `git checkout master/main`, `git pull`, `git worktree remove` from your own Bash — only the merger does this.-- ✅ Exception: during SETUP-INTERVIEW, you may run `cd $CLAUDE_PROJECT_DIR && git add docs/project-context.json && git commit -m "chore(setup): …"` on main. This is the only git write operation you are allowed.-- ✅ Exception: a `promotion-conflict-resolver` developer may `git add`/`git commit` a merge resolution directly in `$CLAUDE_PROJECT_DIR` on main, under `$CLAUDE_PROJECT_DIR/.promote.lock`. This is the only case any agent edits `$CLAUDE_PROJECT_DIR` on main.+- ✅ Exception: during SETUP-INTERVIEW, you may run `cd $CLAUDE_PROJECT_DIR && git add docs/project-context.json && git commit -m "chore(setup): …"` on the base branch. This is the only git write operation you are allowed.+- ✅ Exception: a `promotion-conflict-resolver` developer may `git add`/`git commit` a merge resolution directly in `$CLAUDE_PROJECT_DIR` on the base branch, under `$CLAUDE_PROJECT_DIR/.promote.lock`. This is the only case any agent edits `$CLAUDE_PROJECT_DIR` on the base branch.- ❌ Merge yourself if merger fails or doesn't report → report failure, stop.- ❌ Set `run_in_background: true` (or end the turn waiting for a completion) on any STATE B dispatch — STATE B is fully foreground; a foreground call blocks until it returns, so you just wait for the result inline.- ❌ Start a ticket's next stage before the current stage's foreground agents have returned — never put a downstream-stage agent in the same message as the upstream one.diff --git a/.claude/agents/developer.md b/.claude/agents/developer.mdindex 138a41a9..34b8704c 100644--- a/.claude/agents/developer.md+++ b/.claude/agents/developer.md@@ -68,7 +68,7 @@ The orchestrator parses this line by regex. Any other format is treated as `FAIL1. **Read the work** — `TICKET_FILE` if present, otherwise the `CHANGE_REQUEST:` line in your prompt (SIMPLE dispatch). Then `$CLAUDE_PROJECT_DIR/MEMORY.md` (project domain vocabulary, custom-field semantics, workflow constraints — small by design, read whole), then past ADRs for the same domain (`ls $CLAUDE_PROJECT_DIR/adr/`).2. **Implement** in the worktree — Edit / Write / Bash. Atomic commits per step, every subject prefixed `feat(TASK-XXX):` or `fix(TASK-XXX):`. See _Implementation rules_ below.3. **Record an ADR** if — and only if — the implementation introduces a structural decision (new pattern, new dependency, deliberate departure from convention, non-obvious schema choice). Skip by default. When one is needed, load `Skill({skill: "adr-writing"})` for the file-naming rule, template, and commit format. The ADR lands inside your worktree (the merger ships it to `$CLAUDE_PROJECT_DIR/adr/` like any other change).-4. **Rebase onto the session branch** — sibling tasks merge into `session/<SESSION_SHORT_ID>` (not main) while you work, so rebase onto it. Never rebase onto main/master — that would pull other sessions' work into this session's branch and corrupt the migration diff.+4. **Rebase onto the session branch** — sibling tasks merge into `session/<SESSION_SHORT_ID>` (not the base branch) while you work, so rebase onto it. Never rebase onto the base branch — that would pull other sessions' work into this session's branch and corrupt the migration diff.```bashcd <WORKTREE_PATH> && git rebase session/<SESSION_SHORT_ID>```@@ -232,7 +232,7 @@ e2e tests:Implement the plan. Stick to ticket scope.- **Ponytail (full mode) is always on** — apply the ladder on every ticket without being asked: native HTML/CSS and already-installed react-admin / shadcn components before any new component or dependency; deletion over addition; fewest files, shortest working diff. Adding a dependency for something the stack already covers is a blocking review finding. Never minimize away validation, security, accessibility, error handling, or required tests.-- All work in the worktree. Commits on `BRANCH_NAME`, never on `main`. The orchestrator dispatches the merger after reviews pass.+- All work in the worktree. Commits on `BRANCH_NAME`, never on the base branch. The orchestrator dispatches the merger after reviews pass.- Atomic commits per logical step. Every subject includes `TASK-XXX`: `feat(TASK-XXX): <what>`.- TypeScript strict: no `any`, no `@ts-ignore` without JSDoc.- JSDoc on every non-trivial exported function.diff --git a/.claude/agents/documentator.md b/.claude/agents/documentator.mdindex a3a4f5d3..eb76d6ca 100644--- a/.claude/agents/documentator.md+++ b/.claude/agents/documentator.md@@ -58,12 +58,11 @@ Session logs can be large — read targeted ranges with `Read(offset, limit)`, d## Mode 2 — Business-knowledge synthesis-You operate directly on `$CLAUDE_PROJECT_DIR/` (main), writing **only** `$CLAUDE_PROJECT_DIR/MEMORY.md`. Silence is the default — most sessions add nothing, and that's the expected outcome.+You operate directly on `$CLAUDE_PROJECT_DIR/` (the base branch), writing **only** `$CLAUDE_PROJECT_DIR/MEMORY.md`. Silence is the default — most sessions add nothing, and that's the expected outcome.-1. Enumerate the session diff against `origin/main` (separate Bash calls — `&&`/`|` are blocked):+1. Enumerate the session diff using the `SESSION_DIFF_BASE` two-dot range from your spawn prompt (`session-base/<short>..session/<short>` — the session's net change, independent of the base branch's name, using local refs so no fetch is needed):```- Bash("git -C $CLAUDE_PROJECT_DIR fetch origin main --quiet")- Bash("git -C $CLAUDE_PROJECT_DIR diff --stat origin/main..HEAD")+ Bash("git -C $CLAUDE_PROJECT_DIR diff --stat <SESSION_DIFF_BASE>")```2. `Read("$CLAUDE_PROJECT_DIR/MEMORY.md")` to avoid duplicates. Treat as empty if missing.3. Read the diff's domain-relevant files (types, migrations, dataProvider, resource definitions, entity-naming copy). Skip styling, formatting, infra.@@ -111,7 +110,7 @@ For an `escalation`, replace **Resolution** with **Why no additive lever** and o## Bash usage-Restricted by hook to: `git log`/`git show`/`git diff`/`ls`/`wc -l`, plus the Mode 2 commands listed above (`git -C $CLAUDE_PROJECT_DIR fetch origin main --quiet`, `git -C $CLAUDE_PROJECT_DIR diff/log`, `git -C $CLAUDE_PROJECT_DIR add MEMORY.md`, `git -C $CLAUDE_PROJECT_DIR -c user.name=Documentator -c [email protected] commit -m …` — author identity is pinned). Everything else: use Read/Glob/Grep.+Restricted by hook to: `git log`/`git show`/`git diff`/`ls`/`wc -l`, plus the Mode 2 commands listed above (`git -C $CLAUDE_PROJECT_DIR diff/log`, `git -C $CLAUDE_PROJECT_DIR add MEMORY.md`, `git -C $CLAUDE_PROJECT_DIR -c user.name=Documentator -c [email protected] commit -m …` — author identity is pinned). Everything else: use Read/Glob/Grep.## Outputdiff --git a/.claude/agents/planner.md b/.claude/agents/planner.mdindex 02ef3a58..29e283e0 100644--- a/.claude/agents/planner.md+++ b/.claude/agents/planner.md@@ -132,7 +132,7 @@ Normal feature tickets (type / component / config prop) → `parallel_safe: trueby `SESSION_SHORT_ID`, so the TASK number only needs to be unique within thissession, not across the repository.2. **`SETUP_MODE=true` only** — update `$CLAUDE_PROJECT_DIR/docs/project-context.json`- with the full ticket list and commit on main:+ with the full ticket list and commit on the base branch:```json{ "tickets": [{ "ticket_id": "TASK-001", "title": "...", "status": "pending" }, ...] }```@@ -184,7 +184,7 @@ When `SETUP_MODE=true`:Title convention: `"Remove unused <element> from default CRM"`.Type: `"fix"`.-- Commit project-context.json on main as described in Step 4.+- Commit project-context.json on the base branch as described in Step 4.## Step 5 — Order + summarizediff --git a/.claude/agents/quality-reviewer.md b/.claude/agents/quality-reviewer.mdindex 54312957..b3b3d688 100644--- a/.claude/agents/quality-reviewer.md+++ b/.claude/agents/quality-reviewer.md@@ -72,9 +72,10 @@ Detection: your spawn prompt contains `ROLE: quality-reviewer (SIMPLE mode — s```git -C <WORKTREE_PATH> log -p -1```- For a multi-commit branch, diff against its true base (`main`), not `$CLAUDE_PROJECT_DIR`'s HEAD:+ For a multi-commit branch, diff against the session fork anchor `session-base/<short>` (a local ref, independent of the base branch's name — main, master, or a working branch), not `$CLAUDE_PROJECT_DIR`'s HEAD:```- git -C <WORKTREE_PATH> diff "$(git -C <WORKTREE_PATH> merge-base main HEAD)"..HEAD+ SHORT=$(git -C <WORKTREE_PATH> rev-parse --abbrev-ref HEAD | cut -d/ -f1)+ git -C <WORKTREE_PATH> diff "session-base/$SHORT"..HEAD```2. **Apply the scope-relevant rubric only** — SIMPLE diffs are small and schema-focused:- **A.6b (schema changes)** — no `supabase/migrations/*.sql` in the diff (off-limits to SIMPLE); schema files in `supabase/schemas/*.sql` only; new column appended at the end of the `03_views.sql` SELECT, no ordinal shift.@@ -94,12 +95,12 @@ Your spawn prompt provides `TASK_ID`, `WORKTREE_PATH`, and `TICKET_FILE`.Read the ticket spec at `TICKET_FILE`, read the diff in `WORKTREE_PATH`. Apply your review checklist. Emit the contract line.-1. **Read** ticket spec at `TICKET_FILE` and the worktree diff against the project's main branch:+1. **Read** ticket spec at `TICKET_FILE` and the worktree diff against the session fork anchor:```- git -C <WORKTREE_PATH> fetch origin main --quiet- git -C <WORKTREE_PATH> diff origin/main..HEAD+ SHORT=$(git -C <WORKTREE_PATH> rev-parse --abbrev-ref HEAD | cut -d/ -f1)+ git -C <WORKTREE_PATH> diff "session-base/$SHORT"..HEAD```- `origin/main` is the canonical session base — the `fetch` keeps it current in case other tickets merged while you were waiting for the dev's message.+ `session-base/<short>` is the fixed session fork anchor — a local ref, independent of the base branch's name (main, master, or a working branch). It needs no fetch and is not polluted by other sessions' merges into the base branch.2. **Apply the rubric** below (Parts A and B). Also apply `coding-style.md` and `security-triggers.md` rules.3. **Evidence rule for "missing X" findings (HARD RULE)** — before issuing a REJECTED for a missing artifact (i18n key, test file, view column, export…), verify the absence yourself with one Grep/Glob against the CURRENT worktree HEAD, and cite that check in the finding. A REJECTED that the developer disproves with a grep costs a full wasted cycle.4. **Emit verdict** as the final line of output using the OUTPUT CONTRACT format above.diff --git a/.claude/hooks/restrict-documentator-bash.mjs b/.claude/hooks/restrict-documentator-bash.mjsindex 8985d3c4..230d83db 100755--- a/.claude/hooks/restrict-documentator-bash.mjs+++ b/.claude/hooks/restrict-documentator-bash.mjs@@ -48,7 +48,6 @@ const WHITELIST = [/^git log( |$)/,/^git show( |$)/,/^git diff( |$)/,- /^git -C [^ ]+ fetch origin main --quiet *$/,/^git -C [^ ]+ diff( |$)/,/^git -C [^ ]+ log( |$)/,/^ls( |$)/,@@ -64,6 +63,6 @@ if (isWhitelisted(command)) {}ctx.error(- "Bash command blocked for documentator. Allowed: git log, git show, git diff, ls, wc -l; Mode 2 only: 'git -C <repo> fetch origin main --quiet', 'git -C <repo> diff …', 'git -C <repo> log …', 'git -C <repo> add MEMORY.md', 'git -C <repo> -c user.name=Documentator -c [email protected] commit -m …'. Use Read/Glob/Grep otherwise.",+ "Bash command blocked for documentator. Allowed: git log, git show, git diff, ls, wc -l; Mode 2 only: 'git -C <repo> diff …', 'git -C <repo> log …', 'git -C <repo> add MEMORY.md', 'git -C <repo> -c user.name=Documentator -c [email protected] commit -m …'. Use Read/Glob/Grep otherwise.",);process.exit(2);diff --git a/.claude/scripts/apply-migrations.mjs b/.claude/scripts/apply-migrations.mjsindex 57592fe9..789865ba 100755--- a/.claude/scripts/apply-migrations.mjs+++ b/.claude/scripts/apply-migrations.mjs@@ -8,9 +8,9 @@//// Behaviour:// Migrations are already committed to supabase/migrations/ on-// main (written by the deploy-time migration round and merged-// by the merger) before this script runs. There is nothing to-// promote — this script only applies what is already there.+// the base branch (written by the deploy-time migration round and+// merged by the merger) before this script runs. There is nothing+// to promote — this script only applies what is already there.//// If Supabase is not running: start it (initial start applies// every migration in supabase/migrations/).diff --git a/.claude/skills/writing-migrations/SKILL.md b/.claude/skills/writing-migrations/SKILL.mdindex 843d1f54..d1ce6fa0 100644--- a/.claude/skills/writing-migrations/SKILL.md+++ b/.claude/skills/writing-migrations/SKILL.md@@ -40,10 +40,10 @@ git diff session-base/<SESSION_SHORT_ID>..session/<SESSION_SHORT_ID>```This is the branch's full diff since creation. Do NOT use `git merge-base`-(it collapses after the first promotion). Do NOT diff against main (other-sessions pollute it).+(it collapses after the first promotion). Do NOT diff against the base branch+(other sessions pollute it).-**Checkpoint:** you have the full session diff, produced from the two-dot range above (not merge-base, not main).+**Checkpoint:** you have the full session diff, produced from the two-dot range above (not merge-base, not the base branch).### 2. Identify schema-relevant changes@@ -153,7 +153,7 @@ For Postgres correctness you may load `Skill({skill: "supabase-postgres-best-pra| Rationalization | Reality ||---|---|-| "I'll diff against main, it's close enough." | Other sessions pollute main. Only the two-dot `session-base..session` range is the true net change. |+| "I'll diff against the base branch, it's close enough." | Other sessions pollute the base branch. Only the two-dot `session-base..session` range is the true net change. || "This column is probably already deployed, I'll re-emit it to be safe." | Re-emitting a deployed change is drift, not safety. Guard with `IF NOT EXISTS` and emit only the delta. || "The view still selects all the right columns, order doesn't matter." | Postgres rejects any ordinal shift (42P16). Order is a hard correctness constraint, not cosmetics. || "DROP VIEW CASCADE then CREATE is simpler." | It silently drops dependents and loses REVOKEs. Use `CREATE OR REPLACE` unless you are removing/renaming a column. |@@ -161,7 +161,7 @@ For Postgres correctness you may load `Skill({skill: "supabase-postgres-best-pra## Red Flags-- Diff computed via `git merge-base` or against `main`.+- Diff computed via `git merge-base` or against the base branch.- A migration statement without an `IF [NOT] EXISTS` guard.- A new table with no RLS, or an RLS policy using `USING (true)`.- A view recreated by `DROP … CASCADE` for a mere column *addition*.diff --git a/scripts/launch-harness.sh b/scripts/launch-harness.shindex c520ccd7..31f4aa59 100755--- a/scripts/launch-harness.sh+++ b/scripts/launch-harness.sh@@ -20,10 +20,10 @@ REPO="$(git rev-parse --show-toplevel)"cd "$REPO"# Record the branch + commit we start from so `make clean-harness` can land us-# back here afterwards. The harness checks out main to promote merged work, which-# would otherwise leave you stranded on main with your branch behind. Stored-# under .git/ so it survives the /tmp session cleanup. Detached HEAD → empty-# branch field (clean-harness then just resets in place).+# back here afterwards. The harness checks out the base branch (the branch you+# started on) to promote merged work, which would otherwise leave you stranded on+# it with your branch behind. Stored under .git/ so it survives the /tmp session+# cleanup. Detached HEAD → empty branch field (clean-harness then just resets in place).START_BRANCH="$(git symbolic-ref --short HEAD 2>/dev/null || true)"START_SHA="$(git rev-parse HEAD)"printf '%s\t%s\n' "$START_BRANCH" "$START_SHA" > "$REPO/.git/clean-harness-return"