#!/usr/bin/env bash # Architecture boundary check (U1). # Production import / SQL write / path construction / event producer-consumer. # Goose, *_test.go and fixtures are not production writers. set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" MODE="warn" while [[ $# -gt 0 ]]; do case "$1" in --mode) MODE="${2:-warn}"; shift 2 ;; --mode=*) MODE="${1#--mode=}"; shift ;; *) echo "usage: $0 [--mode warn|block]" >&2; exit 2 ;; esac done if [[ "${MODE}" != "warn" && "${MODE}" != "block" ]]; then echo "mode must be warn or block" >&2 exit 2 fi cd "${ROOT}" echo "arch-check mode=${MODE}" echo "boundaries=${ROOT}/.doc/system-design/module-boundaries.yaml" if ! go test ./internal/archtest -count=1; then echo "arch-check: new, expired, or unowned findings failed go test ./internal/archtest" >&2 exit 1 fi if [[ "${MODE}" == "block" ]]; then if ! ARCHTEST_STRICT=1 go test ./internal/archtest -count=1 -run TestArchitectureBoundaries; then echo "arch-check block: a cleared kind in block_kinds still has findings" >&2 exit 1 fi fi echo "arch-check ${MODE}: production gate passed"