Repository navigation
Give each entry of a GitHub strategy matrix its own hash and skip key (false skip, #43) - #51
Merged
Merged
Conversation
A job running GitHub's own matrix through github: { strategy } gave every entry the same hash
and skip key, so an entry that failed reused the pass of one that succeeded (#43). The
generated hash step now passes toJSON(matrix), through an environment variable, to cigen hash
--matrix, which mixes the entry's canonical JSON into the job's hash. tests/matrix_skip.rs
runs the generated step once per entry: a failed entry runs again after another passed.
ndbroadbent
force-pushed
the
fix/matrix-skip-key
branch
from
December 4, 2026 03:07
a3b0a28 to
8327c32
Compare
ndbroadbent
added a commit
that referenced
this pull request
Dec 4, 2026
Ports #51: hashing::hash_job mixes a GitHub matrix entry into the job's hash (matrix_entry.rs moved to src/hashing/matrix.rs with its tests), so hash --matrix still gives each entry its own hash. cigen explain takes --matrix to show an entry's hash, and for a job that runs a matrix without one, says each entry is hashed in.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #43, a false skip. A job that runs GitHub's own matrix through the
github:passthrough (github: { strategy: { matrix } }) gave every entry the same hash and the same skip key,job-skip-${{ runner.os }}-<job>-<hash>. So whennightlyfailed andstablepassed on one commit, the next commit with unchanged inputs hadnightlyrestorestable's marker and turn green. Found converting ripgrep's CI, where 14 Linux entries of one job would share a key.The fix: the entry goes into the job's hash, not just the key. The generated hash step gets
env: { CIGEN_MATRIX: "${{ toJSON(matrix) }}" }and runscigen hash … --matrix "$CIGEN_MATRIX", for any job whosegithub:block has astrategy.cigen hashparses the entry and mixes its canonical JSON (keys sorted) into the digest (src/commands/matrix_entry.rs). The job hash, the cache key and the pass marker then all name one entry. This also avoids the comma problem: rawtoJSONnever goes into a cache key, and the JSON reaches the shell only as an environment variable, never parsed by it. A matrix built by an expression (fromJSON(...)) andinclude/excludeentries are covered, because the entry is read at runtime. Jobs without astrategygenerate exactly as before; the golden fixtures are unchanged.The entry is mixed in at the top only, never into the hashes of the jobs a job
needs(#30), since those are other jobs.CircleCI: no hole. Its provider renders no job passthrough keys other than
type, and workflow entries are plain job names, so a matrix or job parameters can't be passed through. cigen's ownmatrix:expands into separately named variants, whose status keys include the variant name.The planner (#29): DIRECTION.md now says a GitHub-matrix job's pass records must be per entry. Until the planner can enumerate a literal matrix, it plans such a job as
run, and each entry checks its own marker keyed by--matrix.Tests:
tests/matrix_skip.rsgenerates a workflow and runs the generated hash step itself with bash, once per entry, withCIGEN_MATRIXset as GitHub would.stablepasses andnightlyfails; commit B changes only the README.nightlyruns again andstablestill skips.envand no--matrix.cigen hashignoring the entry, the key tests fail.matrix_entry.rshas unit tests: entries differ, key order doesn't matter, and an entry that isn't JSON is an error that namestoJSON(matrix).Docs and status:
--matrix.task cipasses with no warnings.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.