test(check-links): pin the three percent-decode calls in the self-test - #105
Merged
Conversation
Follow-up to #103. Its self-test grew a /café/ page to cover percent-encoded paths, but the fixture used an ASCII fragment (#accented) and an ASCII alias target, so only one of the three unquote() calls was actually exercised — deleting the decode on the fragment, or the one in the redirect path, still passed. That matters because a mis-decoded path is precisely the bug this file shipped once already: tightening the static-file branch to os.path.isfile turned a silently-passing encoded lookup into a CI failure on any page with a non-ASCII character in its URL. The code is right; the test just wasn't holding it. Two lines in the existing fixture: a non-ASCII id (#résumé) reached through a percent-encoded fragment, and an alias whose refresh URL is itself encoded. All three decode mutants now fail --self-test where two previously survived. [AI-assisted - Claude] Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LVrqpcFzkBjULGSQxaQJ2E
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.
Follow-up to #103, test-only.
That PR's self-test grew a
/café/page to cover percent-encoded paths, but the fixture used anASCII fragment (
#accented) and an ASCII alias target, so only one ofcheck-links.py's threeunquote()calls was actually exercised. Deleting the decode on the fragment, or the one in theredirect path, still passed the self-test.
That is worth closing because a mis-decoded path is exactly the bug this file shipped once already
during #103's review: tightening the static-file branch from
os.path.existstoos.path.isfile(correct on its own) turned a silently-passing encoded lookup into a CI failure for any page whose
URL contains a non-ASCII character. The code is right now; the test just wasn't holding it there.
Two lines in the existing fixture:
#résumé) reached through a percent-encoded fragmentrefreshURL is itself percent-encodedTesting
Mutation-tested, deleting each
unquote()in turn:--self-teststill passes (17 expected failures), and the real site is still clean — no brokeninternal links across 222 pages.
Credit to the review pass on #103 for spotting that the fixture didn't discriminate.
[AI-assisted - Claude]