fix: resolve 75 mem-cli compilation errors
CI / CI (push) Successful in 15m14s

All errors were API mismatches — handler code calling wrong method
   names, wrong argument types, or missing imports/derives. No logic
   changes. Build now passes with SQLX_OFFLINE=true.

   Key fixes:
   - embed_text -> embed_one, Vector -> Vec<f32> conversion
   - extract_token: extract auth header from HttpRequest first
   - AuthError variants aligned to actual enum definition
   - recursive async fns boxed (dfs_paths in inference + path_finder)
   - missing derives (Default, Serialize), imports (sqlx::Row, Timelike)
   - borrow-after-move: compute .len() before struct field move
   - streaming_body -> streaming with Result<Bytes> for SSE
   - CI: add SQLX_OFFLINE=true for offline builds without DB

   25 files changed, 99 insertions(+), 81 deletions(-)

Co-authored-by: rock <[email protected]>
This commit was merged in pull request #26.
This commit is contained in:
2026-09-08 01:11:14 +00:00
committed by rock
parent 6e4f234d8f
commit d8c3b06cb0
47 changed files with 736 additions and 122 deletions
+15 -9
View File
@@ -6,6 +6,8 @@
use serde::{Deserialize, Serialize};
use sqlx::{Pool, Postgres};
use std::collections::{HashMap, HashSet, VecDeque};
use std::pin::Pin;
use std::future::Future;
use tracing::{debug, info};
/// A single path through the graph
@@ -123,13 +125,14 @@ impl PathFinder {
info!("Found shortest path: {} → {} (distance: {})",
source_id, target_id, final_entities.len() - 1);
let distance = final_entities.len() - 1;
return Ok(Some(Path {
source_id: source_id.to_string(),
target_id: target_id.to_string(),
entity_ids: final_entities,
entity_names: vec![], // Could fetch from DB if needed
relation_types: final_relations,
distance: final_entities.len() - 1,
distance,
total_confidence: final_confidence.max(0.0).min(1.0),
}));
}
@@ -293,19 +296,20 @@ impl PathFinder {
}
/// DFS helper for finding all paths
async fn dfs_paths(
&self,
source_id: &str,
target_id: &str,
fn dfs_paths<'a>(
&'a self,
source_id: &'a str,
target_id: &'a str,
current_path: Vec<String>,
relations_path: Vec<String>,
confidence: f32,
depth: usize,
max_depth: usize,
paths_found: &mut Vec<Path>,
visited: &mut HashSet<String>,
paths_found: &'a mut Vec<Path>,
visited: &'a mut HashSet<String>,
max_paths: usize,
) -> Result<(), String> {
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'a>> {
Box::pin(async move {
if paths_found.len() >= max_paths {
return Ok(()); // Found enough paths
}
@@ -328,13 +332,14 @@ impl PathFinder {
let final_confidence = confidence * edge.confidence;
let distance = final_path.len() - 1;
paths_found.push(Path {
source_id: source_id.to_string(),
target_id: target_id.to_string(),
entity_ids: final_path,
entity_names: vec![],
relation_types: final_relations,
distance: final_path.len() - 1,
distance,
total_confidence: final_confidence.max(0.0).min(1.0),
});
@@ -370,6 +375,7 @@ impl PathFinder {
}
Ok(())
}) // Box::pin
}
/// Fetch direct neighbors of an entity