feat(SEM-53): Implement layered query resolution with deduplication#8
Merged
feat(SEM-53): Implement layered query resolution with deduplication#8
Conversation
Adds search and file symbol resolution across layer stack with proper precedence (AI > Working > Branch > Base). Higher layers shadow lower layers, and deleted markers stop search. New types: - LayeredSearchOptions: Builder-pattern search configuration - LayeredSearchResult: Search result with layer info New methods on LayeredIndex: - search_symbols(query, opts): Search across all layers - get_file_symbols(path): Get symbols for a file with move resolution - resolve_symbol_with_layer(hash): Resolve symbol with layer info - total_active_symbols(): Count unique active symbols Features: - Layer precedence with deduplication - Deleted marker handling - File move resolution through layer chain - Case-insensitive search (default) - Filters: kind, risk, limit, layers Includes 31 new tests (6 TDD required + 25 comprehensive). Also fixes singular/plural grammar in UpdateStrategy::description().
SEM-53 Layered Query Resolution
OverviewImplement query resolution across layer stack. Resolution Algorithmfn get_symbol(hash: &str, layers: &[Layer]) -> Option<Symbol> {
for layer in [AI, Working, Branch, Base] {
if layer.deleted.contains(hash) {
return None; // Explicitly deleted
}
if let Some(s) = layer.symbols.get(hash) {
return Some(s); // Found in overlay
}
}
None // Not found anywhere
}Check layers top-down (AI → Working → Branch → Base). TDD Requirements#[test] fn test_ai_layer_shadows_base() { }
#[test] fn test_deleted_marker_stops_search() { }
#[test] fn test_file_move_resolves_path() { }
#[test] fn test_search_merges_all_layers() { }
#[test] fn test_deduplication_across_layers() { }
#[test] fn test_layer_ordering_correct() { }Deliverables
Acceptance Criteria
|
There was a problem hiding this comment.
Pull request overview
This pull request implements layered query resolution for the LayeredIndex with proper layer precedence (AI > Working > Branch > Base), enabling efficient symbol search and retrieval across the layer stack with deduplication.
Key Changes
- Adds
LayeredSearchOptionsbuilder for configuring symbol searches with filters (kind, risk, limit, layers) and case sensitivity - Implements
search_symbols()method that merges and deduplicates results across all layers, respecting deletion markers - Adds
get_file_symbols()with file move resolution through the layer chain - Includes comprehensive test coverage (31 new tests) covering TDD requirements and edge cases
- Fixes grammar bug in
UpdateStrategy::description()(singular vs plural "file"/"files")
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/overlay.rs | Implements core layered query resolution with LayeredSearchOptions, LayeredSearchResult, and search methods (search_symbols, get_file_symbols, resolve_symbol_with_layer, total_active_symbols). Includes 31 comprehensive tests. |
| src/lib.rs | Re-exports new public types LayeredSearchOptions and LayeredSearchResult |
| src/drift.rs | Fixes test for UpdateStrategy::description() to properly verify singular/plural grammar |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Fix doc comments: "fn" → "function" to match SymbolKind::as_str() - Remove unused `module` field from LayeredSearchOptions - Remove dead `with_module()` method (was silently ignored) - Remove obsolete comment about module filtering The module filter was defined but never implemented in search_symbols(). Module filtering belongs at the cache/shard level, not LayeredIndex.
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
Test plan
Closes SEM-53
-- Details
Adds search and file symbol resolution across layer stack with proper precedence (AI > Working > Branch > Base). Higher layers shadow lower layers, and deleted markers stop search.
New types:
New methods on LayeredIndex:
Features:
Includes 31 new tests (6 TDD required + 25 comprehensive). Also fixes singular/plural grammar in UpdateStrategy::description().