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(api): ES-shaped response + 404 for DELETE /_security/privilege

xerj-orgbb2afacba7fa
diff --git a/engine/crates/xerj-api/src/es_compat.rs b/engine/crates/xerj-api/src/es_compat.rs
index 0ee624b9d..88ef5f72d 100644
--- a/engine/crates/xerj-api/src/es_compat.rs
+++ b/engine/crates/xerj-api/src/es_compat.rs
@@ -21993,7 +21993,19 @@ pub async fn security_delete_privilege(
) -> impl IntoResponse {
let key = application_privilege_key(&application, &name);
let found = state.engine.application_privileges.remove(&key).is_some();
- Json(json!({ "found": found })).into_response()
+ // ES nests the result per application/name and 404s when nothing was
+ // deleted: {"<application>": {"<name>": {"found": bool}}} — typed clients
+ // (DeletePrivilegesResponse) index into resp[app][name].
+ let mut by_name = serde_json::Map::new();
+ by_name.insert(name, json!({ "found": found }));
+ let mut by_app = serde_json::Map::new();
+ by_app.insert(application, Value::Object(by_name));
+ let status = if found {
+ StatusCode::OK
+ } else {
+ StatusCode::NOT_FOUND
+ };
+ (status, Json(Value::Object(by_app))).into_response()
}
fn application_privilege_key(application: &str, name: &str) -> String {