fix(core): surface embedder config errors instead of silent mock fallback (#826)#842
fix(core): surface embedder config errors instead of silent mock fallback (#826)#842jyotirmya17 wants to merge 1 commit into
Conversation
|
✅ Health: 7.6 (unchanged) 📋 At a glance Files & modules (2)
🩹 Review priority (files here with the most recent bug-fix history — defects cluster, so review these first)
🔎 More signals (1)🔥 Hotspots touched (4)
1 more
👀 Suggested reviewers @biggiesmallcap-blip 📊 Full report · ⭐ Star Repowise · 📥 Install bot · Last updated 2026-07-15 05:58 UTC |
|
Thanks for turning this around quickly. The shared helper and typed error are the right shape, and I'm glad you raised rather than clamped. One blocking item, on point 2 from my issue comment. The config error is still swallowed on the search path. So the reported symptom is unchanged; the swallow moved up a level. This is what the MCP gemini mapper still has the original bug. Smaller: the error names the wrong var when value is picked by truthiness but name by presence ( Tests pass (36 green). The body mentions NaN/Inf/zero tests but the four cover Happy to look again once config errors thread through an envelope instead of raising into call sites that catch broad |
|
Thanks for the thorough review, Raghav! That makes complete sense, I completely missed that those upstream call sites had broad exception catchers swallowing the new typed error. I'll refactor this to use the envelope pattern/status object so config errors can safely bubble past those try/except blocks and reach the user. I'll also update the MCP gemini mapper to use the validator, patch up the smaller logic bugs, drop the accidental list_issues.py script, and fill in the missing test coverage. I'll get these changes done as soon as possible and push an update to the branch. |
Hi @RaghavChamadiya — thanks for the detailed breakdown on #826, it made the fix straightforward to scope correctly. This follows the architecture you suggested to resolve the conflation issue without falling back to clamping.
Summary
parse_numeric_env()and a typedEmbedderConfigErrorincore/providers/embedding/base.py. Strictly validates numeric inputs (rejectsNaN,Inf, and values<= 0), shared across bothdimensionsandtimeout.build_embedder()now raisesEmbedderConfigErrorexplicitly instead of silently falling back toMockEmbedder. This is intentional — a bad config should crash the CLI, not degrade quietly._server.py's existing broadtry...except Exceptionaround embedder instantiation already catches this, soEmbedderConfigErrorbubbles into the degradation envelope naturally —_embedder_status["reason"]now reports the exact config error instead of a generic failure._embedder_kwargs()andOllamaEmbedder.__init__()now go through the shared validator, so validation logic isn't duplicated or drifting between the two.Scope note: No changes to public constructor signatures — only internal validation logic. Existing valid configs are unaffected; only invalid ones (previously silently mocked) now fail loudly.
Related Issues
Resolves #826
Test Plan
pytestpasses — added 4 unit tests coveringEmbedderConfigErroronNaN,Inf, zero, and negative inputs for bothdimensionsandtimeoutruff check .passesChecklist