Skip to content

Preserve address families when navigating URLs - #589

Closed
theman6660 wants to merge 1 commit into
mahmoud:masterfrom
theman6660:fix/url-navigate-address-family
Closed

theman6660 wants to merge 1 commit into
mahmoud:masterfrom
theman6660:fix/url-navigate-address-family

Conversation

@theman6660

Copy link
Copy Markdown

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

  • Harness/tooling: OpenAI Codex in ChatGPT Work.
  • Model(s): Codex; the exact backend model identifier is not exposed to this session.
  • Original prompt: 找活干去顺便看一下已有的过了多少 (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.

mahmoud added a commit that referenced this pull request Oct 25, 2026
…d keep IPv6 in navigate, reclassify re-registered schemes (#499, #588, #589, #489, #574)
@mahmoud

mahmoud commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Folded into #609 (see the PR description for credit). Thanks for the report and the repro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants