Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

test(store): cover unexpired target requirement in open_feedback_findings

Vinícius DS Andradeb407fa801dba
diff --git a/crates/ai-memory-store/tests/suite/multi_session.rs b/crates/ai-memory-store/tests/suite/multi_session.rs
index 74b7f267..25c7eab5 100644
--- a/crates/ai-memory-store/tests/suite/multi_session.rs
+++ b/crates/ai-memory-store/tests/suite/multi_session.rs
@@ -17,13 +17,13 @@
//! core capability rather than a detail.
use ai_memory_core::{
- ActorContext, AgentKind, HandoffAcceptance, HandoffState, IdentityKey, NewHandoff, NewPage,
- NewSession, NewUser, OwnerFilter, PagePath, ProjectId, SessionId, Tier, UserRole, WorkspaceId,
- owner_stamp,
+ ActorContext, AgentKind, FeedbackKind, HandoffAcceptance, HandoffState, IdentityKey,
+ NewHandoff, NewPage, NewSession, NewUser, OwnerFilter, PagePath, ProjectId, SessionId, Tier,
+ UserRole, WorkspaceId, owner_stamp,
};
use ai_memory_store::{
- ConditionalUpsert, LinkOrAdoptManagedRunSession, ManagedRunSessionLink, PagePrecondition,
- PrepareWorkstreamRun, Store, StoreError, WorkstreamSelection,
+ ConditionalUpsert, DecayParams, LinkOrAdoptManagedRunSession, ManagedRunSessionLink,
+ PagePrecondition, PrepareWorkstreamRun, Store, StoreError, WorkstreamSelection,
};
fn operator(name: &str) -> String {
@@ -4239,3 +4239,53 @@ async fn owned_session_purge_refuses_cross_project_cascades_with_admin_control()
.is_empty()
);
}
+
+/// Open feedback findings ignore feedback attached to expired pages.
+#[tokio::test]
+async fn open_feedback_findings_ignores_expired_pages() {
+ let tmp = tempfile::tempdir().unwrap();
+ let store = Store::open(tmp.path()).unwrap();
+ let (ws, proj) = scope(&store).await;
+
+ let live = page(ws, proj, "notes/live.md", "Live", "active content");
+ store.writer.upsert_page(live).await.unwrap();
+
+ let mut expired = page(ws, proj, "notes/expired.md", "Expired", "expired content");
+ expired.expires_at = Some(jiff::Timestamp::from_second(1).unwrap());
+ store.writer.upsert_page(expired).await.unwrap();
+
+ store
+ .writer
+ .record_page_feedback(
+ ws,
+ proj,
+ PagePath::new("notes/live.md").unwrap(),
+ FeedbackKind::Stale,
+ Some("live page is stale".to_string()),
+ None,
+ DecayParams::default(),
+ )
+ .await
+ .unwrap();
+
+ store
+ .writer
+ .record_page_feedback(
+ ws,
+ proj,
+ PagePath::new("notes/expired.md").unwrap(),
+ FeedbackKind::Wrong,
+ Some("expired page was wrong".to_string()),
+ None,
+ DecayParams::default(),
+ )
+ .await
+ .unwrap();
+
+ let findings = store.reader.open_feedback_findings(ws, proj).await.unwrap();
+ assert_eq!(findings.len(), 1);
+ assert_eq!(findings[0].path, "notes/live.md");
+ assert_eq!(findings[0].kind, "stale");
+ assert_eq!(findings[0].reason.as_deref(), Some("live page is stale"));
+}
+