repo-mailbox/scripts
Kjell Tore Guttormsen 02d4df2dfb
feat(gate): session-gate.sh - R3/R4/R6 checks before a session starts
Order 20260926T070037Z-680859139 (.claude). A read-only, zero-model-call
check any session starter can call first: exit 0 allows, exit 2 denies with
one stderr line naming the rule and what is missing.

- R4: PLAN.md holds exactly one gate line,
  <!-- gate: gjenfortelling=<time>; dekning=komplett; r1-proeve=<time|->;
  foerste-maaling=<time|->; retning=<name> -->
- R3: the Logg table's Bevegelse (ja|nei) and Kvote (N%) columns. Deny at
  >= 10% of the weekly quota without movement since the last row that moved.
- R6: cap 1 live session per repo (claude agents --json --cwd <repo>) until
  r1-proeve and foerste-maaling are both times, then 2. Night 23:00-07:00 or
  --night needs r1-proeve.

Fail-closed: unmeasured rows, a missing claude binary, a non-JSON listing,
duplicate or unknown keys and usage errors all deny.

Measured: claude agents --cwd matches the directory a session was STARTED
in, not its printed cwd, so --repo must be the main checkout root.

Chose NOT to call it from board.sh --dispatch, because a dispatch line is
generated before the start (a live count would be stale), and live-session
reading is the process axis board.sh refuses by design.

session-gate-selftest.sh: 0 -> 97 checks. It was red 91 of 95 before the
script existed, then 97/97 green. Ten mutants all die. It is wired into npm
test as the sixth suite, and the README badge goes from 1006 to 1103.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 09:24:12 +02:00
..
board-selftest.sh test(board): use a fictional repo name in the orphan-mailbox comment 2026-09-23 15:43:06 +02:00
board.sh test(board): pin the "field inserted before neste" class; 16 of 16 mutants die 2026-09-17 17:58:49 +02:00
brief-nightly.sh feat(brief): render the nightly cross-repo briefing without a model 2026-08-01 22:38:46 +02:00
coord-count.sh fix(infra): a failed measurement must never render as a reassuring value 2026-08-26 12:15:05 +02:00
coord-done.sh feat(engine): make a bulk close state what Rule 7 says must be stated 2026-07-31 15:48:42 +02:00
coord-inbox.sh feat(engine): let a message say it needs no answer, and count debt without losing sight of the rest 2026-07-31 15:46:14 +02:00
coord-order-claim.sh fix(orders): call the order-verbs by absolute path, not bare PATH names 2026-08-18 09:16:59 +02:00
coord-order-done.sh fix(orders): narrow the return-reason escape so a plain arrow survives 2026-08-17 21:24:37 +02:00
coord-order-inbox.sh fix(orders): a pending order's age comes from the filename, not the mtime 2026-09-03 22:17:26 +02:00
coord-order-send.sh fix(coord): refuse a control character in --to instead of sanitizing it 2026-08-18 17:00:34 +02:00
coord-selftest.sh fix(dispatch): background report signs with --from; coord-send refuses a worktree-derived sender 2026-09-23 11:20:39 +02:00
coord-send.sh fix(dispatch): background report signs with --from; coord-send refuses a worktree-derived sender 2026-09-23 11:20:39 +02:00
coord-sweep.sh fix(coord-send): stop rejecting dot-prefixed repo names 2026-08-09 21:09:23 +02:00
orders-selftest.sh fix(orders): a pending order's age comes from the filename, not the mtime 2026-09-03 22:17:26 +02:00
route-selftest.sh feat(route,board): strike the advisor rule, add board.sh --row <repo> 2026-09-12 23:45:47 +02:00
route.sh feat(route,board): strike the advisor rule, add board.sh --row <repo> 2026-09-12 23:45:47 +02:00
session-gate-selftest.sh feat(gate): session-gate.sh - R3/R4/R6 checks before a session starts 2026-09-26 09:24:12 +02:00
session-gate.sh feat(gate): session-gate.sh - R3/R4/R6 checks before a session starts 2026-09-26 09:24:12 +02:00
state-line-guard-selftest.sh fix(infra): a failed measurement must never render as a reassuring value 2026-08-26 12:15:05 +02:00