Stop the link sanitizer from removing commercial support URLs on transient failures - #1050
Open
Valyrian-Code wants to merge 1 commit into
Open
Valyrian-Code wants to merge 1 commit into
Valyrian-Code wants to merge 1 commit into
Conversation
check_url_redirects treated any RequestException (timeout, DNS hiccup, connection reset) and any non-200 status as a dead link, so the weekly sanitize job emptied working URLs in data/commercial_support and committed the result. The script only ever empties URLs, it never restores them, so each false positive permanently removed a listing's link. All five URLs emptied by the last three scheduled runs are reachable today and pass this script's own check when run locally, which points at transient conditions on the runner: timeouts, rate limiting or bot protection answering the datacenter IP with 403/429/5xx. Keep the URL when the check cannot give a clear verdict, matching the existing SSLError behaviour: network-level exceptions, 5xx server errors and access-restricted or transient statuses (401, 403, 405, 408, 429) no longer empty a URL. Genuinely broken links (404 and other 4xx) and redirects to a different domain still do. Add tests covering both directions; the transient cases fail on the previous code.
Collaborator
|
It would be nice to have your thoughts on this @timlinux . |
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.
Continues the script reliability and test-coverage work (#1015, #1020, #1042).
Problem
scripts/sanitize_commercial_supports.pyruns every Sunday and empties a listing's URL indata/commercial_supportwhen the link looks broken; the workflow then commits the result to main. Butcheck_url_redirectstreated two ambiguous situations as a dead link:Since the script only ever empties URLs and never restores them, every false positive permanently removes a company's link from the site.
Evidence this is happening
All five URLs emptied by the last three scheduled runs are alive today, and all five pass this script's own check when run locally:
That points at transient conditions on the CI runner: timeouts, rate limiting, or bot protection answering the datacenter IP with 403/429/5xx.
Fix
Keep the URL whenever the check cannot give a clear verdict, which is the choice the code already makes for
SSLError:Tests
test/test_sanitize_commercial_supports.py(on the #1015 harness, all network mocked): transient exceptions and statuses keep the URL, 404 and cross-domain redirects still empty it, same-domain http to https redirects are fine, andprocess_fileempties only flagged lines while preserving formatting. The transient cases fail on the previous code, so the suite has teeth. Full test suite green (60 tests).Happy to follow up by restoring the five wrongly emptied URLs above in a small data PR if you'd like.