Skip to content

fix(actions): dynamic matrix expansion correctness fixes - #38690

Open
bircni wants to merge 4 commits into
go-gitea:mainfrom
bircni:fix/actions-dynamic-matrix-correctness
Open

fix(actions): dynamic matrix expansion correctness fixes#38690
bircni wants to merge 4 commits into
go-gitea:mainfrom
bircni:fix/actions-dynamic-matrix-correctness

Conversation

@bircni

@bircni bircni commented Jul 28, 2026

Copy link
Copy Markdown
Member

Follow-up to #36564 (dynamic matrix) and #36357 (max-parallel), fixing issues found reviewing the two features together.

  • A placeholder could stall its run forever. Its payload keeps the raw matrix but loses its needs, so ParseJob re-expanded it instead of reading it back — fatal for include: ${{ fromJson(needs.*.outputs.*) }}.
  • An if: reading matrix.* skipped the whole job, with or without the ${{ }}. It now reduces to the needs gate, except under always()/failure()/cancelled(), and each combination is decided on its own values once the matrix expands.
  • Dependents could be skipped before the combinations ran, since inserted siblings are absent from the resolver's job set. The pass now stops after an insert and defers to the re-emit it schedules.
  • Expansion failures stranded the placeholder. A retryable one is returned so the queue retries it; a malformed payload fails the job instead of requeueing forever.
  • Rerun could rewind a pass-through row into a raw placeholder keeping its old terminal status, which nothing expands. Now gated on the anchor itself.

Plus: max-parallel distinguishes an unevaluated ${{ }} (debug) from a non-numeric literal (warn — it silently drops the cap).

@bircni
bircni requested a review from Zettat123 July 28, 2026 20:00
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 28, 2026
@github-actions github-actions Bot added topic/gitea-actions related to the actions of Gitea type/bug labels Jul 28, 2026
@Zettat123

Copy link
Copy Markdown
Contributor

Addressed an issue of if: reading matrix.* in 9d4969c

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jul 29, 2026
@silverwind

Copy link
Copy Markdown
Member

Found some more issues, doing cleanups.

A job `if:` may omit the `${{ }}`, which GitHub evaluates as one expression
anyway. The placeholder gate only recognised the braced form, so
`if: matrix.value == 1` was still decided against an absent matrix and skipped
the whole job instead of expanding it.

Reducing such an `if:` to the needs gate also discarded `always()`, `failure()`
and `cancelled()`. A job asking to run whatever its needs did was skipped as a
single unexpanded row, even where the needs had recorded the outputs the matrix
resolves from. The reduction now applies only under the implicit `success()`.

A malformed caller payload fails the same way on every pass, so returning it
requeued the run forever without ever expanding. It fails the job instead;
`getInputsForJob` marks that error invalid-argument so only it is caught, not
every missing row.

Assisted-by: Claude:Opus 5

@silverwind silverwind left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixups done in f16cd23 after a deep investigation. Also reviewed all existing claims, they hold. PR description updated.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jul 29, 2026
@silverwind

Copy link
Copy Markdown
Member

PS: My commit also dropped a nonsensical "Say which one this is, because dropping the cap silently is the opposite of what the author asked for." comment in the code that was added in initial commit by @bircni, should verify why that happened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/gitea-actions related to the actions of Gitea type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants