mirror of
https://github.com/bitbaum/dotfiles.git
synced 2026-12-04 04:17:18 +01:00
fleet drift.sh answers "is the same commit on the laptop, GitHub, Gitea and the box?", but nothing ran it, so it changed nothing. It takes a minute, too slow for SessionStart, so an hourly user timer (fleet-drift.timer) runs scripts/fleet-drift-cache.sh into ~/.cache/fleet-drift.txt and the hook only reads it, next to the agent list. A missing or stale (>3 h) cache is said, never hidden. tests/session-start.test.sh (4 cases, mutation-checked) runs in CI. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
101 lines
4.5 KiB
YAML
101 lines
4.5 KiB
YAML
# The environment repo's own CI. The fleet-automation test suites moved to
|
|
# bitbaum/fleet with the scripts they test (2026-08-28); what remains here is
|
|
# the environment, so what CI checks is the environment.
|
|
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [master]
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
verify:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
# Shell must parse. install.sh is what lands on a new machine; a syntax
|
|
# error there is discovered at the worst possible moment.
|
|
- name: Shell syntax
|
|
run: |
|
|
set -euo pipefail
|
|
found=0
|
|
while IFS= read -r f; do
|
|
found=$((found + 1))
|
|
bash -n "$f"
|
|
done < <(find . -name '*.sh' -not -path './.git/*')
|
|
echo "shell syntax: ok ($found script(s) checked)"
|
|
|
|
# The PreToolUse hook gates every tool call in 5-20 concurrent sessions,
|
|
# so its guard has to be exact in both directions: a false positive stalls
|
|
# the fleet, a false negative re-opens the cwd leak of 2026-09-20.
|
|
- name: PreToolUse guard
|
|
run: bash .claude/hooks/tests/pre-tool-use.test.sh
|
|
|
|
# Auto-approves EnterWorktree into ~/dev/<repo>/.claude/worktrees/<name>
|
|
# only; an over-broad match would silently approve moving the permission root.
|
|
- name: PermissionRequest worktree approval
|
|
run: bash .claude/hooks/tests/permission-request.test.sh
|
|
|
|
# The Stop hook blocks "done" while verify is red. It must block in that
|
|
# one case only: a gate that traps a session (no deps, a slow suite, a red
|
|
# it cannot fix) stalls the fleet worse than having no gate.
|
|
- name: Stop verify gate
|
|
run: bash .claude/hooks/tests/stop.test.sh
|
|
|
|
# Session start shows the drift cache. Missing or stale must be SAID: a
|
|
# sensor that goes quiet reads exactly like a clean fleet.
|
|
- name: Session start drift section
|
|
run: bash .claude/hooks/tests/session-start.test.sh
|
|
|
|
# settings.json is the SSOT for what runs, so it and .claude/hooks/ must
|
|
# agree in BOTH directions: a registration with no committed file (the
|
|
# session-start.sh case) and a committed file nothing runs (the stale
|
|
# fleetcrown-* case) are the same bug from opposite ends.
|
|
- name: settings.json matches hooks
|
|
run: bash .claude/hooks/tests/settings-hooks-match.test.sh
|
|
|
|
# Every symlink install.sh would create must point at a file that exists
|
|
# in this repo — a dangling link is a broken shell on a new machine.
|
|
- name: install.sh targets exist
|
|
run: |
|
|
set -euo pipefail
|
|
missing=0
|
|
while IFS= read -r target; do
|
|
[ -e "$target" ] || { echo "install.sh links '$target', which does not exist" >&2; missing=1; }
|
|
done < <(grep -oP '^\s*link\s+\K\S+' install.sh || true)
|
|
[ "$missing" -eq 0 ]
|
|
echo "install targets: ok"
|
|
|
|
# The global CLAUDE.md loads into EVERY session, and there are commonly
|
|
# 5-20 at once. It reached 718 lines by accretion — roughly 400 of them
|
|
# general software engineering the model already does — which crowded out
|
|
# the ~200 that are actually local to this fleet. Cut to 242 in #63; raised to 291 in #66 for three rules that each
|
|
# record an incident from 2026-09-12 — litter left live, repos created
|
|
# unasked, and a grep that nearly deleted three load-bearing packages.
|
|
#
|
|
# This is a ratchet: the count may fall or hold, never rise. To add a
|
|
# section, lower something else, or raise BUDGET in the same commit so
|
|
# the decision is visible in the diff rather than inherited silently.
|
|
- name: CLAUDE.md budget
|
|
run: |
|
|
set -euo pipefail
|
|
# 291 -> 302 (2026-09-25): "Chats: reuse the reference", added at
|
|
# George's request after 13 divergent chats in 10 repos.
|
|
BUDGET=302
|
|
count=$(grep -c '' .claude/CLAUDE.md)
|
|
if [ "$count" -gt "$BUDGET" ]; then
|
|
echo "CLAUDE.md is $count lines, over the $BUDGET-line budget by $((count - BUDGET))." >&2
|
|
echo "Cut something, or raise BUDGET in this workflow in the same commit." >&2
|
|
exit 1
|
|
fi
|
|
if [ "$count" -lt "$BUDGET" ]; then
|
|
echo "CLAUDE.md is $count lines, $((BUDGET - count)) under budget — lower BUDGET to lock the win in."
|
|
fi
|
|
echo "CLAUDE.md budget: ok ($count/$BUDGET lines)"
|