fix: preserve deep taxonomy tree children#86
Conversation
WalkthroughThis PR refactors the taxonomy tree-building algorithm in 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/repository/taxonomy_repository.go`:
- Around line 1056-1062: The code in buildTaxonomyTree silently drops any root
beyond the first by only setting root when root == nil and continuing, which
masks unexpected multi-root rows; instead keep the existing behavior of using
the first root but add a defensive log when another root is encountered: when
copyNode.ParentID == nil and root != nil, emit a warning (e.g.,
logger.Warn/Warnf) indicating multiple roots for the run and include identifying
info (run id / node id) rather than silently continuing; leave the initial set
root = ©Node path unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: fc5037a7-dfca-44e8-9440-602602a6b1ed
📒 Files selected for processing (2)
internal/repository/taxonomy_repository.gointernal/repository/taxonomy_repository_test.go
Summary
Why
The Formbricks taxonomy explorer depends on Hub returning the full tree. The previous reconstruction appended value copies before descendants were attached, so only shallow levels were visible in the UI.
Validation
go test ./internal/repository