Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/memoryos-adapters/src/wiki/confluence_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ impl ConfluenceExportBackend {
html.push_str(&format!("<h3>{}</h3>\n", h3));
} else if line == "---" {
html.push_str("<hr/>\n");
} else if line.starts_with("- ") {
html.push_str(&format!("<li>{}</li>\n", &line[2..]));
} else if let Some(item) = line.strip_prefix("- ") {
html.push_str(&format!("<li>{}</li>\n", item));
} else if line.starts_with("**") && line.ends_with("**") {
html.push_str(&format!(
"<p><strong>{}</strong></p>\n",
Expand Down
20 changes: 8 additions & 12 deletions crates/memoryos-core/src/security/gdpr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ use serde::{Deserialize, Serialize};
use std::path::PathBuf;
use tracing::info;

/// Type alias for GDPR snapshot data (consents map + deletion requests)
pub type GdprSnapshotData = (
std::collections::HashMap<String, Vec<ConsentRecord>>,
Vec<DeletionRequest>,
);

pub trait GdprStorageBackend: Send + Sync {
fn save_snapshot(
&self,
consents: &std::collections::HashMap<String, Vec<ConsentRecord>>,
deletion_requests: &[DeletionRequest],
);
fn load_snapshot(
&self,
) -> Option<(
std::collections::HashMap<String, Vec<ConsentRecord>>,
Vec<DeletionRequest>,
)>;
fn load_snapshot(&self) -> Option<GdprSnapshotData>;
}

pub struct FileGdprBackend {
Expand Down Expand Up @@ -48,12 +49,7 @@ impl GdprStorageBackend for FileGdprBackend {
}
}

fn load_snapshot(
&self,
) -> Option<(
std::collections::HashMap<String, Vec<ConsentRecord>>,
Vec<DeletionRequest>,
)> {
fn load_snapshot(&self) -> Option<GdprSnapshotData> {
if self.path.exists() {
std::fs::read_to_string(&self.path)
.ok()
Expand Down
1 change: 1 addition & 0 deletions crates/memoryos-gateway/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ rand = "0.8"
default = ["s3"]
s3 = ["memoryos-wiki-gen/s3"]
integration-tests = []
memory-route-tests-disabled = []

[dev-dependencies]
tower.workspace = true
Expand Down
3 changes: 2 additions & 1 deletion crates/memoryos-wiki-gen/src/endpoint/fastapi_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,6 @@ impl FastApiExtractor {
}

fn normalize_path(path: &str) -> String {
path.replace("{", "{").replace("}", "}")
// FastAPI uses {param} natively — no transformation needed
path.to_string()
}
3 changes: 2 additions & 1 deletion crates/memoryos-wiki-gen/src/endpoint/spring_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,5 +192,6 @@ fn combine_paths(class_path: &str, method_path: &str) -> String {
}

fn normalize_path(path: &str) -> String {
path.replace("{", "{").replace("}", "}")
// Spring uses {param} natively — no transformation needed
path.to_string()
}
4 changes: 3 additions & 1 deletion crates/memoryos-wiki-gen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ pub mod llm_adapter;
pub mod llm_gen;
pub mod manifest;
pub mod page_builder;
// Tree-sitter visitor functions require multiple context parameters for recursive AST traversal
#[allow(clippy::too_many_arguments)]
pub mod parser;
pub mod storage;
pub mod wiki_index;
Expand Down Expand Up @@ -148,7 +150,7 @@ impl WikiGenerator {
ProgressStyle::with_template(
"{spinner:.green} [{elapsed_precise}] [{bar:40.cyan/blue}] {pos}/{len} {msg}",
)
.unwrap()
.expect("BUG: invalid progress bar template")
.progress_chars("#>-"),
);

Expand Down
90 changes: 44 additions & 46 deletions crates/memoryos-wiki-gen/src/storage/tests.rs
Original file line number Diff line number Diff line change
@@ -1,47 +1,45 @@
#[cfg(test)]
mod tests {
use super::super::{GitConnector, LocalConnector, StorageConnector};
use tempfile::TempDir;

#[tokio::test]
async fn test_local_connector() {
let temp_dir = TempDir::new().unwrap();
let test_file = temp_dir.path().join("test.txt");
tokio::fs::write(&test_file, b"hello world").await.unwrap();

let mut connector = LocalConnector::new(temp_dir.path().to_path_buf());
connector.connect().await.unwrap();

// Test exists
assert!(connector.exists("test.txt").await.unwrap());
assert!(!connector.exists("nonexistent.txt").await.unwrap());

// Test read
let content = connector.read_file("test.txt").await.unwrap();
assert_eq!(content, b"hello world");

// Test metadata
let meta = connector.metadata("test.txt").await.unwrap();
assert_eq!(meta.size, 11);
assert!(!meta.is_dir);
}

#[tokio::test]
#[ignore] // Requires network
async fn test_git_connector_public_repo() {
// Test with a small public repo (no auth needed)
let mut connector =
GitConnector::new("https://github.com/rust-lang/rustlings.git".to_string())
.with_branch("main".to_string());

// This will clone the repo
connector.connect().await.unwrap();

// Test exists
assert!(connector.exists("README.md").await.unwrap());

// Test read
let content = connector.read_file("README.md").await.unwrap();
assert!(!content.is_empty());
}
#![cfg(test)]

use super::{GitConnector, LocalConnector, StorageConnector};
use tempfile::TempDir;

#[tokio::test]
async fn test_local_connector() {
let temp_dir = TempDir::new().unwrap();
let test_file = temp_dir.path().join("test.txt");
tokio::fs::write(&test_file, b"hello world").await.unwrap();

let mut connector = LocalConnector::new(temp_dir.path().to_path_buf());
connector.connect().await.unwrap();

// Test exists
assert!(connector.exists("test.txt").await.unwrap());
assert!(!connector.exists("nonexistent.txt").await.unwrap());

// Test read
let content = connector.read_file("test.txt").await.unwrap();
assert_eq!(content, b"hello world");

// Test metadata
let meta = connector.metadata("test.txt").await.unwrap();
assert_eq!(meta.size, 11);
assert!(!meta.is_dir);
}

#[tokio::test]
#[ignore] // Requires network
async fn test_git_connector_public_repo() {
// Test with a small public repo (no auth needed)
let mut connector = GitConnector::new("https://github.com/rust-lang/rustlings.git".to_string())
.with_branch("main".to_string());

// This will clone the repo
connector.connect().await.unwrap();

// Test exists
assert!(connector.exists("README.md").await.unwrap());

// Test read
let content = connector.read_file("README.md").await.unwrap();
assert!(!content.is_empty());
}