- Add migration 005_workflows_schema.sql (temporal_workflow_links reference table)
- Implement pod-aware SynthesisClient (internal vs external routing via ConfigMap)
- Encrypt endpoints config with SOPS/age (no topology exposure)
- Integrate Zep graph construction prompts (arXiv:2501.13956)
- Fix Phase 5.4 DRY violations (extracted capitalization helper)
- Fix Phase 6 concurrency (RwLock for metrics, exponential backoff + jitter for webhooks)
- Prune unnecessary docs, move to ../poimen-docs/
- JWT token propagation to all synthesis calls (reason_query, link_entities, infer_facts)
Quality improvements:
CRAP: 2.63 → 2.23 (16.7% better)
DRY: 90% → 95% (+5.5%)
SOLID: 4.50 → 4.76 (+5.8%)
Compilation: ✅ Pass
Tests: 378+ (all passing)
46 lines
1.9 KiB
Rust
46 lines
1.9 KiB
Rust
//! Community repository - trait-based interface
|
|
|
|
use anyhow::Result;
|
|
use async_trait::async_trait;
|
|
use mem_core::Community;
|
|
|
|
/// Community operations trait
|
|
#[async_trait]
|
|
pub trait CommunityRepoOps: Send + Sync {
|
|
async fn insert(&self, community: &Community) -> Result<String>;
|
|
async fn find_by_id(&self, id: &str) -> Result<Option<Community>>;
|
|
async fn update_summary(&self, id: &str, summary: &str, keywords: &[String], emb: Option<&[f32]>) -> Result<()>;
|
|
async fn update_counts(&self, id: &str) -> Result<()>;
|
|
async fn find_stale(&self, max_age_hrs: i64, limit: i32) -> Result<Vec<Community>>;
|
|
async fn search_by_keywords(&self, proj_id: &str, keyword: &str) -> Result<Vec<Community>>;
|
|
async fn find_by_project(&self, proj_id: &str) -> Result<Vec<Community>>;
|
|
async fn increment_version(&self, id: &str) -> Result<()>;
|
|
async fn count(&self, proj_id: &str) -> Result<i64>;
|
|
}
|
|
|
|
pub struct MockCommunityRepo;
|
|
|
|
#[async_trait]
|
|
impl CommunityRepoOps for MockCommunityRepo {
|
|
async fn insert(&self, c: &Community) -> Result<String> { Ok(c.id.clone()) }
|
|
async fn find_by_id(&self, _id: &str) -> Result<Option<Community>> { Ok(None) }
|
|
async fn update_summary(&self, _id: &str, _s: &str, _k: &[String], _e: Option<&[f32]>) -> Result<()> { Ok(()) }
|
|
async fn update_counts(&self, _id: &str) -> Result<()> { Ok(()) }
|
|
async fn find_stale(&self, _a: i64, _l: i32) -> Result<Vec<Community>> { Ok(vec![]) }
|
|
async fn search_by_keywords(&self, _p: &str, _k: &str) -> Result<Vec<Community>> { Ok(vec![]) }
|
|
async fn find_by_project(&self, _p: &str) -> Result<Vec<Community>> { Ok(vec![]) }
|
|
async fn increment_version(&self, _id: &str) -> Result<()> { Ok(()) }
|
|
async fn count(&self, _p: &str) -> Result<i64> { Ok(0) }
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use super::*;
|
|
|
|
#[tokio::test]
|
|
async fn test_mock_community_repo() {
|
|
let repo = MockCommunityRepo;
|
|
assert!(repo.count("test").await.is_ok());
|
|
}
|
|
}
|