| 460 | |
| 461 | #[tokio::test] |
| 462 | async fn test_agent_memory_prune_delegates() { |
| 463 | use a3s_memory::PrunePolicy; |
| 464 | |
| 465 | let store = Arc::new(InMemoryStore::new()); |
| 466 | let memory = AgentMemory::new(store.clone()); |
| 467 | |
| 468 | // Insert one old low-importance item directly into the store. |
| 469 | let mut old_item = a3s_memory::MemoryItem::new("stale").with_importance(0.2); |
| 470 | old_item.timestamp = chrono::Utc::now() - chrono::Duration::days(100); |
| 471 | store.store(old_item).await.unwrap(); |
| 472 | |
| 473 | assert_eq!(store.count().await.unwrap(), 1); |
| 474 | |
| 475 | // Calling prune on the underlying store via the public accessor works. |
| 476 | let policy = PrunePolicy { |
| 477 | max_age_days: 90, |
| 478 | min_importance_to_keep: 0.5, |
| 479 | max_items: 0, |
| 480 | }; |
| 481 | let deleted = memory.store().prune(&policy).await.unwrap(); |
| 482 | assert_eq!(deleted, 1); |
| 483 | assert_eq!(store.count().await.unwrap(), 0); |
| 484 | } |
| 485 | |
| 486 | #[test] |
| 487 | fn test_agent_memory_score_uses_config() { |