9015e7bd1d
Removes the Go source, Dockerfile, go.mod, and Kubernetes manifests. The
deployed service is untouched and the review desk still calls it over
window.SKILLS_REVIEW_VOTE_API; only the source leaves.
The runbook does not leave. vote-service/README.md moves to
docs/vote-service.md, because it carries the parts that are hard to
rediscover: why the ingress overwrites X-Forwarded-For and Caddy stamps
X-Client-IP instead, why the image is side-loaded into containerd rather
than pulled, and why the PVC pins the Deployment to one node.
This drops verify.mjs from 84 assertions to 83. The removed one read
vote-service/main.go for X-Forwarded-For and 'one active vote per skill'
-- the review desk's only anti-abuse control -- and there is no file left
to read. It is the first assertion this repository has ever lost.
Rather than lower the gate's floor and leave a bare number behind,
gate.sh now subtracts the number of entries in
.agents/context/assertion-removals.md from the baseline. A removal costs
a written reason in a tracked file, in the same commit, as a visible
diff. Tested at 82 assertions: still refused.
Also drops the 22 MB of PNG baselines under .agents/snapshots/before/ and
before-reduced-motion/. They pictured the hand-written site, which no
longer exists; visual-regression.mjs has no compare mode to diff them
against; and they are recoverable from d88d8b8.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
82 lines
3.0 KiB
Bash
Executable File
82 lines
3.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Tier 2 gate: types, build, content contracts, dependency audit, tokens.
|
|
# Invoked by .husky/pre-push, and safe to run by hand at any time.
|
|
#
|
|
# Parallel-safe: takes a lock in the SHARED git dir, so ten agents pushing from
|
|
# ten worktrees queue instead of running ten concurrent Astro builds and
|
|
# thrashing the machine. Waiters block; they do not fail.
|
|
set -euo pipefail
|
|
|
|
root=$(git rev-parse --show-toplevel)
|
|
cd "$root"
|
|
|
|
# --git-common-dir resolves to the ONE shared .git across all worktrees, which
|
|
# is exactly the scope we want the lock to cover.
|
|
common=$(git rev-parse --git-common-dir)
|
|
lock="$common/af-gate.lock"
|
|
|
|
exec 9>"$lock"
|
|
if ! flock -n 9; then
|
|
echo "gate: another worktree is running the gate — waiting for it…"
|
|
flock 9
|
|
fi
|
|
|
|
started=$(date +%s)
|
|
step() { printf '\n\033[1m▸ %s\033[0m\n' "$1"; }
|
|
|
|
# Fail loudly rather than passing vacuously when the toolchain is not installed.
|
|
if [ ! -d node_modules ]; then
|
|
echo "gate: node_modules missing — run 'pnpm install --frozen-lockfile' first" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# This project is pnpm-only. An agent that runs `npm install` out of habit gets
|
|
# a second, divergent dependency tree and a lockfile nobody reads — the same
|
|
# class of failure that cost two sessions during phase 0. Catch it here.
|
|
if [ -f package-lock.json ] || [ -f yarn.lock ] || [ -f bun.lock ] || [ -f bun.lockb ]; then
|
|
echo "gate: a non-pnpm lockfile is present. This project uses pnpm only." >&2
|
|
echo " Delete it, then run 'pnpm install --frozen-lockfile'." >&2
|
|
exit 1
|
|
fi
|
|
|
|
step "types"
|
|
pnpm exec astro check
|
|
|
|
step "build"
|
|
pnpm run build
|
|
|
|
step "content contracts"
|
|
pnpm run verify
|
|
|
|
# The assertion count is the thing agents are most tempted to "fix" downward.
|
|
# Compare against origin/main and refuse a silent reduction.
|
|
step "assertion coverage"
|
|
# Task 19 restored the 42 legacy facts and added ten output snapshots: 84 is the
|
|
# floor, in addition to whatever origin/main currently requires.
|
|
#
|
|
# A removal is allowed only by writing a reason into the ledger. The gate counts
|
|
# its entries and lowers the bar by exactly that many, so the bar cannot move
|
|
# without a visible diff explaining why. Deleting an entry to buy headroom is
|
|
# the same offence as deleting the assertion was.
|
|
ledger=.agents/context/assertion-removals.md
|
|
current=$(grep -c 'throw new Error' scripts/verify.mjs)
|
|
allowed=$(grep -c '^## ' "$ledger" 2>/dev/null || echo 0)
|
|
baseline=$(git show origin/main:scripts/verify.mjs 2>/dev/null | grep -c 'throw new Error' || echo 0)
|
|
if [ "$baseline" -lt 84 ]; then baseline=84; fi
|
|
baseline=$((baseline - allowed))
|
|
if [ "$current" -lt "$baseline" ]; then
|
|
echo "gate: verify.mjs coverage fell from $baseline to $current assertions." >&2
|
|
echo " Only verification-engineer may reduce it, with a reason per removal." >&2
|
|
echo " See .agents/context/verification.md" >&2
|
|
exit 1
|
|
fi
|
|
echo " $current assertions (baseline $baseline)"
|
|
|
|
step "runtime dependency audit"
|
|
node scripts/audit-ui.mjs
|
|
|
|
step "design tokens"
|
|
node .agents/scripts/check-tokens.mjs
|
|
|
|
printf '\n\033[32mgate passed\033[0m in %ss\n' "$(( $(date +%s) - started ))"
|