fix: treat hierarchical tags as a tree in the tag-usage scanner - #177
Merged
Merged
Conversation
Parent tags used for structure were flagged as low-usage whenever their standalone count fell below the threshold, even with actively used child tags. Obsidian's tag model aggregates the hierarchy, so a parent with an active descendant is a healthy branch root, not an abandoned tag. A tag is now exempt when any descendant at any depth meets the threshold, so only branches that are entirely below the threshold are reported. Watched parent tags likewise count as present when any child tag appears, matching Obsidian's tag search semantics. Fixes #171
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.
Problem
Users who structure their vaults with hierarchical tags (
#parent/child) saw parent tags flagged as "Low-usage tag" even while their children were actively used (#171). The scanner counted each tag as a flat string, so a parent written standalone only occasionally (below threshold) was reported as underused — a false positive by the check's own purpose: a parent with active descendants is a healthy branch root, not abandoned cruft.The same flat counting also affected the watchlist: a watched parent that only ever appeared as
#parent/childwas reported as "does not appear in the vault", while Obsidian'stag:#parentsearch matches child tags.Change
Verification
npm run lint && npm run lint:obsidian-warnings && npm run build && npm test— 929 tests pass.Fixes #171