fix(test): mock runCaptureEx so the probe-times-out test is deterministic - #3624
Conversation
…r output The unit test at src/lib/inference/local.test.ts:618 expected the legacy 'did not answer the local probe in time' error message, but the validator now returns 'failed the local probe: model X not found' for empty probe output. Test/source drift, broken on main, blocking pre-commit Test (CLI) locally for anyone whose local hits this assertion. One-line fix: update the regex to match the current message shape. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe test for validateOllamaModel now injects a mocked ChangesOllama model validation test assertion
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Comment |
E2E Advisor RecommendationRequired E2E: None Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
|
…stic The probe inside validateOllamaModel uses runCaptureEx (4th positional arg), not runCapture (2nd). The test was only mocking runCapture, so the real probe ran against the host: on CI (no ollama installed) it returned empty stdout and the test passed; on hosts with ollama it returned a JSON error and the test failed. Mock runCaptureEx with an empty-stdout result so the empty-output branch is exercised intentionally regardless of host state. The assertion stays at the original 'did not answer the local probe in time' message that branch emits. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>
Summary
The test
fails ollama model validation when the probe times out or returns nothingwas environment-dependent — passed on CI (no ollama installed) but failed on hosts with ollama installed.Root cause
validateOllamaModeltakes 4 args:(model, runCapture, isSpark, runCaptureEx). The probe inside usesrunCaptureEx(4th), notrunCapture(2nd). The test was only mockingrunCapture, so the realrunCaptureExran against the host:did not answer the local probe in timemessage → regex matched, test passed.{"error":"model 'X' not found"}→ JSON branch →failed the local probe: …message → regex didn't match, test failed.Other tests in the same file (lines 623, 631, 637 etc.) correctly mock
runCaptureEx. This one missed it.Fix
Mock
runCaptureExwith an empty-stdout result so the empty-output branch is exercised intentionally regardless of host state. Original assertion stays — that branch still emitsdid not answer the local probe in time.🤖 Generated with Claude Code
Summary by CodeRabbit
Note: This update contains no user-facing changes.