重命名分离模块 problem_description 为 advice 并同步更新相关校验逻辑与测试
This commit is contained in:
@@ -230,7 +230,7 @@ mod tests {
|
||||
0,
|
||||
&[BindingDecision::NeedRework {
|
||||
to_node: id.clone(),
|
||||
problem_description: note.to_string(),
|
||||
advice: note.to_string(),
|
||||
}],
|
||||
&paths,
|
||||
)
|
||||
@@ -276,7 +276,7 @@ mod tests {
|
||||
};
|
||||
let decision = BindingDecision::NeedRework {
|
||||
to_node: node.id.clone(),
|
||||
problem_description: "x".repeat(MAX_REWORK_NOTE_CHARS + 1),
|
||||
advice: "x".repeat(MAX_REWORK_NOTE_CHARS + 1),
|
||||
};
|
||||
assert!(validate_binding_response(
|
||||
&BindingResp {
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ pub enum BindingDecision {
|
||||
to_node: NodeId,
|
||||
},
|
||||
NeedRework {
|
||||
problem_description: String,
|
||||
advice: String,
|
||||
to_node: NodeId,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -252,14 +252,14 @@ pub fn validate_binding_response(
|
||||
return Err(format!("视觉绑定重复返回节点:{}", node_id.as_str()));
|
||||
}
|
||||
if let BindingDecision::NeedRework {
|
||||
problem_description,
|
||||
advice,
|
||||
..
|
||||
} = decision
|
||||
{
|
||||
if problem_description.trim().is_empty() {
|
||||
if advice.trim().is_empty() {
|
||||
return Err("NeedRework 必须包含问题描述".to_string());
|
||||
}
|
||||
if problem_description.chars().count() > MAX_REWORK_NOTE_CHARS {
|
||||
if advice.chars().count() > MAX_REWORK_NOTE_CHARS {
|
||||
return Err(format!(
|
||||
"NeedRework 问题描述不能超过 {MAX_REWORK_NOTE_CHARS} 个字符"
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user