Skip to content

Properly fix CI gate for empty build matrices - #186

Merged
wilsonchenghy merged 4 commits into
mainfrom
claude/fix-ci-gate-properly
Aug 22, 2026
Merged

Properly fix CI gate for empty build matrices#186
wilsonchenghy merged 4 commits into
mainfrom
claude/fix-ci-gate-properly

Conversation

@wilsonchenghy

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #185, which shipped a broken fix. Root causes found by reading actual job logs from #185's own (failed) CI run:

  1. Wrong assumption in Fix false CI failure for simulation/embedded-only PRs #185: it assumed an empty-matrix build-and-unittest job reports needs.result == "skipped", and only failed the gate on literal "failure". In reality GitHub reports needs.<job>.result as "failure" for a zero-entry matrix job — so the gate kept failing for the exact case it was supposed to let through.
  2. Separate, pre-existing bug: INFRASTRUCTURE_CHANGED in check_src_changes/action.yml was defined with a YAML folded scalar (>) spanning two lines, which appends a trailing newline to the evaluated value ("true\n" instead of "true"). The downstream bash check [ "$INFRASTRUCTURE_CHANGED" == 'true' ] then silently fails even when the expression is true, so the "rebuild everything" sentinel for infrastructure-only changes (e.g. editing workflow files) never actually fired.

Fix

  1. confirm-build-and-unittest-complete now reads setup-environment's computed docker_matrix output directly and checks its entry count (jq '.include | length') instead of trusting build-and-unittest's needs.result. Zero entries → nothing to build for this diff → pass. Non-zero entries still gate on an actual success/failure result.
  2. Collapsed the INFRASTRUCTURE_CHANGED folded-scalar expression to a single line so the evaluated value has no trailing newline.

Test plan

  • Validated both YAML files parse.
  • Locally simulated the gate's bash logic against all 4 (matrix empty/non-empty) × (result success/failure) combinations — behaves correctly in each case.
  • Reproduced the trailing-newline string-comparison bug ($'true\n' != 'true' in bash) and confirmed the single-line expression fixes it.

Generated by Claude Code

claude added 4 commits August 22, 2026 04:01
The previous fix (merged in #185) assumed an empty-matrix
build-and-unittest job reports needs.result == "skipped", so the
gate only failed on literal "failure". That assumption was wrong:
GitHub reports needs.<job>.result as "failure" for a zero-entry
matrix job, so the gate kept failing for the exact case it was
meant to allow.

Two real fixes:

1. confirm-build-and-unittest-complete now reads the computed
   docker_matrix from setup-environment directly and checks its
   entry count, instead of trusting build-and-unittest's result.
   Zero entries = nothing to build for this diff = pass. Non-zero
   entries still gate on an actual success/failure result.

2. INFRASTRUCTURE_CHANGED in check_src_changes/action.yml was
   defined with a YAML folded scalar (`>`) spanning two lines,
   which appends a trailing newline to the evaluated value. The
   downstream bash comparison `[ "$INFRASTRUCTURE_CHANGED" == 'true' ]`
   then silently fails even when the expression evaluates true,
   so the "rebuild everything" sentinel for infra-only changes
   (e.g. workflow file edits) never actually fired. Collapsed to a
   single-line expression so the value has no trailing newline.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mzkt9bALC8oUqQKCN6upNm
Exposed by the infra-sentinel fix in this same PR: isaac_lab_il_datagen
is a single-stage Dockerfile built on the already-skipped
simulation_isaac GPU image (needs cuRobo/CUDA), so it has no
"dependencies"/"build" stages and can't build under the shared
multi-stage build-and-unittest job. It was missing from the existing
GPU/non-CI skip list alongside its siblings simulation, simulation_isaac,
simulation_mj, and embedded -- this had never surfaced because the
infra-sentinel bug meant infra-only changes never actually triggered a
full-matrix build until now.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mzkt9bALC8oUqQKCN6upNm
Found by running the first-ever full-matrix build (this PR's own CI,
enabled by the infra-sentinel fix above): perception and
perception.mac each define services literally named
"perception"/"perception_dev", but the concurrency group only keyed
on matrix.service:

  group: ${{ matrix.service }}-${{ github.workflow }}-${{ github.ref }}

So both modules' matrix jobs collided on the same group and
cancel-in-progress killed one of each pair -- not a failure, but a
silently cancelled job, which still fails the
confirm-build-and-unittest-complete gate since the aggregate
build-and-unittest result isn't "success". This had never triggered
before because a full TEST_ALL=true matrix build never actually ran
until the infra-sentinel fix in this same PR made one possible.

Added matrix.module to the group key so same-named services in
different modules no longer collide.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mzkt9bALC8oUqQKCN6upNm
python-version: '3.10.20' pinned an exact patch build via the very
old actions/setup-python@v1, and GitHub has since pruned that patch
from its hosted-runner Python manifest (only 3.10.21+ available now),
so every run of this workflow failed at the "Set up Python" step
regardless of the actual diff -- confirmed broken on main itself,
independent of any of the other CI fixes in this PR.

Bumped to actions/setup-python@v5 with a floating '3.10' version so
it always resolves to whatever patch is currently available instead
of needing a manual bump each time GitHub prunes an old one.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mzkt9bALC8oUqQKCN6upNm
@wilsonchenghy
wilsonchenghy merged commit e3d8bbe into main Aug 22, 2026
14 checks passed
@wilsonchenghy
wilsonchenghy deleted the claude/fix-ci-gate-properly branch August 22, 2026 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants