From 8ff43487bcf4cd72713d9a78cde004b2b789be11 Mon Sep 17 00:00:00 2001 From: Riz Ashraf Date: Sat, 10 Oct 2026 08:24:42 +0100 Subject: [PATCH] fix: correct tests following strict removal of legacy json aliases --- server/src/handlers/graph.rs | 3 +-- server/src/handlers/meta.rs | 4 ++-- server/src/models.rs | 5 ----- server/src/tools.rs | 2 +- stub_error.log | 0 5 files changed, 4 insertions(+), 10 deletions(-) create mode 100644 stub_error.log diff --git a/server/src/handlers/graph.rs b/server/src/handlers/graph.rs index 5634978..8dbd8ee 100644 --- a/server/src/handlers/graph.rs +++ b/server/src/handlers/graph.rs @@ -1369,10 +1369,9 @@ mod tests { .unwrap(); assert!(res.contains("Successfully created 1 relation(s)")); - // Test serde field aliases (source/target/relationType mapped to from/to/relation_type) let alias_args = json!({ "relations": [ - {"source": "A", "target": "B", "relationType": "knows"} + {"from": "A", "to": "B", "relation_type": "knows"} ] }); let alias_res = handler.execute(alias_args, state.clone()).await.unwrap(); diff --git a/server/src/handlers/meta.rs b/server/src/handlers/meta.rs index f8f47a1..abe2e3f 100644 --- a/server/src/handlers/meta.rs +++ b/server/src/handlers/meta.rs @@ -1900,7 +1900,7 @@ mod tests { "title": "Architecture", "context": "Needs DB", "decision": "Use SQLite", - "consequence": "Simple", + "consequences": "Simple", }); let res1 = decision_handler .execute(args_dec, state.clone()) @@ -2112,7 +2112,7 @@ mod tests { "title": "Use Axum", "context": "Architecture choice", "decision": "Adopt Axum for web framework", - "consequence": "Fast async API routing" + "consequences": "Fast async API routing" }), state.clone(), ) diff --git a/server/src/models.rs b/server/src/models.rs index 78351ed..4077ae9 100644 --- a/server/src/models.rs +++ b/server/src/models.rs @@ -185,7 +185,6 @@ impl std::fmt::Display for TaskStatus { #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Default)] pub struct Entity { pub name: String, - #[serde(alias = "entityType", alias = "type", alias = "category")] pub entity_type: String, #[serde(default)] pub observations: Vec, @@ -207,11 +206,8 @@ pub struct Entity { #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Default)] pub struct Relation { - #[serde(alias = "source", alias = "from_node", alias = "source_node")] pub from: String, - #[serde(alias = "target", alias = "to_node", alias = "target_node")] pub to: String, - #[serde(alias = "relationType", alias = "type", alias = "relation")] pub relation_type: String, #[serde(default = "default_namespace")] pub namespace: String, @@ -363,7 +359,6 @@ pub struct Adr { pub title: String, pub context: String, pub decision: String, - #[serde(alias = "consequences")] pub consequence: String, #[serde(default = "default_adr_status")] pub status: String, diff --git a/server/src/tools.rs b/server/src/tools.rs index 3d2dda8..f6cba5b 100644 --- a/server/src/tools.rs +++ b/server/src/tools.rs @@ -9,7 +9,7 @@ pub struct CreateEntitiesTool { } /// Create new relations between entities in the knowledge graph. -/// Create new relations between entities in the knowledge graph (accepts 'from' or 'source', 'to' or 'target', and 'relation_type' or 'type'). +/// Create new relations between entities in the knowledge graph. #[derive(Debug, Deserialize, Serialize, JsonSchema)] pub struct CreateRelationsTool { /// Array of relations to create. Each relation item MUST use 'from', 'to', and 'relation_type'. diff --git a/stub_error.log b/stub_error.log new file mode 100644 index 0000000..e69de29