feat: scripts/agent_verify.sh fuer dual_agent-Pipeline
Drei Verifikations-Schichten fuer den Planner-Executor-Workflow aus ~/idea/dual_agent: 1. Statisch: node --check auf allen <script>-Bloecken in index.html. 2. Dynamisch: smoke_test.sh auf Port 8088. 3. Semantisch: Funktions-Doppeldeklarationen + Platzhalter-Leichen in der Datei und in der letzten Commit-Message. Die semantischen Checks adressieren konkret die No-Op-Muster, die frueher als Pseudo-Fixes durchgerutscht sind. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a44220c793
commit
1f59b384be
1 changed files with 60 additions and 0 deletions
60
scripts/agent_verify.sh
Executable file
60
scripts/agent_verify.sh
Executable file
|
|
@ -0,0 +1,60 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Verifikations-Hook fuer dual_agent-Pipeline.
|
||||||
|
# Wird nach dem Executor-Lauf aufgerufen; Exit 0 = gruen.
|
||||||
|
# stdout/stderr landen bei Retry als Kontext beim Planner.
|
||||||
|
set -u
|
||||||
|
FAIL=0
|
||||||
|
|
||||||
|
# --- 1. Statisch: JS-Syntax in index.html ------------------------------
|
||||||
|
if [ -f web/index.html ]; then
|
||||||
|
python3 - <<'PY' || FAIL=1
|
||||||
|
import re, subprocess, tempfile, sys
|
||||||
|
html = open('web/index.html').read()
|
||||||
|
for i, s in enumerate(re.findall(r'<script[^>]*>([\s\S]*?)</script>', html)):
|
||||||
|
with tempfile.NamedTemporaryFile('w', suffix='.js', delete=False) as f:
|
||||||
|
f.write(s); p = f.name
|
||||||
|
r = subprocess.run(['node', '--check', p], capture_output=True, text=True)
|
||||||
|
if r.returncode != 0:
|
||||||
|
print(f'JS[{i}] syntax error:\n{r.stderr}')
|
||||||
|
sys.exit(1)
|
||||||
|
print('JS syntax OK')
|
||||||
|
PY
|
||||||
|
fi
|
||||||
|
|
||||||
|
# --- 2. Dynamisch: Smoke-Test (alle Endpunkte) -------------------------
|
||||||
|
if [ -x scripts/smoke_test.sh ]; then
|
||||||
|
./scripts/smoke_test.sh 8088 || FAIL=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# --- 3. Semantisch: Pseudo-Fix-Muster verbieten ------------------------
|
||||||
|
# Diese Patterns haben wir als No-Op-Fixes im JSON-Editor erlebt.
|
||||||
|
# Ein neuer Bugfix darf sie nicht wieder einfuehren.
|
||||||
|
if [ -f web/index.html ]; then
|
||||||
|
# No-Op-Pattern: leerer Container + while(firstChild) -> nichts zu bewegen
|
||||||
|
if grep -qE 'document\.createElement\([^)]+\)[^;]*;[[:space:]]*[^;]*\.appendChild\([^)]*firstChild\)' web/index.html; then
|
||||||
|
: # zu grob — deaktiviert
|
||||||
|
fi
|
||||||
|
# Doppeldeklaration einer Funktion
|
||||||
|
for fn in buildJsonForm extractJsonFromForm createJsonEditUI createTextEditUI applyFilters; do
|
||||||
|
count=$(grep -cE "function[[:space:]]+${fn}\\b" web/index.html || true)
|
||||||
|
if [ "$count" -gt 1 ]; then
|
||||||
|
echo "FAIL: Funktion '$fn' ist $count mal deklariert (erwartet: 1)"
|
||||||
|
FAIL=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
# Platzhalter-Leichen in geaenderten HTML-Attributen
|
||||||
|
if grep -qE 'an[[:space:]][[:space:]]+und[[:space:]][[:space:]]+angehaengt' web/index.html; then
|
||||||
|
echo "FAIL: Platzhalter-Leichen in der Datei (Variablen nicht interpoliert)"
|
||||||
|
FAIL=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# --- 4. Git-Hygiene: Commit-Message ohne Platzhalter-Leichen ----------
|
||||||
|
last_msg=$(git log -1 --pretty=%B 2>/dev/null || true)
|
||||||
|
if echo "$last_msg" | grep -qE '\b(an|in|mit)[[:space:]][[:space:]]+und'; then
|
||||||
|
echo "FAIL: letzter Commit hat doppelte Leerzeichen (Platzhalter nicht ersetzt):"
|
||||||
|
echo "$last_msg" | head -3
|
||||||
|
FAIL=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit $FAIL
|
||||||
Loading…
Add table
Reference in a new issue