ci: shard the semantic and Linux jobs behind their required gate names (CI-SHARD-SEMANTIC-LINUX) #3354

Open
github-bot wants to merge 3 commits from github-bot/gh-3354 into main AGit
Owner

@⁠MoonEyes on GitHub · 2026-12-03 15:53 UTC · original
ProjectLeonida:ci/shard-semantic-linux → main · +286 −30 · 9 files · 3 commits · open

Claimed in the coordination issue as: CI-SHARD-SEMANTIC-LINUX (#3312)

Depends on: #3351 (stacked: the base is its branch, retarget to main once it lands)

What and why

After #3351 the Windows check job runs in 120 to 251 s. The critical path is now semantic-tests (254 to 416 s of translator tests) and linux-python-and-viewer (stdlib loop 223 to 365 s, pytest 56 to 92 s), measured on 7 recent runs.

  • scripts/run_semantic_tests.py: new --shard K/N. Units are top-level modules or packages (a package is never split), assigned greedily by size, largest first; with -j 1 and N>1 it refuses (error 2). On tests/semantic: 4 shards of 139 to 141 files, about 2.14 MB each.
  • .github/workflows/ci.yml: semantic-tests and linux-python-and-viewer become gate jobs (same pattern as check in #3351: needs, if: !cancelled() && docs-only != 'true', fail unless every shard is success). The real work moves to semantic-shards (4) and linux-shards (3). Each Linux shard runs one third of the pytest files and one third of the stdlib loop (--shard); the viewer tests run on shard 0 only.
  • The Linux stdlib loop is only split, not dropped: Linux has numpy, spirv-tools and llvm and runs POSIX tests skipped on Windows, so identical coverage with the Windows loop cannot be shown.
  • tests/test_ci_registration.py: new ShardedJobsTest (matrix size equals the N of K/N, fail-fast: false, each gate waits for its shards and refuses anything but success); the loop test drops every *_SHARD variable (same leak as the one fixed in #3351).

Expected gain, estimated and not yet measured on CI: semantic-tests about 300-415 s to about 100-130 s; linux-python-and-viewer about 295-470 s to about 150-200 s.

Tested

  • Red then green: with the old run_semantic_tests.py the new ShardTest fails (3 failures, 2 errors); with the old ci.yml 10 assertions fail; all pass with this change.
  • test_ci_registration (23), test_run_semantic_tests (40), test_docs_* (57), check_no_game_data.py: pass. Sharding coverage run on the real tree: 560 modules, union of the 4 shards equals the whole, no duplicate; 41 pytest files split 14/14/13.
  • A separate read-only reviewer agent audited the diff and found no blocking issue.
  • Not verified here: gate behaviour in real docs-only and merge_group runs (read from the YAML only), per-shard wall time (balanced by size, not by duration), and the ruleset's handling of the new matrix job names.
  • Risks: 7 jobs instead of 2, so more runner minutes (one tool install per shard).

GPUs tested: n/a

AI-assisted: yes (Claude Code, reviewed by a separate read-only reviewer agent)

Checklist

  • Based on current main through #3351 and merges cleanly.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption.
  • A new translator rule is in the contract table of docs/design.md: n/a

Generated by Claude Code

**@⁠MoonEyes** on GitHub · 2026-12-03 15:53 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/3354) `ProjectLeonida:ci/shard-semantic-linux` → `main` · +286 −30 · 9 files · 3 commits · open Claimed in the coordination issue as: CI-SHARD-SEMANTIC-LINUX (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/3312) Depends on: #3351 (stacked: the base is its branch, retarget to `main` once it lands) ### What and why After #3351 the Windows `check` job runs in 120 to 251 s. The critical path is now `semantic-tests` (254 to 416 s of translator tests) and `linux-python-and-viewer` (stdlib loop 223 to 365 s, pytest 56 to 92 s), measured on 7 recent runs. - `scripts/run_semantic_tests.py`: new `--shard K/N`. Units are top-level modules or packages (a package is never split), assigned greedily by size, largest first; with `-j 1` and N>1 it refuses (error 2). On `tests/semantic`: 4 shards of 139 to 141 files, about 2.14 MB each. - `.github/workflows/ci.yml`: `semantic-tests` and `linux-python-and-viewer` become gate jobs (same pattern as `check` in #3351: `needs`, `if: !cancelled() && docs-only != 'true'`, fail unless every shard is `success`). The real work moves to `semantic-shards` (4) and `linux-shards` (3). Each Linux shard runs one third of the pytest files and one third of the stdlib loop (`--shard`); the viewer tests run on shard 0 only. - The Linux stdlib loop is only split, not dropped: Linux has numpy, spirv-tools and llvm and runs POSIX tests skipped on Windows, so identical coverage with the Windows loop cannot be shown. - `tests/test_ci_registration.py`: new `ShardedJobsTest` (matrix size equals the N of K/N, `fail-fast: false`, each gate waits for its shards and refuses anything but `success`); the loop test drops every `*_SHARD` variable (same leak as the one fixed in #3351). Expected gain, estimated and not yet measured on CI: `semantic-tests` about 300-415 s to about 100-130 s; `linux-python-and-viewer` about 295-470 s to about 150-200 s. ### Tested - Red then green: with the old `run_semantic_tests.py` the new `ShardTest` fails (3 failures, 2 errors); with the old `ci.yml` 10 assertions fail; all pass with this change. - `test_ci_registration` (23), `test_run_semantic_tests` (40), `test_docs_*` (57), `check_no_game_data.py`: pass. Sharding coverage run on the real tree: 560 modules, union of the 4 shards equals the whole, no duplicate; 41 pytest files split 14/14/13. - A separate read-only reviewer agent audited the diff and found no blocking issue. - Not verified here: gate behaviour in real docs-only and merge_group runs (read from the YAML only), per-shard wall time (balanced by size, not by duration), and the ruleset's handling of the new matrix job names. - Risks: 7 jobs instead of 2, so more runner minutes (one tool install per shard). GPUs tested: n/a AI-assisted: yes (Claude Code, reviewed by a separate read-only reviewer agent) ### Checklist - [x] Based on current `main` through #3351 and merges cleanly. - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption. - [ ] A new translator rule is in the contract table of `docs/design.md`: n/a --- _Generated by [Claude Code](https://claude.ai/code)_
Depends on: #3351

run_semantic_tests.py gains --shard K/N (whole top-level units, largest first onto the
lightest slice). semantic-tests and linux-python-and-viewer become gate jobs over
semantic-shards (4) and linux-shards (3, pytest and standard-library loop sliced, viewer
tests on slice 0). test_ci_registration.py checks that each matrix size equals the N in
K/N and that every gate waits for its shards with !cancelled() and fails on non-success.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DDMsHwsknvo96XTWag2WiL
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-03 16:02:45 +00:00
github-bot changed target branch from ci/shorten-ci-time to main 2026-12-03 17:06:59 +00:00
Comments and docs only: point to check-stdlib, check-dotnet, linux-shards
and semantic-shards, noting that check, linux-python-and-viewer and
semantic-tests are only the gates.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DDMsHwsknvo96XTWag2WiL
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DDMsHwsknvo96XTWag2WiL
Author
Owner

@⁠merzleckeier on GitHub · 2026-12-03 17:09 UTC · original

Reviewed 667a0a0 merged with main at fba6f09. With SPIR-V Tools required, the four semantic shards ran 6,796 tests across 561 files, matching the unsharded run. All five runs passed. I also ran the exact old and new Linux selection steps with a capture shim. The shards retained all 41 pytest selections (14/14/13) and all 670 standalone files (224/223/223), with no duplicates. The gate scripts accepted success and rejected failure, cancelled, and skipped.

One small coverage gap in tests/test_ci_registration.py:397: shard_problems accepts a single matching LINUX_SHARD assignment anywhere in the job. Renaming just the pytest step’s env key leaves the check green, and each pytest shard then falls back to 0/1 and runs the full list. Checking the assignment per step would catch this regression. The current workflow sets both correctly.

The local CI-registration and runner suites passed. I did not run a hosted merge-group or docs-only event. Review assisted by OpenAI Codex.

**@⁠merzleckeier** on GitHub · 2026-12-03 17:09 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/3354#issuecomment-7386053328) Reviewed `667a0a0` merged with `main` at `fba6f09`. With SPIR-V Tools required, the four semantic shards ran 6,796 tests across 561 files, matching the unsharded run. All five runs passed. I also ran the exact old and new Linux selection steps with a capture shim. The shards retained all 41 pytest selections (14/14/13) and all 670 standalone files (224/223/223), with no duplicates. The gate scripts accepted `success` and rejected `failure`, `cancelled`, and `skipped`. One small coverage gap in `tests/test_ci_registration.py:397`: `shard_problems` accepts a single matching `LINUX_SHARD` assignment anywhere in the job. Renaming just the pytest step’s env key leaves the check green, and each pytest shard then falls back to `0/1` and runs the full list. Checking the assignment per step would catch this regression. The current workflow sets both correctly. The local CI-registration and runner suites passed. I did not run a hosted merge-group or docs-only event. Review assisted by OpenAI Codex.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3354/head:github-bot/gh-3354'
git switch 'github-bot/gh-3354'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3354'
git switch 'github-bot/gh-3354'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3354'
git switch 'github-bot/gh-3354'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3354'
git switch 'main'
git merge --squash 'github-bot/gh-3354'
git switch 'main'
git merge --ff-only 'github-bot/gh-3354'
git switch 'main'
git merge 'github-bot/gh-3354'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/ubiquitarianism--leonida!3354
No description provided.