diff --git a/.claude/commands/merge-to-main.md b/.claude/commands/merge-to-main.md index 2cde4ec..4447e32 100644 --- a/.claude/commands/merge-to-main.md +++ b/.claude/commands/merge-to-main.md @@ -62,7 +62,19 @@ Show the user: 2. The proposed commit message 3. Ask for confirmation or modifications -### Step 5: Execute Merge +### Step 5: Hermetic CI Gate (MANDATORY — merge is blocked until this passes) + +Before any merge to main, the hermetic gate MUST run green. This is the real merge gate for the Coves backend — it builds the AppView from the working tree, stands up the isolated Docker stack (PDS, PLC, Jetstream, relay, Postgres), and runs every tier through `cmd/ci-report`, whose skip-inversion means an unallowlisted skip is a failure. + +1. Run `make ci` from the repo root. It takes several minutes (image build + staged stack + full suite); do not background it and move on — wait for the verdict. +2. **Green is the only pass.** `make ci`'s own exit code is not sufficient on its own — confirm the `✓ CI GATE PASSED` line AND that `.ci-out/summary.json` reports `"ok": true` with `failed: 0` and no unexpected skips. `make ci` deliberately discards `go test`'s raw exit code; `cmd/ci-report` is the verdict. +3. **If it is red, STOP.** Do not merge, do not "fix it on main." Report the failing tests / unexpected skips / build failures to the user and resolve them on the branch first. A red gate blocking a merge is the gate working. +4. If Docker is not running or the stack cannot come up, that is a blocked gate, not a pass — surface it and stop; never merge on an unrun gate. +5. Only after a recorded green run, record the numbers (test count, wall-clock) and proceed. + +Note: `make ci` requires this repo's hermetic stack and applies to the Coves backend only. It is intentionally absent from the global `merge-to-main` skill and from the mobile/frontend project commands, which have their own toolchains. + +### Step 6: Execute Merge Based on the current state, offer appropriate options: @@ -86,7 +98,7 @@ Based on the current state, offer appropriate options: **If on main with uncommitted changes:** 1. Commit directly with the comprehensive message -### Step 6: Cleanup (Optional) +### Step 7: Cleanup (Optional) After successful merge, offer to: - Delete the feature branch locally: `git branch -d ` @@ -94,6 +106,7 @@ After successful merge, offer to: ## Important Notes +- The hermetic CI gate (Step 5) is mandatory and blocking — never merge on a red or unrun `make ci` - Always show the user what will happen before executing - Never force push or use destructive operations without explicit confirmation - If there are merge conflicts, stop and help the user resolve them