Expose strategy.job-index and strategy.job-total #20

Open
opened 2026-08-03 13:33:54 +00:00 by day01 · 0 comments
Owner

The strategy context is built from fail-fast and, when present,
max-parallel (crates/runner-workflow-github-actions/src/context/evaluation.rs:110-126).
GitHub also exposes strategy.job-index and strategy.job-total.

The failure is silent. Unknown properties evaluate to Value::Null
(expression/access.rs:11-48), which renders as an empty string, so
${{ strategy.job-index }} yields "" instead of a leg number. A workflow that
shards a test suite across matrix legs would run every leg with the same empty
shard id and still report success — the exact silent fallback AGENTS.md rules
out.

Fix: populate both properties from the matrix expansion. Failing that, reject
the reference explicitly rather than resolving it to null.

Found while writing the compatibility suite (#13): the natural way to assert
that a matrix expanded into the expected number of legs is
strategy.job-total, and it is not available.

The `strategy` context is built from `fail-fast` and, when present, `max-parallel` (`crates/runner-workflow-github-actions/src/context/evaluation.rs:110-126`). GitHub also exposes `strategy.job-index` and `strategy.job-total`. The failure is silent. Unknown properties evaluate to `Value::Null` (`expression/access.rs:11-48`), which renders as an empty string, so `${{ strategy.job-index }}` yields `""` instead of a leg number. A workflow that shards a test suite across matrix legs would run every leg with the same empty shard id and still report success — the exact silent fallback AGENTS.md rules out. Fix: populate both properties from the matrix expansion. Failing that, reject the reference explicitly rather than resolving it to null. Found while writing the compatibility suite (#13): the natural way to assert that a matrix expanded into the expected number of legs is `strategy.job-total`, and it is not available.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: syncode/runner#20