优化: AI Chat全栈多批审查修复与架构清理(risk_level清理/路由解耦/工具渲染/测试补测/死代码)

This commit is contained in:
2026-06-18 22:57:19 +08:00
parent 0ca5d9805f
commit a2871a66e0
87 changed files with 5720 additions and 3012 deletions

View File

@@ -101,6 +101,8 @@ impl Dag {
for edge in &self.edges {
// 仅收录两端均为已注册节点的边,跳过野节点
if node_ids.contains(&edge.source) && node_ids.contains(&edge.target) {
// safe: edge.target 已在 node_ids 中(上一行 contains 守卫),而 in_degree
// 对每个 node_id 都插入了表项line 97-99 初始化),故 get_mut 必命中
*in_degree.get_mut(&edge.target).unwrap() += 1;
adjacency_out
.entry(edge.source.clone())
@@ -127,6 +129,9 @@ impl Dag {
// 出边已索引O(出度) 遍历而非 O(E) 全表扫描
if let Some(succs) = adjacency_out.get(&id) {
for succ in succs {
// safe: succ 来自 adjacency_out其元素均为通过 line 103 contains 守卫
// 的 edge.targetline 108 push而 in_degree 覆盖所有 node_idline 97-99
// 故 succ 必在 in_degree 表内get_mut 必命中
let deg = in_degree.get_mut(succ).unwrap();
*deg -= 1;
if *deg == 0 {