From 1747efad6adcd1967968c3caf6d1ef5f9f4ed155 Mon Sep 17 00:00:00 2001 From: Claude Code Bot Date: Thu, 10 Sep 2026 22:33:02 -0700 Subject: [PATCH] fix(standards): say why the base-SHA fetch failed, not just that it did The fallback warning discarded git's stderr (2>/dev/null), so a run that fell back to a whole-repo sweep reported THAT it happened and never WHY. That turns a diagnosable fault into a rate you can only sample. Capture stderr into the same command substitution that gates the branch, and append it to the annotation collapsed to a single line. `fetch_err=$(...)` as an `if` condition is exempt from `set -e`, so a failed fetch still takes the else branch rather than aborting the step. Validated against a known-bad case (an unreachable SHA with no origin): the warning carries "fatal: 'origin' does not appear to be a git repository ..." and the script reaches its end with rc=0. Found while re-measuring the fallback rate, which turned out to be zero (smartwatermelon/dev-env#121). This is the one real gap that survived that correction; it is a diagnostics fix, not a W3 blocker. Claude-Session: https://claude.ai/code/session_01ESsw699T54JHARkQXrdL3o --- .github/workflows/standards-check.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/standards-check.yml b/.github/workflows/standards-check.yml index cb88342..534eeaa 100644 --- a/.github/workflows/standards-check.yml +++ b/.github/workflows/standards-check.yml @@ -134,11 +134,15 @@ jobs: exit 0 ;; esac - if git -C repo fetch --depth=1 origin "${BASE_SHA}" 2>/dev/null; then + # Capture stderr rather than discarding it: a fallback that cannot + # say WHY it fired is a rate you can only sample, not a fault you can + # diagnose. Keep it to one line so the annotation stays readable. + if fetch_err=$(git -C repo fetch --depth=1 origin "${BASE_SHA}" 2>&1); then echo "changed_since=${BASE_SHA}" >> "${GITHUB_OUTPUT}" echo "scoping to files changed since ${BASE_SHA}" else - echo "::warning::could not fetch base ${BASE_SHA}; falling back to whole-repo sweep" + fetch_err=$(printf '%s' "${fetch_err}" | tr '\n' ' ' | tr -s ' ') + echo "::warning::could not fetch base ${BASE_SHA}; falling back to whole-repo sweep — git said: ${fetch_err}" fi - name: Resolve the standards SHA