fix(growth,memory,hands): 穷尽审计后 4 项修复 — 伪造时间戳+测试覆盖+注释纠正
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled

CRITICAL:
- user_profile_store: find_active_pains_since 改为 find_active_pains,
  移除无意义 .filter(|_| true),不再伪造 created_at=since

HIGH:
- daily_report: 移除虚假的 "Emits Tauri event" 注释(事件发射是调用方职责)
- daily_report: chrono::Local → chrono::Utc 一致性修复
- 新增 8 个单元测试: PainPoint 系列测试 + find_since + get_events_since

验证: zclaw-memory 54 PASS, zclaw-growth 151 PASS, zclaw-hands 5 PASS
This commit is contained in:
iven
2026-04-21 18:45:10 +08:00
parent 13507682f7
commit b726d0cd5e
4 changed files with 121 additions and 12 deletions

View File

@@ -457,4 +457,26 @@ mod tests {
// Content should reflect the latest version.
assert_eq!(found[0].context, "context v3");
}
#[tokio::test]
async fn test_find_since_filters_by_date() {
let viking = Arc::new(VikingAdapter::in_memory());
let store = ExperienceStore::new(viking);
let exp = Experience::new(
"agent-1", "recent pattern", "ctx",
vec!["step".into()], "ok",
);
store.store_experience(&exp).await.unwrap();
// Query with since=far past → should find it
let old_since = Utc::now() - chrono::Duration::days(365);
let found = store.find_since("agent-1", old_since).await.unwrap();
assert_eq!(found.len(), 1);
// Query with since=far future → should not find it
let future_since = Utc::now() + chrono::Duration::days(365);
let found = store.find_since("agent-1", future_since).await.unwrap();
assert!(found.is_empty());
}
}