-
Notifications
You must be signed in to change notification settings - Fork 0
feat: performance optimizations, schematic API, and branching setup #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
182c28f
feat: performance optimizations, schematic API, and branching setup
mbaneshi 72dd7bd
docs: add git workflow rules and performance patterns to CLAUDE.md
mbaneshi 71b0dba
feat: unified schematic explorer with full interaction system
mbaneshi f237ca4
feat: add legend panel, drop-shadow on hover, improved node borders
mbaneshi 43c68e1
fix: polish schematic - root label, tooltip hints, narrative fallback
mbaneshi ad3a1e8
fix: community-filtered symbols/edges, source tab loading, root label
mbaneshi 0e1ef9e
feat: E2E tests for schematic (31 tests, all green) + source code fix
mbaneshi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,8 +17,6 @@ use tracing::info; | |
|
|
||
| use crate::state::AppState; | ||
|
|
||
| type SymbolRow = (String, String, String, i64, i64, Option<String>); | ||
|
|
||
| #[derive(Deserialize)] | ||
| struct AskRequest { | ||
| question: String, | ||
|
|
@@ -72,24 +70,35 @@ async fn ask_stream( | |
| }).into_response(); | ||
| } | ||
|
|
||
| // Build context from selected symbols | ||
| // Build context from selected symbols (batch query) | ||
| let mut context_parts = Vec::new(); | ||
| if !body.context_symbol_ids.is_empty() { | ||
| let conn = state.db.connection(); | ||
| for sid in &body.context_symbol_ids { | ||
| let result: Result<SymbolRow, _> = conn.query_row( | ||
| "SELECT s.name, s.kind, f.path, s.start_line, s.end_line, s.signature | ||
| FROM symbols s JOIN files f ON s.file_id = f.id WHERE s.id = ?1", | ||
| [sid], | ||
| |row| Ok((row.get(0)?, row.get(1)?, row.get(2)?, row.get(3)?, row.get(4)?, row.get(5)?)), | ||
| ); | ||
| if let Ok((name, kind, path, start, end, sig)) = result { | ||
| context_parts.push(format!( | ||
| "- {} `{}` in `{}` (lines {}-{}){}", | ||
| kind, name, path, start, end, | ||
| sig.map(|s| format!("\n Signature: {}", s)).unwrap_or_default() | ||
| )); | ||
| } | ||
| let placeholders: Vec<String> = body.context_symbol_ids.iter().enumerate().map(|(i, _)| format!("?{}", i + 1)).collect(); | ||
| let sql = format!( | ||
| "SELECT s.name, s.kind, f.path, s.start_line, s.end_line, s.signature \ | ||
| FROM symbols s JOIN files f ON s.file_id = f.id \ | ||
| WHERE s.id IN ({})", | ||
| placeholders.join(", ") | ||
| ); | ||
| let mut stmt = conn.prepare(&sql).unwrap(); | ||
| let params: Vec<&dyn rusqlite::types::ToSql> = body.context_symbol_ids.iter().map(|id| id as &dyn rusqlite::types::ToSql).collect(); | ||
| let rows = stmt.query_map(params.as_slice(), |row| { | ||
| Ok(( | ||
| row.get::<_, String>(0)?, | ||
| row.get::<_, String>(1)?, | ||
| row.get::<_, String>(2)?, | ||
| row.get::<_, i64>(3)?, | ||
| row.get::<_, i64>(4)?, | ||
| row.get::<_, Option<String>>(5)?, | ||
| )) | ||
| }).unwrap(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the let rows = stmt.query_map(params.as_slice(), |row| {
Ok((
row.get::<_, String>(0)?,
row.get::<_, String>(1)?,
row.get::<_, String>(2)?,
row.get::<_, i64>(3)?,
row.get::<_, i64>(4)?,
row.get::<_, Option<String>>(5)?,
))
}).map_err(|e| ApiError::from(codeilus_core::error::CodeilusError::Database(Box::new(e))))?; |
||
| for (name, kind, path, start, end, sig) in rows.flatten() { | ||
| context_parts.push(format!( | ||
| "- {} `{}` in `{}` (lines {}-{}){}", | ||
| kind, name, path, start, end, | ||
| sig.map(|s| format!("\n Signature: {}", s)).unwrap_or_default() | ||
| )); | ||
| } | ||
| } | ||
|
|
||
|
|
||
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
.unwrap()forconn.preparecan lead to a panic if the SQL statement is malformed or there's a database issue. It's generally safer to handle theResultexplicitly, perhaps by mapping it to anApiError.