fix: validate unsupported template placeholders - #249
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe template text extraction path now reports unsupported placeholders with a descriptive ChangesTemplate error handling
Merge Risk: ⚪ Minimal · up to Unsupported template placeholders now produce a clear validation error instead of an unhandled missing-key failure. No concrete merge-blocking risk is currently identified. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Hi @RoopakBRK, thank you for the contribution! Sorry for the radio silence, we've been revamping our internal workflows that delayed a response on this PR. We can pick this up for a review early next week. |
This PR adds a small validation improvement for query and document templates.
Issue - When an unsupported placeholder is used in a template, for example {domain}, Python currently raises a KeyError when formatting the template. This doesn't make it very clear to the user that the problem is with the template they provided.
What did I change ?
I added handling for the KeyError raised by template.format() and converted it into a ValueError with a more helpful message that points out which placeholder is not supported.
Testing
I ran the targeted tests for extract_texts, and all 9 tests passed. I also ran:
mise run test
mise run lint
mise run typecheck
git diff --check
File Changed -> sie/packages/sie_server/src/sie_server/adapters/_utils.py
Summary by CodeRabbit