Skip to content

fix(healthcheck): support bracketed IPv6 targets and strip brackets before TCP connect - #5875

Merged
gabsprogrammer merged 1 commit into
Osmantic:public-betafrom
vaibhavsrv:fix/healthcheck-bracketed-ipv6
Sep 19, 2026
Merged

gabsprogrammer merged 1 commit into
Osmantic:public-betafrom
vaibhavsrv:fix/healthcheck-bracketed-ipv6

Conversation

@vaibhavsrv

Copy link
Copy Markdown
Contributor

Why this matters

In ods/scripts/healthcheck.py, _parse_target() only recognized colon-separated host:port shorthand if the target did not begin with [ (":" in raw and not raw.startswith("[")). As a consequence, valid IPv6 endpoint targets passed in standard bracketed notation (e.g. [::1]:8080) were rejected with ValueError: target must be http(s) URL, tcp://host:port, or host:port. Furthermore, when bracketed IPv6 addresses were parsed from explicit tcp://[::1]:8080 URLs, _parse_host_port() retained the enclosing brackets [::1], which causes standard socket connections (socket.create_connection(("[::1]", port))) to fail with socket.gaierror: [Errno 8] nodename nor servname provided, or not known.

This patch updates _parse_target() to accept bracketed [ipv6]:port shorthand notation alongside standard hostname/IPv4 targets, and ensures _parse_host_port() strips enclosing brackets from IPv6 host addresses prior to opening the TCP socket connection.

Validation

  • Repro baseline: Invoked python3 ods/scripts/healthcheck.py [::1]:<port> --timeout 2; confirmed baseline raised ValueError: target must be http(s) URL, tcp://host:port, or host:port. When passed tcp://[::1]:<port>, baseline failed with socket gaierror due to unstripped brackets.
  • Post-fix: Verified ods/tests/test_healthcheck_ipv6.py passes with exit code 0; TCP healthcheck successfully connects to listening IPv6 endpoints for both [::1]:port and tcp://[::1]:port targets.
  • Scripts healthcheck suites: 1 passed. New-test syntax and diff checks pass; new regressions wired into Linux CI.

Overlap check

Risk / AI disclosure

AI-assisted investigation, implementation and CLI regressions. This strengthens target parsing and IPv6 TCP address resolution in the universal healthcheck utility, not runtime daemon execution. Independent human review and platform/runtime qualification remain gates. No running configuration, deployment or upstream merge changed.

Follow-up integration evidence

Composed with #5871 at 81b881c without conflicts. Production and test diffs passed together; network health probe contracts remain intact.
Backlog composition was local-only (production/test diffs, excluding workflow/Makefile wiring); it is not an upstream merge or independent human approval. Declared live-review gates remain open.

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