fix: explicit SKIPPED status for Tor/I2P/DNS sites when no proxy is configured#2815
Open
mvanhorn wants to merge 1 commit into
Open
fix: explicit SKIPPED status for Tor/I2P/DNS sites when no proxy is configured#2815mvanhorn wants to merge 1 commit into
mvanhorn wants to merge 1 commit into
Conversation
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.
Summary
In the dispatch path (maigret/checking.py around line 852, right after
checker = make_protocol_checker(options, site.protocol)), detect when the resolved checker is the no-op mock viaisinstance(checker, CheckerMock)and short-circuit before the request is attempted. Instead of dispatching to the mock, build aMaigretCheckResultwithMaigretCheckStatus.ILLEGALplus an explanatoryCheckError("Skipped", "no <protocol> gateway configured"), mirroring the existing disabled-site branch (checking.py ~860) that already renders cleanly in CLI and JSON. ReusingILLEGALkeeps the change to a single file and avoids touching the report/rendering layer (no new enum value to plumb throughmaigret/report.py), while still satisfying the acceptance criteria: no "Connection lost" entries for.onion/.i2p/domain sites and a one-line skip explanation in the report.Why this matters
When the user does not pass
--tor-proxy/--i2p-proxy/--with-domains, the corresponding protocol checker is resolved to aCheckerMock(maigret/checking.py:599) whosecheck()returns('', 0, None). Astatus_codeof0is later interpreted asCheckError("Connection lost"), so every.onion/.i2p/ domain entry reports a fake "Connection lost" error instead of being honestly skipped. This pollutes--print-errors, masks real connection-lost errors on clearweb sites, and is misleading because the site was never actually contacted. The issue was filed by the maintainer (soxoj) with detailed code refs and acceptance criteria; a contributor noted the exact symptom string has drifted, but the underlyingCheckerMockmechanism is unchanged on currentmain(verified at checking.py:599-610 and the proxy-absent fallbacks at checking.py:1121-1138).See #2664.
Testing
.onionsite dispatched with no--tor-proxyyields a skipped result with an explanatory message, and--print-errorsshows no "Connection lost" entry for it. - Edge case:.i2pand domain (DNS) sites behave identically when their proxy/option is absent. - Error path: a genuine clearweb connection failure still surfaces as a realCheckError("Connection lost")and is not swallowed by the new skip branch.Fixes #2664