Skip to content

ci: enable batched integration tests + fix concurrency collisions#1407

Merged
sd-db merged 2 commits into
mainfrom
sd-db/worktree-integration-workflow-batching
Apr 22, 2026
Merged

ci: enable batched integration tests + fix concurrency collisions#1407
sd-db merged 2 commits into
mainfrom
sd-db/worktree-integration-workflow-batching

Conversation

@sd-db
Copy link
Copy Markdown
Collaborator

@sd-db sd-db commented Apr 20, 2026

Here's the trimmed body to paste into PR 1407:

Summary

  • Fix concurrency-group collision: manual PR dispatches all shared workflow-refs/heads/main and cancelled each other. Group is now target-aware (PR number → pr_numbersgit_ref → ref).
  • Replace single pr_number input with pr_numbers — accepts one PR or comma-separated list for batching (100,200,300).
  • New prepare job parses inputs into a JSON target array; the three test jobs fan out via strategy.matrix.target with max-parallel: 2 and fail-fast: false.
  • Artifact names suffixed with the PR id to avoid collisions in batched runs.
  • Adopt the setup-python-deps cache pattern from main.yml so matrix cells restore the warm deps cache instead of re-resolving against JFrog.

The workflow's concurrency group keyed off `github.ref`, so multiple
manual PR dispatches from `main` all shared one group and cancelled each
other — only the last dispatched PR actually ran.

Key changes:
- Concurrency group now keys off PR number / pr_numbers / git_ref, so
  different PRs and batches don't cancel each other; re-dispatch of the
  same target still cancels its stale run.
- Replace `pr_number` input with `pr_numbers` — accepts a single PR
  ("100") or comma-separated list ("100,200,300") for overnight batches.
- Add a `prepare` job that parses inputs into a JSON target array; the
  three test jobs fan out via `strategy.matrix.target` with
  `max-parallel: 2` and `fail-fast: false`.
- Artifact names suffixed with the PR id to avoid collisions within a
  batched run.

Co-authored-by: Isaac
Review-pass refinements on top of the batching change:

- Adopt the `setup-python-deps` + `setup-jfrog-pypi` fallback pattern
  already used by main.yml, and set `cache-local-path: ~/.cache/uv` on
  the uv install step. Each matrix cell now restores the warm deps cache
  instead of re-resolving against JFrog on every run (biggest win at
  batched dispatches of 2+ PRs where we run up to 6 parallel cells).
- Drop `fetch-depth: 0` on checkout — functional tests don't need full
  history, and every sibling workflow already uses the default shallow
  depth.
- Widen the parse whitespace check from literal space to `[[:space:]]`
  so tab / `\r` (e.g. Windows-edited dispatch inputs) are handled.
- Include the full `pr_numbers` in the invalid-PR error to help the
  dispatcher debug their input.
- Add a defensive comment on the first test job explaining why
  downstream jobs deliberately lack `if: always()` / `if: !cancelled()`
  — the fork-skip relies on `needs: prepare` propagating cleanly, and
  forcing evaluation would make `fromJSON("")` explode on a skipped
  prepare.

Co-authored-by: Isaac
@github-actions
Copy link
Copy Markdown

Coverage report

This PR does not seem to contain any modification to coverable code.

@sd-db sd-db merged commit 59c69f6 into main Apr 22, 2026
13 checks passed
@sd-db sd-db deleted the sd-db/worktree-integration-workflow-batching branch April 22, 2026 04:24
sd-db added a commit that referenced this pull request Apr 23, 2026
Main's integration.yml was substantially rewritten by #1407 to introduce
a `prepare` job that emits a targets JSON array for a matrix strategy
across the three integration jobs. Reconciling the slash-command + nightly
work on top:

- Drop the separate `check-nightly-needed` gate; fold the SHA-skip into
  `prepare` itself (emits targets=[] to skip via an empty matrix). Uses
  the GitHub API via curl+jq to check for prior successful runs on the
  current main SHA.
- Drop the `pull_request` trigger + the fork-repo `if:` on `prepare`
  (dead after removing pull_request). Prepare now runs unconditionally.
- Keep the existing `prepare` batch/git_ref/default branches; just prepend
  a `schedule` branch at the top.
- Rename `pr_number` → `pr_numbers` in the dispatcher (integration-trigger.yml)
  so the slash command targets the new input.
- `report-status` now guards on `!contains(inputs.pr_numbers, ',')` — batch
  dispatches don't get auto-comments (matrix jobs produce aggregate results,
  so per-PR reporting would need a larger rework).
- Retain main's note against `!cancelled()` on matrix jobs — the skip-via-
  empty-targets approach avoids that trap entirely.
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