From 6250a547d8b2efa06e9ea13ba1ad1abdbaa1d6bc Mon Sep 17 00:00:00 2001 From: Dmitrii Vasilev Date: Mon, 5 Oct 2026 05:35:24 +0700 Subject: [PATCH 1/2] ci(brain): let the merge gate fail, and fail on a failed detect-build merge-gate had `if: github.event_name == 'pull_request'` and no status function, so GitHub added success(): it ran only when the report and every job upstream of it had passed, and its one test ("the report did not pass") could never be true. On 3 of 3 pull_request runs where the report failed, the gate was skipped. It now runs on !cancelled(). The report read an empty `present` output as "no root build.zig" and exited 0. A failed detect-build never writes that output, so a broken detector gave a green report check claiming the repo has no root build.zig (detect-build's own check stays red). The report now requires detect-build to have succeeded before it trusts `present`. Closes #883. Part of #851. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/brain-ci.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/brain-ci.yml b/.github/workflows/brain-ci.yml index f0aeca87e..62fce650c 100644 --- a/.github/workflows/brain-ci.yml +++ b/.github/workflows/brain-ci.yml @@ -514,6 +514,14 @@ jobs: echo "" >> $GITHUB_STEP_SUMMARY echo "## Verdict" >> $GITHUB_STEP_SUMMARY + # A failed detect-build never writes `present`, and the test below + # read the empty value as "no root build.zig" and passed (#883). + detect_ok=false + [ "${{ needs.detect-build.result }}" == "success" ] && detect_ok=true + if [ "$detect_ok" != true ]; then + echo "### ! Brain CI cannot tell whether it applies: detect-build was ${{ needs.detect-build.result }}" >> $GITHUB_STEP_SUMMARY + exit 1 + fi # When the root build.zig is absent, all brain jobs are `skipped` # (see detect-build). That is an honest "not applicable" state for # the current RTL/HW-focused repo, not damage — do not block on it. @@ -622,7 +630,10 @@ jobs: name: 🔒 Merge Gate runs-on: ubuntu-latest needs: [brain-health-report] - if: github.event_name == 'pull_request' + # Without a status function GitHub adds success(), so this job ran only + # after a passing report and its "report did not pass" test could never + # be true: a damaged PR showed the gate as grey `skipped` (#883). + if: ${{ !cancelled() && github.event_name == 'pull_request' }} timeout-minutes: 2 steps: - name: Check Merge Eligibility From 98da33e353d8cace53301b173257cf5e2e2b8be8 Mon Sep 17 00:00:00 2001 From: Dmitrii Vasilev Date: Mon, 5 Oct 2026 13:03:47 +0700 Subject: [PATCH 2/2] style(brain): name the bool the detect-build verdict tests The verdict step tested `[ "$detect_ok" != true ]`, a negated comparison; every added bash if here tests a named bool with `= true`. Renamed to detect_failed so the if reads what it checks. Same exit for every detect-build result under bash -e: success 0; failure, cancelled, skipped and empty 1 (5/5, old and new side by side). Found by running speed wflint on a trial merge of the 18 open loop PRs: the only lint finding the merged tree adds over main 57de4a1f5. Refs #883, #851. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/brain-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/brain-ci.yml b/.github/workflows/brain-ci.yml index 62fce650c..5e8ed0910 100644 --- a/.github/workflows/brain-ci.yml +++ b/.github/workflows/brain-ci.yml @@ -516,9 +516,9 @@ jobs: echo "## Verdict" >> $GITHUB_STEP_SUMMARY # A failed detect-build never writes `present`, and the test below # read the empty value as "no root build.zig" and passed (#883). - detect_ok=false - [ "${{ needs.detect-build.result }}" == "success" ] && detect_ok=true - if [ "$detect_ok" != true ]; then + detect_failed=true + [ "${{ needs.detect-build.result }}" == "success" ] && detect_failed=false + if [ "$detect_failed" = true ]; then echo "### ! Brain CI cannot tell whether it applies: detect-build was ${{ needs.detect-build.result }}" >> $GITHUB_STEP_SUMMARY exit 1 fi