Repository navigation
fix: scope compilation template names by group - #16998
Conversation
📝 WalkthroughWalkthrough
ChangesCompilation template group scope
Wiki link rendering
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant WikiPlanner
participant LinkTransformer
participant RefineWriter
WikiPlanner->>RefineWriter: pages_spec with planned titles
RefineWriter->>LinkTransformer: markdown and page_titles
LinkTransformer-->>RefineWriter: rewritten artifact links and wikilinks
Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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.
🧹 Nitpick comments (1)
api/db/services/compilation_template_group_service.py (1)
333-343: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd focused tests for the group boundary.
Cover same-name templates across different groups, duplicate names within one group, and the existing built-in behavior.
Also applies to: 417-425
🤖 Prompt for 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. In `@api/db/services/compilation_template_group_service.py` around lines 333 - 343, Add focused tests around the duplicate-name validation in the template group service, covering same-name templates in different groups, duplicate names within the same group, and preservation of the existing built-in-template behavior. Exercise both create and update paths as applicable, including the target-exclusion behavior used by the duplicate_query logic.Source: Coding guidelines
🤖 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.
Nitpick comments:
In `@api/db/services/compilation_template_group_service.py`:
- Around line 333-343: Add focused tests around the duplicate-name validation in
the template group service, covering same-name templates in different groups,
duplicate names within the same group, and preservation of the existing
built-in-template behavior. Exercise both create and update paths as applicable,
including the target-exclusion behavior used by the duplicate_query logic.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5fe37188-6c6b-4b15-baca-d42adb5bc544
📒 Files selected for processing (2)
api/db/db_models.pyapi/db/services/compilation_template_group_service.py
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16998 +/- ##
=======================================
Coverage 93.16% 93.16%
=======================================
Files 10 10
Lines 717 717
Branches 118 118
=======================================
Hits 668 668
Misses 29 29
Partials 20 20 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This reverts commit 6d2c416.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
rag/advanced_rag/knowlege_compile/wiki.py (1)
2900-2904: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueApply title awareness to piped wikilinks.
The
_pipedfunction retains the explicit label exactly as written, even if the LLM emitted a raw slug like[[my-slug|my-slug]]. Since_display_textsafely falls back to the original label if it doesn't match the slug, you can wraptextin_display_text(text, slug)to consistently apply readable titles across both standard Markdown links and piped wikilinks.♻️ Proposed refactor
def _piped(m: re.Match) -> str: slug = m.group(1).strip() text = m.group(2).strip() _track(slug) - return f"[{text}](artifact/{kb_id_str}/{slug})" + return f"[{_display_text(text, slug)}](artifact/{kb_id_str}/{slug})"🤖 Prompt for 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. In `@rag/advanced_rag/knowlege_compile/wiki.py` around lines 2900 - 2904, Update the nested _piped function to pass the extracted text and slug through _display_text before constructing the artifact link, while preserving slug tracking and the existing URL format.
🤖 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 `@rag/advanced_rag/knowlege_compile/wiki.py`:
- Around line 2889-2890: Update the parts-length guard in the artifact slug
parsing logic to reject only lists shorter than two elements, changing the check
from len(parts) < 3 to len(parts) < 2 while preserving the kb_id_str validation.
---
Nitpick comments:
In `@rag/advanced_rag/knowlege_compile/wiki.py`:
- Around line 2900-2904: Update the nested _piped function to pass the extracted
text and slug through _display_text before constructing the artifact link, while
preserving slug tracking and the existing URL format.
🪄 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: CHILL
Plan: Pro
Run ID: 0de97110-0083-432f-a4ca-0525f749beb6
📒 Files selected for processing (1)
rag/advanced_rag/knowlege_compile/wiki.py
What problem does this PR solve?
Compilation template names were incorrectly unique across the entire tenant, preventing different groups from using the same template name.
This change scopes template-name uniqueness to each template group and updates the model definition accordingly.
Type of change