From 576b60cf51f8d312461b4141477a6d01327e2820 Mon Sep 17 00:00:00 2001 From: MDA2AV Date: Mon, 16 Nov 2026 10:03:14 +0000 Subject: [PATCH] PR commands: no false fails on branches behind main Two workflow bugs marked good runs as failed on PRs whose branch is behind main: - The --save dry run (and the merge in benchmark-pr.yml) fetched main with --depth=1 into a full-history checkout. That writes main's tip into .git/shallow, the merge-base disappears, and git refuses with "refusing to merge unrelated histories" - reported as "main has diverged". Every passing pre-check was "Already up to date"; it never tested for conflicts. Fetch without --depth. - benchmark-pr.yml runs from main but with the PR's scripts, and since #1777 it calls scripts/spec.sh after every full benchmark. A branch cut before #1777 has no spec.sh, so every entry was marked failed after benchmarking fine (#1758: Failed: 6). Skip the suites with a notice when the script is missing; a /spec run still fails. --- .github/workflows/benchmark-pr.yml | 15 ++++++++++++--- .github/workflows/pr-commands.yml | 12 ++++++++---- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/workflows/benchmark-pr.yml b/.github/workflows/benchmark-pr.yml index 48272432d8..00e279f4a0 100644 --- a/.github/workflows/benchmark-pr.yml +++ b/.github/workflows/benchmark-pr.yml @@ -137,7 +137,7 @@ jobs: run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - git fetch origin main --depth=1 + git fetch origin main if ! git merge --no-edit origin/main; then git merge --abort 2>/dev/null || true gh pr comment "${{ inputs.pr }}" \ @@ -158,7 +158,7 @@ jobs: # replaces staged main's copy of every file under site/data, and copying the # PR's files back over does not delete, so a file the PR removed stayed in the # index and rode along in the results commit. - git fetch origin main --depth=1 + git fetch origin main rm -rf /tmp/main_site_data mkdir -p /tmp/main_site_data git archive origin/main:site/data | tar -x -C /tmp/main_site_data @@ -178,6 +178,15 @@ jobs: mkdir -p /tmp/bench_logs FAILED="" FIRST=true + # This file runs from main but the scripts come from the PR, and a branch + # cut before the compliance suites (#1777) has no scripts/spec.sh. A + # /benchmark there skips the suites instead of marking every entry + # failed; a /spec there still fails. + have_spec=true + if [ ! -f scripts/spec.sh ]; then + have_spec=false + echo "::notice::scripts/spec.sh is not on this branch (it predates #1777): merge main to run the compliance suites" + fi for fw in $LIST; do # Settle between frameworks. The previous entry's container has only # just been torn down: its sockets are still draining through @@ -205,7 +214,7 @@ jobs: # failed that image may be stale, so the suites wait for the next run. # Like the benchmark, the scores always go to disk and are committed # only on --save. - if [ "$SPEC_ONLY" = "true" ] || { [ "$RESILIENCE_ONLY" != "true" ] && [ -z "$PROFILE" ] && $bench_ok; }; then + if [ "$SPEC_ONLY" = "true" ] || { $have_spec && [ "$RESILIENCE_ONLY" != "true" ] && [ -z "$PROFILE" ] && $bench_ok; }; then echo "::group::spec $fw" skip_build=1 [ "$SPEC_ONLY" = "true" ] && skip_build=0 diff --git a/.github/workflows/pr-commands.yml b/.github/workflows/pr-commands.yml index eb859eb5aa..67e69d16f1 100644 --- a/.github/workflows/pr-commands.yml +++ b/.github/workflows/pr-commands.yml @@ -164,7 +164,11 @@ jobs: # merge happens inside benchmark-pr.yml after maintainer approval; # doing the dry-run here lets us reject conflicting PRs before # asking a maintainer to approve a run that's guaranteed to abort. - # Skipped for non-save runs since they don't push back. + # Skipped for non-save runs since they don't push back. The fetch takes + # no --depth: the checkout has full history, and a shallow fetch cuts + # main's tip off from its parents, so the dry run fails with "refusing + # to merge unrelated histories" for any branch behind main and passes + # only for one already up to date with it. - name: Check main merges into PR if: steps.parse.outputs.save == 'true' && steps.parse.outputs.framework != '' env: @@ -172,7 +176,7 @@ jobs: run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - git fetch origin main --depth=1 + git fetch origin main if ! git merge --no-commit --no-ff origin/main; then git merge --abort 2>/dev/null || true gh pr comment "${{ steps.parse.outputs.pr }}" \ @@ -296,7 +300,7 @@ jobs: run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - git fetch origin main --depth=1 + git fetch origin main if ! git merge --no-commit --no-ff origin/main; then git merge --abort 2>/dev/null || true gh pr comment "${{ steps.parse.outputs.pr }}" \ @@ -415,7 +419,7 @@ jobs: run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - git fetch origin main --depth=1 + git fetch origin main if ! git merge --no-commit --no-ff origin/main; then git merge --abort 2>/dev/null || true gh pr comment "${{ steps.parse.outputs.pr }}" \