Conversation
- Simplified validation logic in embeddings backend - Extracted nested functions to class methods in indexer service - Split complex methods for better readability (MMR, parallel search) - Added early returns in BM25 search for clearer control flow - Improved testability and maintainability across retrieval components Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Restored the warning message that logs non-200 status codes during API validation. This debugging information is valuable for troubleshooting API connection issues. Addresses Greptile review feedback. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
hrayleung
commented
Jan 18, 2026
hrayleung
left a comment
Owner
Author
There was a problem hiding this comment.
restore API validation warning log
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
Code simplification and refactoring to improve maintainability and readability across multiple components.
Changes Made
src/embeddings/backend.py): Simplified_validate_api()by removing redundant conditional logicsrc/indexer/service.py): Extracted nested functions to class methods for better testabilitysrc/retrieval/service.py): Split MMR candidate selection logic into separate method to reduce nestingsrc/retrieval/bm25_search.py): Added early returns for clearer control flowsrc/retrieval/hybrid.py): Extracted future handling logic to improve parallel execution readabilityKey Improvements
Test Plan
🤖 Generated with Claude Code
Greptile Summary
Refactored code across embeddings, indexing, and retrieval services to reduce complexity through systematic extraction of nested logic into dedicated methods and simplification of control flow.
Key Changes:
_validate_api()for clearer early-return pattern_get_repo_safe()and_check_files_modified()from inline lambdas/nested loops to testable class methods_await_search_result()from inline future handling to improve parallel execution readability_select_best_candidate()from nested MMR loop to reduce indentation depthImpact:
All changes are structural refactorings with no behavioral modifications. The changes improve testability (extracted methods can be unit tested), readability (reduced nesting), and maintainability (clearer separation of concerns).
Confidence Score: 5/5
Important Files Changed
Sequence Diagram
sequenceDiagram participant User participant SearchService participant HybridSearch participant VectorSearch participant BM25Search participant SymbolSearch participant IndexerService User->>SearchService: search(repo_name, query) SearchService->>HybridSearch: hybrid_search(repo_name, query) par Parallel Search Execution HybridSearch->>VectorSearch: vector_search() HybridSearch->>BM25Search: bm25_search() Note over BM25Search: _search_pg_search() or<br/>_search_native_fts()<br/>(with early returns) HybridSearch->>SymbolSearch: symbol_hybrid_search() end VectorSearch-->>HybridSearch: vector results BM25Search-->>HybridSearch: bm25 results SymbolSearch-->>HybridSearch: symbol results HybridSearch->>HybridSearch: _await_search_result()<br/>(extracted method) HybridSearch->>HybridSearch: reciprocal_rank_fusion() HybridSearch-->>SearchService: fused results SearchService->>SearchService: _mmr_diversify() SearchService->>SearchService: _select_best_candidate()<br/>(extracted method) SearchService-->>User: CodeSnippet results Note over User,IndexerService: Indexing Flow (Background) User->>IndexerService: ensure_indexed(path) IndexerService->>IndexerService: resolve_repo_name() IndexerService->>IndexerService: _get_repo_safe()<br/>(extracted method) IndexerService->>IndexerService: _has_files_changed() IndexerService->>IndexerService: _check_files_modified()<br/>(extracted method) IndexerService-->>User: IndexResult