Skip to content

MAINT Python CI performance - #2862

Merged
Roman Lutz (romanlutz) merged 8 commits into
microsoft:mainfrom
romanlutz:romanlutz-python-ci-performance
Oct 1, 2026
Merged

Roman Lutz (romanlutz) merged 8 commits into
microsoft:mainfrom
romanlutz:romanlutz-python-ci-performance

Conversation

@romanlutz

Copy link
Copy Markdown
Contributor

Description

Several Garak unit tests repeatedly discover unrelated dataset providers, and the latent separator test persists far more cases than its assertions need. Linux-only JUnit uploads also leave Windows and macOS timing regressions harder to diagnose.

  • Replace repeated provider discovery with function-scoped fixtures that load fresh, complete local corpora. Keep real per-test SQLite persistence, sampling, validation, and disabled-auto-fetch behavior. WebInjection tests seed their existing small corpus instead of fetching datasets whose values are then mocked out.
  • Limit the latent separator test to 92 shared groups while checking every family/trigger pair across all 14 techniques. Keep the separate uncapped 4,266-case population fingerprints and full PromptInject matrix coverage unchanged.
  • Use PR numbers for concurrency identity so same-named branches from different forks do not cancel each other. Upload uniquely named OS/Python/extras JUnit artifacts across the matrix, add a coverage-job report, honor JUNIT_XML, and print the 25 slowest test phases.

No production behavior changes. Preserve all 24 test combinations, three all-file pre-commit jobs, existing triggers and permissions, Linux-only result publishing, the four-worker loadfile scheduler, and the 78% overall / 90% diff coverage thresholds. Cache policy is unchanged: an incomplete local cache experiment did not justify changing it.

Tests and Documentation

Three interleaved before/after pairs used the same 117 test identities in five Garak modules, with uv 0.9.17, Python 3.12.13, all extras, and pytest -n 4 --dist=loadfile on Windows. Every valid run passed with no skips. The baseline and optimized runs used matching configuration, production imports, dataset contents, and parent memory fixtures.

Focused-suite wall time Before After
Pair A 193.73s 42.95s
Pair B 198.49s 29.10s
Pair C 181.47s 30.12s
Median 193.73s 30.12s

This is an 84.45% reduction for the local targeted suite, not a measured full-suite or hosted-CI reduction. The shared host had another workload; pairs were interleaved and counterbalanced. A preliminary snapshot run with collection errors was excluded entirely.

Ruff, formatting, type checks on the four changed Python files, actionlint, targeted workflow-contract checks, and commit hooks passed. The full suite and hosted matrix were not run. Updated the contributor test guide for JUnit paths and timing artifacts.

JupyText: N/A; no notebooks changed.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Integrate microsoft/PyRIT main at 5ffd01a without changing the fixture and CI timing contracts.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Integrate microsoft/PyRIT main at 9bc882c while preserving the Garak fixture and CI timing contracts.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Integrate microsoft/PyRIT main at 83e2b79 while retaining the Python CI performance and JUnit changes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment thread tests/unit/scenario/garak/test_web_injection.py
Keep the fast seeded fixtures while checking one unmocked registry-to-memory initialization over all four real dataset sources.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Integrate microsoft/PyRIT main at ab1c6c8. Preserve fast Garak fixtures and the real dataset resolution regression test using the new async memory API.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@hannahwestra25 hannahwestra25 self-assigned this Oct 1, 2026
Comment thread .github/workflows/bicep_topology.yml
@romanlutz
Roman Lutz (romanlutz) added this pull request to the merge queue Oct 1, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 1, 2026
Integrate microsoft/PyRIT main at 65185d6. Combine new dataset-limit tests with the scoped real-corpus fixtures, bounded separator coverage, and unmocked WebInjection dataset regression test.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@romanlutz
Roman Lutz (romanlutz) added this pull request to the merge queue Oct 1, 2026
Merged via the queue into microsoft:main with commit 3860165 Oct 1, 2026
53 checks passed
@romanlutz
Roman Lutz (romanlutz) deleted the romanlutz-python-ci-performance branch October 1, 2026 23:57
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