The union-observed-but-variant-never-matched tier was one finding per variant, so 67 findings described the same fix across 21 unions. Group by marker class instead: failures and loading markers stay warnings because an unrendered failure means the user gets no feedback, other markers drop to info. nuwayze: 146 findings -> 108, and the actionable core is now visible: 14 warnings (2 dormant decisions + 12 missing-feedback groups), down from 49. Also records a negative result in the README: tiering these by 'variant declares no fields beyond its base' was tried and rejected, because 67/67 qualified and a signal true of the whole population cannot discriminate.
64 lines
1.8 KiB
Bash
Executable file
64 lines
1.8 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
#
|
|
# Gate a fix using pipe itself as the oracle.
|
|
#
|
|
# scripts/gate_fixed.sh <repo> <rule> [key value]
|
|
#
|
|
# Exits 0 when the finding is gone:
|
|
# - with no key/value: the rule reports nothing at all for the repo
|
|
# - with key/value: no finding for that rule has data[key] == value
|
|
#
|
|
# Prefers a built binary (AOT startup is ~30x faster) and falls back to `dart run`.
|
|
set -euo pipefail
|
|
|
|
if [ "$#" -lt 2 ]; then
|
|
echo "usage: scripts/gate_fixed.sh <repo> <rule> [key value]" >&2
|
|
exit 2
|
|
fi
|
|
|
|
repo="$1"
|
|
rule="$2"
|
|
key="${3:-}"
|
|
value="${4:-}"
|
|
|
|
pipe_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
|
|
binary=""
|
|
for candidate in "$pipe_root"/build/cli/*/bundle/bin/pipe "$pipe_root"/build/pipe; do
|
|
if [ -x "$candidate" ]; then
|
|
binary="$candidate"
|
|
break
|
|
fi
|
|
done
|
|
|
|
json="$(mktemp)"
|
|
trap 'rm -f "$json"' EXIT
|
|
|
|
if [ -n "$binary" ]; then
|
|
"$binary" check "$repo" -c 8 --rule "$rule" --format json >"$json"
|
|
else
|
|
(cd "$pipe_root" && dart run bin/pipe.dart check "$repo" -c 8 --rule "$rule" --format json) >"$json"
|
|
fi
|
|
|
|
python3 - "$json" "$repo" "$rule" "$key" "$value" <<'PY'
|
|
import json
|
|
import sys
|
|
|
|
path, repo, rule, key, value = sys.argv[1:6]
|
|
with open(path) as handle:
|
|
report = json.load(handle)
|
|
|
|
findings = [f for f in report.get('findings', []) if f.get('rule') == rule]
|
|
if key:
|
|
findings = [f for f in findings if str(f.get('data', {}).get(key)) == value]
|
|
|
|
target = f'{rule}' + (f' {key}={value}' if key else '')
|
|
if findings:
|
|
print(f'GATE FAIL: {len(findings)} finding(s) still present for {target}')
|
|
for finding in findings[:8]:
|
|
print(f" - {finding.get('file')}:{finding.get('line')} "
|
|
f"{finding.get('data', {}).get('variant') or finding.get('data', {}).get('event') or ''}")
|
|
sys.exit(1)
|
|
|
|
print(f'GATE PASS: nothing reported for {target}')
|
|
PY
|