Repository navigation
Preserve address families when navigating URLs - #589
Closed
theman6660 wants to merge 1 commit into
Closed
theman6660 wants to merge 1 commit into
theman6660 wants to merge 1 commit into
Conversation
mahmoud
added a commit
that referenced
this pull request
Oct 25, 2026
Owner
|
Folded into #609 (see the PR description for credit). Thanks for the report and the repro. |
This was referenced Oct 26, 2026
This was referenced Oct 30, 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.
The change
Navigating from an IPv6 URL such as https://[::1]/a/b to "child" produces https://::1/a/child, losing the brackets required for an IPv6 host. navigate() builds the result with from_parts(), which initializes the address family to None; serialization then treats the IPv6 address as a hostname.
Copy the family from the same destination/base URL that supplies the selected host. This also retains IPv4 family metadata and clears the old family when navigating to a hostname. Existing path/query/authority inheritance behavior is unchanged.
Add 22 regression/control cases for string and URL destinations: relative and absolute paths, queries, fragments, empty references, IPv6 and IPv4 hosts, host changes, and existing absolute-URL behavior. Check serialized results, parse roundtrips, family metadata and input immutability. Before the fix, 16 failed and 6 passed. Afterward, the focused URL tests pass (149 tests), and the complete unit/doctest suite passes (700 tests and 12 subtests). Ruff on the new tests and git diff --check pass.
The backstory
Previous contributions: #542 and #543. This additional defect was found during a Codex-assisted audit of URL navigation and address-family roundtrips; it is not a production incident report.
AI assistance
找活干去顺便看一下已有的过了多少(roughly: find useful work to do and check how many existing PRs have been accepted), followed by requests to continue. The agent selected this URL navigation defect, wrote the patch and regression tests, and ran the checks described above.