Skip to content

CI plans fixed + blobless checkouts; Smoke collection and slowest tests faster (Part of #5882) - #5932

Merged
squid-protocol merged 6 commits into
mainfrom
perf/5882-plan-checkouts
Oct 22, 2026
Merged

squid-protocol merged 6 commits into
mainfrom
perf/5882-plan-checkouts

Conversation

@squid-protocol

@squid-protocol squid-protocol commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Part of #5882 (CI speed).

Bug found in Smoke: the parts' checkout depth was ${{ github.event_name == 'pull_request' && 0 || 1 }}, which is always 1 because 0 is falsy in Actions expressions. On every PR, each of the 3 parts then:

  1. fetched main into a shallow clone (~60 s: Plan the ReDoS sweeps took 55-65 s a part)
  2. found no merge base ("reason": "cannot diff (fatal: origin/main...HEAD: no merge base)", run 39691353465)
  3. planned full, so the ReDoS sweeps that Full-suite test time: ReDoS/contract sweeps are 32% of the suite; gate them on PRs, add a slow-test budget, trim the top 10 #5166 deselects ran on every PR.

test_sweep_plan only checked that the expression mentioned pull_request.

What it does:

  • Smoke: the plan reads the PR's own file list: gh api --paginate repos/R/pulls/N/files plus the PR's changed_files count. The list must be whole, so a failed call, a count mismatch or the API's 3000-file cap plans full, as an unreadable diff did. A renamed file counts under both names. The part checks out one commit and fetches no history, so the test environment is the same as today (it was effectively depth 1 already). New sweep_plan.py --pr-files/--pr-file-count; --files / --base still work locally.
  • Det Sweep and MGT plan jobs: keep fetch-depth: 0 and add filter: blob:none. That gives full history without file contents; git fetches a file's content when it reads it, and det_port.py's base worktree fetches its whole tree in one batch. merge-base, diff and git show behave the same.

Checked:

Expected saving (10-21 volumes):

per run runs/day runner-h/day
Smoke: plan fetch ~60 s x 3 parts ~3 min ~229 PR runs ~11
Smoke: sweeps no longer run on ~80% of PRs ~20-30 s a part ~2-4
Det Sweep plan checkout 74 s -> a few s ~230 ~4.5
MGT plan checkout 45 s -> a few s ~310 ~3.5

That's about 20 runner-h/day. Det Sweep and MGT runs also start their downstream jobs ~1 min sooner, since everything waits for the plan.

Measured on this PR's first CI run (39694500153 / 39694500183 / 39694500225, all green):

  • Smoke Plan the ReDoS sweeps: 2 s a part (was 55-65 s). It planned full for the right reason ("3 changed file(s) are sweep inputs").
  • Det Sweep plan checkout: 10 s (was 74 s).
  • MGT plan checkout: 10 s (was 45 s).

Two more Smoke commits:

  • Collection ~18% faster (it runs in every xdist worker of every part).
    • tests/conftest.py _is_redos_sweep ran Path.relative_to for each of 18k items: 1.5 of 8.3 profiled seconds. It now caches per file.
    • test_workflow_draft_gate parsed every workflow twice at import with the pure-Python loader. It now parses once with CSafeLoader where present; the 47 workflows load identically.
    • collect-only: 4.45 s -> 3.65 s. The same 787 tests carry redos_sweep.
  • The gauntlets scan through tests/tools/scan_server.py: the engine is imported once a process, not once for each of ~20-30 small scans.
    • scan_server is fork-safe now: a server belongs to the pid that started it, so a forked pool worker starts its own.
    • Results are byte-identical with GITGALAXY_SCAN_SERVER=0 vs on (17 unicode cells, 203 cultural results).
    • On 4 cores: unicode 13.6 -> 7.8 s, cultural 16.5 -> 6.4 s. On CI these were the two slowest tests (47 s, 34 s).
  • test_posix_only_imports_4934 parses only files that name a POSIX-only module as a word (119 of 1346): 5.8 -> 2.1 s, still [].

Not done (owner call): the same kind of prefilter for test_source_reads (~29 s on CI). It would stop that test failing on a syntax error in an unrelated file, which it currently does by accident.

🤖 Generated with Claude Code

… blobless (Part of #5882)

Smoke's checkout depth `event == 'pull_request' && 0 || 1` was always 1 (0 is falsy):
every part then fetched main into a shallow clone (~60 s), found no merge base, and
planned "full", so the ReDoS sweeps ran on every PR. The plan now reads the PR's own
file list (gh api pulls/N/files, whole by changed_files, renames under both names);
the part checks out one commit. On 20 recent PRs the API plan equals the git-diff plan
(16 of them deselect the sweeps; each ran them).

Det Sweep's and MGT's plan jobs keep full history but blobless (filter: blob:none):
a clone of the repo took 1.2 s blobless vs 40 s full here; their checkouts took
74 s / 45 s on CI. merge-base, diff and git show behave the same (a blob is fetched
when read; det_port's base worktree fetches its tree in one batch).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01E977ZMkfHVAsLSWrDLDaW5
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

squid-protocol and others added 2 commits October 21, 2026 19:39
Collection runs in every xdist worker of every part (~34 s a part on CI). Two costs:
- tests/conftest.py _is_redos_sweep took Path.relative_to per item (18k items): 1.5 s of
  8.3 s profiled. The directory test is now cached per file; the name test runs first.
- test_workflow_draft_gate parsed every workflow twice at import with the pure-Python
  loader: once now, with libyaml's CSafeLoader where present (47 workflows load
  identically; 0.02 s vs 0.22 s).

collect-only, warm: 4.45 s -> 3.65 s. The same 787 tests carry redos_sweep.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01E977ZMkfHVAsLSWrDLDaW5
… parses 1 file in 11 (Part of #5882)

- unicode_gauntlet / cultural_gauntlet: scan_to_db from tests/tools/scan_server.py (the
  engine imported once a process, not once a scan: ~20 / ~30 scans of a few files each).
  scan_server is fork-safe now: a server belongs to the pid that started it, so a forked
  ProcessPoolExecutor worker starts its own (unicode_gauntlet scans the seed before its
  pool forks). With GITGALAXY_SCAN_SERVER=0 vs on, both gauntlets' results are byte
  for byte the same (17 cells, 203 results); 4 cores: unicode 13.6 -> 7.8 s, cultural
  16.5 -> 6.4 s.
- test_posix_only_imports_4934: an import names its module as a word, so only files
  mentioning one are parsed (119 of 1346): 5.8 -> 2.1 s, still [].

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01E977ZMkfHVAsLSWrDLDaW5
@squid-protocol squid-protocol changed the title CI plans: Smoke's sweep plan reads the PR's file list; plan checkouts blobless (Part of #5882) CI plans fixed + blobless checkouts; Smoke collection and slowest tests faster (Part of #5882) Oct 21, 2026
squid-protocol and others added 3 commits October 21, 2026 20:37
… test is slow by design (Part of #5882)

- test_unicode_gauntlet_scan_env / test_a_legacy_cjk_estate_...: they faked
  galaxy_ir.scan_to_db, which unicode_gauntlet.scan no longer calls (it takes
  scan_server's), so a real scan ran on a missing estate. They fake scan_server's now.
- test_jobs_measure_the_cases_as_one_at_a_time_does (#5926): 18.2 s on a loaded runner
  tripped the 15 s time ratchet; --jobs 2 spawns two processes that each import the
  runner. Marked slow with that reason.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01E977ZMkfHVAsLSWrDLDaW5
@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 22, 2026
squid-protocol added a commit that referenced this pull request Oct 22, 2026
…5941)

~100 scans a Mainframe Ground Truth run each started a fresh `python -m
gitgalaxy.galaxyscope` (~3.5 s of engine import on a runner for a few files' scan).
They take tests/tools/scan_server.py's scan_to_db now (same argv, environment default,
result and errors; it falls back to galaxy_ir.scan_to_db): 50 test modules'
imports, tests/tools/refraction_differential.py (the 8 excerpt scans), and the
refractor's own --scan in the two tests that run it in-process. A new
tests/cobol_mainframe/conftest.py appends tests/tools to sys.path for them.
test_template_file_lineage_4771 reads the pinned zecs clone's cached scan
(mainframe_corpus.scan) instead of scanning it again.

scan_server: a server belongs to the pid that started it (a forked child starts its
own); the same change as PR #5932.

The 52 changed test files, sequential, local: 182 s -> 75 s, 724 passed / 4 skipped
both ways.


Claude-Session: https://claude.ai/code/session_01E977ZMkfHVAsLSWrDLDaW5

Co-authored-by: Claude Opus 5.5 <[email protected]>
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol merged commit 01d5f00 into main Oct 22, 2026
44 checks passed
@squid-protocol
squid-protocol deleted the perf/5882-plan-checkouts branch October 22, 2026 01:53
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

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

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant