fix: critical bug fixes for indexing, chunking, and search stability - #63
Merged
Conversation
## High Priority Fixes - **Model propagation**: Fixed index_single_file to pass resolved model name to chunk_text_with_model, ensuring chunking respects embedder token limits instead of defaulting to 8k ceiling - **UTF-8 safe striding**: Converted stride_large_chunk to use character-based calculations and safe byte position mapping, eliminating runtime panics on multi-byte character boundaries - **CRLF line handling**: Enhanced generic chunker to properly account for different line ending lengths (CRLF=2, LF=1, CR=1) in byte offset calculations, fixing spans for Windows files - **Deterministic reranking**: Fixed reranking to use document matching with duplicate handling instead of positional enumeration, ensuring correct score assignment when reranker reorders results - **Haskell type synonym**: Corrected tree-sitter filter typo from "type_synomym" to "type_synonym" to properly tag Haskell type declarations ## Technical Improvements - Added model_name() method to Embedder trait for proper model propagation - Enhanced FastEmbedder and DummyEmbedder to store and expose model names - Fixed non-fastembed build compilation by correctly passing model parameter - Updated test embedders to implement new model_name() method - Ensured byte spans align with original file structure using line_byte_offsets ## Quality Assurance - ✅ All 130+ tests passing across all crates - ✅ No clippy warnings - ✅ Code properly formatted - ✅ Maintains full backward compatibility These fixes address fundamental stability and correctness issues in text processing, indexing, and search functionality. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
runonthespot
force-pushed
the
fix/critical-bug-suite
branch
from
September 22, 2025 19:32
bf02f9d to
166f13a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses 5 critical and high-priority bugs that affect core stability and correctness across indexing, chunking, and search functionality.
High Priority Bug Fixes
🔧 Model Propagation (
ck-index/src/lib.rs:1072)index_single_filealways calledck_chunk::chunk_textwithout the resolved model name, causing striding to use default 8k token ceiling instead of model-specific limits (e.g., bge-small's 512-token window)model_name()method toEmbeddertrait and updatedindex_single_file_with_progressto usechunk_text_with_modelwith the embedder's model name🔧 UTF-8 Safe Striding (
ck-chunk/src/lib.rs:476-509)stride_large_chunkused floating-point estimates to slice UTF-8 strings directly, causing runtime panics on multi-byte character boundarieschar_indices()and safe byte position mapping🔧 CRLF Line Offset Correction (
ck-chunk/src/lib.rs:216-249)\rcharacters🔧 Deterministic Reranking (
ck-engine/src/semantic_v3.rs:217-236)🔧 Haskell Type Synonym Fix (
ck-chunk/src/lib.rs:331-338)type_synomyminstead oftype_synonymtype_synonymTechnical Improvements
Embeddertrait withmodel_name()method for proper model propagationFastEmbedderandDummyEmbedderto store and expose model namesmodel_name()methodTesting & Quality Assurance
Impact
These fixes address fundamental stability and correctness issues that could cause:
The changes ensure robust text processing across different file formats, character encodings, and embedding models.
🤖 Generated with Claude Code