Files
weichenandCursor 937152a563 Add an architecture edge ratchet and waiting-state tokens
Why: New cross-layer imports and unused exports could land unnoticed, and confirm-waiting reused the success color.
Evidence: bash scripts/lint-boundaries.sh passed, including a probe that a new edge fails. Both design-guard tests passed. Knip counts stay at the baselines.
Impact: make test-boundaries now checks architecture edges. Frontend and ui test targets also run the knip ratchet.
Refs: feature/architecture-baseline
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-03 16:02:57 +00:00

27 lines
925 B
Bash
Executable File

#!/usr/bin/env bash
# 分层棘轮:新增依赖边失败,消失的边只告警。
# 负例:注入一条基线里没有的边,必须失败。
set -euo pipefail
root=$(cd "$(dirname "$0")/.." && pwd)
base="$root/policy/architecture-baseline.json"
tool=(go run "$root/scripts/lint-architecture.go" -root "$root" -baseline "$base")
( cd "$root/scripts" && "${tool[@]}" )
set +e
( cd "$root/scripts" && "${tool[@]}" -inject 'backend/store->backend/__architecture_probe__' ) >/tmp/architecture-probe.out 2>&1
code=$?
set -e
if [ "$code" -eq 0 ]; then
echo "architecture: injected edge was accepted" >&2
cat /tmp/architecture-probe.out >&2
exit 1
fi
if ! grep -q '__architecture_probe__' /tmp/architecture-probe.out; then
echo "architecture: injected edge did not fail for the expected reason" >&2
cat /tmp/architecture-probe.out >&2
exit 1
fi
rm -f /tmp/architecture-probe.out
echo "architecture negative ok"