Skip to content

test(check-links): pin the three percent-decode calls in the self-test - #105

Merged
sanity merged 1 commit into
mainfrom
fix/check-links-selftest-decode
Aug 3, 2026
Merged

test(check-links): pin the three percent-decode calls in the self-test#105
sanity merged 1 commit into
mainfrom
fix/check-links-selftest-decode

Conversation

@sanity

@sanity sanity commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #103, test-only.

That PR's 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 check-links.py's three
unquote() calls was actually exercised. Deleting the decode on the fragment, or the one in the
redirect 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.exists to os.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:

  • a non-ASCII id (#résumé) reached through a percent-encoded fragment
  • an alias whose refresh URL is itself percent-encoded

Testing

Mutation-tested, deleting each unquote() in turn:

mutant before after
decode dropped on the path caught caught
decode dropped on the fragment survived caught
decode dropped on the redirect path survived caught

--self-test still passes (17 expected failures), and the real site is still clean — no broken
internal links across 222 pages.

Credit to the review pass on #103 for spotting that the fixture didn't discriminate.

[AI-assisted - Claude]

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
@sanity
sanity merged commit 6679740 into main Aug 3, 2026
3 checks passed
@sanity
sanity deleted the fix/check-links-selftest-decode branch August 3, 2026 20:38
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.

1 participant