From 2fc7d99c7e1ee8ab4e0fb06bbf7a466c926c0ec1 Mon Sep 17 00:00:00 2001 From: Anton Sauchyk Date: Wed, 23 Sep 2026 22:10:32 +0200 Subject: [PATCH] fix(tests): match stub hosts on subdomains in the link verifier `is_checkable` compared the hostname against STUB_HOSTS by equality, so the offline verifiers' `mainnet.example.com`, `rpc.example.com` and `x.example.com` stubs were treated as real URLs and `--live` failed trying to resolve them. Match the host or any subdomain of it instead. Anchored on a leading dot, so `notexample.com` and `example.com.evil.net` still count as real. Co-Authored-By: Claude Opus 5 (1M context) --- tests/regression/verify_documentation_links.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/regression/verify_documentation_links.py b/tests/regression/verify_documentation_links.py index ae4d877..5641fd0 100644 --- a/tests/regression/verify_documentation_links.py +++ b/tests/regression/verify_documentation_links.py @@ -34,9 +34,10 @@ EXTRA_FILES = ("README.md", "CLAUDE.md") URL = re.compile(r"https?://[^\s'\"()<>\]`,]+") -# Hosts that are not meant to resolve. The offline verifiers point a stub client -# at unroutable addresses on purpose, and example.com is the domain RFC 2606 -# reserves for exactly the placeholder metadata URI a test coin is created with. +# Hosts that are not meant to resolve, matched on the host and any subdomain of +# it. The offline verifiers point a stub client at unroutable addresses on +# purpose, and example.com is the domain RFC 2606 reserves for exactly the +# placeholder metadata URI a test coin is created with. STUB_HOSTS = { "127.0.0.1", "dummy", @@ -101,7 +102,7 @@ def is_checkable(url: str) -> bool: if "{" in url: # f-string template, e.g. an explorer link return False host = urlparse(url).hostname or "" - return host not in STUB_HOSTS + return not any(host == stub or host.endswith(f".{stub}") for stub in STUB_HOSTS) def check_urls_well_formed(found: dict[str, list[str]]) -> None: