shoc-pr-review-runner/scripts/run-backend-gates.sh
Adam Moussa c3cd8f7765
feat: SHOC PR review runner, phase 1
Manually-dispatched GitHub Actions workflow that reviews SHOC pull requests in
a clean environment: exact-head checkout of shoc-frontend-new and shoc-backend,
clean build/test gates, a truthful evidence report, a single-shot Fireworks
review, deterministic output validation, and published artifacts. The runner
never writes to the product repositories or their pull requests.

The review checklists move here from the reviewers' local Cursor commands so
the instructions live outside both product repos.

Phase 1 does not provision a database, start either application, or run live
browser flows; the evidence report records those as NOT_RUN so a review cannot
claim them.

Security architecture: building a PR executes its author's code, so the
workflow is split. The gates job runs that code holding no Fireworks key and
revokes its App token first; the review job holds the key, executes no product
code, and re-checks out this repo fresh. Product checkouts live outside the
workspace, the App token is downscoped at mint time, gate results fail closed
on any duplicate key, changed files are read from git objects rather than the
filesystem, and the validator re-checks every claim against the gate table.
2026-07-29 12:05:38 -04:00

45 lines
1.5 KiB
Bash
Executable file

#!/usr/bin/env bash
# Backend clean build/test gates (spec §13.1, Phase 1 scope).
#
# Mirrors shoc-backend's own governance gates: restore -> Release build -> test.
# Backend runtime (startup, health, migrations, API scenarios) is Phase 2 and is
# recorded NOT_RUN by generate-evidence.sh.
#
# Reads: BACKEND_DIR (default $WORKSPACE_DIR/backend),
# BACKEND_SOLUTION (default SeaHavenIndustries.sln)
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=lib.sh
source "$SCRIPT_DIR/lib.sh"
BACKEND_DIR="${BACKEND_DIR:-$WORKSPACE_DIR/backend}"
BACKEND_SOLUTION="${BACKEND_SOLUTION:-SeaHavenIndustries.sln}"
cd "$BACKEND_DIR"
[ -f "$BACKEND_SOLUTION" ] || {
record_gate backend.restore BLOCKED "solution $BACKEND_SOLUTION not found at checkout"
record_gate backend.build BLOCKED "solution not found"
record_gate backend.test BLOCKED "solution not found"
die "backend solution $BACKEND_SOLUTION not found"
}
overall=0
if run_gate backend.restore backend-restore.log \
dotnet restore "$BACKEND_SOLUTION"; then
if run_gate backend.build backend-build.log \
dotnet build "$BACKEND_SOLUTION" --configuration Release --no-restore; then
run_gate backend.test backend-test.log \
dotnet test "$BACKEND_SOLUTION" --configuration Release --no-build --logger "console;verbosity=normal" \
|| overall=1
else
record_gate backend.test BLOCKED "build failed"
overall=1
fi
else
record_gate backend.build BLOCKED "restore failed"
record_gate backend.test BLOCKED "restore failed"
overall=1
fi
exit "$overall"