Skip to content

fix: treat hierarchical tags as a tree in the tag-usage scanner - #177

Merged
rogerdigital merged 1 commit into
mainfrom
fix/tag-hierarchy-exemption
Sep 17, 2026
Merged

rogerdigital merged 1 commit into
mainfrom
fix/tag-hierarchy-exemption

Conversation

@rogerdigital

Copy link
Copy Markdown
Owner

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/child was reported as "does not appear in the vault", while Obsidian's tag:#parent search matches child tags.

Change

  • Low-usage check: a tag is exempt when any descendant at any depth has a count ≥ the threshold (prefix-based, so grandparents are covered without recursion). Branches that are entirely below the threshold are still reported — that is the genuinely dead case the check exists for.
  • Missing watched tag: a watched tag counts as present when any child tag appears in the vault.
  • No new setting: this is a false-positive correction, not a preference — the new behavior only removes findings no reasonable workflow wants, and dead branches keep their signal. README updated to document the tree semantics.

Verification

  • TDD: new tests observed failing first, then passing — parent exemption (reporter's case), grandparent exemption at depth, watched-parent presence, plus a control that dead branches are still flagged.
  • Full local gate: npm run lint && npm run lint:obsidian-warnings && npm run build && npm test — 929 tests pass.
  • Fingerprints of remaining findings are unchanged, so previously ignored findings stay ignored.

Fixes #171

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
@rogerdigital
rogerdigital merged commit d3e772c into main Sep 17, 2026
1 check passed
@rogerdigital
rogerdigital deleted the fix/tag-hierarchy-exemption branch September 18, 2026 07:10
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.

Exclude parent tags from low-usage check as long as at least one of their children is over the threshold

1 participant