fix(ci): fail loudly instead of silently running full suite on shard-lookup failure - #7864
Conversation
…lookup failure The shard-file lookup used `mapfile -t SHARD_FILES < <(node -e ...)`, which runs the node one-liner in a process-substitution subshell whose exit code mapfile does not propagate. If matrix.shard doesn't match a key in shard-assignment.json, or the file is missing/corrupt, the node script throws, exits non-zero, but mapfile still returns 0 -- leaving SHARD_FILES empty and silently making vitest run the entire suite instead of its slice. Capture the node output via a checked command-substitution assignment instead (same idiom used to fix compose_file_args in JSONbored#7765), so a lookup failure now fails the step with an explicit ::error:: annotation and a non-zero exit. Closes JSONbored#7767
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7864 +/- ##
=======================================
Coverage 91.40% 91.40%
=======================================
Files 730 730
Lines 74763 74763
Branches 22815 22816 +1
=======================================
Hits 68335 68335
Misses 5385 5385
Partials 1043 1043
Flags with carried forward coverage won't be shown. Click here to find out more. |
|
Warning ⏸️ LoopOver review result - manual review recommendedReview updated: 2026-07-21 15:46:22 UTC
Review summary Nits — 5 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Closes #7767
Problem
.github/workflows/ci.yml's shard-file lookup step read a shard's file list with:mapfile -t VAR < <(cmd)runscmdin a process-substitution subshell whose exit statusmapfiledoes not propagate --mapfileitself returns 0 regardless of whether the command inside succeeded. Ifmatrix.sharddoesn't match a key present inshard-assignment.json(shard-count change, key-format drift) or the file is missing/corrupt, thenode -eone-liner throws and exits non-zero, but the step continues anyway withSHARD_FILESsilently empty.vitestthen receives no file filter, i.e. "run every test file" -- each of the 3 shard jobs would redundantly run the entire suite instead of its slice, defeating the duration-aware sharding, with no error surfaced anywhere.This is the same subshell-swallow class fixed for
compose_file_argsin #7765/#7862.Fix
Capture the node script's output via a checked command-substitution assignment (
if ! VAR="$(cmd)"; then exit 1; fi) instead ofmapfile < <(cmd), thenmapfilethe already-captured string with a here-string. A lookup failure now hitsif ! ...directly, prints an::error::annotation naming the offending shard, and exits 1 -- failing the job loudly instead of silently running everything.Diff is scoped to exactly this one step in the one
elsebranch (full-suite sharding path); the sibling scoped-selection (--changed=origin/main) branch is untouched.Verification
This is a workflow-YAML-only change, explicitly not covered by the Codecov patch gate per the issue. Verified manually rather than via vitest:
SHARD_FILESempty and exit code 0 even whennode -ethrows (badmatrix.shardkey) -- reproducing the silent-degradation bug described in the issue.::error::line for all three failure modes: amatrix.shardkey not present inshard-assignment.json, a corrupt (non-JSON)shard-assignment.json, and a missingshard-assignment.json.SHARD_FILESidentically to before.npm run actionlint: clean.git diff --checkagainstupstream/main: clean (no trailing-whitespace regressions).Scope
Single file, single step, +10/-1 lines. No other jobs/steps touched.