fix: track backend label separately in JSONL search handler (#14)#25
Conversation
) _h_search used Python to chain FTS5 and substring backends, then inferred the backend label from truthiness. When FTS5 returns empty results, evaluates substring but is truthy, so backend is mislabeled as 'fts5'. Fix: separate FTS5 call, check result, fall through to substring if empty — matching the correct pattern in server.py. Closes vouchdev#14
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR fixes a bug in the JSONL search handler where substring results were incorrectly labeled as FTS5 results. The fix separates the search fallback chain into sequential steps and explicitly tracks which backend was used, aligning the implementation with the correct pattern already used in the MCP server. ChangesSearch backend fallback logic
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
The fix correctly addresses issue #14: the previous or-chained expression mislabeled backend as "fts5" whenever FTS5 returned [] but the substring fallback returned hits. The new control flow matches the pattern already used in src/vouch/server.py, and not hits handles both None and empty-list returns from index_db.search. Optional, non-blocking: consider adding a regression test that asserts backend == "substring" for a query that FTS5 tokenizes away (e.g. "auth" vs a claim containing "authentication"), per the reproducer in issue #14. LGTM! |
fix: track backend label separately in JSONL search handler (#14)
Summary
State asymmetry between MCP and JSONL transports. When FTS5 returns no results and substring fallback returns results, the JSONL server mislabels them as
backend: "fts5"instead ofbackend: "substring".Root cause
_h_searchused Pythonorto chain backends, then inferred the label from truthiness. When FTS5 returns[](falsy),orevaluates the right side,hitsbecomes truthy, and the label becomes"fts5"— wrong.Fix
Separate the FTS5 call, check result, fall through if empty — matching the correct pattern already used in
server.py:82-93.Related Issues
Closes #14
Summary by CodeRabbit