fix(tests): skip network-bound version checks in the pre-push gate#623
Merged
Conversation
The lefthook pre-push hook runs tests/run_changed_tests.sh. When a foundational file (tests/framework.sh, tests/framework/*, Dockerfile) changes, that runner maps to ALL and execs the whole unit suite, which includes tests/unit/bin/check-versions.sh — a test that invokes the real bin/check-versions.sh and curls api.github.com once per tracked tool. Under concurrent golems those calls serialize and a git push stalls for minutes (observed: golem-599 wedged ~20 min). Add a SKIP_NETWORK_TESTS flag (via a shared network_tests_disabled helper in tests/framework.sh). The pre-push runner exports it so the push gate stays offline-safe; CI invokes run_unit_tests.sh directly and leaves it unset, so the full network matrix still runs there. Guard the 3 live-script tests in check-versions.sh and short-circuit the existing check_network() helper in version-resolution.sh. Add a map_to_test() arm so editing the runner triggers its own regression suite, and add tests/unit/run-changed-tests.sh to lock the wiring in. Closes #615 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the multi-minute
git pushstalls golems hit under concurrent load(#615). The lefthook pre-push hook runs
tests/run_changed_tests.sh; when afoundational file (
tests/framework.sh,tests/framework/*,Dockerfile)changes, that runner maps to
ALLand execs the whole unit suite — whichincludes
tests/unit/bin/check-versions.sh, a test that invokes the realbin/check-versions.shand curlsapi.github.comonce per tracked tool. Withseveral golems pushing at once those calls serialize and a push wedges for
minutes (observed: golem-599 ~20 min).
Approach (proposed solution #1)
Introduce one opt-in env flag,
SKIP_NETWORK_TESTS, consulted through ashared
network_tests_disabled()helper intests/framework.sh:tests/run_changed_tests.sh(the pre-push runner) exportsSKIP_NETWORK_TESTS=1(overridable via${VAR:-1}), so the push gate staysoffline-safe on both the
ALLpath and per-file invocations.run_unit_tests.shdirectly and leaves theflag unset, so the full network matrix still runs there.
check-versions.shand the existingcheck_network()guard inversion-resolution.shhonor the flag.map_to_test()arm maps the runner to its new regression suite so futureedits to it are exercised at push time.
No cross-worktree cache, no push lock, no weakening of foundational-change
coverage — the lowest-risk of the four options in the issue.
Test plan
SKIP_NETWORK_TESTS=1 ./tests/unit/bin/check-versions.sh→ 3 live tests skip,25 mock tests pass, zero
api.github.comcalls.SKIP_NETWORK_TESTS=1 ./tests/unit/base/version-resolution.sh→ 16 networktests skip in ~0.6s.
tests/unit/run-changed-tests.sh(9 assertions) locks the wiring in,including the unset/CI path.
ALL-mapped suite (3128 tests) offline in57s — the exact scenario that previously stalled.
Review findings
Adversarial pre-PR review ran (5 dimensions + judge + gatekeeper). All findings
fixed on this PR, none deferred:
bash -cBASH_SOURCE fragility in the behavioral test(rewritten to toggle the flag in-process); missing
map_to_test()arm for therunner.
assertion per
run_test; added the unset/CI-path behavioral case; barecurl→
command curl(full-path policy); guard check now asserts each live test byname instead of a
>=3count.Closes #615