Skip to content

armgit / xerj

Public Imported from GitHub
0

AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.

fix(runner): truncate error bodies on a char boundary

xerj-orge8f4dab67ca7
diff --git a/engine/tests/es-compat-yaml/src/main.rs b/engine/tests/es-compat-yaml/src/main.rs
index f5406526a..1a6daf7d4 100644
--- a/engine/tests/es-compat-yaml/src/main.rs
+++ b/engine/tests/es-compat-yaml/src/main.rs
@@ -784,13 +784,13 @@ fn execute_do(
// 404 on delete = idempotent cleanup (OK)
// 409 on create = index exists from prior test (OK after cleanup)
if !action_name.contains("delete") && !action_name.contains("create") {
- return Err(format!(
- "{} {} → {} {}",
- method,
- path,
- status,
- &resp_text[..resp_text.len().min(200)]
- ));
+ // Truncate on a char boundary: a multibyte error reason at
+ // the 200-byte mark would panic the whole runner here.
+ let mut cut = resp_text.len().min(200);
+ while !resp_text.is_char_boundary(cut) {
+ cut -= 1;
+ }
+ return Err(format!("{} {} → {} {}", method, path, status, &resp_text[..cut]));
}
}