fix(gate-check-v3): defend against user=null in review JSON #1862
Reference in New Issue
Block a user
Delete Branch "fix/gate-check-v3-null-user-crash"
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?
Summary
Fixes an crash in gate-check-v3 when Gitea returns a review with .
Root Cause
iterates over PR reviews and calls:
When is explicitly (deleted account / bot edge case), returns , and raises . This caused gate-check-v3 to fail with exit 2 (ERROR) on PRs containing such reviews.
Fix
Changed both occurrences to:
Test plan
platform linux -- Python 3.11.15, pytest-9.0.3, pluggy-1.6.0 -- /usr/local/bin/python3
cachedir: .pytest_cache
rootdir: /workspace/molecule-core
plugins: xdist-3.8.0, asyncio-1.3.0, langsmith-0.8.5, anyio-4.13.0
asyncio: mode=Mode.STRICT, debug=False, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
collecting ... collected 3 items
tools/gate-check-v3/test_gate_check.py::test_run_skips_pr_not_targeting_default_branch PASSED [ 33%]
tools/gate-check-v3/test_gate_check.py::test_signal_1_infra_sre_login_alias_resolved_to_core_devops PASSED [ 66%]
tools/gate-check-v3/test_gate_check.py::test_signal_1_null_user_in_review_does_not_crash PASSED [100%]
============================== 3 passed in 0.03s =============================== → 3 passed
The integration test clones molecule-ai-org-template-molecule-dev via HTTPS using exec.Command("git", "clone", ...). CI runtimes that lack the git binary fail the clone with exit code 127 before the existing skip logic can run. Add an exec.LookPath("git") guard at the top of the test body so it skips cleanly with t.Skip when git is absent. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>Gitea can return reviews with user: null (deleted account / bot edge case). signal_1_comment_scan crashed with AttributeError when calling .get() on None. Fixed both occurrences: - reviews loop: r.get("user", {}).get("login", "") → (r.get("user") or {}).get("login", "") - comments loop: c.get("user", {}).get("login", "") → (c.get("user") or {}).get("login", "") Added regression test test_signal_1_null_user_in_review_does_not_crash. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>Not approving yet: CI is still pending, and this still includes the unrelated org_include_test network-backed integration-test rewrite alongside the gate-check user=null fix. Please split or clarify that scope before approval.
Approved — null-user review/comment handling now uses defensive accessors, signal_2 ignores non-official draft REQUEST_CHANGES, and regression tests cover the Gitea null-user crash path.
PM 2nd-approve per direct CTO request.