Skip to content

CI: test-time ratchet, per-test gate and suite budget (Part of #5166) - #5169

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

squid-protocol merged 4 commits into
mainfrom
churn/5166-20261015T0048Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #5166 (part B: test-time ratchet). Part A and C are separate.

What

  • tests/tools/time_ratchet.py + tests/test_time_baseline.json (the 32 tests over 10 s from .test_durations, and suite_budget_s = 3415 s, the suite minus test_evidence_components.py).
  • Per test (every PR): over 10 s fails unless @pytest.mark.slow(reason=...) or baselined; a baselined test fails past 2x its seconds. update only lowers entries, drops those at or under 10 s, never adds or raises.
  • Suite budget: nightly fails over +10% and files/refreshes one issue; PRs and main pushes only print total and delta in the job summary.
  • pr_gates.py --ratchets gets a time entry (checks the committed .test_durations).
  • tests/conftest.py: empty slow reason is a collection error; with GITGALAXY_TEST_TIMES=file a run writes per-test seconds and slow reasons (the controller's reports, so it works under xdist; not exercised locally, the venv has no xdist).

Workflow changes (smoke-test.yml, each minimal)

  1. Part step gets env GITGALAXY_TEST_TIMES.
  2. New step in the required part: time_ratchet.py check (the per-test gate; the required check still always reports).
  3. New step: upload the part's times artifact (all events).
  4. New non-required job suite-time (needs the parts): sums the three parts' own seconds, summary on PRs, --enforce + issue on schedule. Only new permission: issues: write on that job.
    No test is deselected or skipped.

Cross-repo

None. docs/ci.md also changes in #5165 (separate section, expect a trivial merge).

Gates

pr_gates --fast 6/6; --ratchets 8 pass, 0 fail, 0 skipped; test_time_ratchet.py 13 pass.

Lessons for agents

  • def f(path=BASELINE) binds at definition time: a monkeypatched module constant is ignored. Resolve defaults inside the function.
  • total/budget - 1 > 0.10 misjudges the exact boundary (110/100-1 is 0.1000000000000000888); compare total > budget*(1+tol).

🤖 Generated with Claude Code

@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 00:57
@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

No description provided.

@squid-protocol
squid-protocol enabled auto-merge (squash) October 15, 2026 01:03
@squid-protocol

Copy link
Copy Markdown
Owner Author

PR #5169 @ 9664c0d: 1 failed check(s)

== full-suite part 3/3 (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/38662941061/job/116188210977
repro: python -m pytest -q tests/tools/test_pr_gates_fleet.py::test_ratchets_skip_when_nothing_present
failing tests: tests/tools/test_pr_gates_fleet.py::test_ratchets_skip_when_nothing_present
errors:
fail-on-cache-miss: false
E AssertionError: assert [['gitgalaxy....'], ['check']] == [['gitgalaxy....', '--check']]
tests/tools/test_pr_gates_fleet.py:71: AssertionError
FAILED tests/tools/test_pr_gates_fleet.py::test_ratchets_skip_when_nothing_present - AssertionError: assert [['gitgalaxy....'], ['check']] == [['gitgalaxy....', '--check']]
##[error]Process completed with exit code 1.
log tail:
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/tools/test_pr_gates_fleet.py::test_ratchets_skip_when_nothing_present - AssertionError: assert [['gitgalaxy....'], ['check']] == [['gitgalaxy....', '--check']]
Left contains one more item: ['check']
Full diff:
[
[
'gitgalaxy.standards.cics',
'regen',
'--check',
],
+ [
+ 'check',
+ ],
]
1 failed, 8046 passed, 20 skipped, 4 xfailed, 3 xpassed, 2 warnings in 359.49s (0:05:59)
##[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/676df054-2515-44bc-b82e-fcc4fd63393c' 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 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 (ac136d0) 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 01:20
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol

Copy link
Copy Markdown
Owner Author

PR #5169 @ ac136d0: 1 failed check(s)

== full-suite part 2/3 (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/38664727855/job/116195379485
repro: python -m pytest -q tests
errors:
fail-on-cache-miss: false
FAIL tests/core_engine/test_galaxyscope.py::TestGalaxyScopeOrchestrator::test_repo_z_score_backfilled_into_per_file_telemetry: 66.1s is over 2x its baseline 14.8s (make it faster, or mark it slow with a reason)
FAIL tests/core_engine/test_galaxyscope.py::TestGalaxyScopeOrchestrator::test_sarif_sanitization_purge: 56.0s is over 2x its baseline 14.1s (make it faster, or mark it slow with a reason)
FAIL tests/core_engine/test_galaxyscope.py::TestGalaxyScopeOrchestrator::test_typosquat_hits_folded_into_summary: 57.6s is over 2x its baseline 19.5s (make it faster, or mark it slow with a reason)
FAIL tests/core_engine/test_inline_extraction.py::test_in_process_extraction_is_the_pools_output: 11.7s is over 10s and has no @pytest.mark.slow(reason=...) and no entry in tests/test_time_baseline.json
##[error]Process completed with exit code 1.
log tail:
XFAIL tests/extraction/languages/test_dart.py::test_dart_dependency_capture_xfail_invalid[// import 'package:test/test.dart';] - String/comment lookalikes lack AST block shielding
XFAIL tests/extraction/languages/test_dart.py::test_dart_dependency_capture_xfail_invalid[/* \n import 'package:foo/foo.dart'; \n */] - String/comment lookalikes lack AST block shielding
7631 passed, 367 skipped, 5 xfailed, 16 warnings, 9 subtests passed in 399.49s (0:06:39)
##[group]Run python tests/tools/time_ratchet.py check --times "$RUNNER_TEMP/times-part-2.json"
python tests/tools/time_ratchet.py check --times "$RUNNER_TEMP/times-part-2.json"
shell: /usr/bin/bash -e {0}
env:
PYTHONUTF8: 1
GITGALAXY_LICENSE_KEY: COMMUNITY_FREE_TIER
OMP_NUM_THREADS: 1
EVIDENCE_REPORT_ADVISORY: 1
pythonLocation: /opt/hostedtoolcache/Python/3.12.15/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.15/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.15/x64/lib
##[endgroup]
FAIL tests/core_engine/test_galaxyscope.py::TestGalaxyScopeOrchestrator::test_repo_z_score_backfilled_into_per_file_telemetry: 66.1s is over 2x its baseline 14.8s (make it faster, or mark it slow with a reason)
FAIL tests/core_engine/test_galaxyscope.py::TestGalaxyScopeOrchestrator::test_sarif_sanitization_purge: 56.0s is over 2x its baseline 14.1s (make it faster, or mark it slow with a reason)
FAIL tests/core_engine/test_galaxyscope.py::TestGalaxyScopeOrchestrator::test_typosquat_hits_folded_into_summary: 57.6s is over 2x its baseline 19.5s (make it faster, or mark it slow with a reason)
FAIL tests/core_engine/test_inline_extraction.py::test_in_process_extraction_is_the_pools_output: 11.7s is over 10s and has no @pytest.mark.slow(reason=...) and no entry in tests/test_time_baseline.json
8003 tests checked, 4 over the per-test limit
##[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/8646acb9-d8e1-413e-8a5a-576dcd894b3a' 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:24
The baseline came from local durations, so CI tripped on 7 tests: 4 unbaselined over 10 s
(java utf8 guard, inline extraction, redos poison, ground-truth plan) and 3 galaxyscope tests
over 2x. Entries set at CI-observed seconds; origin/main merged.

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 (68f5d27) 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 and removed shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md labels Oct 15, 2026
@squid-protocol squid-protocol added shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md and removed 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:38
@squid-protocol

Copy link
Copy Markdown
Owner Author

PR #5169 @ 68f5d27: 1 failed check(s)

== suite time budget (#5166) (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/38671162154/job/116220384298
repro: python tests/tools/pr_gates.py --fast
errors:
##[error]Process completed with exit code 1.
log tail:
Download artifact has finished successfully
##[group]Run parts=$(find times -name 'times-part-.json' | sort)
parts=$(find times -name 'times-part-
.json' | sort)
test "$(printf '%s\n' "$parts" | grep -c .)" = 3 || { echo "expected 3 parts' test times:"; echo "$parts"; exit 1; }
enforce=()
if [ "$EVENT" = "schedule" ]; then enforce=(--enforce); fi
status=0
python3 tests/tools/time_ratchet.py budget --times $parts "${enforce[@]}" | tee report.txt || status=$?
{ echo "### Suite time budget"; echo; cat report.txt; } >> "$GITHUB_STEP_SUMMARY"
if [ "$status" = 1 ] && [ "$EVENT" = "schedule" ]; then
body="The nightly full suite is over its time budget (tests/test_time_baseline.json): $(tail -n 2 report.txt | head -n 1). Run: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
n=$(gh issue list --repo "$GITHUB_REPOSITORY" --state open --search 'in:title "Suite time over budget"' --json number -q '.[0].number')
if [ -n "$n" ]; then gh issue comment "$n" --repo "$GITHUB_REPOSITORY" --body "$body"
else gh issue create --repo "$GITHUB_REPOSITORY" --title "Suite time over budget (nightly)" --body "$body"; fi
fi
exit $status
shell: /usr/bin/bash -e {0}
env:
EVENT: pull_request
GH_TOKEN: ***
##[endgroup]
find: ‘times’: No such file or directory
expected 3 parts' test times:
##[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/26f57b00-8a17-430f-aed6-fdfe6c205b79' 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
squid-protocol merged commit 4702126 into main Oct 15, 2026
49 of 50 checks passed
@squid-protocol
squid-protocol deleted the churn/5166-20261015T0048Z branch October 15, 2026 02:56
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 shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant