fix(python): report bound server port - #12906
Closed
promiseeuler wants to merge 1 commit into
Closed
Conversation
Contributor
There was a problem hiding this comment.
Hi! Thanks for opening this pull request.
Because this is your first time contributing to this repository, make sure you've read our Contributor Guide and Code of Conduct.
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.
Related
What
While using
rerun-sdk==0.35.0, I found thatrr.server.Server(host="127.0.0.1", port=0)binds an OS-assigned ephemeral port but returnsrerun+http://127.0.0.1:0, which clients cannot use.This change builds the Python server URL after startup from
ServerHandle::connect_addr(), so it reports the actual bound port while preserving the existing connectable-host behavior for unspecified bind addresses. It also adds a regression test that verifies the reported port is nonzero and accepts a TCP connection.Confidence: high. The Python binding was constructing the URL from the requested address before the server started; the server handle already exposes the resolved connect address after binding.
Validation:
pixi run py-buildpixi run py-fmtpixi run lint-rerun rerun_py/src/server.rs rerun_py/tests/unit/test_server.pyrustup run stable rustfmt --edition 2024 --check rerun_py/src/server.rspixi run uv run pytest -q rerun_py/tests/unit/test_server.py -k "port_zero_reports_bound_port or random_port"— 2 passedgit diff --checkThe complete
test_server.pyrun reached 12 passing tests and 3 dataset-fixture failures because this shallow checkout contains Git LFS pointer files instead of the RRD fixtures (the loader readsversrather than anRRF2header).Disclosure
I used an LLM-assisted workflow for this contribution. I manually reproduced the released behavior, reviewed the binding and server-handle paths, implemented the fix, and ran the validation listed above.