feat: complete tree shell cutover and regression coverage

This commit is contained in:
lix-2026
2026-04-18 09:38:16 +08:00
parent d3876e56eb
commit 111a87d4fd
53 changed files with 5440 additions and 516 deletions
@@ -78,7 +78,11 @@ pub fn build_tree_target(
}
}
pub fn ensure_non_empty(value: &str, field: &'static str, context: &RequestContext) -> Result<String, WebError> {
pub fn ensure_non_empty(
value: &str,
field: &'static str,
context: &RequestContext,
) -> Result<String, WebError> {
let trimmed = value.trim();
if trimmed.is_empty() {
return Err(WebError::bad_request_code(
@@ -99,12 +103,11 @@ pub fn read_optional_non_empty(value: Option<String>) -> Option<String> {
pub fn ensure_sort_order(sort_order: i64, context: &RequestContext) -> Result<i64, WebError> {
if sort_order < 0 {
return Err(WebError::bad_request_code(
"tree_command_validation",
"sortOrder 不能小于 0",
)
.with_context(context)
.with_header("x-error-phase", "tree_command_validate"));
return Err(
WebError::bad_request_code("tree_command_validation", "sortOrder 不能小于 0")
.with_context(context)
.with_header("x-error-phase", "tree_command_validate"),
);
}
Ok(sort_order)
}