Repository navigation
fix(links): resolve paths inside the root and report non-portable destinations - #110
Conversation
…tinations docs_links.py and html_navigation.py resolved sources and destinations with Path.resolve() and listed Markdown files with os.walk. Both follow symbolic links, and os.walk follows NTFS junctions, before the containment check runs. A junction loop could hang the scan, and on Windows a destination written with backslashes or a drive letter was read as a Windows path instead of the repository-relative path GitHub sees. - Report destinations containing a backslash or a drive prefix, also when percent-encoded, as non-portable before touching the filesystem. - Resolve sources and destinations step by step inside the root: each entry is lstat-ed, and a symbolic link or junction target is read and checked before it is followed. A cycle is reported after 40 hops. - List Markdown files without following links or junctions. Part of #108. Co-Authored-By: Claude Opus 5.5 <[email protected]>
andy-zen-dev
left a comment
There was a problem hiding this comment.
Reviewed exact head 3d5b0175771daf3d6a6dc24cc33d90518335b389 against issue #108 and the repository's contribution rules. The patch changes the two link scanners to enumerate Markdown entries with lstat (without following directory junctions), resolve source/destination components inside the repository, classify external link targets before following them, and reject non-portable backslash/drive destinations. I inspected tools/docs_links.py, its html_navigation.py integration, the added POSIX/Windows boundary tests and the documentation. No merge-blocking regression found within this scope.
Quality checks run 39916796478 is green in all five required jobs, including Windows Python 3.14 and the two Action self-tests. I did not run an additional local test suite. The PR correctly identifies the outstanding repo_audit.py half of #108 and the macOS/Windows-path limitations; approval is for this partial, bounded link-checker change, not confirmation that all of #108 is complete.
…ymlinks repo_audit.py checked only Path.is_symlink(), which is False for an NTFS junction. A junction named docs or .github was therefore listed and its documents were read from wherever it pointed, contrary to the documented "directory symlinks are not traversed" guarantee. Both the inventory and the document reader now use lstat and the junction reparse tag, so a junction is reported as path.symlink and never read through. The link-checker half of #108 landed with #110. Closes #108 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ymlinks (#111) repo_audit.py checked only Path.is_symlink(), which is False for an NTFS junction. A junction named docs or .github was therefore listed and its documents were read from wherever it pointed, contrary to the documented "directory symlinks are not traversed" guarantee. Both the inventory and the document reader now use lstat and the junction reparse tag, so a junction is reported as path.symlink and never read through. The link-checker half of #108 landed with #110. Closes #108 Co-authored-by: Claude Opus 5.5 <[email protected]>
Reader problem and change
The link checkers resolved paths with
Path.resolve()and listed Markdown files withos.walk. Both follow symbolic links, andos.walkalso follows NTFS junctions, all before the containment check runs. As a result:docs_links.pyandhtml_navigation.py;docs\guide.mdor%43:/xwas read as a Windows path, not the repository-relative path GitHub sees.The change:
non-portable destination (backslash or drive letter)before any filesystem call.link_target_parts) before it is followed. Targets outside the root are reported asescapes repository root, as before, and a cycle is reported after 40 hops.tools/README.mdand the changelog describe the behaviour.Part of #108. The
repo_audit.pyhalf of that issue is still open.Evidence
../outside.mdgives "escapes".Verification
tests/test_path_boundaries.py:os.lstat/os.readlinkcall;Limitations
/var/...against/private/var/...on macOS or an 8.3 short name on Windows, is reported as an escape even when it points inside. macOS is untested.NULand::$DATAdestinations remain Link checkers accept wrong-case and Windows-only path spellings that are dead on GitHub #103.🤖 Generated with Claude Code