Repository navigation
fix: prevent BM25 query token ID overflow - #769
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthrough
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~3 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The wider query indices accommodate the reported overflow boundary without changing computed token IDs. No merge-blocking issue was found. Security Architecture ReviewSecurity architecture risk: ⚪ Minimal · up to The change fixes a boundary-token failure while preserving existing token IDs. The shared sparse-vector interface already accepts int64 indices, and the reviewed paths introduce no new privileges, persistent state, or trust-boundary crossings. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
is that a real-real token |
|
It's an alphanumeric boundary-case test input. I selected it for |
The real token
ad1u66pihasmmh3.hash(token) == -2147483648. Taking its absolute value yields ID 2147483648, which the existing int32 query index array cannot store. Under NumPy 2.3.5 a nonempty query raises OverflowError, while the document embedding accepts the ID.This widens query indices to int64 and preserves the hash function and existing IDs. Tests exercise the actual mmh3 boundary token, matching document/query IDs, normalization, repeated and ordinary tokens, string/list/generator input, and empty queries. They use a local model path with stemming disabled and require no model download. Collision weighting is unchanged.
Validation on Windows 11, Python 3.13.5, NumPy 2.3.5, FastEmbed 0.8.1:
python -m pytest -q tests/test_bm25_query_index_overflow.py.The full model/OS/Python CI matrix was not run locally.
Split from #766 following the maintainer's request for one PR per problem. This branch is based directly on current main and contains only this problem's production change and regression module.