fix(lint): don't hide same-stem orphans behind qualified links#147
Merged
KylinMountain merged 1 commit intoJun 29, 2026
Merged
Conversation
find_orphans added the bare stem of *every* wikilink to the "incoming" set, so a qualified link like `[[concepts/foo]]` also registered the stem `foo`. Any other page that merely shared that stem in a different directory (e.g. `summaries/foo`) was then treated as linked and excluded from orphan detection — a genuine orphan was silently missed. Only add the bare stem when the link itself is a bare stem (no `/`); qualified links register only their full path. Bare `[[foo]]` links still resolve by stem, so a page named `foo` in any directory remains non-orphaned. Adds regression tests for both the qualified-link (orphan now flagged) and bare-link (still matched) cases.
KylinMountain
approved these changes
Jun 29, 2026
KylinMountain
left a comment
Collaborator
There was a problem hiding this comment.
LGTM. Thanks for the sharp catch and the clean fix! Much appreciated 🙏
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
find_orphansbuilds the set of linked pages by adding, for every wikilink, both its full path and its bare stem:So a qualified link like
[[concepts/foo]]also registers the bare stemfoo. Any other page that merely shares that stem in a different directory — e.g.summaries/foo— is then treated as "linked" (stem in incoming) and excluded from orphan detection. A genuine orphan is silently missed.Fix
Only register the bare stem when the link itself is a bare stem (no
/). Qualified links register only their full path:Bare
[[foo]]links still resolve by stem (a page namedfooin any directory stays non-orphaned), so the intended bare-link behaviour is preserved.Testing
test_qualified_link_does_not_hide_same_stem_orphan—summaries/dupis now flagged when only[[concepts/dup]]is linked (fails before the fix).test_bare_stem_link_still_matches_same_stem_page— a bare[[dup]]link still marks a same-stem page as non-orphan.(The 4 unrelated
TestFindMissingEntriesRegistryfailures are pre-existing onmainand untouched by this change.)