Skip to content

fix: validate unsupported template placeholders - #249

Open
RoopakBRK wants to merge 1 commit into
superlinked:mainfrom
RoopakBRK:fix/template-placeholder-validation
Open

fix: validate unsupported template placeholders#249
RoopakBRK wants to merge 1 commit into
superlinked:mainfrom
RoopakBRK:fix/template-placeholder-validation

Conversation

@RoopakBRK

@RoopakBRK RoopakBRK commented Sep 2, 2026

Copy link
Copy Markdown

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

  • Bug Fixes
    • Improved error handling when a template contains an unsupported placeholder.
    • Error messages now identify the problematic placeholder and retain the original error details for troubleshooting.

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: cdd2dd40-0356-4373-9580-f825392a2316

📥 Commits

Reviewing files that changed from the base of the PR and between 9a7e8d3 and 3bc0870.

📒 Files selected for processing (1)
  • packages/sie_server/src/sie_server/adapters/_utils.py

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The template text extraction path now reports unsupported placeholders with a descriptive ValueError and preserves the original KeyError.

Changes

Template error handling

Layer / File(s) Summary
Unsupported placeholder reporting
packages/sie_server/src/sie_server/adapters/_utils.py
extract_texts converts missing template placeholders into a descriptive ValueError and chains the original KeyError.

Merge Risk: ⚪ Minimal · up to 3bc08

This change converts unsupported template placeholders into clearer validation errors. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: validating unsupported template placeholders.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

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.

1 participant