fix: verdict JSON grep pattern — capture value without closing quote

The grep \{"verdict":\s*"[^"]+ captures up to but not including the
closing quote. The second grep for "[A-Z_]+"$ then fails because
there's no closing quote. Fixed: match "verdict":\s*"[A-Z_]+ then
extract [A-Z_]+$ (no quotes needed).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
snomiao
2026-03-28 10:51:35 +00:00
parent bfc0931260
commit 6761c391b7

View File

@@ -223,8 +223,8 @@ if [ -d video-reviews ]; then
[ -f "$rpt" ] || continue
TOTAL_REPORTS=$((TOTAL_REPORTS + 1))
# Try structured JSON verdict first (from ## Verdict section)
VERDICT_JSON=$(grep -oP '\{"verdict":\s*"[^"]+' "$rpt" 2>/dev/null | tail -1 | grep -oP '"[A-Z_]+"$' | tr -d '"' || true)
RISK_JSON=$(grep -oP '"risk":\s*"[^"]+' "$rpt" 2>/dev/null | tail -1 | grep -oP '"[a-z]+"$' | tr -d '"' || true)
VERDICT_JSON=$(grep -oP '"verdict":\s*"[A-Z_]+' "$rpt" 2>/dev/null | tail -1 | grep -oP '[A-Z_]+$' || true)
RISK_JSON=$(grep -oP '"risk":\s*"[a-z]+' "$rpt" 2>/dev/null | tail -1 | grep -oP '[a-z]+$' || true)
if [ -n "$VERDICT_JSON" ]; then
case "$VERDICT_JSON" in
@@ -287,7 +287,7 @@ BADGE_LABEL="QA${QA_DATE}"
FIX_RESULT="" FIX_COLOR="#4c1"
if [ "$TARGET_TYPE" != "issue" ]; then
# Try structured JSON risk first
ALL_RISKS=$(grep -ohP '"risk":\s*"[a-z]+"' video-reviews/*.md 2>/dev/null | grep -oP '"[a-z]+"$' | tr -d '"' || true)
ALL_RISKS=$(grep -ohP '"risk":\s*"[a-z]+' video-reviews/*.md 2>/dev/null | grep -oP '[a-z]+$' || true)
if [ -n "$ALL_RISKS" ]; then
# Use worst risk across all reports
if echo "$ALL_RISKS" | grep -q 'high'; then