Repository navigation
Fix flaky heartbeat port allocation and run summarize_git tests in CI - #10
Merged
Merged
Conversation
_PortBox handed out consecutive ports from 53400, inside Linux's ephemeral range (32768-60999), so any outgoing connection on the CI runner could already hold one and Heartbeat.start() then failed with "Address already in use" (seen on PR #9 in test_no_split_brain_under_simultaneous_start). Reserve each port by binding a throwaway socket to ("127.0.0.1", 0) and reading back the kernel's choice. Pairs are returned sorted so the lower port stays first, which the election rule and the assertions depend on, and a port is never handed out twice in one process. Call sites are unchanged. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The module fixture does pytest.importorskip("requests"), and the
workflow only installed pytest, so every summarize_git test was
reported as skipped on GitHub. Install requests alongside pytest.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Two small, separate fixes for the Tests workflow, one commit each.
test_heartbeat.py: ask the OS for ports
_PortBoxhanded out consecutive ports from 53400, inside Linux's ephemeral range (32768-60999). Any outgoing connection on the runner could already hold one, andHeartbeat.start()then failed with "Address already in use", astest_no_split_brain_under_simultaneous_startdid on #9.The allocator now binds a throwaway socket to
("127.0.0.1", 0)withSO_REUSEADDRand reads back the kernel's choice. Pairs come back sorted so the lower port stays first (the election rule and several assertions rely on lower-port-wins), and no port is handed out twice in one process. ThePORTS.pair()call sites are unchanged.tests.yml: install requests
test_summarize_git.py's module fixture doespytest.importorskip("requests"), and the workflow only installed pytest, so all 23 summarize_git tests were reported as skipped in CI. The install step now installs requests alongside pytest.Verification (local, Python 3.13)
pytest -q test_heartbeat.pythree times: 14 passed each run (43-45 s).test_summarize_git.pywithout requests = 23 skipped; with requests = 23 passed.🤖 Generated with Claude Code