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.
Rust agent-memoryai-agentsbm25claude-codeclicode-searchcursordatabaseelasticsearchfull-text-searchhybrid-searchjsonllocal-firstmcpmcp-servermodel-context-protocolragrustsearch-enginevector-search
fix(ccr): fail loud (501) on CCR auto-follow instead of faking success
xerj-orgf3b49ccf9db3
diff --git a/engine/crates/xerj-api/src/es_compat.rs b/engine/crates/xerj-api/src/es_compat.rsindex b31fc0cf3..b9bc8c3d9 100644--- a/engine/crates/xerj-api/src/es_compat.rs+++ b/engine/crates/xerj-api/src/es_compat.rs@@ -24220,63 +24220,35 @@ pub async fn ccr_info(// DELETE /_ccr/auto_follow/{name}// ─────────────────────────────────────────────────────────────────────────────-pub async fn put_ccr_auto_follow(- State(state): State<AppState>,- Path(name): Path<String>,- Json(body): Json<Value>,-) -> impl IntoResponse {- state.engine.ccr_auto_follow.insert(name, body);- Json(json!({ "acknowledged": true }))+// Auto-follow patterns were persisted into `engine.ccr_auto_follow` and+// acknowledged, but that DashMap has ZERO consumers — no background loop+// ever reads it to actually replicate leader indices. The client believed+// a replication pattern was active while nothing was ever followed. Fail+// loud with an honest 501, matching the sibling ccr_follow/pause/resume/+// unfollow handlers above.++pub async fn put_ccr_auto_follow(Path(_name): Path<String>) -> impl IntoResponse {+ crate::stub::not_implemented_yet(+ "Cross-cluster replication (CCR) auto-follow",+ "v1.x",+ "xerj is single-cluster; CCR is not on the v1.0 roadmap.",+ )}-pub async fn get_ccr_auto_follow(- State(state): State<AppState>,- Path(name): Path<String>,-) -> impl IntoResponse {- if name == "_all" || name == "*" {- let patterns: Vec<Value> = state- .engine- .ccr_auto_follow- .iter()- .map(|e| {- let mut v = e.value().clone();- if let Some(obj) = v.as_object_mut() {- obj.insert("name".to_string(), json!(e.key().clone()));- }- v- })- .collect();- return Json(json!({ "patterns": patterns })).into_response();- }- match state.engine.ccr_auto_follow.get(&name) {- Some(p) => {- let mut v = p.clone();- if let Some(obj) = v.as_object_mut() {- obj.insert("name".to_string(), json!(name));- }- Json(json!({ "patterns": [v] })).into_response()- }- None => {- let e = xerj_common::XerjError::index_not_found(format!(- "auto-follow pattern [{name}] not found"- ));- ApiError::new(e).into_response()- }- }+pub async fn get_ccr_auto_follow(Path(_name): Path<String>) -> impl IntoResponse {+ crate::stub::not_implemented_yet(+ "Cross-cluster replication (CCR) auto-follow",+ "v1.x",+ "xerj is single-cluster; CCR is not on the v1.0 roadmap.",+ )}-pub async fn delete_ccr_auto_follow(- State(state): State<AppState>,- Path(name): Path<String>,-) -> impl IntoResponse {- if state.engine.ccr_auto_follow.remove(&name).is_some() {- Json(json!({ "acknowledged": true })).into_response()- } else {- let e = xerj_common::XerjError::index_not_found(format!(- "auto-follow pattern [{name}] not found"- ));- ApiError::new(e).into_response()- }+pub async fn delete_ccr_auto_follow(Path(_name): Path<String>) -> impl IntoResponse {+ crate::stub::not_implemented_yet(+ "Cross-cluster replication (CCR) auto-follow",+ "v1.x",+ "xerj is single-cluster; CCR is not on the v1.0 roadmap.",+ )}// ─────────────────────────────────────────────────────────────────────────────diff --git a/engine/tests/es-compat-yaml/src/main.rs b/engine/tests/es-compat-yaml/src/main.rsindex f15465583..2ab158855 100644--- a/engine/tests/es-compat-yaml/src/main.rs+++ b/engine/tests/es-compat-yaml/src/main.rs@@ -1348,6 +1348,12 @@ fn resolve_action(action: &str, params: &serde_yaml::Mapping) -> (String, String}"close_point_in_time" => ("DELETE".into(), "/_pit".into(), body),+ // Cross-cluster replication auto-follow patterns+ "ccr.put_auto_follow_pattern" => {+ let name = get_param_str(params, "name").unwrap_or_default();+ ("PUT".into(), format!("/_ccr/auto_follow/{}", name), body)+ }+// Catch-all_ => {let path = format!("/{}", action.replace('.', "/"));diff --git a/engine/tests/es-compat-yaml/yaml/ccr/10_auto_follow.yml b/engine/tests/es-compat-yaml/yaml/ccr/10_auto_follow.ymlnew file mode 100644index 000000000..5607b59b0--- /dev/null+++ b/engine/tests/es-compat-yaml/yaml/ccr/10_auto_follow.yml@@ -0,0 +1,16 @@+---+"CCR auto-follow pattern fails loud with 501":+ # Creating an auto-follow pattern used to fabricate {acknowledged:true}+ # while nothing ever replicated. It must now return an honest 501.+ - do:+ catch: /not_implemented/+ ccr.put_auto_follow_pattern:+ name: my-pattern+ body:+ remote_cluster: leader+ leader_index_patterns:+ - "logs-*"+ follow_index_pattern: "{{leader_index}}-copy"++ - match: { error.type: not_implemented_exception }+ - match: { status: 501 }