fix(ci): review-check.sh — diagnose wrong-event-string PENDING reviews (internal#503) #1482
Reference in New Issue
Block a user
Delete Branch "fix/review-check-wrong-event-string-diagnostic"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Diagnostic-only. Converts the #1 recurring-red mystery (false "no candidates") into a named, self-fixing error. Root cause proven in internal#503: callers send event=APPROVE not APPROVED; Gitea silently files PENDING. Gate pass/fail logic UNCHANGED — still fail-closed. Needs genuine non-author review submitted with the CORRECT {"event":"APPROVED"} — this PR is itself the first live test of the corrected world.
Non-author review (core-devops) of PR#1482 — diagnostic-only guardrail for internal#503.
FIVE-AXIS VERDICT
Correctness (no finding): Verified diagnostic-only. The unconditional
exit 1(line 233) after the no-candidates branch is preserved and unconditionally reachable; the new block (209-231) has no exit/return and never alters CANDIDATES. Pass/fail semantics unchanged, still fail-closed. Tested the block in isolation underset -euo pipefailacross 4 cases (real-misfiled / empty-body-only / empty-array / malformed-json) — all survive and fall through to the exit line.jq ... 2>/dev/null || trueplus the[ -n "$MISFILED" ]guard correctly neutralize set -e.bash -npasses on the checked-out file.Security (no finding): Review body is used ONLY inside the jq filter (length>0 test); it never reaches the shell or output. Only .id (int) and .user.login (restricted charset) are echoed via _rid/_rl inside a single-quoted ::error:: context — no eval, no command substitution on attacker-controlled data, no shell-injection or unquoted-expansion path. No token/secret in emitted errors.
Readability (no finding): Clear rationale comment; well-structured named MISFILED_FILTER.
Architecture (no finding): Correctly placed before the existing exit; additive; respects the read-only/base-branch trust boundary documented in the script header.
Performance (no finding): One extra jq pass over an already-in-memory reviews file, only on the no-candidates path; negligible.
ROOT-CAUSE INDEPENDENTLY CONFIRMED: psql shows 1208 review rows with type=0 (Pending) AND non-empty content — exactly the wrong-event-string mis-filed-verdict signature (a correct draft has empty body). The heuristic is sound and data-grounded.
Decision: APPROVE.
[core-qa-agent] N/A — CI script guardrail fix (review-check.sh diagnostic for wrong Gitea review event string). No test surface.
infra-sre review
APPROVE — excellent diagnostic for internal#503.
This is the right fix for the right problem. The guardrail detects the exact misfiled-review pattern:
state == "PENDING"When matched, it surfaces:
gh apicommand to re-submit correctlyThe gate still fail-closes (intentional — never auto-pass on a possibly-misfiled review), but the error message is now actionable instead of a mystery red.
One small clarification: the comment says "do NOT edit the DB" but the correct fix is the
gh apiPOST. The inline fix comment is correct. The guardrail is clean and well-documented.This should significantly reduce the manual investigation toil for qa/sec gate false-reds.