fix(tag): warn when a tag's root cannot be resolved
resolveRoot silently falls back to returning the tag itself when no null-parent ancestor surfaces — an orphaned parent_id or a chain deeper than the findAncestorIds CTE depth guard. The chip then renders a non-root tag as if it were the theme, with no trace. Log a warning (UUIDs only, per REQ-014) before the fallback so the anomaly is diagnosable. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -220,6 +220,11 @@ public class TagService {
|
||||
if (ancestor != null && ancestor.getParentId() == null) return ancestor;
|
||||
}
|
||||
}
|
||||
// No null-parent ancestor surfaced — the parent is orphaned or the chain is deeper than the
|
||||
// findAncestorIds CTE's depth guard. Fall back to the tag as its own root, but surface it:
|
||||
// a silently mislabeled root would otherwise be invisible. UUIDs only (no tag names logged).
|
||||
log.warn("Tag {} has parent {} but no root surfaced from its ancestry; "
|
||||
+ "treating it as its own root.", tag.getId(), tag.getParentId());
|
||||
return tag;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user