fix(growth): Evolution Engine 审计修复 — 7项全部完成
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

HIGH-1: 提取共享 json_utils.rs,skill_generator/workflow_composer 去重
HIGH-2: FeedbackCollector Vec→HashMap,消除 unwrap() panic 风险
HIGH-3: ProfileUpdater 改为 collect_updates() 返回字段列表,
        growth.rs 直接 async 调用 update_field(),不再用 no-op 闭包
MEDIUM-1: EvolutionMiddleware 注入后自动 drain,防止重复注入
MEDIUM-2: PatternAggregator tools 提取改为直接收集 context 值
MEDIUM-3: evolution_engine.rs 移除 4 个未使用 imports
MEDIUM-4: workflow_composer parse_response pattern 参数加下划线
MEDIUM-7: SkillCandidate 添加 version 字段(默认=1)

测试: zclaw-growth 128 tests, zclaw-runtime 86 tests, workspace 0 failures
This commit is contained in:
iven
2026-04-18 22:15:43 +08:00
parent f97e6fdbb6
commit a9ea9d8691
12 changed files with 163 additions and 175 deletions

View File

@@ -324,25 +324,21 @@ impl GrowthIntegration {
// Update user profile from extraction signals (L1 enhancement)
if let Some(profile_store) = &self.profile_store {
let _store = profile_store.clone();
let user_id = agent_id.to_string();
if let Err(e) = self
let updates = self
.profile_updater
.update(&user_id, &combined_extraction, move |uid, field, val| {
// Synchronous wrapper — the actual update_field is async,
// but we're already in an async context so we handle it via a future
// For now, log and let the store handle it
tracing::debug!(
"[GrowthIntegration] Profile update: {} {}={}",
uid,
field,
val
.collect_updates(&combined_extraction);
let user_id = agent_id.to_string();
for update in updates {
if let Err(e) = profile_store
.update_field(&user_id, &update.field, &update.value)
.await
{
tracing::warn!(
"[GrowthIntegration] Profile update failed for {}: {}",
update.field,
e
);
Ok(())
})
.await
{
tracing::warn!("[GrowthIntegration] Profile update failed: {}", e);
}
}
}