fix(gate): remove unreliable review.state guard from qa/security auto-trigger (#2159) #2161

Closed
core-be wants to merge 1 commits from fix/2159-qa-security-auto-trigger-review-state-guard into main
Member

Summary

Fixes #2159.

The job-level if: guard checking github.event.review.state == 'APPROVED' prevented qa-review.yml and security-review.yml from firing on pull_request_review events in Gitea 1.22.6. The payload shape for this event does not reliably expose the state field that the GitHub-style guard expects, causing the guard to evaluate false and skip the job entirely.

Changes

  • Remove review.state check from job guard in both workflows.
  • Job now fires on ALL pull_request_review events. The evaluator (review-check.sh) reads actual reviews from the API and validates APPROVED independently, so this is safe.
  • Aligns with sop-tier-check.yml which uses the same pattern (no state guard) and provably fires on every review event.
  • Updates test_gate_review_auto_fire.py to assert guard does NOT contain review.state.

Test plan

  • pytest .gitea/scripts/tests/test_gate_review_auto_fire.py -v → 11 passed
  • CR2 live-run: submit APPROVED review on a core PR and verify qa-review + security-review contexts flip green without /qa-recheck backstop.

Context

Refs: internal#760

## Summary Fixes #2159. The job-level `if:` guard checking `github.event.review.state == 'APPROVED'` prevented qa-review.yml and security-review.yml from firing on `pull_request_review` events in Gitea 1.22.6. The payload shape for this event does not reliably expose the state field that the GitHub-style guard expects, causing the guard to evaluate false and skip the job entirely. ## Changes - Remove `review.state` check from job guard in both workflows. - Job now fires on ALL `pull_request_review` events. The evaluator (`review-check.sh`) reads actual reviews from the API and validates APPROVED independently, so this is safe. - Aligns with `sop-tier-check.yml` which uses the same pattern (no state guard) and provably fires on every review event. - Updates `test_gate_review_auto_fire.py` to assert guard does NOT contain `review.state`. ## Test plan - [x] `pytest .gitea/scripts/tests/test_gate_review_auto_fire.py -v` → 11 passed - [ ] CR2 live-run: submit APPROVED review on a core PR and verify qa-review + security-review contexts flip green without `/qa-recheck` backstop. ## Context Refs: internal#760
core-be added 1 commit 2026-06-03 01:19:27 +00:00
fix(gate): remove unreliable review.state guard from qa/security auto-trigger (#2159)
ci-arm64-advisory / fast-checks (pull_request) Waiting to run
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 3s
CI / Python Lint & Test (pull_request) Successful in 7s
Lint shellcheck (arm64 pilot) / shellcheck-arm64 (pilot) (pull_request) Failing after 3s
Lint curl status-code capture / Scan workflows for curl status-capture pollution (pull_request) Successful in 5s
CI / Detect changes (pull_request) Successful in 11s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 10s
E2E Chat / detect-changes (pull_request) Successful in 11s
Lint forbidden tenant-env keys / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 8s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 9s
lint-required-workflows-docker-host-pinned / Lint docker-host pin on docker-touching workflows (pull_request) Successful in 4s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 4s
E2E API Smoke Test / detect-changes (pull_request) Successful in 18s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 18s
sop-checklist / review-refire (pull_request_target) Has been skipped
CI / Platform (Go) (pull_request) Successful in 2s
CI / Canvas (Next.js) (pull_request) Successful in 1s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 1s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 1s
E2E Chat / E2E Chat (pull_request) Successful in 1s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 1s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 1s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
gate-check-v3 / gate-check (pull_request_target) Successful in 25s
CI / all-required (pull_request) Successful in 14s
sop-checklist / all-items-acked (pull_request) acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4 — body-unfilled: comprehensive-testing, local-postgres-e2
sop-checklist / na-declarations (pull_request) N/A: (none)
sop-checklist / all-items-acked (pull_request_target) Successful in 27s
sop-tier-check / tier-check (pull_request_target) Successful in 26s
lint-continue-on-error-tracking / lint-continue-on-error-tracking (pull_request) Failing after 55s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 56s
lint-required-context-exists-in-bp / lint-required-context-exists-in-bp (pull_request) Successful in 1m14s
Lint pre-flip continue-on-error / Verify continue-on-error flips have run-log proof (pull_request) Successful in 1m22s
Ops Scripts Tests / Ops scripts (unittest) (pull_request) Successful in 1m26s
Lint workflow YAML (Gitea-1.22.6-hostile shapes) / Lint workflow YAML for Gitea-1.22.6-hostile shapes (pull_request) Successful in 1m40s
qa-review / approved (pull_request_target) Review check failed via pull_request_review trigger
qa-review / approved (pull_request_review) Failing after 3s
security-review / approved (pull_request_target) Review check failed via pull_request_review trigger
security-review / approved (pull_request_review) Failing after 8s
sop-tier-check / tier-check (pull_request_review) Successful in 7s
audit-force-merge / audit (pull_request_target) Has been skipped
f99c92f248
The job-level `if:` guard checking `github.event.review.state == 'APPROVED'`
prevented qa-review.yml and security-review.yml from firing on
`pull_request_review` events in Gitea 1.22.6.  The payload shape for this
event does not reliably expose the state field that the GitHub-style guard
expects, causing the guard to evaluate false and skip the job entirely.

Fix:
- Remove review.state check from job guard in both workflows.
- Job now fires on ALL pull_request_review events (submitted, comment,
  request_changes).  The evaluator (review-check.sh) reads actual reviews
  from the API and validates APPROVED independently, so this is safe.
- Aligns with sop-tier-check.yml which uses the same pattern (no state
  guard) and provably fires on every review event.
- Updates test_gate_review_auto_fire.py to assert guard does NOT contain
  review.state (instead asserts pull_request_review event name only).

Test count unchanged (11 pass).

Refs: #2159, internal#760
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
molecule-code-reviewer approved these changes 2026-06-03 01:32:05 +00:00
molecule-code-reviewer left a comment
Member

APPROVED — 5-axis review for molecule-core#2161.

Correctness: this directly addresses #2159 by removing the unreliable github.event.review.state job guard from qa/security review workflows. The workflows still trigger on pull_request_review: submitted, and the actual approval decision remains inside review-check.sh, which reads Gitea reviews via API and filters for real APPROVED, non-author, team-member reviews.

Robustness: running the job on all review submissions is idempotent. COMMENT/REQUEST_CHANGES events may re-evaluate, but they do not bypass the gate because review-check.sh remains authoritative. The regression tests now assert the guard fires on pull_request_review and does not reference the unreliable review.state payload.

Security: the trust boundary is preserved: workflow checkout stays on the repository default branch, not PR head; evaluation uses SOP_TIER_CHECK_TOKEN; required status posting uses STATUS_POST_TOKEN; the BP-required context strings remain the pull_request_target variants.

Performance: extra evaluations on non-APPROVED review events are small API/script runs and acceptable for this gate path.

Readability: the comments explain why the guard was removed and point to #2159; the test names and assertions match the intended invariant.

Gate note: I observed lint-continue-on-error-tracking failing on the head while the relevant workflow/script tests were green. This review is a code verdict, not a gate-green signal.

APPROVED — 5-axis review for molecule-core#2161. Correctness: this directly addresses #2159 by removing the unreliable `github.event.review.state` job guard from qa/security review workflows. The workflows still trigger on `pull_request_review: submitted`, and the actual approval decision remains inside `review-check.sh`, which reads Gitea reviews via API and filters for real APPROVED, non-author, team-member reviews. Robustness: running the job on all review submissions is idempotent. COMMENT/REQUEST_CHANGES events may re-evaluate, but they do not bypass the gate because `review-check.sh` remains authoritative. The regression tests now assert the guard fires on pull_request_review and does not reference the unreliable `review.state` payload. Security: the trust boundary is preserved: workflow checkout stays on the repository default branch, not PR head; evaluation uses `SOP_TIER_CHECK_TOKEN`; required status posting uses `STATUS_POST_TOKEN`; the BP-required context strings remain the pull_request_target variants. Performance: extra evaluations on non-APPROVED review events are small API/script runs and acceptable for this gate path. Readability: the comments explain why the guard was removed and point to #2159; the test names and assertions match the intended invariant. Gate note: I observed `lint-continue-on-error-tracking` failing on the head while the relevant workflow/script tests were green. This review is a code verdict, not a gate-green signal.
core-be closed this pull request 2026-06-03 01:43:21 +00:00
Some checks are pending
ci-arm64-advisory / fast-checks (pull_request) Waiting to run
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 3s
CI / Python Lint & Test (pull_request) Successful in 7s
Lint shellcheck (arm64 pilot) / shellcheck-arm64 (pilot) (pull_request) Failing after 3s
Lint curl status-code capture / Scan workflows for curl status-capture pollution (pull_request) Successful in 5s
CI / Detect changes (pull_request) Successful in 11s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 10s
E2E Chat / detect-changes (pull_request) Successful in 11s
Lint forbidden tenant-env keys / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 8s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 9s
lint-required-workflows-docker-host-pinned / Lint docker-host pin on docker-touching workflows (pull_request) Successful in 4s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 4s
Required
Details
E2E API Smoke Test / detect-changes (pull_request) Successful in 18s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 18s
sop-checklist / review-refire (pull_request_target) Has been skipped
CI / Platform (Go) (pull_request) Successful in 2s
CI / Canvas (Next.js) (pull_request) Successful in 1s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 1s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 1s
Required
Details
E2E Chat / E2E Chat (pull_request) Successful in 1s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 1s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 1s
Required
Details
CI / Canvas Deploy Reminder (pull_request) Has been skipped
gate-check-v3 / gate-check (pull_request_target) Successful in 25s
CI / all-required (pull_request) Successful in 14s
Required
Details
sop-checklist / all-items-acked (pull_request) acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4 — body-unfilled: comprehensive-testing, local-postgres-e2
sop-checklist / na-declarations (pull_request) N/A: (none)
sop-checklist / all-items-acked (pull_request_target) Successful in 27s
sop-tier-check / tier-check (pull_request_target) Successful in 26s
lint-continue-on-error-tracking / lint-continue-on-error-tracking (pull_request) Failing after 55s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 56s
lint-required-context-exists-in-bp / lint-required-context-exists-in-bp (pull_request) Successful in 1m14s
Lint pre-flip continue-on-error / Verify continue-on-error flips have run-log proof (pull_request) Successful in 1m22s
Ops Scripts Tests / Ops scripts (unittest) (pull_request) Successful in 1m26s
Lint workflow YAML (Gitea-1.22.6-hostile shapes) / Lint workflow YAML for Gitea-1.22.6-hostile shapes (pull_request) Successful in 1m40s
qa-review / approved (pull_request_target) Review check failed via pull_request_review trigger
Required
qa-review / approved (pull_request_review) Failing after 3s
security-review / approved (pull_request_target) Review check failed via pull_request_review trigger
Required
security-review / approved (pull_request_review) Failing after 8s
sop-tier-check / tier-check (pull_request_review) Successful in 7s
audit-force-merge / audit (pull_request_target) Has been skipped
reserved-path-review / reserved-path-review (pull_request_target)
Required

Pull request closed

Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#2161