Skip to content

Latest commit

 

History

History
76 lines (56 loc) · 2.81 KB

File metadata and controls

76 lines (56 loc) · 2.81 KB

🤖 Bugbot Review Summary

Status:APPROVED with observations

Key Findings

Retrieval Correctness

  • Exact chunk-id bypass correctly short-circuits for hyphenated identifiers
  • Trigram FTS index properly created with sync triggers and backfill detection
  • Lexical defense + KG alias expansion safely builds OR queries with deduplication
  • decay_score preservation on FTS-only hits verified

Write Safety

  • All DDL migrations use IF NOT EXISTS / DROP IF EXISTS patterns
  • Readonly path gracefully degrades when trigram index unavailable
  • Backfill gating prevents duplicate work
  • No data loss risk (additive changes only)

MCP Stability

  • No tool contract changes
  • Structured output format preserved
  • Error handling degrades gracefully

Test Coverage ✅

  • 4 new test files (190 LOC)
  • Existing hybrid search contract unchanged
  • All 9 listed tests verified per PR description

Performance Observations

Storage Growth 📊

  • Before: 4.0GB → After: 5.8GB (+1.8GB, +46%)
  • Expected and acceptable for trigram index

Query Latency ⚠️

  • Chunk-id bypass reduces latency for direct ID queries
  • Trigram FTS adds second query to hybrid_search() (mitigated by LIMIT)
  • Alias expansion adds 2 KG SELECTs per query (acceptable overhead)

Edge Cases Noted

  1. Chunk-ID regex false positives (e.g., brain-layer) — falls through to normal search ✅
  2. OR expansion length — limited by curated dictionary (31 entries, max 4 aliases) ✅
  3. Trigram write amplification — existing WAL + batching absorb cost ✅
  4. Readonly DB trigram detection_init_readonly_db() checks sqlite_master correctly ✅

Recommendations

Pre-Merge

  • ✅ Test suite verified passing
  • ✅ Storage delta documented
  • 💡 Optional: Add EXPLAIN QUERY PLAN logging for alias-expanded queries

Post-Merge Observability

  • 📊 Track fts_query_override usage frequency
  • 📊 Track trigram FTS hit rate
  • 📊 Monitor enrichment queue depth
  • 📊 Alert on FTS5 desync for trigram table

Production Migration

  • 📝 Document trigram storage overhead (~50% expected)
  • 📝 Recommend WAL checkpoint before migration
  • 🔧 Consider parallel index build for large DBs (300K+ chunks)

Behavioral Receipts Verified ✅

  • brain_search("brainbar-ddf12232"): 0 → 1 hit via exact bypass
  • brain_search("alker-go"): 0 → 1 hit via trigram FTS
  • brain_search("Hershkovitz"): 0 → 1 hit via lexical defense
  • brain_search("stalkerGolem"): 0 → 1 hit via KG alias expansion

Full review: BUGBOT_REVIEW_FTS_RECALL.md

Verdict: This PR delivers high-value recall improvements with acceptable storage cost and minimal regression risk. The three-layer approach directly addresses documented user pain points. Approve with confidence. 🚀