Skip to content

tests: speed up the slow-test top 10 without weakening a check (Part of #5166) - #5171

Merged
squid-protocol merged 3 commits into
mainfrom
churn/5166-20261015T0052Z
Oct 15, 2026
Merged

squid-protocol merged 3 commits into
mainfrom
churn/5166-20261015T0052Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #5166 (part C only). Parts A and B are other workers' PRs.

What changed (tests only; same assertions, no engine code, no golden/ratchet moves)

Test (issue's CI time) Cause found by profiling Fix Serial local before -> after
test_galaxyscope x3 (19.5 / 14.8 / 14.1 s) execute_pipeline ends with the ecosystem audits (X-ray, API mapper, firewall) over the scan root; the tests used root ".", so each X-rayed the whole repo (cProfile: 13.5 of 13.9 s in binary_anomaly_detector) for a result they never read root is an empty temp dir (_empty_root) typosquat 23.9 -> 0.01 s; z-score 12.9 -> 0.01 s; sarif purge 12.8 -> 0.01 s
test_cleanup_contract_redos_sweep (33.2) and test_immutability_locks_redos_sweep (21.0) one spawned interpreter per (language, payload) pair new assert_redos_immune_all in _strict_harness.py: one child for the whole sweep, every pair still timed on the child's CPU clock and bounded by timeout_sec; a hang kills the child and names that pair 3.99 -> 0.13 s; 2.45 -> 0.07 s
test_no_new_offenders (21.9) sites measured one after another in one worker tool_regex_redos.sweep(..., workers=N) deals sites round-robin to N workers (rows in the same order; default stays serial for the CLI); test uses 4 4.43 -> 2.07 s
test_the_oracle_is_sound_on_the_mainframe_seed (46.4) ~10 estate scans at jobs=2 jobs=min(6, cpu_count); same EBCDIC pages, same assertions 17.4 -> 8.5 s
test_the_same_tree_scans_the_same_under_any_parent[tmp] (42.2) module fixture ran 7 independent scan subprocesses serially, billed to the first test fixture runs them in a thread pool 8.6 (setup) -> 1.6 s
test_a_spawned_pool_is_the_forked_pools_output (18.1) spawned scan, then the inline scan, back to back the two independent scans overlap (Popen) 8.5 -> 6.8 s

Test count: unchanged for the ten targets. +3 new tests: test_a_sharded_sweep_returns_the_serial_rows_in_order and two harness self-tests for assert_redos_immune_all (clean pairs pass and a disabled rule is skipped; a hang mid-batch names that pair). Collected in the touched files: 194.

The local times are on a 12-core box under load; CI is 3-5x slower per the issue, so the CI delta is what the issue's .test_durations refresh will show.

Not changed

  • cultural_gauntlet::test_the_sampled_plan_passes_its_ratchet (60.8): 34 distinct cells, each one ~1.2 s scan subprocess (94% of a cell is scan_to_db; profiled), already jobs=cpu_count. No dedupe is possible without sharing scans across different inputs, so I left it rather than weaken it. See Sibling gaps.
  • Part A (the redos_sweep marker) is not merged, so the two sweeps were fixed on their own; A may still deselect them on PRs.

Gates

pr_gates.py --fast 6/6, --ratchets 7/7 (0 skipped), via heavy-run.sh. Touched tests pass with -o addopts="" serial.

Sibling gaps

  • 16 more test files loop assert_redos_immune per payload (for payload in payloads); each can switch to assert_redos_immune_all.
  • The 4 other test_galaxyscope pipeline tests with root "." (~1.9 s each).
  • Cultural gauntlet sampled plan: needs a cheaper per-cell scan (engine startup) or fewer cells.

Lessons for agents

  • Queue.put from a child stuck in a regex never flushes (the feeder thread needs the GIL), so batch ReDoS results go through a Pipe.
  • A test that builds Orchestrator(".") and calls execute_pipeline scans the real repo in the ecosystem audits: give it a temp root.

Co-Authored-By: Claude Opus 5.5 [email protected]

🤖 Generated with Claude Code

#5166)

- test_galaxyscope: three pipeline tests scanned the whole repo ("." root) in the ecosystem audits; use an empty temp root
- ReDoS sweeps (cleanup, immutability): one spawned child per sweep via assert_redos_immune_all, not one per pair
- tool_regex_redos.sweep: optional `workers` shards; the offender test uses 4
- scan path independence / spawned-pool tests: independent scans run side by side
- unicode gauntlet seed test: jobs 2 -> cpu count (max 6)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 15, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol marked this pull request as ready for review October 15, 2026 01:09
@squid-protocol
squid-protocol enabled auto-merge (squash) October 15, 2026 01:10
sys.path.insert(0, _LANGUAGES_DIR)

from _strict_harness import assert_redos_immune # noqa: E402 # type: ignore
import _strict_harness # noqa: E402 # type: ignore
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol

Copy link
Copy Markdown
Owner Author

PR #5171 @ 0fe6a17: 1 failed check(s)

== full-suite part 3/3 (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/38664059372/job/116191775353
repro: python -m pytest -q tests/test_source_reads.py::test_no_source_read_loses_a_byte
failing tests: tests/test_source_reads.py::test_no_source_read_loses_a_byte
errors:
fail-on-cache-miss: false
E AssertionError: #3813: decode through gitgalaxy.core.source_text (read_source / open_source / decode_bytes) instead of a lossy errors= handler or a text-mode read of an estate file:
tests/test_source_reads.py:137: AssertionError
FAILED tests/test_source_reads.py::test_no_source_read_loses_a_byte - AssertionError: #3813: decode through gitgalaxy.core.source_text (read_source / open_source / decode_bytes) instead of a lossy errors= handler or a text-mode read of an e
##[error]Process completed with exit code 1.
log tail:
SKIPPED [1] tests/tools/test_content_keyed_baseline.py:218: ruff not on PATH
SKIPPED [1] tests/tools/test_crucible_case.py:87: no cics-crucible checkout (CICS_CRUCIBLE_PATH)
SKIPPED [1] tests/tools/test_crucible_case.py:103: no cics-crucible checkout (CICS_CRUCIBLE_PATH)
SKIPPED [1] tests/tools/test_crucible_case.py:157: no cics-crucible checkout (CICS_CRUCIBLE_PATH)
SKIPPED [1] tests/tools/test_crucible_case.py:232: no cics-crucible checkout (CICS_CRUCIBLE_PATH)
SKIPPED [1] tests/tools/test_ctags_reader_qualify.py:35: ctags not on PATH
SKIPPED [1] tests/tools/test_ctags_reader_qualify.py:56: ctags not on PATH
SKIPPED [1] tests/tools/test_ctags_reader_qualify.py:75: ctags not on PATH
SKIPPED [1] tests/tools/test_evidence_report.py:60: #4703: per-PR CI is advisory (smoke-test.yml / full-suite-gate.yml print the level deltas); the evidence-refresh bot regenerates the reports on main and the release gate (publish.yml) runs
SKIPPED [1] tests/tools/test_pin_requirements.py:28: uv executable not installed in this environment
SKIPPED [1] tests/tools/test_pin_requirements.py:94: uv executable not installed in this environment
SKIPPED [1] tests/tools/test_unicode_gauntlet_vs_treesitter.py:52: keyword-rosetta corpus not available
XFAIL tests/extraction/languages/test_jcl.py::test_jcl_func_start_invalid[//SYSUDUMP DD DATA,DLM=$$\n//BAD EXEC PGM=X\n$$] - Known limitation: No block shielding for instream data in JCL
XFAIL tests/extraction/languages/test_jcl.py::test_jcl_class_start_invalid[//SYSIN DD \n//FAKE JOB 1\n/] - Known limitation: No block shielding for instream data in JCL
XFAIL tests/extraction/languages/test_zig.py::test_zig_args_invalid["fn (a: i32, b: i32)"] - Known limitation: No block shielding for args inside strings
XFAIL tests/extraction/languages/test_zig.py::test_zig_args_invalid[// fn (a: i32, b: i32)] - Known limitation: No block shielding for args inside comments
XPASS tests/extraction/languages/test_jcl.py::test_jcl_args_valid["//STEP1 EXEC PGM=PROG,PARM='THIS STRI"...len102-1d86da8b-"'THIS STRING CONTINUES "...len72-7c3fedb5] - Known limitation: Engine cannot parse JCL line con
XPASS tests/extraction/languages/test_jcl.py::test_jcl_dependency_invalid[//DD DATA \n INCLUDE MEMBER=NOPE \n/*] - Known limitation: No block shielding for instream data in JCL
XPASS tests/extraction/languages/test_jcl.py::test_jcl_dependency_invalid['//STEP1 EXEC PGM=PROG1 THIS COMMENT CO'...len69-d3e393cd] - Known limitation: Inline comments aren't stripped before dependency capture
FAILED tests/test_source_reads.py::test_no_source_read_loses_a_byte - AssertionError: #3813: decode through gitgalaxy.core.source_text (read_source / open_source / decode_bytes) instead of a lossy errors= handler or a text-mode read of an e
tests/core_engine/test_inline_extraction.py:139 in test_a_spawned_pool_is_the_forked_pools_output() [lossy-errors]
assert not [('tests/core_engine/test_inline_extraction.py', 'test_a_spawned_pool_is_the_forked_pools_output', 'lossy-errors', 139)]
1 failed, 8089 passed, 20 skipped, 4 xfailed, 3 xpassed, 4 warnings in 625.83s (0:10:25)
##[error]Process completed with exit code 1.
Post job cleanup.
[command]/usr/bin/git version
git version 2.55.0
Temporarily overriding HOME='/home/runner/work/_temp/642efe07-f976-4c97-ad09-66b6a01029d2' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
[command]/usr/bin/git config --global --add safe.directory /home/runner/work/gitgalaxy/gitgalaxy
Removing SSH command configuration
[command]/usr/bin/git config --local --name-only --get-regexp core.sshCommand
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
Removing HTTP extra header
[command]/usr/bin/git config --local --name-only --get-regexp http.https://github.com/.extraheader
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http.https://github.com/.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
Removing includeIf entries pointing to credentials config files
[command]/usr/bin/git config --local --name-only --get-regexp ^includeIf.gitdir:
[command]/usr/bin/git submodule foreach --recursive git config --local --show-origin --name-only --get-regexp remote.origin.url
Cleaning up orphan processes

@squid-protocol squid-protocol added the shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md label Oct 15, 2026
squid-protocol and others added 2 commits October 14, 2026 22:23
…rs="replace" (Part of #5166)

The #3813 gate (test_source_reads) forbids lossy errors= handlers in tests;
full-suite part 3/3 failed on the one this PR added.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@squid-protocol squid-protocol removed the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 15, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

CI shepherd: the head of this PR (ac1df9b) is not the one a maintainer labelled shepherd:merge on (new commits, or never approved), so the label was removed and nothing merges unreviewed code. Re-add the label when the new head is ready (shepherd:reapprove marks this PR until then).

@squid-protocol squid-protocol added shepherd:reapprove Bot: new commits dropped shepherd:merge; re-add it to merge this head. Guide: docs/ci.md shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md and removed shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md shepherd:reapprove Bot: new commits dropped shepherd:merge; re-add it to merge this head. Guide: docs/ci.md labels Oct 15, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol enabled auto-merge (squash) October 15, 2026 02:30
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol merged commit 5c14730 into main Oct 15, 2026
36 checks passed
@squid-protocol
squid-protocol deleted the churn/5166-20261015T0052Z branch October 15, 2026 02:58
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.

2 participants