// Copyright 2026 Nowledge
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use super::{
build_compatibility_query_inventory, CompatibilityQueryCallSite, CompatibilityQueryInventory,
};
use super::{
CompatibilityCheck, CompatibilityFixture, CompatibilityTolerance, CypherFixtureCheck,
CypherFixtureStatement, ExpectedRows, ProjectedGraphFixtureCheck,
};
use hawdb_core::Value;
use hawdb_executor::Row;
use std::collections::BTreeMap;
pub fn nowledge_memory_core_fixture() -> CompatibilityFixture {
CompatibilityFixture {
name: "nowledge-memory-core".to_string(),
setup: vec![
CypherFixtureStatement::new("CREATE NODE LABEL Memory"),
CypherFixtureStatement::new("CREATE NODE LABEL Entity"),
CypherFixtureStatement::new("CREATE RELATIONSHIP TYPE MENTIONS"),
CypherFixtureStatement::new("CREATE RELATIONSHIP TYPE EVOLVES"),
CypherFixtureStatement::new("CREATE INDEX ON :Memory(id)"),
CypherFixtureStatement::new(
"MERGE (:Memory {id: 1, title: 'Graph foundations', kind: 'note', status: null, importance: 0.9, memory_count: 0, is_crystal: false, decay_score_cached: 0.2})-[:MENTIONS {weight: 3}]->(:Entity {id: 10, name: 'Rust', aliases: ['Ferris', 'Rustacean']})",
),
CypherFixtureStatement::new(
"MERGE (:Memory {id: 2, title: 'Runtime strategy', kind: 'note', importance: 0.4, is_crystal: false, decay_score_cached: 0.8})-[:MENTIONS {weight: 4}]->(:Entity {id: 11, name: 'Cypher'})",
),
CypherFixtureStatement::new(
"MERGE (:Memory {id: 2, title: 'Runtime strategy', kind: 'note'})-[:EVOLVES]->(:Memory {id: 3, title: 'Cloud projection', kind: 'decision', is_crystal: true})",
),
],
checks: vec![
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"parameterized lookup uses small-label scan",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id = $id RETURN m.title AS title",
BTreeMap::from([("id".to_string(), Value::Int(1))]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"title",
Value::String("Graph foundations".to_string()),
)])]),
)
.with_plan_contains(vec!["NodeProjectionScanExec".to_string()]),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"graph totals memory count read",
CypherFixtureStatement::new("MATCH (m:Memory) RETURN count(m)"),
ExpectedRows::Exact(vec![compatibility_row([("count(m)", Value::Int(3))])]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"graph totals evolves count read",
CypherFixtureStatement::new("MATCH ()-[e:EVOLVES]->() RETURN count(e)"),
ExpectedRows::Exact(vec![compatibility_row([("count(e)", Value::Int(1))])]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"graph totals crystal count read",
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.is_crystal = true RETURN count(m)",
),
ExpectedRows::Exact(vec![compatibility_row([("count(m)", Value::Int(1))])]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"mcp crystal count read",
CypherFixtureStatement::new(
"MATCH (c:Memory) WHERE c.is_crystal = true RETURN count(c)",
),
ExpectedRows::Exact(vec![compatibility_row([("count(c)", Value::Int(1))])]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"checkpoint control statement",
CypherFixtureStatement::new("CHECKPOINT"),
ExpectedRows::RowCount(0),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"begin transaction control statement",
CypherFixtureStatement::new("BEGIN TRANSACTION"),
ExpectedRows::RowCount(0),
)
.with_session_execution(),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"commit transaction control statement",
CypherFixtureStatement::new("COMMIT"),
ExpectedRows::RowCount(1),
)
.with_session_execution()
.with_setup_query(CypherFixtureStatement::new("BEGIN TRANSACTION"))
.with_setup_query(CypherFixtureStatement::new(
"CREATE NODE LABEL TxProbeCommit",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rollback transaction control statement",
CypherFixtureStatement::new("ROLLBACK"),
ExpectedRows::RowCount(0),
)
.with_session_execution()
.with_setup_query(CypherFixtureStatement::new("BEGIN TRANSACTION"))
.with_setup_query(CypherFixtureStatement::new(
"CREATE NODE LABEL TxProbeRollback",
)),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"community relates edge endpoint read",
CypherFixtureStatement::new(
"MATCH (e1:Entity)-[r:RELATES_TO]->(e2:Entity) RETURN e1.id, e2.id",
),
ExpectedRows::RowCount(0),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"community memory mention hit ranking read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[:MENTIONS]->(e:Entity) WHERE e.id IN $entity_ids RETURN m.title, m.content, m.importance, COUNT(e) AS hits, m.metadata, COALESCE(m.is_latest, true) ORDER BY hits DESC, m.importance DESC, m.title ASC LIMIT 8",
BTreeMap::from([(
"entity_ids".to_string(),
Value::List(vec![Value::Int(10), Value::Int(11)]),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("m.title", Value::String("Graph foundations".to_string())),
("m.content", Value::Null),
("m.importance", Value::Float(0.9)),
("hits", Value::Int(1)),
("m.metadata", Value::Null),
("coalesce", Value::Bool(true)),
]),
compatibility_row([
("m.title", Value::String("Runtime strategy".to_string())),
("m.content", Value::Null),
("m.importance", Value::Float(0.4)),
("hits", Value::Int(1)),
("m.metadata", Value::Null),
("coalesce", Value::Bool(true)),
]),
]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"community entity topic candidate read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) WHERE e.id IN $entity_ids RETURN e.name, e.entity_type, e.confidence ORDER BY e.confidence DESC, e.name ASC LIMIT 30",
BTreeMap::from([(
"entity_ids".to_string(),
Value::List(vec![Value::Int(10), Value::Int(11)]),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("e.name", Value::String("Cypher".to_string())),
("e.entity_type", Value::Null),
("e.confidence", Value::Null),
]),
compatibility_row([
("e.name", Value::String("Rust".to_string())),
("e.entity_type", Value::Null),
("e.confidence", Value::Null),
]),
]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph entity overview ranking read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) RETURN e.id, COALESCE(e.name, e.id), e.entity_type, e.description, COALESCE(e.pagerank_score, e.confidence, 0.5), e.community_id, e.confidence ORDER BY COALESCE(e.pagerank_score, e.confidence, 0.5) DESC LIMIT $limit",
BTreeMap::from([("limit".to_string(), Value::Int(1))]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'rest-graph-entity-overview', name: 'Rest Graph Entity Overview', entity_type: 'concept', description: 'overview fixture', pagerank_score: 99.0, community_id: 42, confidence: 0.91})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'rest-graph-entity-overview'}) DETACH DELETE e",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"community entity relation edge detail read",
CypherFixtureStatement::with_parameters(
"MATCH (e1:Entity)-[r:RELATES_TO]->(e2:Entity) WHERE e1.id IN $entity_ids AND e2.id IN $entity_ids RETURN e1.name, e2.name, r.relation_type, r.strength, r.context, r.confidence ORDER BY r.strength DESC, r.confidence DESC LIMIT 20",
BTreeMap::from([(
"entity_ids".to_string(),
Value::List(vec![
Value::String("community-edge-a".to_string()),
Value::String("community-edge-b".to_string()),
]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("e1.name", Value::String("Community Edge A".to_string())),
("e2.name", Value::String("Community Edge B".to_string())),
("r.relation_type", Value::String("related".to_string())),
("r.strength", Value::Float(0.8)),
("r.context", Value::String("shared context".to_string())),
("r.confidence", Value::Float(0.7)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'community-edge-a', name: 'Community Edge A'})-[:RELATES_TO {relation_type: 'related', strength: 0.8, context: 'shared context', confidence: 0.7}]->(:Entity {id: 'community-edge-b', name: 'Community Edge B'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['community-edge-a', 'community-edge-b'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph overview edge list read",
CypherFixtureStatement::with_parameters(
"MATCH (a)-[r]->(b) WHERE a.id IN $ids AND b.id IN $ids RETURN a.id, b.id, label(r), COALESCE(r.strength, r.confidence, 0.5)",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![
Value::String("rest-graph-edge-a".to_string()),
Value::String("rest-graph-edge-b".to_string()),
]),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'rest-graph-edge-a'})-[:RELATES_TO {strength: 0.87, confidence: 0.76}]->(:Entity {id: 'rest-graph-edge-b'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-graph-edge-a', 'rest-graph-edge-b'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph overview edge limited list read",
CypherFixtureStatement::with_parameters(
"MATCH (a)-[r]->(b) WHERE a.id IN $ids AND b.id IN $ids RETURN a.id, b.id, label(r), COALESCE(r.strength, r.confidence, 0.5) LIMIT 200",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![
Value::String("rest-graph-edge-limited-a".to_string()),
Value::String("rest-graph-edge-limited-b".to_string()),
]),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'rest-graph-edge-limited-a'})-[:RELATES_TO {strength: 0.81, confidence: 0.71}]->(:Entity {id: 'rest-graph-edge-limited-b'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-graph-edge-limited-a', 'rest-graph-edge-limited-b'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"community topic signal reset write",
CypherFixtureStatement::new(
"MATCH (e:Entity) SET e.topic_graph_eligible = false, e.topic_signal_score = 0.0, e.topic_signal_updated_at = CURRENT_TIMESTAMP()",
),
ExpectedRows::RowCount(2),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity) SET e.topic_graph_eligible = NULL, e.topic_signal_score = NULL, e.topic_signal_updated_at = NULL",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"community topic signal enable write",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {id: $entity_id}) SET e.topic_graph_eligible = true, e.topic_signal_score = $score, e.topic_signal_updated_at = CURRENT_TIMESTAMP()",
BTreeMap::from([
("entity_id".to_string(), Value::Int(10)),
("score".to_string(), Value::Float(0.75)),
]),
),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"community topic eligible entity read",
CypherFixtureStatement::new(
"MATCH (e:Entity) WHERE e.topic_graph_eligible = true RETURN e.id",
),
ExpectedRows::Exact(vec![compatibility_row([("e.id", Value::Int(10))])]),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity {id: 10}) SET e.topic_graph_eligible = NULL, e.topic_signal_score = NULL, e.topic_signal_updated_at = NULL",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"community node assignment write",
CypherFixtureStatement::with_parameters(
"MATCH (n) WHERE n.id = $node_id SET n.community_id = $community_id",
BTreeMap::from([
("node_id".to_string(), Value::Int(10)),
("community_id".to_string(), Value::Int(42)),
]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id = 10 SET n.community_id = NULL",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"community entity assignment reset write",
CypherFixtureStatement::new("MATCH (e:Entity) SET e.community_id = NULL"),
ExpectedRows::RowCount(2),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"community memory assignment reset write",
CypherFixtureStatement::new("MATCH (m:Memory) SET m.community_id = NULL"),
ExpectedRows::RowCount(3),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"community mention detail read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[:MENTIONS]->(e:Entity) WHERE e.id IN $entity_ids RETURN e.id, m.id, m.metadata, COALESCE(m.is_latest, true)",
BTreeMap::from([(
"entity_ids".to_string(),
Value::List(vec![Value::Int(10), Value::Int(11)]),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("e.id", Value::Int(10)),
("m.id", Value::Int(1)),
("m.metadata", Value::Null),
("coalesce", Value::Bool(true)),
]),
compatibility_row([
("e.id", Value::Int(11)),
("m.id", Value::Int(2)),
("m.metadata", Value::Null),
("coalesce", Value::Bool(true)),
]),
]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"community node cleanup delete",
CypherFixtureStatement::new("MATCH (c:Community) DELETE c"),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'community-cleanup-temp', community_id: 8100})",
)),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"community detection result create",
CypherFixtureStatement::with_parameters(
"CREATE (c:Community { id: $id, community_id: $community_id, name: $name, description: $description, ai_summary: $ai_summary, member_count: $member_count, algorithm: 'louvain', resolution: $resolution, created_at: CURRENT_TIMESTAMP(), updated_at: CURRENT_TIMESTAMP() })",
BTreeMap::from([
(
"id".to_string(),
Value::String("community-detection-result".to_string()),
),
("community_id".to_string(), Value::Int(8101)),
(
"name".to_string(),
Value::String("Detection Community".to_string()),
),
(
"description".to_string(),
Value::String("detected community".to_string()),
),
(
"ai_summary".to_string(),
Value::String("detected summary".to_string()),
),
("member_count".to_string(), Value::Int(3)),
("resolution".to_string(), Value::Float(0.8)),
]),
),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"community latest updated read",
CypherFixtureStatement::new(
"MATCH (c:Community) WHERE c.updated_at IS NOT NULL RETURN c.updated_at ORDER BY c.updated_at DESC LIMIT 1",
),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"community summary corpus read",
CypherFixtureStatement::new(
"MATCH (c:Community) WHERE c.community_id IS NOT NULL AND c.community_id >= 0 RETURN c.ai_summary",
),
ExpectedRows::Exact(vec![compatibility_row([(
"c.ai_summary",
Value::String("detected summary".to_string()),
)])]),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (c:Community {id: 'community-detection-result'}) DELETE c",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"community graph meta update",
CypherFixtureStatement::with_parameters(
"MATCH (m:GraphMeta {meta_id: 'main'}) SET m.community_detection_applied = true, m.community_algorithm = 'louvain', m.community_resolution = $resolution, m.community_count = $count, m.community_detection_computed_at = CURRENT_TIMESTAMP(), m.last_augmentation_at = CURRENT_TIMESTAMP(), m.updated_at = CURRENT_TIMESTAMP()",
BTreeMap::from([
("resolution".to_string(), Value::Float(0.8)),
("count".to_string(), Value::Int(1)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"MERGE (:GraphMeta {meta_id: 'main'})",
))
.with_effect_query(
CypherFixtureStatement::new("MATCH (m:GraphMeta {meta_id: 'main'}) DELETE m"),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"graph meta pagerank sentinel read",
CypherFixtureStatement::new(
"MATCH (m:GraphMeta) RETURN m.pagerank_computed_at LIMIT 1",
),
ExpectedRows::Exact(vec![compatibility_row([(
"m.pagerank_computed_at",
Value::Int(123),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:GraphMeta {meta_id: 'schema-sentinel', pagerank_computed_at: 123})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:GraphMeta {meta_id: 'schema-sentinel'}) DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph augmentation state graph meta read",
CypherFixtureStatement::new(
"MATCH (m:GraphMeta {meta_id: 'main'}) RETURN m.community_detection_applied, m.pagerank_applied, m.community_algorithm, m.community_resolution, m.community_count, m.pagerank_algorithm, m.pagerank_damping, m.pagerank_iterations, m.last_augmentation_at, m.schema_version, m.community_detection_computed_at, m.pagerank_computed_at",
),
ExpectedRows::Exact(vec![compatibility_row([
("m.community_detection_applied", Value::Bool(true)),
("m.pagerank_applied", Value::Bool(true)),
("m.community_algorithm", Value::String("louvain".to_string())),
("m.community_resolution", Value::Float(0.8)),
("m.community_count", Value::Int(3)),
("m.pagerank_algorithm", Value::String("pagerank".to_string())),
("m.pagerank_damping", Value::Float(0.85)),
("m.pagerank_iterations", Value::Int(20)),
("m.last_augmentation_at", Value::Int(300)),
("m.schema_version", Value::Int(2)),
("m.community_detection_computed_at", Value::Int(301)),
("m.pagerank_computed_at", Value::Int(302)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"MERGE (m:GraphMeta {meta_id: 'main'}) SET m.community_detection_applied = true, m.pagerank_applied = true, m.community_algorithm = 'louvain', m.community_resolution = 0.8, m.community_count = 3, m.pagerank_algorithm = 'pagerank', m.pagerank_damping = 0.85, m.pagerank_iterations = 20, m.last_augmentation_at = 300, m.schema_version = 2, m.community_detection_computed_at = 301, m.pagerank_computed_at = 302",
))
.with_effect_query(
CypherFixtureStatement::new("MATCH (m:GraphMeta {meta_id: 'main'}) DELETE m"),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"entity lifecycle mention memory id read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[:MENTIONS]->(e:Entity {id: $id}) RETURN m.id",
BTreeMap::from([("id".to_string(), Value::Int(10))]),
),
ExpectedRows::Exact(vec![compatibility_row([("m.id", Value::Int(1))])]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"entity lifecycle relationship create",
CypherFixtureStatement::with_parameters(
"MATCH (source:Entity {id: $source_id}), (target:Entity {id: $target_id}) CREATE (source)-[:RELATES_TO { relation_type: $relation_type, strength: $strength, confidence: $confidence, context: $context, conditions: $conditions, temporal_info: $temporal_info, source_reference: $source_reference, bidirectional: $bidirectional, created_at: $created_at, properties: $properties, temporal_type: $temporal_type, rel_start: $rel_start, rel_end: $rel_end, temporal_precision: $temporal_precision, is_ongoing: $is_ongoing, temporal_confidence: $temporal_confidence }]->(target)",
BTreeMap::from([
(
"source_id".to_string(),
Value::String("entity-life-rel-source".to_string()),
),
(
"target_id".to_string(),
Value::String("entity-life-rel-target".to_string()),
),
(
"relation_type".to_string(),
Value::String("supports".to_string()),
),
("strength".to_string(), Value::Float(0.8)),
("confidence".to_string(), Value::Float(0.75)),
(
"context".to_string(),
Value::String("lifecycle context".to_string()),
),
(
"conditions".to_string(),
Value::String("{}".to_string()),
),
(
"temporal_info".to_string(),
Value::String("{}".to_string()),
),
(
"source_reference".to_string(),
Value::String("entity-lifecycle".to_string()),
),
("bidirectional".to_string(), Value::Bool(false)),
("created_at".to_string(), Value::Int(11)),
(
"properties".to_string(),
Value::String("{}".to_string()),
),
(
"temporal_type".to_string(),
Value::String("ongoing".to_string()),
),
(
"rel_start".to_string(),
Value::String("2024-01-01".to_string()),
),
("rel_end".to_string(), Value::Null),
(
"temporal_precision".to_string(),
Value::String("day".to_string()),
),
("is_ongoing".to_string(), Value::Bool(true)),
("temporal_confidence".to_string(), Value::Float(0.6)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-life-rel-source', name: 'Lifecycle Rel Source'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-life-rel-target', name: 'Lifecycle Rel Target'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['entity-life-rel-source', 'entity-life-rel-target'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"entity lifecycle graph meta reset",
CypherFixtureStatement::new(
"MERGE (m:GraphMeta {meta_id: 'main'}) SET m.pagerank_applied = false, m.pagerank_computed_at = NULL, m.community_detection_applied = false, m.community_detection_computed_at = NULL, m.updated_at = CURRENT_TIMESTAMP()",
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new("MATCH (m:GraphMeta {meta_id: 'main'}) DELETE m"),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"entity lifecycle label id read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {id: $id})-[:HAS_LABEL]->(n:Label) RETURN n.id",
BTreeMap::from([(
"id".to_string(),
Value::String("entity-life-label-read".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"n.id",
Value::String("entity-life-label-read-label".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-life-label-read', name: 'Lifecycle Label Read'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'entity-life-label-read-label', name: 'Lifecycle Label Read'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'entity-life-label-read'}), (n:Label {id: 'entity-life-label-read-label'}) CREATE (e)-[:HAS_LABEL]->(n)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['entity-life-label-read', 'entity-life-label-read-label'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"entity lifecycle label relationship create",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {id: $target_id}), (n:Label {id: $label_id}) CREATE (e)-[:HAS_LABEL { assigned_by: $assigned_by, created_at: $created_at, properties: $properties }]->(n)",
BTreeMap::from([
(
"target_id".to_string(),
Value::String("entity-life-label-create".to_string()),
),
(
"label_id".to_string(),
Value::String("entity-life-label-create-label".to_string()),
),
(
"assigned_by".to_string(),
Value::String("entity-lifecycle".to_string()),
),
("created_at".to_string(), Value::Int(12)),
(
"properties".to_string(),
Value::String("{}".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-life-label-create', name: 'Lifecycle Label Create'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'entity-life-label-create-label', name: 'Lifecycle Label Create'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['entity-life-label-create', 'entity-life-label-create-label'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"entity lifecycle community id read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {id: $id})-[:BELONGS_TO]->(n:Community) RETURN n.id",
BTreeMap::from([(
"id".to_string(),
Value::String("entity-life-community-read".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"n.id",
Value::String("entity-life-community-read-community".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-life-community-read', name: 'Lifecycle Community Read'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'entity-life-community-read-community', name: 'Lifecycle Community Read'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'entity-life-community-read'}), (n:Community {id: 'entity-life-community-read-community'}) CREATE (e)-[:BELONGS_TO]->(n)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['entity-life-community-read', 'entity-life-community-read-community'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"entity lifecycle community relationship create",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {id: $target_id}), (n:Community {id: $community_id}) CREATE (e)-[:BELONGS_TO { strength: $strength, created_at: $created_at, properties: $properties }]->(n)",
BTreeMap::from([
(
"target_id".to_string(),
Value::String("entity-life-community-create".to_string()),
),
(
"community_id".to_string(),
Value::String("entity-life-community-create-community".to_string()),
),
("strength".to_string(), Value::Float(0.7)),
("created_at".to_string(), Value::Int(13)),
(
"properties".to_string(),
Value::String("{}".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-life-community-create', name: 'Lifecycle Community Create'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'entity-life-community-create-community', name: 'Lifecycle Community Create'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['entity-life-community-create', 'entity-life-community-create-community'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"entity lifecycle endpoint metadata read",
CypherFixtureStatement::with_parameters(
"MATCH (source:Entity {id: $source_id}), (target:Entity {id: $target_id}) RETURN source.metadata, target.metadata",
BTreeMap::from([
("source_id".to_string(), Value::String("entity-life-meta-source".to_string())),
("target_id".to_string(), Value::String("entity-life-meta-target".to_string())),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"source.metadata",
Value::String("{\"role\":\"source\"}".to_string()),
),
(
"target.metadata",
Value::String("{\"role\":\"target\"}".to_string()),
),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-life-meta-source', metadata: '{\"role\":\"source\"}'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-life-meta-target', metadata: '{\"role\":\"target\"}'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['entity-life-meta-source', 'entity-life-meta-target'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"entity lifecycle mention relationship read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[r:MENTIONS]->(e:Entity {id: $id}) RETURN m.id, r",
BTreeMap::from([("id".to_string(), Value::String("entity-life-mention-target".to_string()))]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'entity-life-mention-memory'})-[:MENTIONS {confidence: 0.88, mention_count: 2, created_at: 14, properties: '{}'}]->(:Entity {id: 'entity-life-mention-target'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['entity-life-mention-memory', 'entity-life-mention-target'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"entity lifecycle mention relationship create",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $memory_id}), (e:Entity {id: $target_id}) CREATE (m)-[:MENTIONS {confidence: $confidence, mention_count: $mention_count, created_at: $created_at, properties: $properties}]->(e)",
BTreeMap::from([
("memory_id".to_string(), Value::String("entity-life-create-mention-memory".to_string())),
("target_id".to_string(), Value::String("entity-life-create-mention-target".to_string())),
("confidence".to_string(), Value::Float(0.91)),
("mention_count".to_string(), Value::Int(3)),
("created_at".to_string(), Value::Int(15)),
("properties".to_string(), Value::String("{}".to_string())),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'entity-life-create-mention-memory'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-life-create-mention-target'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['entity-life-create-mention-memory', 'entity-life-create-mention-target'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"entity lifecycle target metadata update",
CypherFixtureStatement::with_parameters(
"MATCH (target:Entity {id: $target_id}) SET target.aliases = $aliases, target.metadata = $metadata, target.updated_at = $updated_at, target.pagerank_score = 0.0, target.topic_graph_eligible = false, target.topic_signal_score = 0.0",
BTreeMap::from([
("target_id".to_string(), Value::String("entity-life-update-target".to_string())),
(
"aliases".to_string(),
Value::List(vec![Value::String("updated alias".to_string())]),
),
("metadata".to_string(), Value::String("{\"updated\":true}".to_string())),
("updated_at".to_string(), Value::Int(16)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-life-update-target', aliases: [], metadata: '{}', updated_at: 1})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (target:Entity {id: 'entity-life-update-target'}) DETACH DELETE target",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"entity lifecycle source detach delete",
CypherFixtureStatement::with_parameters(
"MATCH (source:Entity {id: $source_id}) DETACH DELETE source",
BTreeMap::from([(
"source_id".to_string(),
Value::String("entity-life-delete-source".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-life-delete-source'})",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label lifecycle snapshot read",
CypherFixtureStatement::with_parameters(
"MATCH (l:Label {id: $id}) RETURN l.id, l.name, l.canonical_name, l.color, l.description, l.metadata, l.updated_at",
BTreeMap::from([(
"id".to_string(),
Value::String("label-lifecycle-snapshot".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"l.id",
Value::String("label-lifecycle-snapshot".to_string()),
),
("l.name", Value::String("Lifecycle Snapshot".to_string())),
(
"l.canonical_name",
Value::String("lifecycle_snapshot".to_string()),
),
("l.color", Value::String("#3b82f6".to_string())),
(
"l.description",
Value::String("snapshot description".to_string()),
),
("l.metadata", Value::String("{}".to_string())),
("l.updated_at", Value::Int(21)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-lifecycle-snapshot', name: 'Lifecycle Snapshot', canonical_name: 'lifecycle_snapshot', color: '#3b82f6', description: 'snapshot description', metadata: '{}', updated_at: 21})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (l:Label {id: 'label-lifecycle-snapshot'}) DETACH DELETE l",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label governance receipt read",
CypherFixtureStatement::with_parameters(
"MATCH (o:GovernanceOperation {id: $id}) RETURN o.operation_type, o.source_id, o.target_id, o.payload",
BTreeMap::from([(
"id".to_string(),
Value::String("label-governance-receipt".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("o.operation_type", Value::String("merge".to_string())),
("o.source_id", Value::String("label-source".to_string())),
("o.target_id", Value::String("label-target".to_string())),
("o.payload", Value::String("{\"ok\":true}".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:GovernanceOperation {id: 'label-governance-receipt', operation_type: 'merge', source_id: 'label-source', target_id: 'label-target', payload: '{\"ok\":true}', created_at: 22})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (o:GovernanceOperation {id: 'label-governance-receipt'}) DETACH DELETE o",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label governance receipt create",
CypherFixtureStatement::with_parameters(
"CREATE (o:GovernanceOperation { id: $id, operation_type: $operation_type, source_id: $source_id, target_id: $target_id, payload: $payload, created_at: $created_at })",
BTreeMap::from([
(
"id".to_string(),
Value::String("label-governance-create".to_string()),
),
(
"operation_type".to_string(),
Value::String("delete".to_string()),
),
("source_id".to_string(), Value::String("label-a".to_string())),
("target_id".to_string(), Value::String(String::new())),
(
"payload".to_string(),
Value::String("{\"done\":true}".to_string()),
),
("created_at".to_string(), Value::Int(23)),
]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (o:GovernanceOperation {id: 'label-governance-create'}) DETACH DELETE o",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label canonical usage read",
CypherFixtureStatement::new(
"MATCH (l:Label) WHERE l.canonical_name IS NOT NULL OPTIONAL MATCH (l)<-[:HAS_LABEL]-(n) WITH l, COUNT(n) AS usage RETURN l.id, l.name, l.canonical_name, usage",
),
ExpectedRows::Exact(vec![compatibility_row([
("l.id", Value::String("label-canonical-usage".to_string())),
("l.name", Value::String("Canonical Usage".to_string())),
(
"l.canonical_name",
Value::String("canonical_usage".to_string()),
),
("usage", Value::Int(1)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-canonical-usage', name: 'Canonical Usage', canonical_name: 'canonical_usage'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'label-canonical-memory'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'label-canonical-memory'}), (l:Label {id: 'label-canonical-usage'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['label-canonical-usage', 'label-canonical-memory'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label row usage read",
CypherFixtureStatement::with_parameters(
"MATCH (l:Label {id: $label_id}) OPTIONAL MATCH (l)<-[:HAS_LABEL]-(n) WITH l, COUNT(n) as usage_count RETURN l.id, l.name, l.color, l.description, l.created_at, l.updated_at, usage_count",
BTreeMap::from([(
"label_id".to_string(),
Value::String("label-row-usage".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("l.id", Value::String("label-row-usage".to_string())),
("l.name", Value::String("Label Row Usage".to_string())),
("l.color", Value::String("#3b82f6".to_string())),
(
"l.description",
Value::String("row usage description".to_string()),
),
("l.created_at", Value::Int(24)),
("l.updated_at", Value::Int(25)),
("usage_count", Value::Int(1)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-row-usage', name: 'Label Row Usage', color: '#3b82f6', description: 'row usage description', created_at: 24, updated_at: 25})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'label-row-memory'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'label-row-memory'}), (l:Label {id: 'label-row-usage'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['label-row-usage', 'label-row-memory'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest list label row aliased usage read",
CypherFixtureStatement::with_parameters(
"MATCH (l:Label {id: $label_id}) OPTIONAL MATCH (l)<-[:HAS_LABEL]-(n) WITH l, COUNT(n) as usage_count RETURN l.id as id, l.name as name, l.color as color, l.description as description, l.created_at as created_at, l.updated_at as updated_at, usage_count",
BTreeMap::from([(
"label_id".to_string(),
Value::String("rest-list-label-row-usage".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'rest-list-label-row-usage', name: 'REST List Label', color: '#778899', description: 'rest list label', created_at: 108, updated_at: 109})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-list-label-row-memory'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-list-label-row-memory'}), (l:Label {id: 'rest-list-label-row-usage'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-list-label-row-usage', 'rest-list-label-row-memory'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"rest list label health usage read",
CypherFixtureStatement::new(
"MATCH (l:Label) OPTIONAL MATCH (l)<-[:HAS_LABEL]-(n) WITH l, COUNT(n) AS u RETURN u",
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'rest-list-health-label-1', name: 'Health Label'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (l:Label {id: 'rest-list-health-label-1'}) DETACH DELETE l",
),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"rest list memory label health count read",
CypherFixtureStatement::new(
"MATCH (m:Memory) OPTIONAL MATCH (m)-[:HAS_LABEL]->(l:Label) WITH m, COUNT(l) AS k RETURN k",
),
ExpectedRows::RowCount(3),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label canonical merge write",
CypherFixtureStatement::with_parameters(
"MERGE (l:Label {id: $label_id}) ON CREATE SET l.name = $label_name, l.canonical_name = $canonical, l.color = $color, l.description = $description, l.created_at = $now, l.updated_at = $now, l.metadata = $metadata ON MATCH SET l.updated_at = $now, l.canonical_name = COALESCE(l.canonical_name, $canonical)",
BTreeMap::from([
(
"label_id".to_string(),
Value::String("label-canonical-merge".to_string()),
),
(
"label_name".to_string(),
Value::String("Canonical Merge".to_string()),
),
(
"canonical".to_string(),
Value::String("canonical_merge".to_string()),
),
("color".to_string(), Value::String("#3b82f6".to_string())),
(
"description".to_string(),
Value::String("merge description".to_string()),
),
("now".to_string(), Value::Int(26)),
("metadata".to_string(), Value::String("{}".to_string())),
]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (l:Label {id: 'label-canonical-merge'}) DETACH DELETE l",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label memory edge count read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $memory_id})-[r:HAS_LABEL]->(l:Label {id: $label_id}) RETURN COUNT(r)",
BTreeMap::from([
(
"memory_id".to_string(),
Value::String("label-edge-count-memory".to_string()),
),
(
"label_id".to_string(),
Value::String("label-edge-count-label".to_string()),
),
]),
),
ExpectedRows::Exact(vec![compatibility_row([("count(r)", Value::Int(1))])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'label-edge-count-memory'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-edge-count-label'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'label-edge-count-memory'}), (l:Label {id: 'label-edge-count-label'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['label-edge-count-memory', 'label-edge-count-label'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label semantic pairing usage read",
CypherFixtureStatement::with_parameters(
"MATCH (l:Label) WHERE l.canonical_name IS NOT NULL OPTIONAL MATCH (l)<-[:HAS_LABEL]-(n) WITH l, COUNT(n) AS usage RETURN l.id, l.name, l.canonical_name, usage ORDER BY usage DESC LIMIT $cap",
BTreeMap::from([("cap".to_string(), Value::Int(50))]),
),
ExpectedRows::Exact(vec![compatibility_row([
("l.id", Value::String("label-semantic-pairing".to_string())),
("l.name", Value::String("Semantic Pairing".to_string())),
(
"l.canonical_name",
Value::String("semantic_pairing".to_string()),
),
("usage", Value::Int(1)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-semantic-pairing', name: 'Semantic Pairing', canonical_name: 'semantic_pairing'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'label-semantic-memory'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'label-semantic-memory'}), (l:Label {id: 'label-semantic-pairing'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['label-semantic-pairing', 'label-semantic-memory'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label metadata update",
CypherFixtureStatement::with_parameters(
"MATCH (l:Label {id: $id}) SET l.metadata = $meta, l.updated_at = $now",
BTreeMap::from([
(
"id".to_string(),
Value::String("label-metadata-update".to_string()),
),
(
"meta".to_string(),
Value::String("{\"merged\":true}".to_string()),
),
("now".to_string(), Value::Int(27)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-metadata-update', metadata: '{}', updated_at: 1})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (l:Label {id: 'label-metadata-update'}) DETACH DELETE l",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label source detach delete",
CypherFixtureStatement::with_parameters(
"MATCH (source:Label {id: $source_id}) DETACH DELETE source",
BTreeMap::from([(
"source_id".to_string(),
Value::String("label-source-delete".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-source-delete'})",
)),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"whole node projection",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $memory_id}) RETURN m",
BTreeMap::from([("memory_id".to_string(), Value::Int(1))]),
),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest agent memory attachment node read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $id}) RETURN m",
BTreeMap::from([(
"id".to_string(),
Value::String("rest-agent-memory-1".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-agent-memory-1', title: 'Agent Memory', content: 'attached memory content', unit_type: 'fact'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-agent-memory-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"source provenance endpoint existence",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $memory_id}), (e:Entity {id: $source_id}) RETURN count(m)",
BTreeMap::from([
("memory_id".to_string(), Value::Int(1)),
("source_id".to_string(), Value::Int(10)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([("count(m)", Value::Int(1))])]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"entity relationship endpoint existence",
CypherFixtureStatement::with_parameters(
"MATCH (source:Entity {id: $source_entity_id}) MATCH (target:Entity {id: $target_entity_id}) RETURN source.id, target.id",
BTreeMap::from([
("source_entity_id".to_string(), Value::Int(10)),
("target_entity_id".to_string(), Value::Int(11)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
("source.id", Value::Int(10)),
("target.id", Value::Int(11)),
])]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory access counter touch",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id = $id SET m.access_count = COALESCE(m.access_count, 0) + 1, m.last_accessed_at = $now",
BTreeMap::from([
("id".to_string(), Value::Int(2)),
("now".to_string(), Value::Int(42)),
]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 2}) RETURN m.access_count AS count, m.last_accessed_at AS last_accessed_at",
),
ExpectedRows::Exact(vec![compatibility_row([
("count", Value::Int(1)),
("last_accessed_at", Value::Int(42)),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory click dwell access touch",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $memory_id}) SET m.clicks = COALESCE(m.clicks, 0) + 1, m.last_clicked_at = $now, m.total_dwell_time_ms = COALESCE(m.total_dwell_time_ms, 0) + $dwell, m.access_count = COALESCE(m.access_count, 0) + 1, m.last_accessed_at = $now",
BTreeMap::from([
("memory_id".to_string(), Value::Int(2)),
("now".to_string(), Value::Int(84)),
("dwell".to_string(), Value::Int(250)),
]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 2}) RETURN m.clicks AS clicks, m.last_clicked_at AS last_clicked_at, m.total_dwell_time_ms AS total_dwell_time_ms, m.access_count AS access_count, m.last_accessed_at AS last_accessed_at",
),
ExpectedRows::Exact(vec![compatibility_row([
("clicks", Value::Int(1)),
("last_clicked_at", Value::Int(84)),
("total_dwell_time_ms", Value::Int(250)),
("access_count", Value::Int(2)),
("last_accessed_at", Value::Int(84)),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory full content update",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $id}) SET m.content = $content, m.title = $title, m.semantic_field = $semantic_field, m.importance = $importance, m.confidence = $confidence, m.unit_type = $unit_type, m.source = $source, m.source_range = $source_range, m.space_id = $space_id, m.updated_at = $updated_at, m.reindex_needed = $reindex_needed, m.review_status = $review_status, m.extraction_method = $extraction_method",
BTreeMap::from([
(
"id".to_string(),
Value::String("memory-full-update-1".to_string()),
),
(
"content".to_string(),
Value::String("Updated memory content".to_string()),
),
(
"title".to_string(),
Value::String("Updated Memory".to_string()),
),
(
"semantic_field".to_string(),
Value::String("Updated Memory\nUpdated memory content".to_string()),
),
("importance".to_string(), Value::Float(0.83)),
("confidence".to_string(), Value::Float(0.91)),
("unit_type".to_string(), Value::String("fact".to_string())),
("source".to_string(), Value::String("fixture".to_string())),
("source_range".to_string(), Value::Null),
("space_id".to_string(), Value::String("default".to_string())),
("updated_at".to_string(), Value::Int(0)),
("reindex_needed".to_string(), Value::Bool(true)),
(
"review_status".to_string(),
Value::String("pending".to_string()),
),
(
"extraction_method".to_string(),
Value::String("manual".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-full-update-1', content: 'old', title: 'Old', status: 'fixture', lifecycle_state: 'archived', reindex_needed: false})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'memory-full-update-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"null predicate",
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.status IS NULL RETURN m.id AS id ORDER BY id ASC",
),
ExpectedRows::Exact(vec![
compatibility_row([("id", Value::Int(1))]),
compatibility_row([("id", Value::Int(2))]),
compatibility_row([("id", Value::Int(3))]),
]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"entity alias list lookup",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) WHERE list_contains(e.aliases, $name) RETURN e.id AS id",
BTreeMap::from([(
"name".to_string(),
Value::String("Ferris".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([("id", Value::Int(10))])]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"entity reusable exact lookup",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {name: $name, entity_type: $entity_type}) RETURN e.id, e.name, e.aliases, e.entity_created, e.entity_ended, e.temporal_precision, e.temporal_confidence, e.temporal_context, e.description LIMIT 1",
BTreeMap::from([
(
"name".to_string(),
Value::String("Reusable Exact".to_string()),
),
(
"entity_type".to_string(),
Value::String("concept".to_string()),
),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"e.id",
Value::String("entity-reusable-exact-1".to_string()),
),
("e.name", Value::String("Reusable Exact".to_string())),
(
"e.aliases",
Value::List(vec![Value::String("Exact Alias".to_string())]),
),
(
"e.entity_created",
Value::String("2024-01-01".to_string()),
),
("e.entity_ended", Value::Null),
(
"e.temporal_precision",
Value::String("day".to_string()),
),
("e.temporal_confidence", Value::Float(0.75)),
(
"e.temporal_context",
Value::String("exact context".to_string()),
),
(
"e.description",
Value::String("Exact reusable entity".to_string()),
),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-reusable-exact-1', name: 'Reusable Exact', entity_type: 'concept', aliases: ['Exact Alias'], entity_created: '2024-01-01', entity_ended: NULL, temporal_precision: 'day', temporal_confidence: 0.75, temporal_context: 'exact context', description: 'Exact reusable entity', updated_at: 10})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'entity-reusable-exact-1'}) DETACH DELETE e",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"entity reusable lowercase lookup",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) WHERE e.entity_type = $entity_type AND LOWER(e.name) = LOWER($name) RETURN e.id, e.name, e.aliases, e.entity_created, e.entity_ended, e.temporal_precision, e.temporal_confidence, e.temporal_context, e.description LIMIT 1",
BTreeMap::from([
(
"name".to_string(),
Value::String("reusable case".to_string()),
),
(
"entity_type".to_string(),
Value::String("concept".to_string()),
),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"e.id",
Value::String("entity-reusable-lowercase-1".to_string()),
),
("e.name", Value::String("Reusable Case".to_string())),
("e.aliases", Value::List(vec![])),
(
"e.entity_created",
Value::String("2023-01-01".to_string()),
),
("e.entity_ended", Value::Null),
(
"e.temporal_precision",
Value::String("year".to_string()),
),
("e.temporal_confidence", Value::Float(0.5)),
("e.temporal_context", Value::Null),
(
"e.description",
Value::String("Case reusable entity".to_string()),
),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-reusable-lowercase-1', name: 'Reusable Case', entity_type: 'concept', aliases: [], entity_created: '2023-01-01', entity_ended: NULL, temporal_precision: 'year', temporal_confidence: 0.5, temporal_context: NULL, description: 'Case reusable entity', updated_at: 20})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'entity-reusable-lowercase-1'}) DETACH DELETE e",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"entity reusable alias lookup",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) WHERE e.entity_type = $entity_type AND list_contains(e.aliases, $name) RETURN e.id, e.name, e.aliases, e.entity_created, e.entity_ended, e.temporal_precision, e.temporal_confidence, e.temporal_context, e.description LIMIT 1",
BTreeMap::from([
(
"name".to_string(),
Value::String("Reusable Alias".to_string()),
),
(
"entity_type".to_string(),
Value::String("concept".to_string()),
),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"e.id",
Value::String("entity-reusable-alias-1".to_string()),
),
("e.name", Value::String("Reusable Alias Owner".to_string())),
(
"e.aliases",
Value::List(vec![Value::String("Reusable Alias".to_string())]),
),
("e.entity_created", Value::Null),
("e.entity_ended", Value::Null),
("e.temporal_precision", Value::Null),
("e.temporal_confidence", Value::Null),
("e.temporal_context", Value::Null),
(
"e.description",
Value::String("Alias reusable entity".to_string()),
),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-reusable-alias-1', name: 'Reusable Alias Owner', entity_type: 'concept', aliases: ['Reusable Alias'], entity_created: NULL, entity_ended: NULL, temporal_precision: NULL, temporal_confidence: NULL, temporal_context: NULL, description: 'Alias reusable entity', updated_at: 30})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'entity-reusable-alias-1'}) DETACH DELETE e",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"entity reusable same-type bounded scan",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) WHERE e.entity_type = $entity_type RETURN e.id, e.name, e.aliases, e.entity_created, e.entity_ended, e.temporal_precision, e.temporal_confidence, e.temporal_context, e.description ORDER BY e.updated_at DESC LIMIT $limit",
BTreeMap::from([
(
"entity_type".to_string(),
Value::String("scan-concept".to_string()),
),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"e.id",
Value::String("entity-reusable-scan-new".to_string()),
),
("e.name", Value::String("Reusable Scan New".to_string())),
(
"e.aliases",
Value::List(vec![Value::String("Scan New".to_string())]),
),
(
"e.entity_created",
Value::String("2024-02-01".to_string()),
),
("e.entity_ended", Value::Null),
(
"e.temporal_precision",
Value::String("day".to_string()),
),
("e.temporal_confidence", Value::Float(0.9)),
(
"e.temporal_context",
Value::String("scan context".to_string()),
),
(
"e.description",
Value::String("New scan reusable entity".to_string()),
),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-reusable-scan-old', name: 'Reusable Scan Old', entity_type: 'scan-concept', aliases: ['Scan Old'], entity_created: '2024-01-01', entity_ended: NULL, temporal_precision: 'day', temporal_confidence: 0.6, temporal_context: 'old scan context', description: 'Old scan reusable entity', updated_at: 10})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-reusable-scan-new', name: 'Reusable Scan New', entity_type: 'scan-concept', aliases: ['Scan New'], entity_created: '2024-02-01', entity_ended: NULL, temporal_precision: 'day', temporal_confidence: 0.9, temporal_context: 'scan context', description: 'New scan reusable entity', updated_at: 20})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity) WHERE e.entity_type = 'scan-concept' DETACH DELETE e",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"entity temporal metadata update write",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {id: $id}) SET e.aliases = $aliases, e.entity_created = $entity_created, e.entity_ended = $entity_ended, e.temporal_precision = $temporal_precision, e.temporal_confidence = $temporal_confidence, e.temporal_context = $temporal_context, e.updated_at = $updated_at",
BTreeMap::from([
(
"id".to_string(),
Value::String("entity-temporal-update-1".to_string()),
),
(
"aliases".to_string(),
Value::List(vec![Value::String("Updated Alias".to_string())]),
),
(
"entity_created".to_string(),
Value::String("2024-03-01".to_string()),
),
("entity_ended".to_string(), Value::Null),
(
"temporal_precision".to_string(),
Value::String("day".to_string()),
),
("temporal_confidence".to_string(), Value::Float(0.8)),
(
"temporal_context".to_string(),
Value::String("updated context".to_string()),
),
("updated_at".to_string(), Value::Int(40)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-temporal-update-1', name: 'Temporal Update', entity_type: 'concept', aliases: ['Old Alias'], entity_created: NULL, entity_ended: NULL, temporal_precision: NULL, temporal_confidence: NULL, temporal_context: NULL, updated_at: 1})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'entity-temporal-update-1'}) DETACH DELETE e",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"entity temporal create write",
CypherFixtureStatement::with_parameters(
"CREATE (e:Entity { id: $id, name: $name, entity_type: $entity_type, description: $description, aliases: $aliases, confidence: $confidence, entity_created: $entity_created, entity_ended: $entity_ended, temporal_precision: $temporal_precision, temporal_confidence: $temporal_confidence, temporal_context: $temporal_context, created_at: $created_at, updated_at: $updated_at, metadata: $metadata })",
BTreeMap::from([
(
"id".to_string(),
Value::String("entity-temporal-create-1".to_string()),
),
(
"name".to_string(),
Value::String("Temporal Create".to_string()),
),
(
"entity_type".to_string(),
Value::String("concept".to_string()),
),
(
"description".to_string(),
Value::String("Created temporal entity".to_string()),
),
(
"aliases".to_string(),
Value::List(vec![Value::String("Created Alias".to_string())]),
),
("confidence".to_string(), Value::Float(0.95)),
(
"entity_created".to_string(),
Value::String("2024-04-01".to_string()),
),
("entity_ended".to_string(), Value::Null),
(
"temporal_precision".to_string(),
Value::String("day".to_string()),
),
("temporal_confidence".to_string(), Value::Float(0.85)),
(
"temporal_context".to_string(),
Value::String("created context".to_string()),
),
("created_at".to_string(), Value::Int(50)),
("updated_at".to_string(), Value::Int(50)),
("metadata".to_string(), Value::String("{}".to_string())),
]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'entity-temporal-create-1'}) DETACH DELETE e",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"entity mention relationship create",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $memory_id}), (e:Entity {id: $entity_id}) CREATE (m)-[:MENTIONS { confidence: $confidence, mention_count: 1, created_at: $created_at, properties: $properties }]->(e)",
BTreeMap::from([
(
"memory_id".to_string(),
Value::String("entity-mention-memory-1".to_string()),
),
(
"entity_id".to_string(),
Value::String("entity-mention-entity-1".to_string()),
),
("confidence".to_string(), Value::Float(0.7)),
("created_at".to_string(), Value::Int(60)),
(
"properties".to_string(),
Value::String("{\"source_memory_id\":\"entity-mention-memory-1\"}".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'entity-mention-memory-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-mention-entity-1', name: 'Mention Entity'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['entity-mention-memory-1', 'entity-mention-entity-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"entity temporal relationship create",
CypherFixtureStatement::with_parameters(
"MATCH (source:Entity {id: $source_entity_id}), (target:Entity {id: $target_entity_id}) CREATE (source)-[:RELATES_TO { relation_type: $relation_type, strength: $confidence, confidence: $confidence, context: $context, conditions: $conditions, temporal_info: $temporal_info, source_reference: $source_reference, bidirectional: false, created_at: $created_at, properties: $properties, temporal_type: $temporal_type, rel_start: $rel_start, rel_end: $rel_end, temporal_precision: $temporal_precision, is_ongoing: $is_ongoing, temporal_confidence: $temporal_confidence }]->(target)",
BTreeMap::from([
(
"source_entity_id".to_string(),
Value::String("entity-rel-source-1".to_string()),
),
(
"target_entity_id".to_string(),
Value::String("entity-rel-target-1".to_string()),
),
(
"relation_type".to_string(),
Value::String("supports".to_string()),
),
("confidence".to_string(), Value::Float(0.82)),
(
"context".to_string(),
Value::String("relationship context".to_string()),
),
(
"conditions".to_string(),
Value::String("when active".to_string()),
),
(
"temporal_info".to_string(),
Value::String("since 2024".to_string()),
),
(
"source_reference".to_string(),
Value::String("entity-rel-source-memory".to_string()),
),
("created_at".to_string(), Value::Int(70)),
(
"properties".to_string(),
Value::String("{\"reasoning\":\"test\"}".to_string()),
),
(
"temporal_type".to_string(),
Value::String("ongoing".to_string()),
),
(
"rel_start".to_string(),
Value::String("2024-01-01".to_string()),
),
("rel_end".to_string(), Value::Null),
(
"temporal_precision".to_string(),
Value::String("day".to_string()),
),
("is_ongoing".to_string(), Value::Bool(true)),
("temporal_confidence".to_string(), Value::Float(0.77)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-rel-source-1', name: 'Relationship Source'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-rel-target-1', name: 'Relationship Target'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['entity-rel-source-1', 'entity-rel-target-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"entity total count read",
CypherFixtureStatement::new("MATCH (e:Entity) RETURN count(e)"),
ExpectedRows::Exact(vec![compatibility_row([("count(e)", Value::Int(2))])]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"current timestamp write",
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 3}) SET m.updated_at = CURRENT_TIMESTAMP()",
),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"timestamp cutoff predicate",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.updated_at > timestamp($cutoff) RETURN count(m) AS total",
BTreeMap::from([(
"cutoff".to_string(),
Value::String("1970-01-01T00:00:00".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([("total", Value::Int(1))])]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"cast timestamp cleanup coverage predicate",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE (m.is_crystal IS NULL OR m.is_crystal = false) AND (m.is_latest IS NULL OR m.is_latest = true) AND (m.lifecycle_state IS NULL OR m.lifecycle_state = 'active') AND m.created_at IS NOT NULL AND m.created_at >= CAST($recent_7d AS TIMESTAMP) RETURN count(m) AS total",
BTreeMap::from([(
"recent_7d".to_string(),
Value::String("1970-01-01T00:00:00".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([("total", Value::Int(1))])]),
)
.with_setup_query(CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: 1}) SET m.created_at = timestamp($created_at)",
BTreeMap::from([(
"created_at".to_string(),
Value::String("1970-01-02T00:00:00".to_string()),
)]),
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"analyzable corpus max updated fingerprint",
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE (m.is_crystal IS NULL OR m.is_crystal = false) AND (m.is_latest IS NULL OR m.is_latest = true) AND (m.lifecycle_state IS NULL OR m.lifecycle_state = 'active') RETURN count(m), max(m.updated_at)",
),
ExpectedRows::Exact(vec![compatibility_row([
("count(m)", Value::Int(2)),
("max(m.updated_at)", Value::Int(172800000000000)),
])]),
)
.with_setup_query(CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: 1}) SET m.updated_at = timestamp($updated_at)",
BTreeMap::from([(
"updated_at".to_string(),
Value::String("1970-01-02T00:00:00".to_string()),
)]),
))
.with_setup_query(CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: 2}) SET m.updated_at = timestamp($updated_at)",
BTreeMap::from([(
"updated_at".to_string(),
Value::String("1970-01-03T00:00:00".to_string()),
)]),
)),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"list predicate and pagination",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN [1, $id, 3] RETURN m.title AS title ORDER BY title DESC SKIP 1 LIMIT 1",
BTreeMap::from([("id".to_string(), Value::Int(2))]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"title",
Value::String("Graph foundations".to_string()),
)])]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"grouped aggregation",
CypherFixtureStatement::new(
"MATCH (m:Memory) RETURN m.kind AS kind, count(*) AS total ORDER BY total DESC, kind ASC",
),
ExpectedRows::Exact(vec![
compatibility_row([
("kind", Value::String("note".to_string())),
("total", Value::Int(2)),
]),
compatibility_row([
("kind", Value::String("decision".to_string())),
("total", Value::Int(1)),
]),
]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"health average read",
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.is_crystal = false RETURN count(m), avg(m.decay_score_cached)",
),
ExpectedRows::Exact(vec![compatibility_row([
("count(m)", Value::Int(2)),
("avg(m.decay_score_cached)", Value::Float(0.5)),
])]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"health stale count read",
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.is_crystal = false AND m.decay_score_cached < 0.5 RETURN count(m)",
),
ExpectedRows::Exact(vec![compatibility_row([("count(m)", Value::Int(1))])]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"activity digest recent memory read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.created_at >= $cutoff AND (m.is_crystal IS NULL OR m.is_crystal = false) RETURN m.id, m.title, m.unit_type, m.importance, m.created_at ORDER BY m.created_at DESC LIMIT 20",
BTreeMap::from([(
"cutoff".to_string(),
Value::Int(1_000_000_000_000_000),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("m.id", Value::String("digest-memory-1".to_string())),
("m.title", Value::String("Digest Memory".to_string())),
("m.unit_type", Value::String("fact".to_string())),
("m.importance", Value::Float(0.7)),
("m.created_at", Value::Int(2_000_000_000_000_000)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'digest-memory-1', title: 'Digest Memory', unit_type: 'fact', importance: 0.7, is_crystal: false, created_at: 2000000000000000})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'digest-memory-crystal', title: 'Digest Crystal', unit_type: 'context', importance: 0.9, is_crystal: true, created_at: 2100000000000000})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['digest-memory-1', 'digest-memory-crystal'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"activity digest recent evolves read",
CypherFixtureStatement::with_parameters(
"MATCH (newer:Memory)-[e:EVOLVES]->(older:Memory) WHERE e.created_at >= $cutoff RETURN newer.id, newer.title, older.id, older.title, e.content_relation, e.created_at ORDER BY e.created_at DESC LIMIT 10",
BTreeMap::from([("cutoff".to_string(), Value::Int(1000))]),
),
ExpectedRows::Exact(vec![compatibility_row([
("newer.id", Value::String("digest-evolves-newer".to_string())),
("newer.title", Value::String("Newer Digest".to_string())),
("older.id", Value::String("digest-evolves-older".to_string())),
("older.title", Value::String("Older Digest".to_string())),
("e.content_relation", Value::String("updates".to_string())),
("e.created_at", Value::Int(3000)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'digest-evolves-newer', title: 'Newer Digest'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'digest-evolves-older', title: 'Older Digest'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'digest-evolves-old-newer', title: 'Old Newer Digest'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'digest-evolves-old-older', title: 'Old Older Digest'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (newer:Memory {id: 'digest-evolves-newer'}), (older:Memory {id: 'digest-evolves-older'}) CREATE (newer)-[:EVOLVES {content_relation: 'updates', created_at: 3000}]->(older)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (newer:Memory {id: 'digest-evolves-old-newer'}), (older:Memory {id: 'digest-evolves-old-older'}) CREATE (newer)-[:EVOLVES {content_relation: 'older', created_at: 500}]->(older)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['digest-evolves-newer', 'digest-evolves-older', 'digest-evolves-old-newer', 'digest-evolves-old-older'] DETACH DELETE m",
),
ExpectedRows::RowCount(4),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"activity digest recent crystal read",
CypherFixtureStatement::with_parameters(
"MATCH (c:Memory) WHERE c.is_crystal = true AND c.created_at >= $cutoff RETURN c.id, c.title, c.created_at ORDER BY c.created_at DESC LIMIT 5",
BTreeMap::from([("cutoff".to_string(), Value::Int(1000))]),
),
ExpectedRows::Exact(vec![compatibility_row([
("c.id", Value::String("digest-crystal-1".to_string())),
("c.title", Value::String("Digest Crystal One".to_string())),
("c.created_at", Value::Int(4000)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'digest-crystal-1', title: 'Digest Crystal One', is_crystal: true, created_at: 4000})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'digest-crystal-old', title: 'Digest Crystal Old', is_crystal: true, created_at: 500})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['digest-crystal-1', 'digest-crystal-old'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"activity digest recent source read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source) WHERE s.created_at >= $cutoff RETURN s.id, s.original_name, s.source_type, s.lifecycle_state, s.memory_count ORDER BY s.created_at DESC LIMIT 10",
BTreeMap::from([("cutoff".to_string(), Value::Int(1000))]),
),
ExpectedRows::Exact(vec![compatibility_row([
("s.id", Value::String("digest-source-1".to_string())),
("s.original_name", Value::String("Digest Source".to_string())),
("s.source_type", Value::String("file".to_string())),
("s.lifecycle_state", Value::String("indexed".to_string())),
("s.memory_count", Value::Int(2)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'digest-source-1', original_name: 'Digest Source', source_type: 'file', lifecycle_state: 'indexed', memory_count: 2, created_at: 2000})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'digest-source-old', original_name: 'Old Digest Source', source_type: 'file', lifecycle_state: 'parsed', memory_count: 1, created_at: 500})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source) WHERE s.id IN ['digest-source-1', 'digest-source-old'] DETACH DELETE s",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"activity task crystal memory read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.created_at >= $cutoff AND (m.is_crystal IS NULL OR m.is_crystal = false) RETURN m.id, m.title, m.unit_type, m.importance, m.created_at ORDER BY m.created_at DESC LIMIT 30",
BTreeMap::from([(
"cutoff".to_string(),
Value::Int(1_000_000_000_000_000),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("m.id", Value::String("task-crystal-memory-1".to_string())),
("m.title", Value::String("Task Crystal Candidate".to_string())),
("m.unit_type", Value::String("fact".to_string())),
("m.importance", Value::Float(0.8)),
("m.created_at", Value::Int(2_200_000_000_000_000)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'task-crystal-memory-1', title: 'Task Crystal Candidate', unit_type: 'fact', importance: 0.8, is_crystal: false, created_at: 2200000000000000})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'task-crystal-memory-old', title: 'Old Task Crystal Candidate', unit_type: 'fact', importance: 0.2, is_crystal: false, created_at: 500})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['task-crystal-memory-1', 'task-crystal-memory-old'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"activity task crystallized source id read",
CypherFixtureStatement::new(
"MATCH (c:Memory {is_crystal: true})-[:SYNTHESIZED_FROM]->(s:Memory) RETURN DISTINCT s.id",
),
ExpectedRows::Exact(vec![compatibility_row([(
"s.id",
Value::String("task-crystallized-source".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'task-crystallized-crystal', is_crystal: true})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'task-crystallized-source', is_crystal: false})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (c:Memory {id: 'task-crystallized-crystal'}), (s:Memory {id: 'task-crystallized-source'}) CREATE (c)-[:SYNTHESIZED_FROM]->(s)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['task-crystallized-crystal', 'task-crystallized-source'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"activity task challenge edge read",
CypherFixtureStatement::new(
"MATCH (newer:Memory)-[e:EVOLVES {content_relation: 'challenges'}]->(older:Memory) RETURN newer.id, newer.title, older.id, older.title, e.created_at ORDER BY e.created_at DESC LIMIT 10",
),
ExpectedRows::Exact(vec![compatibility_row([
("newer.id", Value::String("task-challenge-newer".to_string())),
("newer.title", Value::String("Challenge Newer".to_string())),
("older.id", Value::String("task-challenge-older".to_string())),
("older.title", Value::String("Challenge Older".to_string())),
("e.created_at", Value::Int(2300)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'task-challenge-newer', title: 'Challenge Newer'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'task-challenge-older', title: 'Challenge Older'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (newer:Memory {id: 'task-challenge-newer'}), (older:Memory {id: 'task-challenge-older'}) CREATE (newer)-[:EVOLVES {content_relation: 'challenges', created_at: 2300}]->(older)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['task-challenge-newer', 'task-challenge-older'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"activity task decision memory read",
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.unit_type = 'decision' RETURN m.id, m.title, m.created_at, m.importance ORDER BY m.created_at DESC LIMIT 20",
),
ExpectedRows::Exact(vec![compatibility_row([
("m.id", Value::String("task-decision-1".to_string())),
("m.title", Value::String("Task Decision".to_string())),
("m.created_at", Value::Int(2400)),
("m.importance", Value::Float(0.9)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'task-decision-1', title: 'Task Decision', unit_type: 'decision', created_at: 2400, importance: 0.9})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'task-decision-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"activity task source attention read",
CypherFixtureStatement::new(
"MATCH (s:Source) WHERE s.lifecycle_state = 'ingested' OR s.lifecycle_state = 'parsed' OR s.lifecycle_state = 'chunked' OR s.lifecycle_state = 'error' RETURN s.id, s.original_name, s.lifecycle_state, s.memory_count, s.created_at ORDER BY s.created_at ASC LIMIT 15",
),
ExpectedRows::Exact(vec![compatibility_row([
("s.id", Value::String("task-source-attention-1".to_string())),
(
"s.original_name",
Value::String("Task Source Attention".to_string()),
),
("s.lifecycle_state", Value::String("parsed".to_string())),
("s.memory_count", Value::Int(3)),
("s.created_at", Value::Int(2500)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'task-source-attention-1', original_name: 'Task Source Attention', lifecycle_state: 'parsed', memory_count: 3, created_at: 2500})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'task-source-attention-done', original_name: 'Task Source Done', lifecycle_state: 'indexed', memory_count: 1, created_at: 2400})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source) WHERE s.id IN ['task-source-attention-1', 'task-source-attention-done'] DETACH DELETE s",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"activity task evolves cluster read",
CypherFixtureStatement::new(
"MATCH (m:Memory)-[:EVOLVES]-(other:Memory) WHERE (m.is_crystal IS NULL OR m.is_crystal = false) AND (other.is_crystal IS NULL OR other.is_crystal = false) RETURN m.id, m.title, m.unit_type, count(DISTINCT other) as neighbor_count ORDER BY neighbor_count DESC LIMIT 30",
),
ExpectedRows::Exact(vec![
compatibility_row([
("m.id", Value::String("task-evolves-cluster-a".to_string())),
(
"m.title",
Value::String("Task Evolves Cluster A".to_string()),
),
("m.unit_type", Value::String("fact".to_string())),
("neighbor_count", Value::Int(1)),
]),
compatibility_row([
("m.id", Value::String("task-evolves-cluster-b".to_string())),
(
"m.title",
Value::String("Task Evolves Cluster B".to_string()),
),
("m.unit_type", Value::String("fact".to_string())),
("neighbor_count", Value::Int(1)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'task-evolves-cluster-a', title: 'Task Evolves Cluster A', unit_type: 'fact', is_crystal: false})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'task-evolves-cluster-b', title: 'Task Evolves Cluster B', unit_type: 'fact', is_crystal: false})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Memory {id: 'task-evolves-cluster-a'}), (b:Memory {id: 'task-evolves-cluster-b'}) CREATE (a)-[:EVOLVES]->(b)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['task-evolves-cluster-a', 'task-evolves-cluster-b'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory evolves relation lookup",
CypherFixtureStatement::with_parameters(
"MATCH (a:Memory)-[r:EVOLVES]->(b:Memory) WHERE a.id = $older_id AND b.id = $newer_id RETURN r.content_relation",
BTreeMap::from([
(
"older_id".to_string(),
Value::String("evolves-relation-older".to_string()),
),
(
"newer_id".to_string(),
Value::String("evolves-relation-newer".to_string()),
),
]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"r.content_relation",
Value::String("confirms".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'evolves-relation-older'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'evolves-relation-newer'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Memory {id: 'evolves-relation-older'}), (b:Memory {id: 'evolves-relation-newer'}) CREATE (a)-[:EVOLVES {content_relation: 'confirms'}]->(b)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['evolves-relation-older', 'evolves-relation-newer'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"activity task compaction evolves read",
CypherFixtureStatement::with_parameters(
"MATCH (a:Memory)-[e:EVOLVES]-(b:Memory) WHERE a.id IN $ids AND b.id IN $ids RETURN a.id, b.id, e.content_relation",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![
Value::String("compaction-evolves-a".to_string()),
Value::String("compaction-evolves-b".to_string()),
]),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("a.id", Value::String("compaction-evolves-a".to_string())),
("b.id", Value::String("compaction-evolves-b".to_string())),
("e.content_relation", Value::String("updates".to_string())),
]),
compatibility_row([
("a.id", Value::String("compaction-evolves-b".to_string())),
("b.id", Value::String("compaction-evolves-a".to_string())),
("e.content_relation", Value::String("updates".to_string())),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'compaction-evolves-a', title: 'Compaction A'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'compaction-evolves-b', title: 'Compaction B'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'compaction-evolves-outside', title: 'Compaction Outside'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Memory {id: 'compaction-evolves-a'}), (b:Memory {id: 'compaction-evolves-b'}) CREATE (a)-[:EVOLVES {content_relation: 'updates'}]->(b)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Memory {id: 'compaction-evolves-a'}), (b:Memory {id: 'compaction-evolves-outside'}) CREATE (a)-[:EVOLVES {content_relation: 'outside'}]->(b)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['compaction-evolves-a', 'compaction-evolves-b', 'compaction-evolves-outside'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory evolves outgoing context read",
CypherFixtureStatement::with_parameters(
"MATCH (a:Memory)-[e:EVOLVES]->(b:Memory) WHERE a.id IN $ids RETURN a.id, b.id, b.title, e.content_relation ORDER BY b.updated_at DESC LIMIT $limit",
BTreeMap::from([
(
"ids".to_string(),
Value::List(vec![
Value::String("repo-evolves-older".to_string()),
Value::String("missing-repo-evolves".to_string()),
]),
),
("limit".to_string(), Value::Int(3)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
("a.id", Value::String("repo-evolves-older".to_string())),
("b.id", Value::String("repo-evolves-newer".to_string())),
("b.title", Value::String("Repo Newer".to_string())),
(
"e.content_relation",
Value::String("supersedes".to_string()),
),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'repo-evolves-older', title: 'Repo Older', updated_at: 10})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'repo-evolves-newer', title: 'Repo Newer', updated_at: 20})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Memory {id: 'repo-evolves-older'}), (b:Memory {id: 'repo-evolves-newer'}) CREATE (a)-[:EVOLVES {content_relation: 'supersedes'}]->(b)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['repo-evolves-older', 'repo-evolves-newer'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory evolves incoming context read",
CypherFixtureStatement::with_parameters(
"MATCH (a:Memory)-[e:EVOLVES]->(b:Memory) WHERE b.id IN $ids RETURN b.id, a.id, a.title, e.content_relation ORDER BY a.updated_at DESC LIMIT $limit",
BTreeMap::from([
(
"ids".to_string(),
Value::List(vec![
Value::String("repo-evolves-target".to_string()),
Value::String("missing-repo-evolves".to_string()),
]),
),
("limit".to_string(), Value::Int(3)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
("b.id", Value::String("repo-evolves-target".to_string())),
("a.id", Value::String("repo-evolves-source".to_string())),
("a.title", Value::String("Repo Source".to_string())),
("e.content_relation", Value::String("updates".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'repo-evolves-source', title: 'Repo Source', updated_at: 30})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'repo-evolves-target', title: 'Repo Target', updated_at: 40})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Memory {id: 'repo-evolves-source'}), (b:Memory {id: 'repo-evolves-target'}) CREATE (a)-[:EVOLVES {content_relation: 'updates'}]->(b)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['repo-evolves-source', 'repo-evolves-target'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp memory evolves outgoing read",
CypherFixtureStatement::with_parameters(
"MATCH (a:Memory)-[e:EVOLVES]->(b:Memory) WHERE a.id = $id RETURN b.id, b.title, e.content_relation, e.confidence, e.reviewed, b.is_latest",
BTreeMap::from([(
"id".to_string(),
Value::String("mcp-evolves-source".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("b.id", Value::String("mcp-evolves-target".to_string())),
("b.title", Value::String("MCP Evolves Target".to_string())),
(
"e.content_relation",
Value::String("supersedes".to_string()),
),
("e.confidence", Value::Float(0.82)),
("e.reviewed", Value::Bool(true)),
("b.is_latest", Value::Bool(true)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-evolves-source', title: 'MCP Evolves Source', is_latest: false})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-evolves-target', title: 'MCP Evolves Target', is_latest: true})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Memory {id: 'mcp-evolves-source'}), (b:Memory {id: 'mcp-evolves-target'}) CREATE (a)-[:EVOLVES {content_relation: 'supersedes', confidence: 0.82, reviewed: true}]->(b)",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp memory evolves incoming read",
CypherFixtureStatement::with_parameters(
"MATCH (a:Memory)-[e:EVOLVES]->(b:Memory) WHERE b.id = $id RETURN a.id, a.title, e.content_relation, e.confidence, e.reviewed, a.is_latest",
BTreeMap::from([(
"id".to_string(),
Value::String("mcp-evolves-target".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("a.id", Value::String("mcp-evolves-source".to_string())),
("a.title", Value::String("MCP Evolves Source".to_string())),
(
"e.content_relation",
Value::String("supersedes".to_string()),
),
("e.confidence", Value::Float(0.82)),
("e.reviewed", Value::Bool(true)),
("a.is_latest", Value::Bool(false)),
])]),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['mcp-evolves-source', 'mcp-evolves-target'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"activity task oldest crystal read",
CypherFixtureStatement::new(
"MATCH (c:Memory) WHERE c.is_crystal = true RETURN c.id, c.title, c.created_at, c.last_evaluated_at, c.review_status ORDER BY c.created_at ASC LIMIT 10",
),
ExpectedRows::Exact(vec![
compatibility_row([
("c.id", Value::Int(3)),
("c.title", Value::String("Cloud projection".to_string())),
("c.created_at", Value::Null),
("c.last_evaluated_at", Value::Null),
("c.review_status", Value::Null),
]),
compatibility_row([
("c.id", Value::String("task-oldest-crystal-1".to_string())),
("c.title", Value::String("Task Oldest Crystal".to_string())),
("c.created_at", Value::Int(-1000)),
("c.last_evaluated_at", Value::Int(-500)),
("c.review_status", Value::String("pending".to_string())),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'task-oldest-crystal-1', title: 'Task Oldest Crystal', is_crystal: true, created_at: -1000, last_evaluated_at: -500, review_status: 'pending'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'task-oldest-crystal-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"activity task stale crystal source read",
CypherFixtureStatement::new(
"MATCH (c:Memory {is_crystal: true})-[:SYNTHESIZED_FROM]->(src:Memory) MATCH (src)-[:EVOLVES]-(newer:Memory) WHERE newer.created_at > c.created_at AND c.review_status <> 'dismissed' RETURN c.id, c.title, newer.id, newer.title, newer.created_at, c.review_status ORDER BY newer.created_at DESC LIMIT 10",
),
ExpectedRows::Exact(vec![compatibility_row([
("c.id", Value::String("task-stale-crystal".to_string())),
("c.title", Value::String("Task Stale Crystal".to_string())),
("newer.id", Value::String("task-stale-newer".to_string())),
("newer.title", Value::String("Task Stale Newer".to_string())),
("newer.created_at", Value::Int(4000)),
("c.review_status", Value::String("pending".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'task-stale-crystal', title: 'Task Stale Crystal', is_crystal: true, created_at: 3000, review_status: 'pending'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'task-stale-source', title: 'Task Stale Source', is_crystal: false})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'task-stale-newer', title: 'Task Stale Newer', is_crystal: false, created_at: 4000})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (c:Memory {id: 'task-stale-crystal'}), (src:Memory {id: 'task-stale-source'}) CREATE (c)-[:SYNTHESIZED_FROM]->(src)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (src:Memory {id: 'task-stale-source'}), (newer:Memory {id: 'task-stale-newer'}) CREATE (src)-[:EVOLVES]->(newer)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['task-stale-crystal', 'task-stale-source', 'task-stale-newer'] DETACH DELETE m",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"distinct relationship aggregation",
CypherFixtureStatement::new(
"MATCH (m:Memory)-[:MENTIONS]->(e:Entity) RETURN count(DISTINCT m) AS memories, count(DISTINCT e.id) AS entities",
),
ExpectedRows::Exact(vec![compatibility_row([
("memories", Value::Int(2)),
("entities", Value::Int(2)),
])]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"relationship min aggregation",
CypherFixtureStatement::new(
"MATCH (:Memory)-[r:MENTIONS]->(:Entity) RETURN count(*), min(r.weight)",
),
ExpectedRows::Exact(vec![compatibility_row([
("count(*)", Value::Int(2)),
("min(r.weight)", Value::Int(3)),
])]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"node property pattern read",
CypherFixtureStatement::new(
"MATCH (m:Memory {kind: 'note'})-[:MENTIONS]->(e:Entity {name: 'Rust'}) RETURN DISTINCT m.id AS id",
),
ExpectedRows::Exact(vec![compatibility_row([("id", Value::Int(1))])]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"undirected evolves read",
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 3})-[:EVOLVES]-(other:Memory) RETURN DISTINCT other.id AS id",
),
ExpectedRows::Exact(vec![compatibility_row([("id", Value::Int(2))])]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"evolves progression list read",
CypherFixtureStatement::with_parameters(
"MATCH (older:Memory)-[e:EVOLVES]->(newer:Memory) WHERE (older.unit_type IN $types OR newer.unit_type IN $types) RETURN older.id, newer.id, e.content_relation, e.is_progression, older.unit_type, newer.unit_type, older.title, newer.title, older.created_at, newer.created_at, older.is_latest, newer.is_latest, older.space_id, newer.space_id ORDER BY newer.created_at DESC LIMIT 500",
BTreeMap::from([(
"types".to_string(),
Value::List(vec![Value::String("context".to_string())]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("older.id", Value::Int(2)),
("newer.id", Value::Int(3)),
(
"e.content_relation",
Value::String("supersedes".to_string()),
),
("e.is_progression", Value::Bool(true)),
("older.unit_type", Value::String("context".to_string())),
("newer.unit_type", Value::String("decision".to_string())),
("older.title", Value::String("Runtime strategy".to_string())),
("newer.title", Value::String("Cloud projection".to_string())),
("older.created_at", Value::Int(100)),
("newer.created_at", Value::Int(200)),
("older.is_latest", Value::Bool(false)),
("newer.is_latest", Value::Bool(true)),
("older.space_id", Value::String("default".to_string())),
("newer.space_id", Value::String("default".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 2}) SET m.unit_type = 'context', m.created_at = 100, m.is_latest = false, m.space_id = 'default'",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 3}) SET m.unit_type = 'decision', m.created_at = 200, m.is_latest = true, m.space_id = 'default'",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (older:Memory {id: 2})-[e:EVOLVES]->(newer:Memory {id: 3}) SET e.content_relation = 'supersedes', e.is_progression = true",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"context memory title preview read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.unit_type IN $types AND (m.is_latest IS NULL OR m.is_latest = true) AND (m.is_crystal IS NULL OR m.is_crystal = false) RETURN m.id, m.title ORDER BY m.created_at DESC LIMIT 400",
BTreeMap::from([(
"types".to_string(),
Value::List(vec![Value::String("context-preview".to_string())]),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("m.id", Value::String("context-preview-newer".to_string())),
("m.title", Value::String("Context Preview Newer".to_string())),
]),
compatibility_row([
("m.id", Value::String("context-preview-older".to_string())),
("m.title", Value::String("Context Preview Older".to_string())),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'context-preview-older', title: 'Context Preview Older', unit_type: 'context-preview', is_crystal: false, created_at: 1000})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'context-preview-newer', title: 'Context Preview Newer', unit_type: 'context-preview', is_latest: true, is_crystal: false, created_at: 2000})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'context-preview-stale', title: 'Context Preview Stale', unit_type: 'context-preview', is_latest: false, is_crystal: false, created_at: 3000})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'context-preview-crystal', title: 'Context Preview Crystal', unit_type: 'context-preview', is_latest: true, is_crystal: true, created_at: 4000})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'context-preview-label', name: 'Context Preview', canonical_name: 'context-preview'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'context-preview-newer'}), (l:Label {id: 'context-preview-label'}) CREATE (m)-[:HAS_LABEL]->(l)",
)),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"context memory label preview read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[:HAS_LABEL]->(l:Label) WHERE m.unit_type IN $types AND m.is_latest = true AND (m.is_crystal IS NULL OR m.is_crystal = false) RETURN l.id, l.canonical_name, l.name, m.id, m.title ORDER BY m.created_at DESC LIMIT 2000",
BTreeMap::from([(
"types".to_string(),
Value::List(vec![Value::String("context-preview".to_string())]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"l.id",
Value::String("context-preview-label".to_string()),
),
(
"l.canonical_name",
Value::String("context-preview".to_string()),
),
("l.name", Value::String("Context Preview".to_string())),
("m.id", Value::String("context-preview-newer".to_string())),
("m.title", Value::String("Context Preview Newer".to_string())),
])]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"context memory typed preview read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.unit_type IN $types AND (m.is_latest IS NULL OR m.is_latest = true) AND (m.is_crystal IS NULL OR m.is_crystal = false) RETURN m.id, m.title, m.unit_type ORDER BY m.created_at DESC LIMIT 800",
BTreeMap::from([(
"types".to_string(),
Value::List(vec![Value::String("context-preview".to_string())]),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("m.id", Value::String("context-preview-newer".to_string())),
("m.title", Value::String("Context Preview Newer".to_string())),
("m.unit_type", Value::String("context-preview".to_string())),
]),
compatibility_row([
("m.id", Value::String("context-preview-older".to_string())),
("m.title", Value::String("Context Preview Older".to_string())),
("m.unit_type", Value::String("context-preview".to_string())),
]),
]),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['context-preview-older', 'context-preview-newer', 'context-preview-stale', 'context-preview-crystal', 'context-preview-label'] DETACH DELETE n",
),
ExpectedRows::RowCount(5),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"incoming mentions read",
CypherFixtureStatement::new(
"MATCH (e:Entity {name: 'Rust'})<-[:MENTIONS]-(m:Memory) RETURN DISTINCT m.id AS id",
),
ExpectedRows::Exact(vec![compatibility_row([("id", Value::Int(1))])]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"untyped relationship label read",
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 1})-[r]->(e:Entity) RETURN label(r) AS rel_type",
),
ExpectedRows::Exact(vec![compatibility_row([(
"rel_type",
Value::String("MENTIONS".to_string()),
)])]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"multi label overview read",
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 1})-[r]-(neighbor:Entity:Memory) RETURN DISTINCT neighbor.id AS id",
),
ExpectedRows::Exact(vec![compatibility_row([("id", Value::Int(10))])]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"where matched evolves relationship create",
CypherFixtureStatement::new(
"MATCH (a:Memory), (b:Memory) WHERE a.id = 1 AND b.id = 2 CREATE (a)-[:EVOLVES {content_relation: 'replaces'}]->(b)",
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (a:Memory {id: 1})-[r:EVOLVES]->(b:Memory {id: 2}) RETURN count(r) AS total, min(r.content_relation) AS relation",
),
ExpectedRows::Exact(vec![compatibility_row([
("total", Value::Int(1)),
("relation", Value::String("replaces".to_string())),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory evolves parameterized relationship create",
CypherFixtureStatement::with_parameters(
"MATCH (a:Memory), (b:Memory) WHERE a.id = $older_id AND b.id = $newer_id CREATE (a)-[:EVOLVES { content_relation: $relation, is_progression: $is_progression, confidence: $confidence, detected_by: $detected_by, reviewed: $reviewed, reason: $reason, created_at: timestamp($now) }]->(b)",
BTreeMap::from([
(
"older_id".to_string(),
Value::String("evolves-create-older".to_string()),
),
(
"newer_id".to_string(),
Value::String("evolves-create-newer".to_string()),
),
(
"relation".to_string(),
Value::String("replaces".to_string()),
),
("is_progression".to_string(), Value::Bool(true)),
("confidence".to_string(), Value::Float(0.91)),
(
"detected_by".to_string(),
Value::String("rule".to_string()),
),
("reviewed".to_string(), Value::Bool(true)),
(
"reason".to_string(),
Value::String("fixture".to_string()),
),
("now".to_string(), Value::Int(1_700_000_019)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'evolves-create-older'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'evolves-create-newer'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['evolves-create-older', 'evolves-create-newer'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory evolves relation update",
CypherFixtureStatement::with_parameters(
"MATCH (a:Memory)-[r:EVOLVES]->(b:Memory) WHERE a.id = $older_id AND b.id = $newer_id SET r.content_relation = 'replaces', r.is_progression = true, r.confidence = $confidence, r.detected_by = $detected_by, r.reviewed = $reviewed, r.reason = $reason",
BTreeMap::from([
(
"older_id".to_string(),
Value::String("evolves-update-older".to_string()),
),
(
"newer_id".to_string(),
Value::String("evolves-update-newer".to_string()),
),
("confidence".to_string(), Value::Float(0.92)),
(
"detected_by".to_string(),
Value::String("rule".to_string()),
),
("reviewed".to_string(), Value::Bool(true)),
(
"reason".to_string(),
Value::String("fixture".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'evolves-update-older'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'evolves-update-newer'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Memory {id: 'evolves-update-older'}), (b:Memory {id: 'evolves-update-newer'}) CREATE (a)-[:EVOLVES {content_relation: 'confirms'}]->(b)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['evolves-update-older', 'evolves-update-newer'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory latest demotion update",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id = $older_id SET m.is_latest = false",
BTreeMap::from([("older_id".to_string(), Value::Int(2))]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 2}) SET m.space_id = 'default', m.is_latest = true",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 2}) RETURN m.is_latest",
),
ExpectedRows::Exact(vec![compatibility_row([(
"m.is_latest",
Value::Bool(false),
)])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory latest promotion update",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id = $newer_id SET m.is_latest = true",
BTreeMap::from([("newer_id".to_string(), Value::Int(2))]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 2}) SET m.is_latest = false",
))
.with_effect_query(
CypherFixtureStatement::new("MATCH (m:Memory {id: 2}) RETURN m.is_latest"),
ExpectedRows::Exact(vec![compatibility_row([(
"m.is_latest",
Value::Bool(true),
)])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory latest demotion in space update",
CypherFixtureStatement::with_parameters(
"MATCH (older:Memory {id: $older_id}) WHERE older.space_id = $space_id SET older.is_latest = false",
BTreeMap::from([
("older_id".to_string(), Value::Int(2)),
("space_id".to_string(), Value::String("default".to_string())),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 2}) SET m.space_id = 'default', m.is_latest = true",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 2}) RETURN m.is_latest",
),
ExpectedRows::Exact(vec![compatibility_row([(
"m.is_latest",
Value::Bool(false),
)])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source provenance relationship create",
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 1}), (e:Entity {id: 10}) CREATE (m)-[:SOURCED_FROM {chunk_index: 0}]->(e)",
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 1})-[r:SOURCED_FROM]->(e:Entity {id: 10}) RETURN count(r) AS total, min(r.chunk_index) AS first_chunk",
),
ExpectedRows::Exact(vec![compatibility_row([
("total", Value::Int(1)),
("first_chunk", Value::Int(0)),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source provenance source endpoint existence",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $memory_id}), (s:Source {id: $source_id}) RETURN count(m)",
BTreeMap::from([
(
"memory_id".to_string(),
Value::String("source-write-memory-1".to_string()),
),
(
"source_id".to_string(),
Value::String("source-write-source-1".to_string()),
),
]),
),
ExpectedRows::Exact(vec![compatibility_row([("count(m)", Value::Int(1))])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'source-write-memory-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-write-source-1', memory_count: 0})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['source-write-memory-1', 'source-write-source-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source provenance full relationship create",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $memory_id}), (s:Source {id: $source_id}) CREATE (m)-[:SOURCED_FROM { chunk_index: $chunk_index, chunk_range: $chunk_range, source_version: $source_version, created_at: $created_at }]->(s)",
BTreeMap::from([
(
"memory_id".to_string(),
Value::String("source-full-memory-1".to_string()),
),
(
"source_id".to_string(),
Value::String("source-full-source-1".to_string()),
),
("chunk_index".to_string(), Value::Int(4)),
(
"chunk_range".to_string(),
Value::String("40..80".to_string()),
),
("source_version".to_string(), Value::Int(2)),
("created_at".to_string(), Value::Int(80)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'source-full-memory-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-full-source-1', memory_count: 0})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['source-full-memory-1', 'source-full-source-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source provenance edge existence count",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $memory_id})-[r:SOURCED_FROM]->(s:Source {id: $source_id}) RETURN count(r)",
BTreeMap::from([
(
"memory_id".to_string(),
Value::String("source-edge-memory-1".to_string()),
),
(
"source_id".to_string(),
Value::String("source-edge-source-1".to_string()),
),
]),
),
ExpectedRows::Exact(vec![compatibility_row([("count(r)", Value::Int(1))])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'source-edge-memory-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-edge-source-1', memory_count: 1})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'source-edge-memory-1'}), (s:Source {id: 'source-edge-source-1'}) CREATE (m)-[:SOURCED_FROM]->(s)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['source-edge-memory-1', 'source-edge-source-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source repair exact provenance candidate scan",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE ( m.source = $source_value OR m.metadata CONTAINS $compact_fragment OR m.metadata CONTAINS $spaced_fragment ) RETURN m.id ORDER BY m.created_at ASC, m.id ASC SKIP $offset LIMIT $limit",
BTreeMap::from([
(
"source_value".to_string(),
Value::String("library:source-repair-1".to_string()),
),
(
"compact_fragment".to_string(),
Value::String("\"source_id\":\"source-repair-1\"".to_string()),
),
(
"spaced_fragment".to_string(),
Value::String("\"source_id\": \"source-repair-1\"".to_string()),
),
("offset".to_string(), Value::Int(0)),
("limit".to_string(), Value::Int(10)),
]),
),
ExpectedRows::Exact(vec![
compatibility_row([(
"m.id",
Value::String("source-repair-memory-a".to_string()),
)]),
compatibility_row([(
"m.id",
Value::String("source-repair-memory-b".to_string()),
)]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'source-repair-memory-a', source: 'library:source-repair-1', metadata: '{}', created_at: 10})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'source-repair-memory-b', source: 'mcp', metadata: '{\"source_id\":\"source-repair-1\"}', created_at: 20})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'source-repair-memory-c', source: 'manual', metadata: '{\"file\":\"source-repair-1.pdf\"}', created_at: 30})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['source-repair-memory-a', 'source-repair-memory-b', 'source-repair-memory-c'] DETACH DELETE m",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source memory count read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source {id: $id}) RETURN s.memory_count",
BTreeMap::from([(
"id".to_string(),
Value::String("source-memory-count-read-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"s.memory_count",
Value::Int(7),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-memory-count-read-1', memory_count: 7})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'source-memory-count-read-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source provenance global edge count",
CypherFixtureStatement::new(
"MATCH (:Memory)-[r:SOURCED_FROM]->(:Source) RETURN count(r)",
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'source-global-memory-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-global-source-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'source-global-memory-1'}), (s:Source {id: 'source-global-source-1'}) CREATE (m)-[:SOURCED_FROM]->(s)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['source-global-memory-1', 'source-global-source-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source attribution read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[:SOURCED_FROM]->(s:Source) WHERE m.id IN $ids RETURN m.id, s.id",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![Value::Int(1), Value::Int(99)]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("m.id", Value::Int(1)),
("s.id", Value::String("source-attribution-1".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-attribution-1', original_name: 'Attribution source'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 1}), (s:Source {id: 'source-attribution-1'}) CREATE (m)-[:SOURCED_FROM]->(s)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'source-attribution-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source provenance memory detail read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[r:SOURCED_FROM]->(s:Source {id: $source_id}) RETURN m.id as memory_id, m.title as title, m.content as content, r.chunk_index as chunk_index, r.chunk_range as chunk_range, m.unit_type as unit_type, m.confidence as confidence ORDER BY r.chunk_index ASC LIMIT $limit",
BTreeMap::from([
(
"source_id".to_string(),
Value::String("source-detail-memory-source-1".to_string()),
),
("limit".to_string(), Value::Int(10)),
]),
),
ExpectedRows::Exact(vec![
compatibility_row([
(
"memory_id",
Value::String("source-detail-memory-1".to_string()),
),
("title", Value::String("Source Detail One".to_string())),
("content", Value::String("source detail body one".to_string())),
("chunk_index", Value::Int(1)),
("chunk_range", Value::String("0..10".to_string())),
("unit_type", Value::String("fact".to_string())),
("confidence", Value::Float(0.8)),
]),
compatibility_row([
(
"memory_id",
Value::String("source-detail-memory-2".to_string()),
),
("title", Value::String("Source Detail Two".to_string())),
("content", Value::String("source detail body two".to_string())),
("chunk_index", Value::Int(2)),
("chunk_range", Value::String("10..20".to_string())),
("unit_type", Value::String("fact".to_string())),
("confidence", Value::Float(0.7)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-detail-memory-source-1', title: 'Detail Memory Source'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'source-detail-memory-1', title: 'Source Detail One', content: 'source detail body one', unit_type: 'fact', confidence: 0.8})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'source-detail-memory-2', title: 'Source Detail Two', content: 'source detail body two', unit_type: 'fact', confidence: 0.7})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'source-detail-memory-1'}), (s:Source {id: 'source-detail-memory-source-1'}) CREATE (m)-[:SOURCED_FROM {chunk_index: 1, chunk_range: '0..10'}]->(s)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'source-detail-memory-2'}), (s:Source {id: 'source-detail-memory-source-1'}) CREATE (m)-[:SOURCED_FROM {chunk_index: 2, chunk_range: '10..20'}]->(s)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['source-detail-memory-source-1', 'source-detail-memory-1', 'source-detail-memory-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source memory id list read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[:SOURCED_FROM]->(s:Source {id: $sid}) RETURN m.id LIMIT 24",
BTreeMap::from([(
"sid".to_string(),
Value::String("source-memory-id-list-source-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"m.id",
Value::String("source-memory-id-list-memory-1".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-memory-id-list-source-1', title: 'Memory Id List Source'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'source-memory-id-list-memory-1', title: 'Source Memory Id List'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'source-memory-id-list-memory-1'}), (s:Source {id: 'source-memory-id-list-source-1'}) CREATE (m)-[:SOURCED_FROM]->(s)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['source-memory-id-list-source-1', 'source-memory-id-list-memory-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory source provenance id read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $id})-[:SOURCED_FROM]->(s:Source) RETURN s.id",
BTreeMap::from([(
"id".to_string(),
Value::String("memory-source-provenance-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"s.id",
Value::String("source-provenance-single-1".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-source-provenance-1', title: 'Source provenance memory'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-provenance-single-1', original_name: 'Single provenance source'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'memory-source-provenance-1'}), (s:Source {id: 'source-provenance-single-1'}) CREATE (m)-[:SOURCED_FROM]->(s)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['memory-source-provenance-1', 'source-provenance-single-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source memory-count decrement floor write",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source {id: $id}) SET s.memory_count = CASE WHEN s.memory_count > 0 THEN s.memory_count - 1 ELSE 0 END",
BTreeMap::from([(
"id".to_string(),
Value::String("source-memory-count-decrement-1".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-memory-count-decrement-1', memory_count: 2})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'source-memory-count-decrement-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread compaction attribution read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread)-[:COMPACTS_TO]->(m:Memory) WHERE m.id IN $ids RETURN m.id, t.thread_id",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![Value::Int(1), Value::Int(99)]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("m.id", Value::Int(1)),
(
"t.thread_id",
Value::String("compact-thread-1".to_string()),
),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'compact-thread-node-1', thread_id: 'compact-thread-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'compact-thread-node-1'}), (m:Memory {id: 1}) CREATE (t)-[:COMPACTS_TO]->(m)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'compact-thread-node-1'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"context skill thread source read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread)-[:COMPACTS_TO]->(m:Memory)<-[:SYNTHESIZED_FROM]-(sk:Skill {id: $id}) RETURN t.title, t.source",
BTreeMap::from([(
"id".to_string(),
Value::String("context-skill-source".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("t.title", Value::String("Context Source Thread".to_string())),
("t.source", Value::String("codex".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'context-source-thread', title: 'Context Source Thread', source: 'codex'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'context-source-memory', title: 'Context Source Memory'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'context-skill-source', title: 'Context Source Skill'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'context-source-thread'}), (m:Memory {id: 'context-source-memory'}) CREATE (t)-[:COMPACTS_TO]->(m)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (sk:Skill {id: 'context-skill-source'}), (m:Memory {id: 'context-source-memory'}) CREATE (sk)-[:SYNTHESIZED_FROM]->(m)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['context-source-thread', 'context-source-memory', 'context-skill-source'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory metadata bulk read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, m.unit_type, m.metadata",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![
Value::String("repo-bulk-memory-1".to_string()),
Value::String("missing-repo-bulk-memory".to_string()),
]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("m.id", Value::String("repo-bulk-memory-1".to_string())),
("m.unit_type", Value::String("note".to_string())),
("m.metadata", Value::String("{\"source\":\"repo\"}".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'repo-bulk-memory-1', unit_type: 'note', metadata: '{\"source\":\"repo\"}'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'repo-bulk-memory-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory cascade delete",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $memory_id}) DETACH DELETE m",
BTreeMap::from([(
"memory_id".to_string(),
Value::String("memory-cascade-delete-1".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-cascade-delete-1', title: 'Delete me'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'memory-cascade-delete-source-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'memory-cascade-delete-1'}), (s:Source {id: 'memory-cascade-delete-source-1'}) CREATE (m)-[:SOURCED_FROM]->(s)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'memory-cascade-delete-source-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source thread memory attribution read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread)-[:COMPACTS_TO]->(m:Memory) WHERE m.id IN $memory_ids RETURN m.id as memory_id, t.thread_id as thread_id, t.title as title, t.source as source, CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END AS space_id",
BTreeMap::from([(
"memory_ids".to_string(),
Value::List(vec![
Value::String("repo-source-memory-1".to_string()),
Value::String("missing-repo-source-memory".to_string()),
]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"memory_id",
Value::String("repo-source-memory-1".to_string()),
),
("thread_id", Value::String("repo-thread-1".to_string())),
("title", Value::String("Repo Thread".to_string())),
("source", Value::String("import".to_string())),
("space_id", Value::String("default".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'repo-source-memory-1', title: 'Repo Source Memory'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'repo-thread-node-1', thread_id: 'repo-thread-1', title: 'Repo Thread', source: 'import', space_id: ''})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'repo-thread-node-1'}), (m:Memory {id: 'repo-source-memory-1'}) CREATE (t)-[:COMPACTS_TO]->(m)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['repo-source-memory-1', 'repo-thread-node-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread compacted-memory count read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $thread_uuid})-[:COMPACTS_TO]->(m:Memory) RETURN COUNT(m)",
BTreeMap::from([(
"thread_uuid".to_string(),
Value::String("compact-count-thread-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([("count(m)", Value::Int(2))])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'compact-count-thread-1', thread_id: 'compact-count-logical-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'compact-count-memory-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'compact-count-memory-2'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'compact-count-thread-1'}), (m:Memory {id: 'compact-count-memory-1'}) CREATE (t)-[:COMPACTS_TO]->(m)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'compact-count-thread-1'}), (m:Memory {id: 'compact-count-memory-2'}) CREATE (t)-[:COMPACTS_TO]->(m)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['compact-count-thread-1', 'compact-count-memory-1', 'compact-count-memory-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread compacted-memory ids read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $thread_uuid})-[:COMPACTS_TO]->(m:Memory) RETURN m.id",
BTreeMap::from([(
"thread_uuid".to_string(),
Value::String("compact-id-thread-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([(
"m.id",
Value::String("compact-id-memory-1".to_string()),
)]),
compatibility_row([(
"m.id",
Value::String("compact-id-memory-2".to_string()),
)]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'compact-id-thread-1', thread_id: 'compact-id-logical-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'compact-id-memory-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'compact-id-memory-2'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'compact-id-thread-1'}), (m:Memory {id: 'compact-id-memory-1'}) CREATE (t)-[:COMPACTS_TO]->(m)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'compact-id-thread-1'}), (m:Memory {id: 'compact-id-memory-2'}) CREATE (t)-[:COMPACTS_TO]->(m)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['compact-id-thread-1', 'compact-id-memory-1', 'compact-id-memory-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread compacted-memory summary read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $uuid})-[:COMPACTS_TO]->(m:Memory) RETURN m.id, m.title, m.content LIMIT 200",
BTreeMap::from([(
"uuid".to_string(),
Value::String("compact-summary-thread-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([
(
"m.id",
Value::String("compact-summary-memory-1".to_string()),
),
("m.title", Value::String("Compact Summary One".to_string())),
("m.content", Value::String("summary one".to_string())),
]),
compatibility_row([
(
"m.id",
Value::String("compact-summary-memory-2".to_string()),
),
("m.title", Value::String("Compact Summary Two".to_string())),
("m.content", Value::String("summary two".to_string())),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'compact-summary-thread-1', thread_id: 'compact-summary-logical-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'compact-summary-memory-1', title: 'Compact Summary One', content: 'summary one'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'compact-summary-memory-2', title: 'Compact Summary Two', content: 'summary two'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'compact-summary-thread-1'}), (m:Memory {id: 'compact-summary-memory-1'}) CREATE (t)-[:COMPACTS_TO]->(m)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'compact-summary-thread-1'}), (m:Memory {id: 'compact-summary-memory-2'}) CREATE (t)-[:COMPACTS_TO]->(m)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['compact-summary-thread-1', 'compact-summary-memory-1', 'compact-summary-memory-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread distill compaction link create",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $thread_uuid}), (m:Memory {id: $memory_id}) CREATE (t)-[:COMPACTS_TO {compaction_method: $method, created_at: $created_at, properties: $props}]->(m)",
BTreeMap::from([
(
"thread_uuid".to_string(),
Value::String("thread-distill-link-1".to_string()),
),
(
"memory_id".to_string(),
Value::String("thread-distill-link-memory-1".to_string()),
),
(
"method".to_string(),
Value::String("manual_distillation".to_string()),
),
("created_at".to_string(), Value::Int(1_700_000_070)),
(
"props".to_string(),
Value::String("{\"mode\":\"manual\"}".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-distill-link-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'thread-distill-link-memory-1'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['thread-distill-link-1', 'thread-distill-link-memory-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory created-at bulk read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, m.created_at",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![
Value::String("bulk-created-1".to_string()),
Value::String("missing-memory".to_string()),
]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("m.id", Value::String("bulk-created-1".to_string())),
("m.created_at", Value::Int(123456789)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'bulk-created-1', title: 'Bulk created read', created_at: 123456789})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'bulk-created-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory bulk metadata read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, m.metadata",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![
Value::String("bulk-metadata-1".to_string()),
Value::String("bulk-metadata-2".to_string()),
Value::String("bulk-metadata-missing".to_string()),
]),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("m.id", Value::String("bulk-metadata-1".to_string())),
(
"m.metadata",
Value::String("{\"source\":\"one\"}".to_string()),
),
]),
compatibility_row([
("m.id", Value::String("bulk-metadata-2".to_string())),
(
"m.metadata",
Value::String("{\"source\":\"two\"}".to_string()),
),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'bulk-metadata-1', metadata: '{\"source\":\"one\"}'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'bulk-metadata-2', metadata: '{\"source\":\"two\"}'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['bulk-metadata-1', 'bulk-metadata-2'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"feed memory detail bulk read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, m.title, m.content, m.metadata, m.is_latest",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![
Value::String("feed-memory-1".to_string()),
Value::String("feed-memory-2".to_string()),
Value::String("feed-memory-missing".to_string()),
]),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("m.id", Value::String("feed-memory-1".to_string())),
("m.title", Value::String("Feed One".to_string())),
("m.content", Value::String("feed content one".to_string())),
("m.metadata", Value::String("{\"rank\":1}".to_string())),
("m.is_latest", Value::Bool(true)),
]),
compatibility_row([
("m.id", Value::String("feed-memory-2".to_string())),
("m.title", Value::String("Feed Two".to_string())),
("m.content", Value::String("feed content two".to_string())),
("m.metadata", Value::String("{\"rank\":2}".to_string())),
("m.is_latest", Value::Bool(false)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'feed-memory-1', title: 'Feed One', content: 'feed content one', metadata: '{\"rank\":1}', is_latest: true})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'feed-memory-2', title: 'Feed Two', content: 'feed content two', metadata: '{\"rank\":2}', is_latest: false})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['feed-memory-1', 'feed-memory-2'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory authority signal read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $memory_ids RETURN m.id, m.importance, m.pagerank_score, m.metadata, m.is_latest, m.lifecycle_state",
BTreeMap::from([(
"memory_ids".to_string(),
Value::List(vec![
Value::String("authority-memory-1".to_string()),
Value::String("authority-memory-missing".to_string()),
]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("m.id", Value::String("authority-memory-1".to_string())),
("m.importance", Value::Float(0.8)),
("m.pagerank_score", Value::Float(0.3)),
("m.metadata", Value::String("{\"visible\":true}".to_string())),
("m.is_latest", Value::Bool(true)),
("m.lifecycle_state", Value::String("active".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'authority-memory-1', importance: 0.8, pagerank_score: 0.3, metadata: '{\"visible\":true}', is_latest: true, lifecycle_state: 'active'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'authority-memory-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory bulk space read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, m.space_id",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![
Value::String("bulk-space-1".to_string()),
Value::String("bulk-space-2".to_string()),
Value::String("bulk-space-missing".to_string()),
]),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("m.id", Value::String("bulk-space-1".to_string())),
("m.space_id", Value::String("default".to_string())),
]),
compatibility_row([
("m.id", Value::String("bulk-space-2".to_string())),
("m.space_id", Value::String("research".to_string())),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'bulk-space-1', space_id: 'default'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'bulk-space-2', space_id: 'research'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['bulk-space-1', 'bulk-space-2'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"feed memory normalized-space bulk read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![
Value::String("feed-space-1".to_string()),
Value::String("feed-space-2".to_string()),
Value::String("feed-space-missing".to_string()),
]),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("m.id", Value::String("feed-space-1".to_string())),
("space_id", Value::String("default".to_string())),
]),
compatibility_row([
("m.id", Value::String("feed-space-2".to_string())),
("space_id", Value::String("research".to_string())),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'feed-space-1', space_id: ''})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'feed-space-2', space_id: 'research'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['feed-space-1', 'feed-space-2'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest fs memory unit-type count read",
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.unit_type IS NOT NULL AND m.unit_type <> '' RETURN m.unit_type, COUNT(DISTINCT m) AS memory_count",
),
ExpectedRows::RowCount(3),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-fs-unit-count-1', unit_type: 'restfs-unit'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-fs-unit-count-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest fs memory created-at scan read",
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.created_at IS NOT NULL RETURN m.created_at, m.metadata, m.is_latest LIMIT 5000",
),
ExpectedRows::RowCount(4),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-fs-created-at-1', created_at: 1700000080, metadata: '{\"state\":\"active\"}', is_latest: true})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-fs-created-at-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest fs memory event-start scan read",
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.event_start IS NOT NULL RETURN m.event_start, m.metadata, m.is_latest LIMIT 5000",
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-fs-event-start-1', event_start: 1700000081, metadata: '{\"state\":\"active\"}', is_latest: true})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-fs-event-start-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest fs memory id page read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id > $after RETURN m.id, m.title, m.crystal_title, m.is_crystal, m.updated_at, m.metadata, m.is_latest ORDER BY m.id ASC LIMIT $limit",
BTreeMap::from([
(
"after".to_string(),
Value::String("rest-fs-page-0".to_string()),
),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
("m.id", Value::String("rest-fs-page-1".to_string())),
("m.title", Value::String("Rest FS Page".to_string())),
("m.crystal_title", Value::String("Rest Crystal".to_string())),
("m.is_crystal", Value::Bool(true)),
("m.updated_at", Value::Int(1700000082)),
("m.metadata", Value::String("{\"state\":\"active\"}".to_string())),
("m.is_latest", Value::Bool(true)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-fs-page-1', title: 'Rest FS Page', crystal_title: 'Rest Crystal', is_crystal: true, updated_at: 1700000082, metadata: '{\"state\":\"active\"}', is_latest: true})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-fs-page-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory compact detail fallback read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $memory_id}) RETURN m.id, COALESCE(m.title, ''), COALESCE(m.content, ''), COALESCE(m.unit_type, '')",
BTreeMap::from([(
"memory_id".to_string(),
Value::String("compact-detail-memory-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"m.id",
Value::String("compact-detail-memory-1".to_string()),
),
("coalesce", Value::String("Compact Detail".to_string())),
("coalesce#2", Value::String("compact detail body".to_string())),
("coalesce#3", Value::String("fact".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'compact-detail-memory-1', title: 'Compact Detail', content: 'compact detail body', unit_type: 'fact'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'compact-detail-memory-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest fs memory detail token lookup read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id = $lookup OR m.id STARTS WITH $lookup OR m.id CONTAINS $lookup OR m.id = $token OR m.id STARTS WITH $token OR m.id CONTAINS $token RETURN m.id, m.title, m.content, m.importance, m.confidence, COALESCE(m.is_crystal, false), m.crystal_title, m.created_at, m.updated_at, m.event_start, m.event_end, m.temporal_context, CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END, m.unit_type, m.source, m.metadata, m.lifecycle_state LIMIT 1",
BTreeMap::from([
(
"lookup".to_string(),
Value::String("rest-fs-detail-token-1".to_string()),
),
(
"token".to_string(),
Value::String("detail-token".to_string()),
),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"m.id",
Value::String("rest-fs-detail-token-1".to_string()),
),
("m.title", Value::String("Detail Token".to_string())),
("m.content", Value::String("token content".to_string())),
("m.importance", Value::Float(0.72)),
("m.confidence", Value::Float(0.82)),
("coalesce", Value::Bool(false)),
("m.crystal_title", Value::Null),
("m.created_at", Value::Int(1700000083)),
("m.updated_at", Value::Int(1700000084)),
("m.event_start", Value::Int(1700000085)),
("m.event_end", Value::Int(1700000086)),
("m.temporal_context", Value::String("event".to_string())),
("space_id", Value::String("default".to_string())),
("m.unit_type", Value::String("fact".to_string())),
("m.source", Value::String("kfs".to_string())),
("m.metadata", Value::String("{\"state\":\"active\"}".to_string())),
("m.lifecycle_state", Value::String("active".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-fs-detail-token-1', title: 'Detail Token', content: 'token content', importance: 0.72, confidence: 0.82, is_crystal: false, created_at: 1700000083, updated_at: 1700000084, event_start: 1700000085, event_end: 1700000086, temporal_context: 'event', space_id: '', unit_type: 'fact', source: 'kfs', metadata: '{\"state\":\"active\"}', lifecycle_state: 'active'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-fs-detail-token-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest fs memory detail lookup read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id = $lookup OR m.id STARTS WITH $lookup OR m.id CONTAINS $lookup RETURN m.id, m.title, m.content, m.importance, m.confidence, COALESCE(m.is_crystal, false), m.crystal_title, m.created_at, m.updated_at, m.event_start, m.event_end, m.temporal_context, CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END, m.unit_type, m.source, m.metadata, m.lifecycle_state LIMIT 1",
BTreeMap::from([(
"lookup".to_string(),
Value::String("rest-fs-detail-plain-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"m.id",
Value::String("rest-fs-detail-plain-1".to_string()),
),
("m.title", Value::String("Detail Plain".to_string())),
("m.content", Value::String("plain content".to_string())),
("m.importance", Value::Float(0.64)),
("m.confidence", Value::Float(0.74)),
("coalesce", Value::Bool(true)),
("m.crystal_title", Value::String("Plain Crystal".to_string())),
("m.created_at", Value::Int(1700000087)),
("m.updated_at", Value::Int(1700000088)),
("m.event_start", Value::Null),
("m.event_end", Value::Null),
("m.temporal_context", Value::String("timeless".to_string())),
("space_id", Value::String("research".to_string())),
("m.unit_type", Value::String("context".to_string())),
("m.source", Value::String("kfs".to_string())),
("m.metadata", Value::String("{\"state\":\"active\"}".to_string())),
("m.lifecycle_state", Value::String("active".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-fs-detail-plain-1', title: 'Detail Plain', content: 'plain content', importance: 0.64, confidence: 0.74, is_crystal: true, crystal_title: 'Plain Crystal', created_at: 1700000087, updated_at: 1700000088, temporal_context: 'timeless', space_id: 'research', unit_type: 'context', source: 'kfs', metadata: '{\"state\":\"active\"}', lifecycle_state: 'active'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-fs-detail-plain-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest fs memory label names read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $id})-[:HAS_LABEL]->(l:Label) RETURN l.name ORDER BY l.name",
BTreeMap::from([(
"id".to_string(),
Value::String("rest-fs-label-memory-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([(
"l.name",
Value::String("alpha".to_string()),
)]),
compatibility_row([(
"l.name",
Value::String("beta".to_string()),
)]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-fs-label-memory-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'rest-fs-label-alpha', name: 'alpha'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'rest-fs-label-beta', name: 'beta'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-fs-label-memory-1'}), (l:Label {id: 'rest-fs-label-beta'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-fs-label-memory-1'}), (l:Label {id: 'rest-fs-label-alpha'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-fs-label-memory-1', 'rest-fs-label-alpha', 'rest-fs-label-beta'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest fs memory mention count read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $id})-[r:MENTIONS]->(:Entity) RETURN COUNT(r)",
BTreeMap::from([(
"id".to_string(),
Value::String("rest-fs-mention-memory-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"count(r)",
Value::Int(2),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-fs-mention-memory-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'rest-fs-mention-entity-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'rest-fs-mention-entity-2'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-fs-mention-memory-1'}), (e:Entity {id: 'rest-fs-mention-entity-1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-fs-mention-memory-1'}), (e:Entity {id: 'rest-fs-mention-entity-2'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-fs-mention-memory-1', 'rest-fs-mention-entity-1', 'rest-fs-mention-entity-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest fs memory back-reference count read",
CypherFixtureStatement::with_parameters(
"MATCH (other:Memory)-[r:MENTIONS]->(:Entity)<-[:MENTIONS]-(m:Memory {id: $id}) WHERE other.id <> $id RETURN COUNT(DISTINCT other)",
BTreeMap::from([(
"id".to_string(),
Value::String("rest-fs-backref-memory-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"count(DISTINCT other)",
Value::Int(2),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-fs-backref-memory-1', 'rest-fs-backref-other-1', 'rest-fs-backref-other-2', 'rest-fs-backref-entity-1'] DETACH DELETE n",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-fs-backref-memory-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-fs-backref-other-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-fs-backref-other-2'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'rest-fs-backref-entity-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-fs-backref-memory-1'}), (e:Entity {id: 'rest-fs-backref-entity-1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-fs-backref-other-1'}), (e:Entity {id: 'rest-fs-backref-entity-1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-fs-backref-other-2'}), (e:Entity {id: 'rest-fs-backref-entity-1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-fs-backref-memory-1', 'rest-fs-backref-other-1', 'rest-fs-backref-other-2', 'rest-fs-backref-entity-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(4),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp memory content detail read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id = $id RETURN m.title, m.content, m.created_at, m.source",
BTreeMap::from([(
"id".to_string(),
Value::String("mcp-memory-detail".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("m.title", Value::String("MCP Memory Detail".to_string())),
("m.content", Value::String("detail content".to_string())),
("m.created_at", Value::Int(77)),
("m.source", Value::String("mcp".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-memory-detail', title: 'MCP Memory Detail', content: 'detail content', created_at: 77, source: 'mcp', unit_type: 'fact', importance: 0.55, space_id: 'mcp-space'})",
)),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"mcp memory metadata detail read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id = $id RETURN m.unit_type, m.importance, m.space_id",
BTreeMap::from([(
"id".to_string(),
Value::String("mcp-memory-detail".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("m.unit_type", Value::String("fact".to_string())),
("m.importance", Value::Float(0.55)),
("m.space_id", Value::String("mcp-space".to_string())),
])]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp memory compact detail read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id = $id RETURN m.id, m.title, m.content, m.unit_type",
BTreeMap::from([(
"id".to_string(),
Value::String("mcp-memory-detail".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("m.id", Value::String("mcp-memory-detail".to_string())),
("m.title", Value::String("MCP Memory Detail".to_string())),
("m.content", Value::String("detail content".to_string())),
("m.unit_type", Value::String("fact".to_string())),
])]),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'mcp-memory-detail'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest favorite memories paged metadata read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.metadata CONTAINS 'is_favorite' RETURN m ORDER BY m.updated_at DESC SKIP $offset LIMIT $limit",
BTreeMap::from([
("offset".to_string(), Value::Int(0)),
("limit".to_string(), Value::Int(10)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-favorite-memory-1', metadata: '{\"is_favorite\":true}', updated_at: 91})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-favorite-memory-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest favorite threads paged metadata read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE t.metadata CONTAINS 'is_favorite' RETURN t.thread_id, t.title, t.summary, COALESCE(t.message_count, 0), t.source, t.id, t.created_at, t.updated_at, t.metadata, CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END ORDER BY t.updated_at DESC SKIP $offset LIMIT $limit",
BTreeMap::from([
("offset".to_string(), Value::Int(0)),
("limit".to_string(), Value::Int(10)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'rest-favorite-thread-node-1', thread_id: 'rest-favorite-thread-1', title: 'Favorite thread', summary: 'summary', source: 'rest', created_at: 92, updated_at: 93, metadata: '{\"is_favorite\":true}', space_id: ''})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'rest-favorite-thread-node-1'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest thread metadata lookup read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE t.thread_id = $thread_id OR t.id = $thread_id RETURN t.id, t.thread_id, COALESCE(t.message_count, 0), t.metadata LIMIT 1",
BTreeMap::from([(
"thread_id".to_string(),
Value::String("rest-thread-lookup-1".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'rest-thread-lookup-node-1', thread_id: 'rest-thread-lookup-1', message_count: 3, metadata: '{}'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'rest-thread-lookup-node-1'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest list thread legacy message detail read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $thread_uuid})-[c:CONTAINS]->(m:Message) RETURN m.id, m.content, m.role, COALESCE(c.order_index, m.order_index), m.timestamp, m.token_count, m.created_at, m.updated_at, m.metadata ORDER BY COALESCE(c.order_index, m.order_index)",
BTreeMap::from([(
"thread_uuid".to_string(),
Value::String("rest-list-thread-detail-1".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'rest-list-thread-detail-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Message {id: 'rest-list-message-detail-1', content: 'message body', role: 'user', order_index: 2, timestamp: 101, token_count: 4, created_at: 102, updated_at: 103, metadata: '{}'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'rest-list-thread-detail-1'}), (m:Message {id: 'rest-list-message-detail-1'}) CREATE (t)-[:CONTAINS {order_index: 1}]->(m)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-list-thread-detail-1', 'rest-list-message-detail-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest list thread compacted memory detail read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $thread_uuid})-[:COMPACTS_TO]->(m:Memory) RETURN m.id, m.content, m.title, m.importance, m.pagerank_score, m.confidence, m.source_range, m.source, m.created_at, m.updated_at, m.metadata, CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END, m.last_reindexed_at, m.reindex_needed, COALESCE(m.unit_type, 'fact'), COALESCE(m.is_latest, true), COALESCE(m.version, 1), COALESCE(m.is_crystal, false), m.crystal_title, m.source_unit_count, COALESCE(m.extraction_method, 'manual'), COALESCE(m.access_count, 0), COALESCE(m.appearances, 0), COALESCE(m.clicks, 0), COALESCE(m.decay_score_cached, 0.0), m.event_end, m.event_start, m.last_accessed_at, m.last_clicked_at, m.last_evaluated_at, COALESCE(m.review_status, ''), m.temporal_confidence, m.temporal_context, m.temporal_precision, m.temporal_type, COALESCE(m.total_dwell_time_ms, 0) ORDER BY m.importance DESC, m.created_at DESC LIMIT 10",
BTreeMap::from([(
"thread_uuid".to_string(),
Value::String("rest-list-compact-thread-1".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'rest-list-compact-thread-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-list-compact-memory-1', content: 'related content', title: 'Related memory', importance: 0.8, pagerank_score: 0.2, confidence: 0.7, source_range: '{}', source: 'thread', created_at: 104, updated_at: 105, metadata: '{}', space_id: '', unit_type: 'fact', is_latest: true, version: 1, is_crystal: false})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'rest-list-compact-thread-1'}), (m:Memory {id: 'rest-list-compact-memory-1'}) CREATE (t)-[:COMPACTS_TO]->(m)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-list-compact-thread-1', 'rest-list-compact-memory-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest list thread metadata related memory read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE ( m.space_id = $space_id OR ($space_id = 'default' AND (m.space_id IS NULL OR m.space_id = '')) ) AND ( m.metadata CONTAINS $source_id_spaced OR m.metadata CONTAINS $source_id_compact OR m.metadata CONTAINS $source_thread_id_spaced OR m.metadata CONTAINS $source_thread_id_compact ) RETURN m.id, m.content, m.title, m.importance, m.pagerank_score, m.confidence, m.source_range, m.source, m.created_at, m.updated_at, m.metadata, CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END, m.last_reindexed_at, m.reindex_needed, COALESCE(m.unit_type, 'fact'), COALESCE(m.is_latest, true), COALESCE(m.version, 1), COALESCE(m.is_crystal, false), m.crystal_title, m.source_unit_count, COALESCE(m.extraction_method, 'manual'), COALESCE(m.access_count, 0), COALESCE(m.appearances, 0), COALESCE(m.clicks, 0), COALESCE(m.decay_score_cached, 0.0), m.event_end, m.event_start, m.last_accessed_at, m.last_clicked_at, m.last_evaluated_at, COALESCE(m.review_status, ''), m.temporal_confidence, m.temporal_context, m.temporal_precision, m.temporal_type, COALESCE(m.total_dwell_time_ms, 0) ORDER BY m.created_at DESC LIMIT 25",
BTreeMap::from([
("space_id".to_string(), Value::String("default".to_string())),
(
"source_id_spaced".to_string(),
Value::String("\"source_id\": \"rest-list-external-thread-1\"".to_string()),
),
(
"source_id_compact".to_string(),
Value::String("\"source_id\":\"rest-list-external-thread-1\"".to_string()),
),
(
"source_thread_id_spaced".to_string(),
Value::String("\"source_thread_id\": \"rest-list-external-thread-1\"".to_string()),
),
(
"source_thread_id_compact".to_string(),
Value::String("\"source_thread_id\":\"rest-list-external-thread-1\"".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-list-metadata-memory-1', content: 'metadata related content', title: 'Metadata related memory', importance: 0.6, pagerank_score: 0.1, confidence: 0.5, source_range: '{}', source: 'thread', created_at: 106, updated_at: 107, metadata: '{\"source_id\": \"rest-list-external-thread-1\"}', space_id: 'default'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-list-metadata-memory-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest list related entity names by memory ids read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[:MENTIONS]->(e:Entity) WHERE m.id IN $memory_ids RETURN DISTINCT e.name ORDER BY e.name LIMIT 20",
BTreeMap::from([(
"memory_ids".to_string(),
Value::List(vec![
Value::String("rest-list-entity-memory-1".to_string()),
Value::String("missing-memory".to_string()),
]),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-list-entity-memory-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'rest-list-entity-1', name: 'related entity'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-list-entity-memory-1'}), (e:Entity {id: 'rest-list-entity-1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-list-entity-memory-1', 'rest-list-entity-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest list related entity names by thread read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $thread_uuid})-[:COMPACTS_TO]->(m:Memory)-[:MENTIONS]->(e:Entity) RETURN DISTINCT e.name ORDER BY e.name LIMIT 20",
BTreeMap::from([(
"thread_uuid".to_string(),
Value::String("rest-list-related-thread-1".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'rest-list-related-thread-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-list-related-memory-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'rest-list-related-entity-1', name: 'thread related entity'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'rest-list-related-thread-1'}), (m:Memory {id: 'rest-list-related-memory-1'}) CREATE (t)-[:COMPACTS_TO]->(m)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-list-related-memory-1'}), (e:Entity {id: 'rest-list-related-entity-1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-list-related-thread-1', 'rest-list-related-memory-1', 'rest-list-related-entity-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory label name list read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $memory_id})-[:HAS_LABEL]->(l:Label) RETURN l.name LIMIT $limit",
BTreeMap::from([
(
"memory_id".to_string(),
Value::String("memory-label-list-memory-1".to_string()),
),
("limit".to_string(), Value::Int(10)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"l.name",
Value::String("architecture".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-label-list-memory-1', title: 'Labeled memory'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'memory-label-list-label-1', name: 'architecture'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'memory-label-list-memory-1'}), (l:Label {id: 'memory-label-list-label-1'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['memory-label-list-memory-1', 'memory-label-list-label-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest memory label metadata read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $memory_id})-[:HAS_LABEL]->(l:Label) RETURN l.id, l.name, l.color, l.description ORDER BY l.name",
BTreeMap::from([(
"memory_id".to_string(),
Value::String("rest-label-memory-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("l.id", Value::String("rest-label-alpha".to_string())),
("l.name", Value::String("alpha".to_string())),
("l.color", Value::String("#112233".to_string())),
(
"l.description",
Value::String("alpha label".to_string()),
),
]),
compatibility_row([
("l.id", Value::String("rest-label-beta".to_string())),
("l.name", Value::String("beta".to_string())),
("l.color", Value::String("#445566".to_string())),
("l.description", Value::String("beta label".to_string())),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-label-memory-1', title: 'REST labeled memory'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'rest-label-beta', name: 'beta', color: '#445566', description: 'beta label'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'rest-label-alpha', name: 'alpha', color: '#112233', description: 'alpha label'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-label-memory-1'}), (l:Label {id: 'rest-label-beta'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-label-memory-1'}), (l:Label {id: 'rest-label-alpha'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-label-memory-1', 'rest-label-alpha', 'rest-label-beta'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory label names by id read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[:HAS_LABEL]->(l:Label) WHERE m.id = $id RETURN l.name",
BTreeMap::from([(
"id".to_string(),
Value::String("memory-label-by-id-memory-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"l.name",
Value::String("replacement".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-label-by-id-memory-1', title: 'Replacement memory'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'memory-label-by-id-label-1', name: 'replacement'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'memory-label-by-id-memory-1'}), (l:Label {id: 'memory-label-by-id-label-1'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['memory-label-by-id-memory-1', 'memory-label-by-id-label-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory label bulk name read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[:HAS_LABEL]->(l:Label) WHERE m.id IN $ids RETURN m.id, l.name",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![
Value::String("memory-label-bulk-memory-1".to_string()),
Value::String("missing-memory".to_string()),
]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"m.id",
Value::String("memory-label-bulk-memory-1".to_string()),
),
("l.name", Value::String("retrieval".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-label-bulk-memory-1', title: 'Bulk labeled memory'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'memory-label-bulk-label-1', name: 'retrieval'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'memory-label-bulk-memory-1'}), (l:Label {id: 'memory-label-bulk-label-1'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['memory-label-bulk-memory-1', 'memory-label-bulk-label-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory label fallback bulk read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[:HAS_LABEL]->(l:Label) WHERE m.id IN $ids RETURN m.id, COALESCE(l.name, l.id)",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![
Value::String("memory-label-fallback-memory-1".to_string()),
Value::String("missing-memory".to_string()),
]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"m.id",
Value::String("memory-label-fallback-memory-1".to_string()),
),
(
"coalesce",
Value::String("memory-label-fallback-label-1".to_string()),
),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-label-fallback-memory-1', title: 'Fallback labeled memory'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'memory-label-fallback-label-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'memory-label-fallback-memory-1'}), (l:Label {id: 'memory-label-fallback-label-1'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['memory-label-fallback-memory-1', 'memory-label-fallback-label-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory label endpoint bulk read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[:HAS_LABEL]->(l:Label) WHERE m.id IN $ids RETURN m.id, l.id",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![
Value::String("memory-label-endpoint-memory-1".to_string()),
Value::String("missing-memory".to_string()),
]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"m.id",
Value::String("memory-label-endpoint-memory-1".to_string()),
),
(
"l.id",
Value::String("memory-label-endpoint-label-1".to_string()),
),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-label-endpoint-memory-1', title: 'Label endpoint memory'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'memory-label-endpoint-label-1', name: 'endpoint'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'memory-label-endpoint-memory-1'}), (l:Label {id: 'memory-label-endpoint-label-1'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['memory-label-endpoint-memory-1', 'memory-label-endpoint-label-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory label distinct name count read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[:HAS_LABEL]->(l:Label) WHERE m.id IN $ids AND l.name IN $names RETURN m.id, COUNT(DISTINCT l.name)",
BTreeMap::from([
(
"ids".to_string(),
Value::List(vec![
Value::String("memory-label-count-memory-1".to_string()),
Value::String("missing-memory".to_string()),
]),
),
(
"names".to_string(),
Value::List(vec![
Value::String("retrieval".to_string()),
Value::String("missing-label".to_string()),
]),
),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"m.id",
Value::String("memory-label-count-memory-1".to_string()),
),
("count(DISTINCT l.name)", Value::Int(1)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-label-count-memory-1', title: 'Label count memory'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'memory-label-count-label-1', name: 'retrieval'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'memory-label-count-label-2', name: 'storage'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'memory-label-count-memory-1'}), (l:Label {id: 'memory-label-count-label-1'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'memory-label-count-memory-1'}), (l:Label {id: 'memory-label-count-label-2'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['memory-label-count-memory-1', 'memory-label-count-label-1', 'memory-label-count-label-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source label bulk name read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source)-[:HAS_LABEL]->(l:Label) WHERE s.id IN $ids RETURN s.id, l.name",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![
Value::String("source-label-bulk-source-1".to_string()),
Value::String("missing-source".to_string()),
]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"s.id",
Value::String("source-label-bulk-source-1".to_string()),
),
("l.name", Value::String("source-label".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-label-bulk-source-1', original_name: 'Labeled source'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'source-label-bulk-label-1', name: 'source-label'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (s:Source {id: 'source-label-bulk-source-1'}), (l:Label {id: 'source-label-bulk-label-1'}) CREATE (s)-[:HAS_LABEL]->(l)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['source-label-bulk-source-1', 'source-label-bulk-label-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source label endpoint bulk read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source)-[:HAS_LABEL]->(l:Label) WHERE s.id IN $ids RETURN s.id, l.id",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![
Value::String("source-label-endpoint-source-1".to_string()),
Value::String("missing-source".to_string()),
]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"s.id",
Value::String("source-label-endpoint-source-1".to_string()),
),
(
"l.id",
Value::String("source-label-endpoint-label-1".to_string()),
),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-label-endpoint-source-1', original_name: 'Endpoint labeled source'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'source-label-endpoint-label-1', name: 'source-endpoint'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (s:Source {id: 'source-label-endpoint-source-1'}), (l:Label {id: 'source-label-endpoint-label-1'}) CREATE (s)-[:HAS_LABEL]->(l)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['source-label-endpoint-source-1', 'source-label-endpoint-label-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp label memory lookup read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[:HAS_LABEL]->(l:Label) WHERE l.name = $label RETURN m.id, m.title, 'memory', m.importance LIMIT $limit",
BTreeMap::from([
("label".to_string(), Value::String("mcp-label".to_string())),
("limit".to_string(), Value::Int(10)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
("m.id", Value::String("mcp-label-memory".to_string())),
("m.title", Value::String("MCP Label Memory".to_string())),
("literal", Value::String("memory".to_string())),
("m.importance", Value::Float(0.7)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'mcp-label-node', name: 'mcp-label'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-label-memory', title: 'MCP Label Memory', importance: 0.7})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'mcp-label-entity', name: 'MCP Label Entity', entity_type: 'concept'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'mcp-label-source', original_name: 'MCP Label Source', source_type: 'file'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'mcp-label-memory'}), (l:Label {id: 'mcp-label-node'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'mcp-label-entity'}), (l:Label {id: 'mcp-label-node'}) CREATE (e)-[:HAS_LABEL]->(l)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (s:Source {id: 'mcp-label-source'}), (l:Label {id: 'mcp-label-node'}) CREATE (s)-[:HAS_LABEL]->(l)",
)),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"mcp label entity lookup read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity)-[:HAS_LABEL]->(l:Label) WHERE l.name = $label RETURN e.id, e.name, e.entity_type LIMIT $limit",
BTreeMap::from([
("label".to_string(), Value::String("mcp-label".to_string())),
("limit".to_string(), Value::Int(10)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
("e.id", Value::String("mcp-label-entity".to_string())),
("e.name", Value::String("MCP Label Entity".to_string())),
("e.entity_type", Value::String("concept".to_string())),
])]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp label source lookup read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source)-[:HAS_LABEL]->(l:Label) WHERE l.name = $label RETURN s.id, s.original_name, s.source_type LIMIT $limit",
BTreeMap::from([
("label".to_string(), Value::String("mcp-label".to_string())),
("limit".to_string(), Value::Int(10)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
("s.id", Value::String("mcp-label-source".to_string())),
(
"s.original_name",
Value::String("MCP Label Source".to_string()),
),
("s.source_type", Value::String("file".to_string())),
])]),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['mcp-label-node', 'mcp-label-memory', 'mcp-label-entity', 'mcp-label-source'] DETACH DELETE n",
),
ExpectedRows::RowCount(4),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"mcp subgraph edge list read",
CypherFixtureStatement::with_parameters(
"MATCH (a)-[r]->(b) WHERE a.id IN $ids AND b.id IN $ids RETURN a.id, b.id",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![Value::Int(1), Value::Int(10)]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("a.id", Value::Int(1)),
("b.id", Value::Int(10)),
]),
compatibility_row([
("a.id", Value::Int(1)),
("b.id", Value::Int(10)),
])]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"mcp subgraph node title fallback read",
CypherFixtureStatement::with_parameters(
"MATCH (n) WHERE n.id IN $ids RETURN n.id, COALESCE(n.title, n.name, n.id)",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![Value::Int(1), Value::Int(10)]),
)]),
),
ExpectedRows::Unordered(vec![
compatibility_row([
("n.id", Value::Int(1)),
("coalesce", Value::String("Graph foundations".to_string())),
]),
compatibility_row([
("n.id", Value::Int(10)),
("coalesce", Value::String("Rust".to_string())),
]),
]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source label relationship count read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source {id: $source_id})-[r:HAS_LABEL]->(l:Label {id: $label_id}) RETURN COUNT(r)",
BTreeMap::from([
(
"source_id".to_string(),
Value::String("source-label-count-source-1".to_string()),
),
(
"label_id".to_string(),
Value::String("source-label-count-label-1".to_string()),
),
]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"count(r)",
Value::Int(1),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-label-count-source-1', original_name: 'Count labeled source'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'source-label-count-label-1', name: 'source-count'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (s:Source {id: 'source-label-count-source-1'}), (l:Label {id: 'source-label-count-label-1'}) CREATE (s)-[:HAS_LABEL]->(l)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['source-label-count-source-1', 'source-label-count-label-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source label relationship merge",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source {id: $source_id}), (l:Label {id: $label_id}) MERGE (s)-[r:HAS_LABEL]->(l) ON CREATE SET r.assigned_by = $assigned_by, r.created_at = $created_at, r.properties = $properties",
BTreeMap::from([
(
"source_id".to_string(),
Value::String("source-label-merge-source-1".to_string()),
),
(
"label_id".to_string(),
Value::String("source-label-merge-label-1".to_string()),
),
(
"assigned_by".to_string(),
Value::String("system".to_string()),
),
("created_at".to_string(), Value::Int(987)),
(
"properties".to_string(),
Value::String("{\"scope\":\"source\"}".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-label-merge-source-1', original_name: 'Merge labeled source'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'source-label-merge-label-1', name: 'source-merge'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['source-label-merge-source-1', 'source-label-merge-label-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source label relationship delete",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source {id: $source_id})-[r:HAS_LABEL]->(l:Label {id: $label_id}) DELETE r",
BTreeMap::from([
(
"source_id".to_string(),
Value::String("source-label-delete-source-1".to_string()),
),
(
"label_id".to_string(),
Value::String("source-label-delete-label-1".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-label-delete-source-1', original_name: 'Delete labeled source'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'source-label-delete-label-1', name: 'source-delete'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (s:Source {id: 'source-label-delete-source-1'}), (l:Label {id: 'source-label-delete-label-1'}) CREATE (s)-[:HAS_LABEL]->(l)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['source-label-delete-source-1', 'source-label-delete-label-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source detail normalized space read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source {id: $source_id}) RETURN s.id, s.original_name, CASE WHEN s.space_id IS NULL OR s.space_id = '' THEN 'default' ELSE s.space_id END, s.lifecycle_state, s.parsed_path",
BTreeMap::from([(
"source_id".to_string(),
Value::String("source-detail-space-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("s.id", Value::String("source-detail-space-1".to_string())),
(
"s.original_name",
Value::String("Space Normalized Source".to_string()),
),
("space_id", Value::String("default".to_string())),
("s.lifecycle_state", Value::String("parsed".to_string())),
(
"s.parsed_path",
Value::String("/tmp/source-detail-space.md".to_string()),
),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-detail-space-1', original_name: 'Space Normalized Source', space_id: '', lifecycle_state: 'parsed', parsed_path: '/tmp/source-detail-space.md'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'source-detail-space-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source detail chunk-count read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source {id: $source_id}) RETURN s.original_name, CASE WHEN s.space_id IS NULL OR s.space_id = '' THEN 'default' ELSE s.space_id END, s.chunk_count",
BTreeMap::from([(
"source_id".to_string(),
Value::String("source-detail-chunk-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"s.original_name",
Value::String("Chunk Count Source".to_string()),
),
("space_id", Value::String("default".to_string())),
("s.chunk_count", Value::Int(7)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-detail-chunk-1', original_name: 'Chunk Count Source', space_id: '', chunk_count: 7})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'source-detail-chunk-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source detail file-path read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source {id: $source_id}) RETURN s.original_name, CASE WHEN s.space_id IS NULL OR s.space_id = '' THEN 'default' ELSE s.space_id END, s.file_path",
BTreeMap::from([(
"source_id".to_string(),
Value::String("source-detail-file-path-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"s.original_name",
Value::String("File Path Source".to_string()),
),
("space_id", Value::String("default".to_string())),
(
"s.file_path",
Value::String("/tmp/source-detail-file-path.md".to_string()),
),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-detail-file-path-1', original_name: 'File Path Source', space_id: '', file_path: '/tmp/source-detail-file-path.md'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'source-detail-file-path-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source default metadata fallback read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source {id: $id}) RETURN COALESCE(s.space_id, 'default'), COALESCE(s.source_type, 'file'), COALESCE(s.lifecycle_state, 'indexed'), COALESCE(s.mime_type, '')",
BTreeMap::from([(
"id".to_string(),
Value::String("source-default-metadata-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("coalesce", Value::String("default".to_string())),
("coalesce#2", Value::String("file".to_string())),
("coalesce#3", Value::String("indexed".to_string())),
("coalesce#4", Value::String(String::new())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-default-metadata-1'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'source-default-metadata-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest fs source grep single lookup read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source) WHERE s.id = $key OR s.id STARTS WITH $key OR s.id CONTAINS $key RETURN s.id, s.original_name, s.parsed_path, s.mime_type, s.created_at, s.updated_at, s.space_id, s.lifecycle_state, s.chunk_count, s.memory_count, s.size_bytes LIMIT 1",
BTreeMap::from([(
"key".to_string(),
Value::String("rest-fs-source-grep-single-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"s.id",
Value::String("rest-fs-source-grep-single-1".to_string()),
),
(
"s.original_name",
Value::String("Grep Single Source".to_string()),
),
(
"s.parsed_path",
Value::String("/tmp/rest-fs-source-grep-single.md".to_string()),
),
("s.mime_type", Value::String("text/markdown".to_string())),
("s.created_at", Value::Int(1700000090)),
("s.updated_at", Value::Int(1700000091)),
("s.space_id", Value::String("default".to_string())),
("s.lifecycle_state", Value::String("parsed".to_string())),
("s.chunk_count", Value::Int(3)),
("s.memory_count", Value::Int(2)),
("s.size_bytes", Value::Int(4096)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'rest-fs-source-grep-single-1', original_name: 'Grep Single Source', parsed_path: '/tmp/rest-fs-source-grep-single.md', mime_type: 'text/markdown', created_at: 1700000090, updated_at: 1700000091, space_id: 'default', lifecycle_state: 'parsed', chunk_count: 3, memory_count: 2, size_bytes: 4096})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'rest-fs-source-grep-single-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest fs source grep page read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source) WHERE s.id > $after RETURN s.id, s.original_name, s.parsed_path, s.mime_type, s.created_at, s.updated_at, s.space_id, s.lifecycle_state, s.chunk_count, s.memory_count, s.size_bytes ORDER BY s.id ASC LIMIT 200",
BTreeMap::from([(
"after".to_string(),
Value::String("zz-rest-fs-source-grep-page-0".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"s.id",
Value::String("zz-rest-fs-source-grep-page-1".to_string()),
),
(
"s.original_name",
Value::String("Grep Page Source".to_string()),
),
(
"s.parsed_path",
Value::String("/tmp/rest-fs-source-grep-page.md".to_string()),
),
("s.mime_type", Value::String("text/markdown".to_string())),
("s.created_at", Value::Int(1700000092)),
("s.updated_at", Value::Int(1700000093)),
("s.space_id", Value::String("default".to_string())),
("s.lifecycle_state", Value::String("parsed".to_string())),
("s.chunk_count", Value::Int(5)),
("s.memory_count", Value::Int(4)),
("s.size_bytes", Value::Int(8192)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'zz-rest-fs-source-grep-page-1', original_name: 'Grep Page Source', parsed_path: '/tmp/rest-fs-source-grep-page.md', mime_type: 'text/markdown', created_at: 1700000092, updated_at: 1700000093, space_id: 'default', lifecycle_state: 'parsed', chunk_count: 5, memory_count: 4, size_bytes: 8192})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'zz-rest-fs-source-grep-page-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest agent source attachment node read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source {id: $id}) RETURN s",
BTreeMap::from([(
"id".to_string(),
Value::String("rest-agent-source-1".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'rest-agent-source-1', original_name: 'Agent Source', source_type: 'file', chunk_count: 4})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'rest-agent-source-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest fs source listing page read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source) WHERE s.id > $after RETURN s.id, s.original_name, s.mime_type, s.updated_at, s.size_bytes, s.summary ORDER BY s.id ASC LIMIT $limit",
BTreeMap::from([
(
"after".to_string(),
Value::String("zz-rest-fs-source-listing-0".to_string()),
),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"s.id",
Value::String("zz-rest-fs-source-listing-1".to_string()),
),
(
"s.original_name",
Value::String("Listing Source".to_string()),
),
("s.mime_type", Value::String("text/plain".to_string())),
("s.updated_at", Value::Int(1700000094)),
("s.size_bytes", Value::Int(2048)),
("s.summary", Value::String("listing summary".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'zz-rest-fs-source-listing-1', original_name: 'Listing Source', mime_type: 'text/plain', updated_at: 1700000094, size_bytes: 2048, summary: 'listing summary'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'zz-rest-fs-source-listing-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest fs source detail lookup read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source) WHERE s.id = $key OR s.id STARTS WITH $key OR s.id CONTAINS $key RETURN s.id, s.original_name, s.mime_type, s.parsed_path, s.summary, s.size_bytes, s.chunk_count, s.memory_count, s.created_at, s.updated_at, s.space_id, s.lifecycle_state LIMIT 1",
BTreeMap::from([(
"key".to_string(),
Value::String("rest-fs-source-detail-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"s.id",
Value::String("rest-fs-source-detail-1".to_string()),
),
(
"s.original_name",
Value::String("Detail Source".to_string()),
),
("s.mime_type", Value::String("text/markdown".to_string())),
(
"s.parsed_path",
Value::String("/tmp/rest-fs-source-detail.md".to_string()),
),
("s.summary", Value::String("detail summary".to_string())),
("s.size_bytes", Value::Int(1024)),
("s.chunk_count", Value::Int(6)),
("s.memory_count", Value::Int(7)),
("s.created_at", Value::Int(1700000095)),
("s.updated_at", Value::Int(1700000096)),
("s.space_id", Value::String("research".to_string())),
("s.lifecycle_state", Value::String("indexed".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'rest-fs-source-detail-1', original_name: 'Detail Source', mime_type: 'text/markdown', parsed_path: '/tmp/rest-fs-source-detail.md', summary: 'detail summary', size_bytes: 1024, chunk_count: 6, memory_count: 7, created_at: 1700000095, updated_at: 1700000096, space_id: 'research', lifecycle_state: 'indexed'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'rest-fs-source-detail-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest fs community topic detail read",
CypherFixtureStatement::with_parameters(
"MATCH (c:Community) WHERE c.community_id = $cid RETURN c.community_id, c.name, c.ai_summary, c.description, c.member_count LIMIT 1",
BTreeMap::from([("cid".to_string(), Value::Int(170001))]),
),
ExpectedRows::Exact(vec![compatibility_row([
("c.community_id", Value::Int(170001)),
("c.name", Value::String("REST FS Community".to_string())),
("c.ai_summary", Value::String("community summary".to_string())),
(
"c.description",
Value::String("community description".to_string()),
),
("c.member_count", Value::Int(12)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'rest-fs-community-topic-1', community_id: 170001, name: 'REST FS Community', ai_summary: 'community summary', description: 'community description', member_count: 12})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (c:Community {id: 'rest-fs-community-topic-1'}) DETACH DELETE c",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest fs crystal wiki detail read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.is_crystal = true AND (m.id = $key OR m.id STARTS WITH $key OR m.id CONTAINS $key) RETURN m.id, m.crystal_title, m.title, m.content, m.importance, m.unit_type, m.created_at LIMIT 1",
BTreeMap::from([(
"key".to_string(),
Value::String("rest-fs-crystal-detail-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"m.id",
Value::String("rest-fs-crystal-detail-1".to_string()),
),
(
"m.crystal_title",
Value::String("REST FS Crystal".to_string()),
),
("m.title", Value::String("Crystal fallback".to_string())),
("m.content", Value::String("crystal body".to_string())),
("m.importance", Value::Float(0.91)),
("m.unit_type", Value::String("insight".to_string())),
("m.created_at", Value::Int(1700000110)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-fs-crystal-detail-1', is_crystal: true, crystal_title: 'REST FS Crystal', title: 'Crystal fallback', content: 'crystal body', importance: 0.91, unit_type: 'insight', created_at: 1700000110})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-fs-crystal-detail-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest fs crystal page read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.is_crystal = true AND m.id > $after RETURN m.id, m.title, m.crystal_title, m.is_crystal, m.updated_at, m.metadata, m.is_latest ORDER BY m.id ASC LIMIT $limit",
BTreeMap::from([
(
"after".to_string(),
Value::String("zzzz-rest-fs-crystal-page-0".to_string()),
),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"m.id",
Value::String("zzzz-rest-fs-crystal-page-1".to_string()),
),
("m.title", Value::String("Crystal Page".to_string())),
(
"m.crystal_title",
Value::String("Crystal Page Title".to_string()),
),
("m.is_crystal", Value::Bool(true)),
("m.updated_at", Value::Int(1700000111)),
("m.metadata", Value::String("{\"state\":\"active\"}".to_string())),
("m.is_latest", Value::Bool(true)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'zzzz-rest-fs-crystal-page-1', title: 'Crystal Page', crystal_title: 'Crystal Page Title', is_crystal: true, updated_at: 1700000111, metadata: '{\"state\":\"active\"}', is_latest: true})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'zzzz-rest-fs-crystal-page-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest fs imported artifact source page read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source) WHERE s.id > $after RETURN s.id, s.original_name, s.mime_type, s.updated_at ORDER BY s.id ASC LIMIT $limit",
BTreeMap::from([
(
"after".to_string(),
Value::String("zzzz-rest-fs-artifact-source-0".to_string()),
),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"s.id",
Value::String("zzzz-rest-fs-artifact-source-1".to_string()),
),
(
"s.original_name",
Value::String("Artifact Source.md".to_string()),
),
("s.mime_type", Value::String("text/markdown".to_string())),
("s.updated_at", Value::Int(1700000112)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'zzzz-rest-fs-artifact-source-1', original_name: 'Artifact Source.md', mime_type: 'text/markdown', updated_at: 1700000112})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'zzzz-rest-fs-artifact-source-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest fs generated artifact source page read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source) WHERE s.id > $after AND s.metadata IS NOT NULL AND s.metadata CONTAINS $marker RETURN s.id, s.original_name, s.updated_at ORDER BY s.id ASC LIMIT $limit",
BTreeMap::from([
(
"after".to_string(),
Value::String("zzzz-rest-fs-generated-source-0".to_string()),
),
("marker".to_string(), Value::String("report".to_string())),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"s.id",
Value::String("zzzz-rest-fs-generated-source-1".to_string()),
),
(
"s.original_name",
Value::String("Generated Report".to_string()),
),
("s.updated_at", Value::Int(1700000113)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'zzzz-rest-fs-generated-source-1', original_name: 'Generated Report', metadata: '{\"artifact_kind\":\"report\"}', updated_at: 1700000113})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'zzzz-rest-fs-generated-source-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source list fallback page read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source) RETURN s.id, COALESCE(s.original_name, ''), COALESCE(s.summary, ''), COALESCE(s.mime_type, ''), COALESCE(s.source_type, 'file'), COALESCE(s.source_url, ''), COALESCE(s.size_bytes, 0), COALESCE(s.version, 1), COALESCE(s.memory_count, 0), COALESCE(s.chunk_count, 0), COALESCE(s.lifecycle_state, 'indexed'), COALESCE(s.space_id, 'default'), s.created_at, s.updated_at ORDER BY s.id SKIP $offset LIMIT $limit",
BTreeMap::from([
("offset".to_string(), Value::Int(0)),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"s.id",
Value::String("000-source-list-fallback-1".to_string()),
),
("coalesce", Value::String("List Source".to_string())),
("coalesce#2", Value::String("".to_string())),
("coalesce#3", Value::String("text/markdown".to_string())),
("coalesce#4", Value::String("file".to_string())),
("coalesce#5", Value::String("".to_string())),
("coalesce#6", Value::Int(0)),
("coalesce#7", Value::Int(1)),
("coalesce#8", Value::Int(0)),
("coalesce#9", Value::Int(3)),
("coalesce#10", Value::String("indexed".to_string())),
("coalesce#11", Value::String("default".to_string())),
("s.created_at", Value::Int(11)),
("s.updated_at", Value::Int(12)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: '000-source-list-fallback-1', original_name: 'List Source', mime_type: 'text/markdown', chunk_count: 3, created_at: 11, updated_at: 12})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: '000-source-list-fallback-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"reindex memory projection page read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) RETURN m.id, m.title, m.content, m.importance, m.confidence, m.created_at, m.updated_at, m.is_latest, m.is_crystal, m.unit_type, m.review_status, m.space_id, m.metadata ORDER BY m.id SKIP $offset LIMIT $limit",
BTreeMap::from([
("offset".to_string(), Value::Int(3)),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"m.id",
Value::String("000-reindex-memory-1".to_string()),
),
(
"m.title",
Value::String("Reindex Memory".to_string()),
),
("m.content", Value::String("projection body".to_string())),
("m.importance", Value::Float(0.61)),
("m.confidence", Value::Float(0.71)),
("m.created_at", Value::Int(41)),
("m.updated_at", Value::Int(42)),
("m.is_latest", Value::Bool(true)),
("m.is_crystal", Value::Bool(false)),
("m.unit_type", Value::String("fact".to_string())),
("m.review_status", Value::String("approved".to_string())),
("m.space_id", Value::String("default".to_string())),
("m.metadata", Value::String("{\"kind\":\"reindex\"}".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: '000-reindex-memory-1', title: 'Reindex Memory', content: 'projection body', importance: 0.61, confidence: 0.71, created_at: 41, updated_at: 42, is_latest: true, is_crystal: false, unit_type: 'fact', review_status: 'approved', space_id: 'default', metadata: '{\"kind\":\"reindex\"}'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: '000-reindex-memory-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"reindex entity projection page read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) RETURN e.id, e.name, e.description, e.entity_type, e.created_at ORDER BY e.id SKIP $offset LIMIT $limit",
BTreeMap::from([
("offset".to_string(), Value::Int(0)),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
("e.id", Value::Int(10)),
("e.name", Value::String("Rust".to_string())),
("e.description", Value::Null),
("e.entity_type", Value::Null),
("e.created_at", Value::Null),
])]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"reindex community projection page read",
CypherFixtureStatement::with_parameters(
"MATCH (c:Community) RETURN c.id, c.community_id, COALESCE(c.name, ''), COALESCE(c.description, ''), COALESCE(c.ai_summary, ''), COALESCE(c.member_count, 0), c.created_at ORDER BY c.id SKIP $offset LIMIT $limit",
BTreeMap::from([
("offset".to_string(), Value::Int(0)),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"c.id",
Value::String("000-reindex-community-1".to_string()),
),
("c.community_id", Value::Int(42)),
("coalesce", Value::String(String::new())),
(
"coalesce#2",
Value::String("Community description".to_string()),
),
("coalesce#3", Value::String(String::new())),
("coalesce#4", Value::Int(0)),
("c.created_at", Value::Int(31)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: '000-reindex-community-1', community_id: 42, description: 'Community description', created_at: 31})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (c:Community {id: '000-reindex-community-1'}) DETACH DELETE c",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"reindex thread projection page read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) RETURN t.id, t.thread_id, COALESCE(t.title, ''), COALESCE(t.source, ''), COALESCE(t.project, ''), COALESCE(t.workspace, ''), COALESCE(t.space_id, 'default') ORDER BY t.id SKIP $offset LIMIT $limit",
BTreeMap::from([
("offset".to_string(), Value::Int(0)),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
("t.id", Value::String("000-reindex-thread-1".to_string())),
(
"t.thread_id",
Value::String("thread-logical-1".to_string()),
),
("coalesce", Value::String(String::new())),
("coalesce#2", Value::String("codex".to_string())),
("coalesce#3", Value::String(String::new())),
("coalesce#4", Value::String("workspace".to_string())),
("coalesce#5", Value::String("default".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: '000-reindex-thread-1', thread_id: 'thread-logical-1', source: 'codex', workspace: 'workspace'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: '000-reindex-thread-1'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source overview memory-count ranking read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source) RETURN s.id, COALESCE(s.original_name, s.source_type, 'Source'), s.source_type, s.lifecycle_state, COALESCE(s.memory_count, 0) ORDER BY s.memory_count DESC LIMIT $limit",
BTreeMap::from([("limit".to_string(), Value::Int(1))]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"s.id",
Value::String("source-overview-ranking-1".to_string()),
),
("coalesce", Value::String("Ranked Source".to_string())),
("s.source_type", Value::String("file".to_string())),
("s.lifecycle_state", Value::String("indexed".to_string())),
("coalesce#2", Value::Int(999)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-overview-ranking-1', original_name: 'Ranked Source', source_type: 'file', lifecycle_state: 'indexed', memory_count: 999})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'source-overview-ranking-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source bulk summary fallback read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source) WHERE s.id IN $ids RETURN s.id, COALESCE(s.original_name, s.file_path, s.source_type, 'Source'), s.source_type, s.summary, s.file_path, s.memory_count, s.chunk_count",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![
Value::String("source-bulk-summary-1".to_string()),
Value::String("source-bulk-summary-2".to_string()),
Value::String("missing-source".to_string()),
]),
)]),
),
ExpectedRows::Unordered(vec![
compatibility_row([
("s.id", Value::String("source-bulk-summary-1".to_string())),
("coalesce", Value::String("Bulk Source One".to_string())),
("s.source_type", Value::String("file".to_string())),
("s.summary", Value::String("summary one".to_string())),
(
"s.file_path",
Value::String("/tmp/source-bulk-one.md".to_string()),
),
("s.memory_count", Value::Int(2)),
("s.chunk_count", Value::Int(4)),
]),
compatibility_row([
("s.id", Value::String("source-bulk-summary-2".to_string())),
(
"coalesce",
Value::String("/tmp/source-bulk-two.md".to_string()),
),
("s.source_type", Value::String("file".to_string())),
("s.summary", Value::String("summary two".to_string())),
(
"s.file_path",
Value::String("/tmp/source-bulk-two.md".to_string()),
),
("s.memory_count", Value::Int(0)),
("s.chunk_count", Value::Int(1)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-bulk-summary-1', original_name: 'Bulk Source One', source_type: 'file', summary: 'summary one', file_path: '/tmp/source-bulk-one.md', memory_count: 2, chunk_count: 4})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-bulk-summary-2', source_type: 'file', summary: 'summary two', file_path: '/tmp/source-bulk-two.md', memory_count: 0, chunk_count: 1})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['source-bulk-summary-1', 'source-bulk-summary-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source count read",
CypherFixtureStatement::new("MATCH (s:Source) RETURN count(s)"),
ExpectedRows::Exact(vec![compatibility_row([(
"count(s)",
Value::Int(1),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-count-1', original_name: 'Count Source'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'source-count-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source extracted id list read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source) WHERE s.id IN $ids AND s.lifecycle_state = 'extracted' RETURN s.id",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![
Value::String("source-extracted-id-1".to_string()),
Value::String("source-extracted-id-2".to_string()),
Value::String("missing-source".to_string()),
]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"s.id",
Value::String("source-extracted-id-1".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-extracted-id-1', lifecycle_state: 'extracted'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-extracted-id-2', lifecycle_state: 'indexed'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['source-extracted-id-1', 'source-extracted-id-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source extracted lifecycle mark indexed write",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source) WHERE s.id IN $ids AND s.lifecycle_state = 'extracted' SET s.lifecycle_state = 'indexed', s.updated_at = timestamp($updated_at)",
BTreeMap::from([
(
"ids".to_string(),
Value::List(vec![
Value::String("source-lifecycle-index-1".to_string()),
Value::String("source-lifecycle-index-2".to_string()),
Value::String("missing-source".to_string()),
]),
),
("updated_at".to_string(), Value::Int(1_700_000_001)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-lifecycle-index-1', lifecycle_state: 'extracted', updated_at: 1})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-lifecycle-index-2', lifecycle_state: 'indexed', updated_at: 2})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['source-lifecycle-index-1', 'source-lifecycle-index-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source lifecycle indexed chunk-count write",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source {id: $id}) SET s.lifecycle_state = 'indexed', s.chunk_count = $chunk_count, s.updated_at = timestamp($updated_at)",
BTreeMap::from([
(
"id".to_string(),
Value::String("source-lifecycle-chunk-count-1".to_string()),
),
("chunk_count".to_string(), Value::Int(8)),
("updated_at".to_string(), Value::Int(1_700_000_008)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-lifecycle-chunk-count-1', lifecycle_state: 'parsed', chunk_count: 0, updated_at: 1})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'source-lifecycle-chunk-count-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source lifecycle state update write",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source {id: $id}) SET s.lifecycle_state = $state, s.updated_at = timestamp($updated_at)",
BTreeMap::from([
(
"id".to_string(),
Value::String("source-lifecycle-state-1".to_string()),
),
("state".to_string(), Value::String("failed".to_string())),
("updated_at".to_string(), Value::Int(1_700_000_009)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-lifecycle-state-1', lifecycle_state: 'parsed', updated_at: 1})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'source-lifecycle-state-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source space update write",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source {id: $id}) SET s.space_id = $target_space_id, s.updated_at = timestamp($updated_at)",
BTreeMap::from([
(
"id".to_string(),
Value::String("source-space-update-1".to_string()),
),
(
"target_space_id".to_string(),
Value::String("research".to_string()),
),
("updated_at".to_string(), Value::Int(1_700_000_010)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-space-update-1', space_id: 'default', updated_at: 1})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'source-space-update-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source bulk normalized-space move write",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source) WHERE s.id IN $ids AND CASE WHEN s.space_id IS NULL OR s.space_id = '' THEN 'default' ELSE s.space_id END = $source_space_id SET s.space_id = $target_space_id, s.updated_at = $updated_at",
BTreeMap::from([
(
"ids".to_string(),
Value::List(vec![
Value::String("source-bulk-space-move-1".to_string()),
Value::String("source-bulk-space-move-2".to_string()),
Value::String("missing-source".to_string()),
]),
),
(
"source_space_id".to_string(),
Value::String("default".to_string()),
),
(
"target_space_id".to_string(),
Value::String("research".to_string()),
),
("updated_at".to_string(), Value::Int(1_700_000_011)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-bulk-space-move-1', space_id: '', updated_at: 1})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-bulk-space-move-2', space_id: 'archive', updated_at: 2})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['source-bulk-space-move-1', 'source-bulk-space-move-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source normalized-space id list read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source) WHERE CASE WHEN s.space_id IS NULL OR s.space_id = '' THEN 'default' ELSE s.space_id END = $space_id RETURN s.id",
BTreeMap::from([(
"space_id".to_string(),
Value::String("default".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"s.id",
Value::String("source-normalized-space-1".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-normalized-space-1', space_id: ''})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-normalized-space-2', space_id: 'archive'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['source-normalized-space-1', 'source-normalized-space-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory normalized-space id list read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END = $space_id RETURN m.id",
BTreeMap::from([(
"space_id".to_string(),
Value::String("default".to_string()),
)]),
),
ExpectedRows::Unordered(vec![
compatibility_row([("m.id", Value::Int(1))]),
compatibility_row([("m.id", Value::Int(2))]),
compatibility_row([("m.id", Value::Int(3))]),
compatibility_row([(
"m.id",
Value::String("memory-normalized-space-1".to_string()),
)]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-normalized-space-1', space_id: ''})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-normalized-space-2', space_id: 'archive'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['memory-normalized-space-1', 'memory-normalized-space-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory bulk normalized-space move write",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $ids AND CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END = $source_space_id SET m.space_id = $target_space_id, m.updated_at = $updated_at",
BTreeMap::from([
(
"ids".to_string(),
Value::List(vec![
Value::String("memory-bulk-space-move-1".to_string()),
Value::String("memory-bulk-space-move-2".to_string()),
Value::String("missing-memory".to_string()),
]),
),
(
"source_space_id".to_string(),
Value::String("default".to_string()),
),
(
"target_space_id".to_string(),
Value::String("research".to_string()),
),
("updated_at".to_string(), Value::Int(1_700_000_012)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-bulk-space-move-1', space_id: '', updated_at: 1})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-bulk-space-move-2', space_id: 'archive', updated_at: 2})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['memory-bulk-space-move-1', 'memory-bulk-space-move-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory normalized-space limit-one read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END = $space_id RETURN m.id LIMIT 1",
BTreeMap::from([(
"space_id".to_string(),
Value::String("archive".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"m.id",
Value::String("memory-normalized-limit-1".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-normalized-limit-1', space_id: 'archive'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'memory-normalized-limit-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory candidate normalized-space id read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $candidate_ids AND CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END = $source_space_id RETURN m.id",
BTreeMap::from([
(
"candidate_ids".to_string(),
Value::List(vec![
Value::String("memory-candidate-space-1".to_string()),
Value::String("memory-candidate-space-2".to_string()),
Value::String("missing-memory".to_string()),
]),
),
(
"source_space_id".to_string(),
Value::String("default".to_string()),
),
]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"m.id",
Value::String("memory-candidate-space-1".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-candidate-space-1', space_id: ''})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-candidate-space-2', space_id: 'archive'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['memory-candidate-space-1', 'memory-candidate-space-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory candidate normalized-space exclusion read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $candidate_ids AND CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END <> $target_space_id RETURN m.id",
BTreeMap::from([
(
"candidate_ids".to_string(),
Value::List(vec![
Value::String("memory-candidate-exclusion-1".to_string()),
Value::String("memory-candidate-exclusion-2".to_string()),
Value::String("memory-candidate-exclusion-3".to_string()),
]),
),
(
"target_space_id".to_string(),
Value::String("default".to_string()),
),
]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"m.id",
Value::String("memory-candidate-exclusion-3".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-candidate-exclusion-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-candidate-exclusion-2', space_id: ''})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-candidate-exclusion-3', space_id: 'archive'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['memory-candidate-exclusion-1', 'memory-candidate-exclusion-2', 'memory-candidate-exclusion-3'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory normalized-space count read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END = $source_space_id RETURN count(m)",
BTreeMap::from([(
"source_space_id".to_string(),
Value::String("count-space".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([("count(m)", Value::Int(2))])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-normalized-count-1', space_id: 'count-space'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-normalized-count-2', space_id: 'count-space'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-normalized-count-3', space_id: 'other-space'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['memory-normalized-count-1', 'memory-normalized-count-2', 'memory-normalized-count-3'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory normalized-space limited id read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END = $source_space_id RETURN m.id LIMIT $limit",
BTreeMap::from([
(
"source_space_id".to_string(),
Value::String("limited-space".to_string()),
),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-normalized-limited-1', space_id: 'limited-space'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-normalized-limited-2', space_id: 'limited-space'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['memory-normalized-limited-1', 'memory-normalized-limited-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory unit type update returning id",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $id}) SET m.unit_type = $unit_type, m.updated_at = $updated_at RETURN m.id",
BTreeMap::from([
(
"id".to_string(),
Value::String("memory-unit-type-update-1".to_string()),
),
(
"unit_type".to_string(),
Value::String("context".to_string()),
),
("updated_at".to_string(), Value::Int(1_700_000_017)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"m.id",
Value::String("memory-unit-type-update-1".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-unit-type-update-1', unit_type: 'fact', updated_at: 1})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'memory-unit-type-update-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory lifecycle metadata update",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $id}) SET m.metadata = $metadata, m.is_latest = $is_latest, m.lifecycle_state = $lifecycle_state, m.updated_at = $updated_at",
BTreeMap::from([
(
"id".to_string(),
Value::String("memory-lifecycle-update-1".to_string()),
),
(
"metadata".to_string(),
Value::String("{\"state\":\"archived\"}".to_string()),
),
("is_latest".to_string(), Value::Bool(false)),
(
"lifecycle_state".to_string(),
Value::String("archived".to_string()),
),
("updated_at".to_string(), Value::Int(1_700_000_018)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-lifecycle-update-1', metadata: '{}', is_latest: true, lifecycle_state: 'active', updated_at: 1})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'memory-lifecycle-update-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory id-list normalized-space move returning ids",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $memory_ids AND CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END = $source_space_id SET m.space_id = $target_space_id, m.updated_at = $updated_at RETURN m.id",
BTreeMap::from([
(
"memory_ids".to_string(),
Value::List(vec![
Value::String("memory-returning-space-move-1".to_string()),
Value::String("memory-returning-space-move-2".to_string()),
Value::String("missing-memory".to_string()),
]),
),
(
"source_space_id".to_string(),
Value::String("default".to_string()),
),
(
"target_space_id".to_string(),
Value::String("research".to_string()),
),
("updated_at".to_string(), Value::Int(1_700_000_015)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"m.id",
Value::String("memory-returning-space-move-1".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-returning-space-move-1', space_id: '', updated_at: 1})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-returning-space-move-2', space_id: 'archive', updated_at: 2})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['memory-returning-space-move-1', 'memory-returning-space-move-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory id-list normalized-space exclusion move returning ids",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $memory_ids AND CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END <> $target_space_id SET m.space_id = $target_space_id, m.updated_at = $updated_at RETURN m.id",
BTreeMap::from([
(
"memory_ids".to_string(),
Value::List(vec![
Value::String("memory-returning-exclusion-move-1".to_string()),
Value::String("memory-returning-exclusion-move-2".to_string()),
Value::String("memory-returning-exclusion-move-3".to_string()),
]),
),
(
"target_space_id".to_string(),
Value::String("default".to_string()),
),
("updated_at".to_string(), Value::Int(1_700_000_016)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"m.id",
Value::String("memory-returning-exclusion-move-3".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-returning-exclusion-move-1', updated_at: 1})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-returning-exclusion-move-2', space_id: '', updated_at: 2})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-returning-exclusion-move-3', space_id: 'archive', updated_at: 3})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['memory-returning-exclusion-move-1', 'memory-returning-exclusion-move-2', 'memory-returning-exclusion-move-3'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread normalized-space id pair read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END = $space_id RETURN t.id, t.thread_id",
BTreeMap::from([(
"space_id".to_string(),
Value::String("default".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"t.id",
Value::String("thread-normalized-space-1".to_string()),
),
(
"t.thread_id",
Value::String("thread-normalized-logical-1".to_string()),
),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-normalized-space-1', thread_id: 'thread-normalized-logical-1', space_id: ''})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-normalized-space-2', thread_id: 'thread-normalized-logical-2', space_id: 'archive'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['thread-normalized-space-1', 'thread-normalized-space-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread bulk node-id normalized-space move write",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE t.id IN $ids AND CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END = $source_space_id SET t.space_id = $target_space_id, t.updated_at = $updated_at",
BTreeMap::from([
(
"ids".to_string(),
Value::List(vec![
Value::String("thread-node-space-move-1".to_string()),
Value::String("thread-node-space-move-2".to_string()),
Value::String("missing-thread".to_string()),
]),
),
(
"source_space_id".to_string(),
Value::String("default".to_string()),
),
(
"target_space_id".to_string(),
Value::String("research".to_string()),
),
("updated_at".to_string(), Value::Int(1_700_000_013)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-node-space-move-1', thread_id: 'thread-node-space-logical-1', space_id: '', updated_at: 1})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-node-space-move-2', thread_id: 'thread-node-space-logical-2', space_id: 'archive', updated_at: 2})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['thread-node-space-move-1', 'thread-node-space-move-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread denorm preserve newer update",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $thread_uuid}) SET t.message_count = $message_count, t.updated_at = CASE WHEN $updated_at IS NULL THEN t.updated_at WHEN $preserve_newer_existing_updated_at = true AND t.updated_at IS NOT NULL AND t.updated_at > $updated_at THEN t.updated_at ELSE $updated_at END",
BTreeMap::from([
(
"thread_uuid".to_string(),
Value::String("thread-denorm-update-1".to_string()),
),
("message_count".to_string(), Value::Int(7)),
("updated_at".to_string(), Value::Int(100)),
(
"preserve_newer_existing_updated_at".to_string(),
Value::Bool(true),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-denorm-update-1', message_count: 1, updated_at: 200})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'thread-denorm-update-1'}) RETURN t.message_count, t.updated_at",
),
ExpectedRows::Exact(vec![compatibility_row([
("t.message_count", Value::Int(7)),
("t.updated_at", Value::Int(200)),
])]),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'thread-denorm-update-1'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread identity normalized-space id read",
CypherFixtureStatement::with_parameters(
"MATCH (ti:ThreadIdentity) WHERE CASE WHEN ti.space_id IS NULL OR ti.space_id = '' THEN 'default' ELSE ti.space_id END = $space_id RETURN ti.thread_id",
BTreeMap::from([(
"space_id".to_string(),
Value::String("default".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"ti.thread_id",
Value::String("identity-normalized-logical-1".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:ThreadIdentity {id: 'thread-identity-normalized-space-1', thread_id: 'identity-normalized-logical-1', space_id: ''})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:ThreadIdentity {id: 'thread-identity-normalized-space-2', thread_id: 'identity-normalized-logical-2', space_id: 'archive'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['thread-identity-normalized-space-1', 'thread-identity-normalized-space-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest thread source lookup read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE t.thread_id = $sid OR t.id = $sid RETURN t.thread_id, t.title, t.source, t.created_at LIMIT 1",
BTreeMap::from([(
"sid".to_string(),
Value::String("rest-thread-logical-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"t.thread_id",
Value::String("rest-thread-logical-1".to_string()),
),
("t.title", Value::String("REST Thread".to_string())),
("t.source", Value::String("codex".to_string())),
("t.created_at", Value::Int(1_700_000_060)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'rest-thread-node-1', thread_id: 'rest-thread-logical-1', title: 'REST Thread', source: 'codex', created_at: 1700000060})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'rest-thread-node-1'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest fs thread source distinct listing read",
CypherFixtureStatement::new(
"MATCH (t:Thread) WHERE t.source IS NOT NULL AND t.source <> '' RETURN DISTINCT t.source AS s ORDER BY s ASC",
),
ExpectedRows::Exact(vec![
compatibility_row([("s", Value::String("codex".to_string()))]),
compatibility_row([("s", Value::String("web".to_string()))]),
]),
)
.with_setup_query(CypherFixtureStatement::new("MATCH (t:Thread) DETACH DELETE t"))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'rest-fs-thread-source-1', source: 'codex'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'rest-fs-thread-source-2', source: 'web'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'rest-fs-thread-source-empty', source: ''})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread) WHERE t.id IN ['rest-fs-thread-source-1', 'rest-fs-thread-source-2', 'rest-fs-thread-source-empty'] DETACH DELETE t",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph thread overview ranking read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) RETURN t.id, COALESCE(t.title, t.source, 'Thread'), t.source, COALESCE(t.message_count, 0), t.space_id, t.summary, t.created_at, t.updated_at ORDER BY t.message_count DESC LIMIT $limit",
BTreeMap::from([("limit".to_string(), Value::Int(1))]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'rest-graph-thread-overview', title: 'Rest Graph Thread Overview', source: 'fixture', message_count: 999999, space_id: 'default', summary: 'overview fixture', created_at: 1, updated_at: 2})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'rest-graph-thread-overview'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest fs thread source page read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE t.source = $source AND t.id > $after RETURN t.id, t.title, t.updated_at ORDER BY t.id ASC LIMIT $limit",
BTreeMap::from([
("source".to_string(), Value::String("codex".to_string())),
(
"after".to_string(),
Value::String("rest-fs-thread-page-0".to_string()),
),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"t.id",
Value::String("rest-fs-thread-page-1".to_string()),
),
("t.title", Value::String("REST FS Thread Page".to_string())),
("t.updated_at", Value::Int(1700000104)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'rest-fs-thread-page-1', title: 'REST FS Thread Page', source: 'codex', updated_at: 1700000104})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'rest-fs-thread-page-1'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest fs thread meta lookup read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE (t.id = $key OR t.id STARTS WITH $key OR t.id CONTAINS $key) AND t.source = $source RETURN t.id, t.thread_id, t.title, t.summary, t.message_count, t.source, t.created_at, t.updated_at, t.space_id, t.project, t.workspace LIMIT 1",
BTreeMap::from([
(
"key".to_string(),
Value::String("rest-fs-thread-meta-1".to_string()),
),
("source".to_string(), Value::String("codex".to_string())),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"t.id",
Value::String("rest-fs-thread-meta-1".to_string()),
),
(
"t.thread_id",
Value::String("rest-fs-thread-logical-1".to_string()),
),
("t.title", Value::String("REST FS Thread Meta".to_string())),
("t.summary", Value::String("meta summary".to_string())),
("t.message_count", Value::Int(2)),
("t.source", Value::String("codex".to_string())),
("t.created_at", Value::Int(1700000105)),
("t.updated_at", Value::Int(1700000106)),
("t.space_id", Value::String("default".to_string())),
("t.project", Value::String("hawdb".to_string())),
("t.workspace", Value::String("local".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'rest-fs-thread-meta-1', thread_id: 'rest-fs-thread-logical-1', title: 'REST FS Thread Meta', summary: 'meta summary', message_count: 2, source: 'codex', created_at: 1700000105, updated_at: 1700000106, space_id: 'default', project: 'hawdb', workspace: 'local'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'rest-fs-thread-meta-1'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest fs thread messages lookup read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE (t.id = $key OR t.id STARTS WITH $key OR t.id CONTAINS $key) AND t.source = $source RETURN t.id, t.message_count, t.space_id LIMIT 1",
BTreeMap::from([
(
"key".to_string(),
Value::String("rest-fs-thread-messages-1".to_string()),
),
("source".to_string(), Value::String("codex".to_string())),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"t.id",
Value::String("rest-fs-thread-messages-1".to_string()),
),
("t.message_count", Value::Int(2)),
("t.space_id", Value::String("default".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'rest-fs-thread-messages-1', message_count: 2, source: 'codex', space_id: 'default'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'rest-fs-thread-messages-1'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest fs thread legacy messages read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $thread_uuid})-[c:CONTAINS]->(m:Message) RETURN m.id, m.role, m.content, COALESCE(c.order_index, m.order_index), m.timestamp, m.token_count ORDER BY COALESCE(c.order_index, m.order_index)",
BTreeMap::from([(
"thread_uuid".to_string(),
Value::String("rest-fs-thread-legacy-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([
(
"m.id",
Value::String("rest-fs-thread-legacy-msg-1".to_string()),
),
("m.role", Value::String("user".to_string())),
("m.content", Value::String("first message".to_string())),
("coalesce", Value::Int(1)),
("m.timestamp", Value::Int(1700000107)),
("m.token_count", Value::Int(3)),
]),
compatibility_row([
(
"m.id",
Value::String("rest-fs-thread-legacy-msg-2".to_string()),
),
("m.role", Value::String("assistant".to_string())),
("m.content", Value::String("second message".to_string())),
("coalesce", Value::Int(2)),
("m.timestamp", Value::Int(1700000108)),
("m.token_count", Value::Null),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'rest-fs-thread-legacy-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Message {id: 'rest-fs-thread-legacy-msg-1', role: 'user', content: 'first message', order_index: 9, timestamp: 1700000107, token_count: 3})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Message {id: 'rest-fs-thread-legacy-msg-2', role: 'assistant', content: 'second message', order_index: 2, timestamp: 1700000108})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'rest-fs-thread-legacy-1'}), (m:Message {id: 'rest-fs-thread-legacy-msg-1'}) CREATE (t)-[:CONTAINS {order_index: 1}]->(m)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'rest-fs-thread-legacy-1'}), (m:Message {id: 'rest-fs-thread-legacy-msg-2'}) CREATE (t)-[:CONTAINS]->(m)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-fs-thread-legacy-1', 'rest-fs-thread-legacy-msg-1', 'rest-fs-thread-legacy-msg-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest agent thread attachment title read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE t.thread_id = $id OR t.id = $id RETURN t.title LIMIT 1",
BTreeMap::from([(
"id".to_string(),
Value::String("rest-agent-thread-logical-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"t.title",
Value::String("Agent Thread".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'rest-agent-thread-node-1', thread_id: 'rest-agent-thread-logical-1', title: 'Agent Thread'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'rest-agent-thread-node-1'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread identity bulk normalized-space move write",
CypherFixtureStatement::with_parameters(
"MATCH (ti:ThreadIdentity) WHERE ti.thread_id IN $ids AND CASE WHEN ti.space_id IS NULL OR ti.space_id = '' THEN 'default' ELSE ti.space_id END = $source_space_id SET ti.space_id = $target_space_id, ti.updated_at = $updated_at",
BTreeMap::from([
(
"ids".to_string(),
Value::List(vec![
Value::String("identity-bulk-space-logical-1".to_string()),
Value::String("identity-bulk-space-logical-2".to_string()),
Value::String("missing-identity".to_string()),
]),
),
(
"source_space_id".to_string(),
Value::String("default".to_string()),
),
(
"target_space_id".to_string(),
Value::String("research".to_string()),
),
("updated_at".to_string(), Value::Int(1_700_000_014)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:ThreadIdentity {id: 'thread-identity-bulk-space-1', thread_id: 'identity-bulk-space-logical-1', space_id: '', updated_at: 1})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:ThreadIdentity {id: 'thread-identity-bulk-space-2', thread_id: 'identity-bulk-space-logical-2', space_id: 'archive', updated_at: 2})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['thread-identity-bulk-space-1', 'thread-identity-bulk-space-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread identity resolve read",
CypherFixtureStatement::with_parameters(
"MATCH (ti:ThreadIdentity {id: $identity_key}) RETURN ti.thread_node_id, ti.thread_id, ti.space_id, ti.source LIMIT 1",
BTreeMap::from([(
"identity_key".to_string(),
Value::String("identity-resolve-logical-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"ti.thread_node_id",
Value::String("identity-resolve-node-1".to_string()),
),
(
"ti.thread_id",
Value::String("identity-resolve-logical-1".to_string()),
),
("ti.space_id", Value::String("default".to_string())),
("ti.source", Value::String("codex".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:ThreadIdentity {id: 'identity-resolve-logical-1', thread_node_id: 'identity-resolve-node-1', thread_id: 'identity-resolve-logical-1', space_id: 'default', source: 'codex'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (ti:ThreadIdentity {id: 'identity-resolve-logical-1'}) DETACH DELETE ti",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread identity compensation delete",
CypherFixtureStatement::with_parameters(
"MATCH (ti:ThreadIdentity {id: $identity_key}) DETACH DELETE ti",
BTreeMap::from([(
"identity_key".to_string(),
Value::String("identity-compensation-delete-1".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:ThreadIdentity {id: 'identity-compensation-delete-1', thread_node_id: 'identity-compensation-node-1', thread_id: 'identity-compensation-logical-1', space_id: 'default', source: 'codex'})",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread identity cascade delete",
CypherFixtureStatement::with_parameters(
"MATCH (ti:ThreadIdentity) WHERE ti.id = $public_thread_id OR ti.id = $input_thread_id OR ti.thread_node_id = $thread_uuid DETACH DELETE ti",
BTreeMap::from([
(
"public_thread_id".to_string(),
Value::String("identity-cascade-public".to_string()),
),
(
"input_thread_id".to_string(),
Value::String("identity-cascade-input".to_string()),
),
(
"thread_uuid".to_string(),
Value::String("identity-cascade-node".to_string()),
),
]),
),
ExpectedRows::RowCount(3),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:ThreadIdentity {id: 'identity-cascade-public', thread_node_id: 'identity-cascade-other-1', thread_id: 'identity-cascade-logical-public'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:ThreadIdentity {id: 'identity-cascade-input', thread_node_id: 'identity-cascade-other-2', thread_id: 'identity-cascade-logical-input'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:ThreadIdentity {id: 'identity-cascade-by-node', thread_node_id: 'identity-cascade-node', thread_id: 'identity-cascade-logical-node'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:ThreadIdentity {id: 'identity-cascade-survivor', thread_node_id: 'identity-cascade-survivor-node', thread_id: 'identity-cascade-logical-survivor'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (ti:ThreadIdentity {id: 'identity-cascade-survivor'}) DETACH DELETE ti",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread compensation delete",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $thread_uuid}) DETACH DELETE t",
BTreeMap::from([(
"thread_uuid".to_string(),
Value::String("thread-compensation-delete-1".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-compensation-delete-1', thread_id: 'thread-compensation-logical-1', source: 'codex'})",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread logical fallback resolve read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {thread_id: $thread_id}) RETURN t.id, t.thread_id, t.space_id, t.source LIMIT 2",
BTreeMap::from([(
"thread_id".to_string(),
Value::String("thread-fallback-logical-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("t.id", Value::String("thread-fallback-node-1".to_string())),
(
"t.thread_id",
Value::String("thread-fallback-logical-1".to_string()),
),
("t.space_id", Value::String("default".to_string())),
("t.source", Value::String("codex".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-fallback-node-1', thread_id: 'thread-fallback-logical-1', space_id: 'default', source: 'codex'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'thread-fallback-node-1'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread sync metadata coalesced read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $id}) RETURN COALESCE(t.title, ''), COALESCE(t.source, ''), COALESCE(t.project, ''), COALESCE(t.workspace, ''), COALESCE(t.space_id, 'default')",
BTreeMap::from([(
"id".to_string(),
Value::String("thread-sync-metadata-node-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("coalesce", Value::String("Sync Metadata".to_string())),
("coalesce#2", Value::String("codex".to_string())),
("coalesce#3", Value::String(String::new())),
("coalesce#4", Value::String(String::new())),
("coalesce#5", Value::String("default".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-sync-metadata-node-1', title: 'Sync Metadata', source: 'codex'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'thread-sync-metadata-node-1'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread create with identity payload write",
CypherFixtureStatement::with_parameters(
"CREATE (t:Thread { id: $id, thread_id: $thread_id, title: $title, summary: $summary, message_count: $message_count, participants: $participants, source: $source, created_at: $created_at, updated_at: $updated_at, space_id: $space_id, project: $project, workspace: $workspace, tool_version: $tool_version, import_date: $import_date, metadata: $metadata })",
BTreeMap::from([
("id".to_string(), Value::String("thread-create-node-1".to_string())),
("thread_id".to_string(), Value::String("thread-create-logical-1".to_string())),
("title".to_string(), Value::String("Created Thread".to_string())),
("summary".to_string(), Value::String(String::new())),
("message_count".to_string(), Value::Int(2)),
(
"participants".to_string(),
Value::List(vec![Value::String("user".to_string())]),
),
("source".to_string(), Value::String("codex".to_string())),
("created_at".to_string(), Value::Int(101)),
("updated_at".to_string(), Value::Int(102)),
("space_id".to_string(), Value::String("default".to_string())),
("project".to_string(), Value::String("hawdb".to_string())),
("workspace".to_string(), Value::String("local".to_string())),
("tool_version".to_string(), Value::String("test".to_string())),
("import_date".to_string(), Value::Int(103)),
("metadata".to_string(), Value::String("{}".to_string())),
]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'thread-create-node-1'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread identity create write",
CypherFixtureStatement::with_parameters(
"CREATE (ti:ThreadIdentity { id: $id, thread_id: $thread_id, thread_node_id: $thread_node_id, source: $source, space_id: $space_id, created_at: $created_at, updated_at: $updated_at })",
BTreeMap::from([
("id".to_string(), Value::String("identity-create-logical-1".to_string())),
("thread_id".to_string(), Value::String("identity-create-logical-1".to_string())),
("thread_node_id".to_string(), Value::String("identity-create-node-1".to_string())),
("source".to_string(), Value::String("codex".to_string())),
("space_id".to_string(), Value::String("default".to_string())),
("created_at".to_string(), Value::Int(201)),
("updated_at".to_string(), Value::Int(202)),
]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (ti:ThreadIdentity {id: 'identity-create-logical-1'}) DETACH DELETE ti",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread normalized-space logical id read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END = $space_id RETURN t.thread_id",
BTreeMap::from([(
"space_id".to_string(),
Value::String("default".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"t.thread_id",
Value::String("thread-normalized-logical-only-1".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-normalized-logical-only-node-1', thread_id: 'thread-normalized-logical-only-1', space_id: ''})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-normalized-logical-only-node-2', thread_id: 'thread-normalized-logical-only-2', space_id: 'archive'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['thread-normalized-logical-only-node-1', 'thread-normalized-logical-only-node-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory entity name list read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $memory_id})-[:MENTIONS]->(e:Entity) RETURN e.name LIMIT $limit",
BTreeMap::from([
(
"memory_id".to_string(),
Value::String("memory-entity-list-memory-1".to_string()),
),
("limit".to_string(), Value::Int(10)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"e.name",
Value::String("HawDB".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-entity-list-memory-1', title: 'Entity linked memory'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'memory-entity-list-entity-1', name: 'HawDB'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'memory-entity-list-memory-1'}), (e:Entity {id: 'memory-entity-list-entity-1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['memory-entity-list-memory-1', 'memory-entity-list-entity-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest memory related entity metadata read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $memory_id})-[:MENTIONS]->(e:Entity) RETURN e.name, e.entity_type, e.confidence",
BTreeMap::from([(
"memory_id".to_string(),
Value::String("rest-entity-memory-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("e.name", Value::String("Nowledge".to_string())),
("e.entity_type", Value::String("system".to_string())),
("e.confidence", Value::Float(0.82)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-entity-memory-1', title: 'REST entity memory'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'rest-entity-node-1', name: 'Nowledge', entity_type: 'system', confidence: 0.82})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-entity-memory-1'}), (e:Entity {id: 'rest-entity-node-1'}) CREATE (m)-[:MENTIONS {confidence: 0.31}]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-entity-memory-1', 'rest-entity-node-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory entity endpoint bulk read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[:MENTIONS]->(e:Entity) WHERE m.id IN $mids AND e.id IN $eids RETURN m.id, e.id",
BTreeMap::from([
(
"mids".to_string(),
Value::List(vec![
Value::String("memory-entity-endpoint-memory-1".to_string()),
Value::String("missing-memory".to_string()),
]),
),
(
"eids".to_string(),
Value::List(vec![
Value::String("memory-entity-endpoint-entity-1".to_string()),
Value::String("missing-entity".to_string()),
]),
),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"m.id",
Value::String("memory-entity-endpoint-memory-1".to_string()),
),
(
"e.id",
Value::String("memory-entity-endpoint-entity-1".to_string()),
),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-entity-endpoint-memory-1', title: 'Endpoint memory'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'memory-entity-endpoint-entity-1', name: 'Endpoint entity'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'memory-entity-endpoint-memory-1'}), (e:Entity {id: 'memory-entity-endpoint-entity-1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['memory-entity-endpoint-memory-1', 'memory-entity-endpoint-entity-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source fan-in relationship count",
CypherFixtureStatement::with_parameters(
"MATCH (:Memory)-[r:SOURCED_FROM]->(:Source {id: $id}) RETURN count(r)",
BTreeMap::from([(
"id".to_string(),
Value::String("fan-in-source-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([("count(r)", Value::Int(1))])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'fan-in-source-1', original_name: 'Fan in source'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 1}), (s:Source {id: 'fan-in-source-1'}) CREATE (m)-[:SOURCED_FROM {chunk_index: 0}]->(s)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'fan-in-source-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source detail memory-count read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source) WHERE s.id = $id OPTIONAL MATCH (m:Memory)-[:SOURCED_FROM]->(s) RETURN s.id, s.title, s.source_type, COUNT(m)",
BTreeMap::from([(
"id".to_string(),
Value::String("source-detail-count-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"s.id",
Value::String("source-detail-count-1".to_string()),
),
("s.title", Value::String("Detail Source".to_string())),
("s.source_type", Value::String("markdown".to_string())),
("count(m)", Value::Int(2)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-detail-count-1', title: 'Detail Source', source_type: 'markdown'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'source-detail-memory-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'source-detail-memory-2'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'source-detail-memory-1'}), (s:Source {id: 'source-detail-count-1'}) CREATE (m)-[:SOURCED_FROM]->(s)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'source-detail-memory-2'}), (s:Source {id: 'source-detail-count-1'}) CREATE (m)-[:SOURCED_FROM]->(s)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['source-detail-count-1', 'source-detail-memory-1', 'source-detail-memory-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"projection fallback read",
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 1})-[r:MENTIONS]->(e:Entity) RETURN COALESCE(m.title, LEFT(COALESCE(m.content, ''), 60)) AS label, COALESCE(r.strength, r.weight, 0.5) AS weight",
),
ExpectedRows::Exact(vec![compatibility_row([
("label", Value::String("Graph foundations".to_string())),
("weight", Value::Int(3)),
])]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"projection fallback ordering",
CypherFixtureStatement::new(
"MATCH (m:Memory) RETURN m.id AS id ORDER BY COALESCE(m.pagerank_score, m.importance, 0.5) DESC",
),
ExpectedRows::Exact(vec![
compatibility_row([("id", Value::Int(1))]),
compatibility_row([("id", Value::Int(3))]),
compatibility_row([("id", Value::Int(2))]),
]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"memory ranked overview read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) RETURN m.id, COALESCE(m.title, LEFT(m.content, 60)), m.title, LEFT(COALESCE(m.content, ''), 200), COALESCE(m.pagerank_score, m.importance, 0.5), m.community_id, m.space_id, m.created_at, m.updated_at, m.source, m.event_start, m.event_end, m.importance ORDER BY COALESCE(m.pagerank_score, m.importance, 0.5) DESC LIMIT $limit",
BTreeMap::from([("limit".to_string(), Value::Int(3))]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("m.id", Value::String("overview-memory-1".to_string())),
("coalesce", Value::String("Overview One".to_string())),
("m.title", Value::String("Overview One".to_string())),
("left", Value::String("body one".to_string())),
("coalesce#2", Value::Float(3.0)),
("m.community_id", Value::Int(7001)),
("m.space_id", Value::String("default".to_string())),
("m.created_at", Value::Int(101)),
("m.updated_at", Value::Int(201)),
("m.source", Value::String("overview".to_string())),
("m.event_start", Value::Int(301)),
("m.event_end", Value::Int(401)),
("m.importance", Value::Float(0.1)),
]),
compatibility_row([
("m.id", Value::String("overview-memory-2".to_string())),
("coalesce", Value::String("Fallback body".to_string())),
("m.title", Value::Null),
("left", Value::String("Fallback body".to_string())),
("coalesce#2", Value::Float(2.0)),
("m.community_id", Value::Int(7002)),
("m.space_id", Value::String("default".to_string())),
("m.created_at", Value::Int(102)),
("m.updated_at", Value::Int(202)),
("m.source", Value::String("overview".to_string())),
("m.event_start", Value::Int(302)),
("m.event_end", Value::Int(402)),
("m.importance", Value::Float(0.2)),
]),
compatibility_row([
("m.id", Value::String("overview-memory-3".to_string())),
("coalesce", Value::String("Overview Three".to_string())),
("m.title", Value::String("Overview Three".to_string())),
("left", Value::String(String::new())),
("coalesce#2", Value::Float(1.0)),
("m.community_id", Value::Int(7003)),
("m.space_id", Value::String("default".to_string())),
("m.created_at", Value::Int(103)),
("m.updated_at", Value::Int(203)),
("m.source", Value::String("overview".to_string())),
("m.event_start", Value::Int(303)),
("m.event_end", Value::Int(403)),
("m.importance", Value::Float(0.3)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'overview-memory-1', title: 'Overview One', content: 'body one', pagerank_score: 3.0, importance: 0.1, community_id: 7001, space_id: 'default', created_at: 101, updated_at: 201, source: 'overview', event_start: 301, event_end: 401})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'overview-memory-2', content: 'Fallback body', pagerank_score: 2.0, importance: 0.2, community_id: 7002, space_id: 'default', created_at: 102, updated_at: 202, source: 'overview', event_start: 302, event_end: 402})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'overview-memory-3', title: 'Overview Three', pagerank_score: 1.0, importance: 0.3, community_id: 7003, space_id: 'default', created_at: 103, updated_at: 203, source: 'overview', event_start: 303, event_end: 403})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['overview-memory-1', 'overview-memory-2', 'overview-memory-3'] DETACH DELETE m",
),
ExpectedRows::RowCount(3),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"memory review-status bulk read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, m.review_status, m.title, m.content",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![Value::Int(1), Value::Int(2), Value::Int(99)]),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("m.id", Value::Int(1)),
("m.review_status", Value::Null),
("m.title", Value::String("Graph foundations".to_string())),
("m.content", Value::Null),
]),
compatibility_row([
("m.id", Value::Int(2)),
("m.review_status", Value::Null),
("m.title", Value::String("Runtime strategy".to_string())),
("m.content", Value::Null),
]),
]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"predicate fallback read",
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE COALESCE(m.is_crystal, false) = false RETURN m.id AS id ORDER BY id ASC",
),
ExpectedRows::Exact(vec![
compatibility_row([("id", Value::Int(1))]),
compatibility_row([("id", Value::Int(2))]),
]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"case insensitive fallback grep",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE LOWER(COALESCE(m.title, '')) CONTAINS LOWER($needle) RETURN m.id AS id",
BTreeMap::from([("needle".to_string(), Value::String("GRAPH".to_string()))]),
),
ExpectedRows::Exact(vec![compatibility_row([("id", Value::Int(1))])]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"anonymous relationship count",
CypherFixtureStatement::new(
"MATCH (:Memory)-[r:MENTIONS]->(:Entity) RETURN count(r) AS total",
),
ExpectedRows::Exact(vec![compatibility_row([("total", Value::Int(2))])]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"relationship property read",
CypherFixtureStatement::new(
"MATCH (m:Memory)-[r:MENTIONS {weight: 4}]->(e:Entity) RETURN e.name AS entity, r.weight AS weight",
),
ExpectedRows::Exact(vec![compatibility_row([
("entity", Value::String("Cypher".to_string())),
("weight", Value::Int(4)),
])]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"unlabeled node mutation",
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id = 1 SET n.community_id = 42",
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.community_id = 42 RETURN n.id AS id",
),
ExpectedRows::Exact(vec![compatibility_row([("id", Value::Int(1))])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"relationship property mutation",
CypherFixtureStatement::new(
"MATCH (m:Memory)-[r:MENTIONS {weight: 3}]->(e:Entity) WHERE m.id = 1 AND r.weight = 3 SET r.weight = 7",
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory)-[r:MENTIONS]->(e:Entity) WHERE m.id = 1 RETURN r.weight AS weight",
),
ExpectedRows::Exact(vec![compatibility_row([("weight", Value::Int(7))])]),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"cypher projected graph definition",
CypherFixtureStatement::new(
"CALL project_graph('MemoryMentions', ['Memory', 'Entity'], ['MENTIONS'])",
),
ExpectedRows::Exact(vec![compatibility_row([
("graph_name", Value::String("MemoryMentions".to_string())),
("node_count", Value::Int(5)),
("edge_count", Value::Int(2)),
])]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"unified projected graph map definition",
CypherFixtureStatement::new(
"CALL PROJECT_GRAPH('UnifiedGraph', ['Entity', 'Memory'], { 'RELATES_TO': '', 'MENTIONS': '', 'MEMORY_RELATES_TO': \"r.status = 'active'\" })",
),
ExpectedRows::Exact(vec![compatibility_row([
("graph_name", Value::String("UnifiedGraph".to_string())),
("node_count", Value::Int(5)),
("edge_count", Value::Int(2)),
])]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
// The two source-to-sink pairs and one isolated node lose
// dangling mass: base = (1 - 0.85) / 5, sink = base * 1.85.
// The legacy projected-graph helper below keeps its oracle.
"page rank procedure",
CypherFixtureStatement::new(
"CALL page_rank('MemoryMentions', dampingFactor := 0.85, maxIterations := 20) RETURN node, pagerank_score",
),
ExpectedRows::Exact(vec![
compatibility_row([
("node", Value::Int(1)),
("pagerank_score", Value::Float(0.0555)),
]),
compatibility_row([
("node", Value::Int(3)),
("pagerank_score", Value::Float(0.0555)),
]),
compatibility_row([
("node", Value::Int(0)),
("pagerank_score", Value::Float(0.03)),
]),
compatibility_row([
("node", Value::Int(2)),
("pagerank_score", Value::Float(0.03)),
]),
compatibility_row([
("node", Value::Int(4)),
("pagerank_score", Value::Float(0.03)),
]),
]),
)
.with_tolerance(CompatibilityTolerance { float_abs: 1.0e-6 }),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"unified page rank procedure",
CypherFixtureStatement::new(
"CALL page_rank('UnifiedGraph', dampingFactor := 0.85, maxIterations := 20, tolerance := 0.0000001, normalizeInitial := true) RETURN node, rank",
),
ExpectedRows::Exact(vec![
compatibility_row([
("node", Value::Int(1)),
("rank", Value::Float(0.0555)),
]),
compatibility_row([
("node", Value::Int(3)),
("rank", Value::Float(0.0555)),
]),
compatibility_row([
("node", Value::Int(0)),
("rank", Value::Float(0.03)),
]),
compatibility_row([
("node", Value::Int(2)),
("rank", Value::Float(0.03)),
]),
compatibility_row([
("node", Value::Int(4)),
("rank", Value::Float(0.03)),
]),
]),
)
.with_tolerance(CompatibilityTolerance { float_abs: 1.0e-6 }),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"hierarchical louvain procedure",
CypherFixtureStatement::new(
"CALL louvain('MemoryMentions', maxLevels := 2) RETURN node, level, louvain_id",
),
// The contracted pairs are stationary; no duplicate level is
// emitted. Check every assignment instead of only cardinality.
ExpectedRows::Exact(
[(0, 0), (1, 0), (2, 2), (3, 2), (4, 4)]
.into_iter()
.map(|(node, community)| {
compatibility_row([
("node", Value::Int(node)),
("level", Value::Int(0)),
("louvain_id", Value::Int(community)),
])
})
.collect(),
),
)),
CompatibilityCheck::ProjectedGraph(ProjectedGraphFixtureCheck {
name: "mentions projection".to_string(),
rel_type: Some("MENTIONS".to_string()),
expected_node_count: 5,
expected_edge_count: 2,
expected_incoming: vec![(1, vec![0])],
expected_communities: vec![(0, 0), (1, 0), (2, 2), (3, 2), (4, 4)],
expected_hierarchical_communities: vec![(0, 0, 0), (0, 4, 4)],
expected_page_rank_scores: vec![
(1, 0.2761194029526352),
(3, 0.2761194029526352),
],
page_rank_top_node: Some(1),
tolerance: CompatibilityTolerance { float_abs: 1.0e-6 },
}),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source memory count increment",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source {id: $id}) SET s.memory_count = s.memory_count + 1",
BTreeMap::from([(
"id".to_string(),
Value::String("source-count-increment-1".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-count-increment-1', memory_count: 0, space_id: 'source-write'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'source-count-increment-1'}) RETURN s.memory_count AS count",
),
ExpectedRows::Exact(vec![compatibility_row([("count", Value::Int(1))])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"undo community delete nodes",
CypherFixtureStatement::new("MATCH (c:Community) DETACH DELETE c"),
ExpectedRows::RowCount(2),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'undo-community-a', community_id: 100, name: 'Undo A'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'undo-community-b', community_id: 101, name: 'Undo B'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (c:Community) WHERE c.id IN ['undo-community-a', 'undo-community-b'] RETURN count(c) AS total",
),
ExpectedRows::Exact(vec![compatibility_row([("total", Value::Int(0))])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"undo community clear node assignments",
CypherFixtureStatement::new(
"MATCH (n) WHERE n.community_id IS NOT NULL SET n.community_id = NULL",
),
ExpectedRows::RowCount(3),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'undo-community-memory', community_id: 100})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'undo-community-memory-2', community_id: 101})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['undo-community-memory', 'undo-community-memory-2'] RETURN count(n.community_id) AS remaining",
),
ExpectedRows::Exact(vec![compatibility_row([("remaining", Value::Int(0))])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"undo community reset graph meta",
CypherFixtureStatement::new(
"MATCH (m:GraphMeta {meta_id: 'main'}) SET m.community_detection_applied = false, m.community_algorithm = '', m.community_resolution = 1.0, m.community_count = 0, m.community_detection_computed_at = NULL, m.updated_at = CURRENT_TIMESTAMP()",
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"MERGE (:GraphMeta {meta_id: 'main', community_detection_applied: true, community_algorithm: 'louvain', community_resolution: 0.8, community_count: 2, community_detection_computed_at: 1})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:GraphMeta {meta_id: 'main'}) RETURN m.community_detection_applied AS applied, m.community_algorithm AS algorithm, m.community_resolution AS resolution, m.community_count AS count, count(m.community_detection_computed_at) AS computed",
),
ExpectedRows::Exact(vec![compatibility_row([
("applied", Value::Bool(false)),
("algorithm", Value::String(String::new())),
("resolution", Value::Float(1.0)),
("count", Value::Int(0)),
("computed", Value::Int(0)),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"community scheduler graph meta read",
CypherFixtureStatement::new(
"MATCH (m:GraphMeta {meta_id: 'main'}) RETURN m.community_detection_computed_at, m.community_count, m.last_augmentation_at",
),
ExpectedRows::Exact(vec![compatibility_row([
("m.community_detection_computed_at", Value::Int(101)),
("m.community_count", Value::Int(2)),
("m.last_augmentation_at", Value::Int(202)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"MERGE (m:GraphMeta {meta_id: 'main'}) SET m.community_detection_computed_at = 101, m.community_count = 2, m.last_augmentation_at = 202",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"community scheduler candidate scan",
CypherFixtureStatement::with_parameters(
"MATCH (c:Community) WHERE c.community_id IS NOT NULL AND c.community_id >= 0 RETURN c.id, c.community_id, c.name, c.description, c.ai_summary, c.member_count ORDER BY c.member_count DESC, c.community_id ASC LIMIT $row_limit",
BTreeMap::from([("row_limit".to_string(), Value::Int(2))]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("c.id", Value::String("community-scheduler-high".to_string())),
("c.community_id", Value::Int(802)),
("c.name", Value::String("Scheduler High".to_string())),
("c.description", Value::String("high description".to_string())),
("c.ai_summary", Value::String("high summary".to_string())),
("c.member_count", Value::Int(20)),
]),
compatibility_row([
("c.id", Value::String("community-scheduler-low".to_string())),
("c.community_id", Value::Int(801)),
("c.name", Value::String("Scheduler Low".to_string())),
("c.description", Value::String("low description".to_string())),
("c.ai_summary", Value::String("low summary".to_string())),
("c.member_count", Value::Int(10)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'community-scheduler-low', community_id: 801, name: 'Scheduler Low', description: 'low description', ai_summary: 'low summary', member_count: 10})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'community-scheduler-high', community_id: 802, name: 'Scheduler High', description: 'high description', ai_summary: 'high summary', member_count: 20})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'community-scheduler-negative', community_id: -1, name: 'Scheduler Negative', description: 'negative description', ai_summary: 'negative summary', member_count: 100})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (c:Community) WHERE c.id IN ['community-scheduler-low', 'community-scheduler-high', 'community-scheduler-negative'] DETACH DELETE c",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"community scheduler member entity ids",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) WHERE e.community_id = $cid RETURN e.id",
BTreeMap::from([("cid".to_string(), Value::Int(811))]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"e.id",
Value::String("community-scheduler-entity".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'community-scheduler-entity', community_id: 811})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'community-scheduler-entity'}) DETACH DELETE e",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"community scheduler summary write",
CypherFixtureStatement::with_parameters(
"MATCH (c:Community {id: $id}) SET c.name = $name, c.description = $description, c.ai_summary = $ai_summary, c.updated_at = CURRENT_TIMESTAMP()",
BTreeMap::from([
(
"id".to_string(),
Value::String("community-scheduler-write".to_string()),
),
("name".to_string(), Value::String("Written Name".to_string())),
(
"description".to_string(),
Value::String("Written description".to_string()),
),
(
"ai_summary".to_string(),
Value::String("TITLE: Written Name\nWritten description".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'community-scheduler-write', community_id: 812, name: 'Old Name', description: 'old description', ai_summary: '', member_count: 1})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (c:Community {id: 'community-scheduler-write'}) RETURN c.name, c.description, c.ai_summary, count(c.updated_at) AS updated",
),
ExpectedRows::Exact(vec![compatibility_row([
("c.name", Value::String("Written Name".to_string())),
(
"c.description",
Value::String("Written description".to_string()),
),
(
"c.ai_summary",
Value::String("TITLE: Written Name\nWritten description".to_string()),
),
("updated", Value::Int(1)),
])]),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (c:Community {id: 'community-scheduler-write'}) DETACH DELETE c",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"cleanup compaction seed scan",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE COALESCE(m.is_crystal, false) = false AND COALESCE(m.is_latest, true) = true AND (m.lifecycle_state = 'active' OR (m.lifecycle_state IS NULL AND (m.metadata IS NULL OR NOT (m.metadata CONTAINS '\"state\"') OR (m.metadata CONTAINS '\"state\":\"active\"')))) AND (COALESCE(m.decay_score_cached, 1.0) < 0.55 OR COALESCE(m.created_at, m.last_accessed_at) <= $stale_cutoff) AND m.space_id = $space_id RETURN m.id ORDER BY COALESCE(m.clicks, 0) ASC, COALESCE(m.total_dwell_time_ms, 0) ASC, CASE WHEN COALESCE(m.access_count, 0) - COALESCE(m.appearances, 0) - COALESCE(m.clicks, 0) < 0 THEN 0 ELSE COALESCE(m.access_count, 0) - COALESCE(m.appearances, 0) - COALESCE(m.clicks, 0) END ASC, COALESCE(m.created_at, m.last_accessed_at) ASC, COALESCE(m.decay_score_cached, 1.0) ASC, COALESCE(m.importance, 0.5) ASC LIMIT $limit",
BTreeMap::from([
(
"stale_cutoff".to_string(),
Value::String("2026-06-01T00:00:00".to_string()),
),
(
"space_id".to_string(),
Value::String("cleanup-fixture".to_string()),
),
("limit".to_string(), Value::Int(2)),
]),
),
ExpectedRows::Exact(vec![
compatibility_row([(
"m.id",
Value::String("cleanup-seed-low".to_string()),
)]),
compatibility_row([(
"m.id",
Value::String("cleanup-seed-high".to_string()),
)]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'cleanup-seed-low', space_id: 'cleanup-fixture', is_crystal: false, is_latest: true, lifecycle_state: 'active', decay_score_cached: 0.4, created_at: '2026-01-01T00:00:00', last_accessed_at: '2026-01-02T00:00:00', access_count: 1, appearances: 0, clicks: 0, total_dwell_time_ms: 0, importance: 0.3})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'cleanup-seed-high', space_id: 'cleanup-fixture', is_crystal: false, is_latest: true, lifecycle_state: 'active', decay_score_cached: 0.3, created_at: '2026-01-03T00:00:00', last_accessed_at: '2026-01-04T00:00:00', access_count: 5, appearances: 1, clicks: 1, total_dwell_time_ms: 20, importance: 0.9})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['cleanup-seed-low', 'cleanup-seed-high'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"cleanup hot duplicate seed scan",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE COALESCE(m.is_crystal, false) = false AND COALESCE(m.is_latest, true) = true AND (m.lifecycle_state = 'active' OR (m.lifecycle_state IS NULL AND (m.metadata IS NULL OR NOT (m.metadata CONTAINS '\"state\"') OR (m.metadata CONTAINS '\"state\":\"active\"')))) AND COALESCE(m.created_at, m.last_accessed_at) >= $recent_cutoff AND m.space_id = $space_id RETURN m.id ORDER BY COALESCE(m.created_at, m.last_accessed_at) DESC, COALESCE(m.importance, 0.5) DESC LIMIT $limit",
BTreeMap::from([
(
"recent_cutoff".to_string(),
Value::String("2026-07-01T00:00:00".to_string()),
),
(
"space_id".to_string(),
Value::String("cleanup-fixture".to_string()),
),
("limit".to_string(), Value::Int(2)),
]),
),
ExpectedRows::Exact(vec![
compatibility_row([(
"m.id",
Value::String("cleanup-hot-newer".to_string()),
)]),
compatibility_row([(
"m.id",
Value::String("cleanup-hot-older".to_string()),
)]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'cleanup-hot-older', space_id: 'cleanup-fixture', is_crystal: false, is_latest: true, lifecycle_state: 'active', created_at: '2026-07-02T00:00:00', last_accessed_at: '2026-07-02T00:00:00', importance: 0.9})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'cleanup-hot-newer', space_id: 'cleanup-fixture', is_crystal: false, is_latest: true, lifecycle_state: 'active', created_at: '2026-07-03T00:00:00', last_accessed_at: '2026-07-03T00:00:00', importance: 0.1})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['cleanup-hot-older', 'cleanup-hot-newer'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"cleanup existing evolves pairs",
CypherFixtureStatement::with_parameters(
"MATCH (a:Memory)-[:EVOLVES]-(b:Memory) WHERE a.id IN $ids AND b.id IN $ids RETURN a.id, b.id",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![
Value::String("cleanup-evolves-a".to_string()),
Value::String("cleanup-evolves-b".to_string()),
]),
)]),
),
ExpectedRows::RowCount(2),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'cleanup-evolves-a'})-[:EVOLVES]->(:Memory {id: 'cleanup-evolves-b'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['cleanup-evolves-a', 'cleanup-evolves-b'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"cleanup fingerprint row fetch",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, m.title, m.metadata, m.is_latest, m.decay_score_cached, m.created_at, m.last_accessed_at, m.last_clicked_at, m.access_count, m.appearances, m.clicks, m.total_dwell_time_ms, m.importance, m.unit_type, m.semantic_field",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![Value::String("cleanup-fingerprint".to_string())]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("m.id", Value::String("cleanup-fingerprint".to_string())),
("m.title", Value::String("Cleanup Fingerprint".to_string())),
("m.metadata", Value::String("{\"state\":\"active\"}".to_string())),
("m.is_latest", Value::Bool(true)),
("m.decay_score_cached", Value::Float(0.6)),
(
"m.created_at",
Value::String("2026-07-01T00:00:00".to_string()),
),
(
"m.last_accessed_at",
Value::String("2026-07-02T00:00:00".to_string()),
),
(
"m.last_clicked_at",
Value::String("2026-07-03T00:00:00".to_string()),
),
("m.access_count", Value::Int(4)),
("m.appearances", Value::Int(1)),
("m.clicks", Value::Int(2)),
("m.total_dwell_time_ms", Value::Int(300)),
("m.importance", Value::Float(0.8)),
("m.unit_type", Value::String("fact".to_string())),
("m.semantic_field", Value::String("cleanup text".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'cleanup-fingerprint', title: 'Cleanup Fingerprint', metadata: '{\"state\":\"active\"}', is_latest: true, decay_score_cached: 0.6, created_at: '2026-07-01T00:00:00', last_accessed_at: '2026-07-02T00:00:00', last_clicked_at: '2026-07-03T00:00:00', access_count: 4, appearances: 1, clicks: 2, total_dwell_time_ms: 300, importance: 0.8, unit_type: 'fact', semantic_field: 'cleanup text'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'cleanup-fingerprint'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"crystallized provenance backfill merge",
CypherFixtureStatement::new(
"MATCH (c:Memory)-[r:CRYSTALLIZED_FROM]->(s:Memory) MERGE (c)-[n:SYNTHESIZED_FROM]->(s) ON CREATE SET n.weight = r.contribution_weight, n.occasion_key = '', n.created_at = r.created_at",
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'crystal-backfill-c'})-[:CRYSTALLIZED_FROM {contribution_weight: 0.75, created_at: 123}]->(:Memory {id: 'crystal-backfill-s'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (:Memory)-[r:SYNTHESIZED_FROM {occasion_key: ''}]->(:Memory) RETURN count(r) AS total, min(r.weight) AS weight, min(r.created_at) AS created",
),
ExpectedRows::Exact(vec![compatibility_row([
("total", Value::Int(1)),
("weight", Value::Float(0.75)),
("created", Value::Int(123)),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"crystallized provenance backfill idempotent",
CypherFixtureStatement::new(
"MATCH (c:Memory)-[r:CRYSTALLIZED_FROM]->(s:Memory) MERGE (c)-[n:SYNTHESIZED_FROM]->(s) ON CREATE SET n.weight = r.contribution_weight, n.occasion_key = '', n.created_at = r.created_at",
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (:Memory)-[r:SYNTHESIZED_FROM {occasion_key: ''}]->(:Memory) RETURN count(r) AS total",
),
ExpectedRows::Exact(vec![compatibility_row([("total", Value::Int(1))])]),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"synthesized provenance edge count",
CypherFixtureStatement::new(
"MATCH (:Memory)-[:SYNTHESIZED_FROM]->(:Memory) RETURN count(*)",
),
ExpectedRows::Exact(vec![compatibility_row([("count(*)", Value::Int(1))])]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"crystallized provenance edge count",
CypherFixtureStatement::new(
"MATCH (:Memory)-[:CRYSTALLIZED_FROM]->(:Memory) RETURN count(*)",
),
ExpectedRows::Exact(vec![compatibility_row([("count(*)", Value::Int(1))])]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"crystallized provenance unmirrored verification",
CypherFixtureStatement::new(
"MATCH (c:Memory)-[:CRYSTALLIZED_FROM]->(s:Memory) WHERE NOT EXISTS { MATCH (c)-[:SYNTHESIZED_FROM]->(s) } RETURN count(*)",
),
ExpectedRows::Exact(vec![compatibility_row([("count(*)", Value::Int(0))])]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"crystallized provenance distinct pair count",
CypherFixtureStatement::new(
"MATCH (c:Memory)-[:CRYSTALLIZED_FROM]->(s:Memory) WITH DISTINCT c.id AS a, s.id AS b RETURN count(*)",
),
ExpectedRows::Exact(vec![compatibility_row([("count(*)", Value::Int(2))])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'crystal-distinct-c'})-[:CRYSTALLIZED_FROM]->(:Memory {id: 'crystal-distinct-s'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (c:Memory {id: 'crystal-distinct-c'}), (s:Memory {id: 'crystal-distinct-s'}) CREATE (c)-[:CRYSTALLIZED_FROM]->(s)",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"synthesized source ids collect read",
CypherFixtureStatement::with_parameters(
"MATCH (c:Memory)-[:SYNTHESIZED_FROM]->(s:Memory) WHERE c.id IN $ids WITH c, COLLECT(DISTINCT s.id) AS source_ids RETURN c.id, source_ids",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![Value::String("collect-c1".to_string())]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("c.id", Value::String("collect-c1".to_string())),
(
"source_ids",
Value::List(vec![
Value::String("collect-s1".to_string()),
Value::String("collect-s2".to_string()),
]),
),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'collect-c1'})-[:SYNTHESIZED_FROM]->(:Memory {id: 'collect-s1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'collect-s2'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (c:Memory {id: 'collect-c1'}), (s:Memory {id: 'collect-s2'}) CREATE (c)-[:SYNTHESIZED_FROM]->(s)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (c:Memory {id: 'collect-c1'}), (s:Memory {id: 'collect-s2'}) CREATE (c)-[:SYNTHESIZED_FROM]->(s)",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"skill synthesized memory id read",
CypherFixtureStatement::with_parameters(
"MATCH (sk:Skill)-[:SYNTHESIZED_FROM]->(m:Memory) WHERE sk.stage IN $stages RETURN m.id",
BTreeMap::from([(
"stages".to_string(),
Value::List(vec![Value::String("active".to_string())]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"m.id",
Value::String("skill-source-memory-1".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'skill-synth-1', stage: 'active'})-[:SYNTHESIZED_FROM]->(:Memory {id: 'skill-source-memory-1', title: 'Skill source memory'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (sk:Skill {id: 'skill-synth-1'}) DETACH DELETE sk",
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'skill-source-memory-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"skill stage list read",
CypherFixtureStatement::with_parameters(
"MATCH (sk:Skill) WHERE sk.stage IN $stages RETURN sk.id, sk.title, sk.name, sk.description, sk.stage, sk.evidence_count LIMIT 50",
BTreeMap::from([(
"stages".to_string(),
Value::List(vec![Value::String("listed".to_string())]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("sk.id", Value::String("skill-list-1".to_string())),
("sk.title", Value::String("Skill List".to_string())),
("sk.name", Value::String("skill-list".to_string())),
(
"sk.description",
Value::String("List readable skill".to_string()),
),
("sk.stage", Value::String("listed".to_string())),
("sk.evidence_count", Value::Int(3)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'skill-list-1', title: 'Skill List', name: 'skill-list', description: 'List readable skill', stage: 'listed', evidence_count: 3})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (sk:Skill {id: 'skill-list-1'}) DETACH DELETE sk",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest skills public detail read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id}) RETURN s.id, s.title, s.name, s.metadata",
BTreeMap::from([(
"id".to_string(),
Value::String("rest-skill-public-detail".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'rest-skill-public-detail', title: 'Public Detail', name: 'public-detail', metadata: '{}'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'rest-skill-public-detail'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest skills stale memory ids read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $ids AND m.is_latest = false RETURN m.id",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![Value::String("rest-skill-stale-memory".to_string())]),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-skill-stale-memory', is_latest: false})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-skill-stale-memory'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest skills evolves latest read",
CypherFixtureStatement::with_parameters(
"MATCH (old:Memory)-[:EVOLVES]->(new:Memory) WHERE old.id IN $ids RETURN DISTINCT new.id, new.is_latest",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![Value::String("rest-skill-evolves-old".to_string())]),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-skill-evolves-old', is_latest: false})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-skill-evolves-new', is_latest: true})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (old:Memory {id: 'rest-skill-evolves-old'}), (new:Memory {id: 'rest-skill-evolves-new'}) CREATE (old)-[:EVOLVES]->(new)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['rest-skill-evolves-old', 'rest-skill-evolves-new'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest skills id read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id}) RETURN s.id",
BTreeMap::from([(
"id".to_string(),
Value::String("rest-skill-id-read".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'rest-skill-id-read'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'rest-skill-id-read'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest skills id version read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id}) RETURN s.id, s.version",
BTreeMap::from([(
"id".to_string(),
Value::String("rest-skill-id-version".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'rest-skill-id-version', version: 7})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'rest-skill-id-version'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest skills source memory title content read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id})-[:SYNTHESIZED_FROM]->(m:Memory) RETURN m.title, m.content ORDER BY m.created_at LIMIT 8",
BTreeMap::from([(
"id".to_string(),
Value::String("rest-skill-source-detail".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'rest-skill-source-detail'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-skill-source-memory', title: 'Source Title', content: 'source content', created_at: 1})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'rest-skill-source-detail'}), (m:Memory {id: 'rest-skill-source-memory'}) CREATE (s)-[:SYNTHESIZED_FROM]->(m)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-skill-source-detail', 'rest-skill-source-memory'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest skills metadata read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id}) RETURN s.metadata",
BTreeMap::from([(
"id".to_string(),
Value::String("rest-skill-metadata".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'rest-skill-metadata', metadata: '{\"source\":\"rest\"}'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'rest-skill-metadata'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest skills version read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id}) RETURN s.version",
BTreeMap::from([(
"id".to_string(),
Value::String("rest-skill-version".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'rest-skill-version', version: 9})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'rest-skill-version'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest skills title read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id}) RETURN s.title",
BTreeMap::from([(
"id".to_string(),
Value::String("rest-skill-title".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'rest-skill-title', title: 'Skill Title'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'rest-skill-title'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest skills imported draft create",
CypherFixtureStatement::with_parameters(
"CREATE (s:Skill { id: $id, stage: 'draft', title: $title, kind: 'procedure', rationale: $null_str, evidence_count: 0, confidence: 0.0, demand_signal: 0.0, rejected_at: $null_ts, name: $name, description: $description, triggers: $empty_strs, tools: $empty_strs, bundle_path: $bundle_path, content_hash: $content_hash, version: 1, invalidation_reason: $null_str, write_origin: 'imported', scope: 'personal', freshness: 1.0, pinned: false, use_count: 0, success_rate: 0.0, last_activity_at: $null_ts, space_id: $space_id, created_at: $now, updated_at: $now, last_evidence_at: $null_ts, metadata: $metadata })",
BTreeMap::from([
(
"id".to_string(),
Value::String("rest-skill-imported-draft".to_string()),
),
(
"title".to_string(),
Value::String("Imported Draft".to_string()),
),
("null_str".to_string(), Value::Null),
("null_ts".to_string(), Value::Null),
(
"name".to_string(),
Value::String("imported-draft".to_string()),
),
(
"description".to_string(),
Value::String("imported description".to_string()),
),
("empty_strs".to_string(), Value::List(Vec::new())),
(
"bundle_path".to_string(),
Value::String("/tmp/imported-draft".to_string()),
),
(
"content_hash".to_string(),
Value::String("hash-imported".to_string()),
),
("space_id".to_string(), Value::String("default".to_string())),
("now".to_string(), Value::Int(100)),
(
"metadata".to_string(),
Value::String("{\"kind\":\"imported\"}".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'rest-skill-imported-draft'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest skills promotable create",
CypherFixtureStatement::with_parameters(
"CREATE (s:Skill { id: $id, stage: 'promotable', title: $title, kind: 'procedure', rationale: $rationale, evidence_count: $evidence_count, confidence: 0.0, demand_signal: 0.0, rejected_at: $null_ts, name: $null_str, description: $null_str, triggers: $empty_strs, tools: $empty_strs, bundle_path: $null_str, content_hash: $null_str, version: 1, invalidation_reason: $null_str, write_origin: 'user', scope: 'personal', freshness: 1.0, pinned: false, use_count: 0, success_rate: 0.0, last_activity_at: $null_ts, space_id: $space_id, created_at: $now, updated_at: $now, last_evidence_at: $null_ts, metadata: $metadata })",
BTreeMap::from([
(
"id".to_string(),
Value::String("rest-skill-promotable-create".to_string()),
),
(
"title".to_string(),
Value::String("Promotable Skill".to_string()),
),
(
"rationale".to_string(),
Value::String("evidence supports promotion".to_string()),
),
("evidence_count".to_string(), Value::Int(2)),
("null_ts".to_string(), Value::Null),
("null_str".to_string(), Value::Null),
("empty_strs".to_string(), Value::List(Vec::new())),
("space_id".to_string(), Value::String("default".to_string())),
("now".to_string(), Value::Int(101)),
(
"metadata".to_string(),
Value::String("{\"kind\":\"promotable\"}".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'rest-skill-promotable-create'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest skills thread compact memory ids read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {thread_id: $tid})-[:COMPACTS_TO]->(m:Memory) RETURN m.id",
BTreeMap::from([(
"tid".to_string(),
Value::String("rest-skill-thread-logical".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'rest-skill-thread-node', thread_id: 'rest-skill-thread-logical'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-skill-thread-memory'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'rest-skill-thread-node'}), (m:Memory {id: 'rest-skill-thread-memory'}) CREATE (t)-[:COMPACTS_TO]->(m)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-skill-thread-node', 'rest-skill-thread-memory'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest skills reject mutation",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id}) SET s.stage = 'rejected', s.rejected_at = $rejected_at, s.updated_at = $updated_at",
BTreeMap::from([
(
"id".to_string(),
Value::String("rest-skill-reject".to_string()),
),
("rejected_at".to_string(), Value::Int(201)),
("updated_at".to_string(), Value::Int(202)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'rest-skill-reject', stage: 'candidate'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'rest-skill-reject'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest skills stage metadata read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id}) RETURN s.stage, s.metadata",
BTreeMap::from([(
"id".to_string(),
Value::String("rest-skill-stage-metadata".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'rest-skill-stage-metadata', stage: 'draft', metadata: '{\"stage\":\"draft\"}'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'rest-skill-stage-metadata'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest skills full write state read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id}) RETURN s.stage, s.metadata, s.version, s.use_count, s.bundle_path, s.content_hash, s.name, s.description, s.title",
BTreeMap::from([(
"id".to_string(),
Value::String("rest-skill-full-state".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'rest-skill-full-state', stage: 'draft', metadata: '{}', version: 1, use_count: 0, bundle_path: '/tmp/full', content_hash: 'hash-full', name: 'full-state', description: 'full state', title: 'Full State'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'rest-skill-full-state'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest skills stage update",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id}) SET s.stage = $stage, s.updated_at = $updated_at",
BTreeMap::from([
(
"id".to_string(),
Value::String("rest-skill-stage-update".to_string()),
),
("stage".to_string(), Value::String("active".to_string())),
("updated_at".to_string(), Value::Int(301)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'rest-skill-stage-update', stage: 'draft'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'rest-skill-stage-update'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest skills compiled update",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id}) SET s.version = $version, s.title = $name, s.name = $name, s.description = $description, s.content_hash = $content_hash, s.bundle_path = $bundle_path, s.metadata = $metadata, s.updated_at = $updated_at",
BTreeMap::from([
(
"id".to_string(),
Value::String("rest-skill-compiled-update".to_string()),
),
("version".to_string(), Value::Int(2)),
(
"name".to_string(),
Value::String("compiled-skill".to_string()),
),
(
"description".to_string(),
Value::String("compiled description".to_string()),
),
(
"content_hash".to_string(),
Value::String("hash-compiled-rest".to_string()),
),
(
"bundle_path".to_string(),
Value::String("/tmp/compiled-rest".to_string()),
),
(
"metadata".to_string(),
Value::String("{\"compiled\":true}".to_string()),
),
("updated_at".to_string(), Value::Int(401)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'rest-skill-compiled-update', stage: 'draft'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'rest-skill-compiled-update'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest skills stage rejection update",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id}) SET s.stage = $stage, s.rejected_at = $rejected_at, s.updated_at = $updated_at",
BTreeMap::from([
(
"id".to_string(),
Value::String("rest-skill-stage-rejection".to_string()),
),
("stage".to_string(), Value::String("rejected".to_string())),
("rejected_at".to_string(), Value::Int(501)),
("updated_at".to_string(), Value::Int(502)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'rest-skill-stage-rejection', stage: 'candidate'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'rest-skill-stage-rejection'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest skills source merge",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $skill_id}), (m:Memory {id: $memory_id}) MERGE (s)-[r:SYNTHESIZED_FROM]->(m) ON CREATE SET r.weight = 1.0, r.occasion_key = '', r.created_at = $now",
BTreeMap::from([
(
"skill_id".to_string(),
Value::String("rest-skill-source-merge".to_string()),
),
(
"memory_id".to_string(),
Value::String("rest-skill-source-merge-memory".to_string()),
),
("now".to_string(), Value::Int(601)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'rest-skill-source-merge'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-skill-source-merge-memory'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-skill-source-merge', 'rest-skill-source-merge-memory'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest skills memory title content read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $ids RETURN m.title, m.content ORDER BY m.created_at",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![Value::String("rest-skill-memory-title".to_string())]),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-skill-memory-title', title: 'Skill Memory Title', content: 'skill memory content', created_at: 1})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-skill-memory-title'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest skills metadata version read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id}) RETURN s.metadata, s.version",
BTreeMap::from([(
"id".to_string(),
Value::String("rest-skill-metadata-version".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'rest-skill-metadata-version', metadata: '{\"version\":3}', version: 3})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'rest-skill-metadata-version'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest skills content hash metadata update",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id}) SET s.content_hash = $content_hash, s.metadata = $metadata, s.updated_at = $updated_at",
BTreeMap::from([
(
"id".to_string(),
Value::String("rest-skill-content-hash-update".to_string()),
),
(
"content_hash".to_string(),
Value::String("hash-updated".to_string()),
),
(
"metadata".to_string(),
Value::String("{\"updated\":true}".to_string()),
),
("updated_at".to_string(), Value::Int(701)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'rest-skill-content-hash-update', content_hash: 'old', metadata: '{}'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'rest-skill-content-hash-update'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"skill builder list read",
CypherFixtureStatement::new(
"MATCH (s:Skill) RETURN s ORDER BY s.updated_at DESC LIMIT 60",
),
ExpectedRows::RowCount(2),
)
.with_setup_query(CypherFixtureStatement::new("MATCH (s:Skill) DETACH DELETE s"))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'skill-builder-1', title: 'Builder One', updated_at: 10})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'skill-builder-2', title: 'Builder Two', updated_at: 20})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill) WHERE s.id IN ['skill-builder-1', 'skill-builder-2'] DETACH DELETE s",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"skill active whole-record list read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill) WHERE s.stage = 'active' RETURN s ORDER BY s.updated_at DESC LIMIT $limit",
BTreeMap::from([("limit".to_string(), Value::Int(2))]),
),
ExpectedRows::RowCount(2),
)
.with_setup_query(CypherFixtureStatement::new("MATCH (s:Skill) DETACH DELETE s"))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'skill-active-list-1', title: 'Active One', stage: 'active', updated_at: 10})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'skill-active-list-2', title: 'Active Two', stage: 'active', updated_at: 20})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'skill-active-list-3', title: 'Active Three', stage: 'active', updated_at: 30})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'skill-active-list-draft', title: 'Draft Skill', stage: 'draft', updated_at: 40})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill) WHERE s.id IN ['skill-active-list-1', 'skill-active-list-2', 'skill-active-list-3', 'skill-active-list-draft'] DETACH DELETE s",
),
ExpectedRows::RowCount(4),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest fs active skill listing read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill) WHERE s.stage = 'active' AND s.id > $after RETURN s.id, s.name, s.title, s.updated_at, s.version ORDER BY s.id ASC LIMIT $limit",
BTreeMap::from([
(
"after".to_string(),
Value::String("rest-fs-skill-0".to_string()),
),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"s.id",
Value::String("rest-fs-skill-active-1".to_string()),
),
("s.name", Value::String("rest-fs-active".to_string())),
("s.title", Value::String("REST FS Active Skill".to_string())),
("s.updated_at", Value::Int(1700000100)),
("s.version", Value::Int(2)),
])]),
)
.with_setup_query(CypherFixtureStatement::new("MATCH (s:Skill) DETACH DELETE s"))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'rest-fs-skill-active-1', name: 'rest-fs-active', title: 'REST FS Active Skill', stage: 'active', updated_at: 1700000100, version: 2})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'rest-fs-skill-draft-1', name: 'rest-fs-draft', title: 'REST FS Draft Skill', stage: 'draft', updated_at: 1700000101, version: 1})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill) WHERE s.id IN ['rest-fs-skill-active-1', 'rest-fs-skill-draft-1'] DETACH DELETE s",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest fs active skill detail lookup read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill) WHERE s.id = $key OR s.id STARTS WITH $key OR s.id CONTAINS $key RETURN s.id, s.name, s.title, s.stage, s.version, s.created_at, s.updated_at LIMIT 1",
BTreeMap::from([(
"key".to_string(),
Value::String("rest-fs-skill-detail-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"s.id",
Value::String("rest-fs-skill-detail-1".to_string()),
),
("s.name", Value::String("rest-fs-detail".to_string())),
("s.title", Value::String("REST FS Detail Skill".to_string())),
("s.stage", Value::String("active".to_string())),
("s.version", Value::Int(3)),
("s.created_at", Value::Int(1700000102)),
("s.updated_at", Value::Int(1700000103)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'rest-fs-skill-detail-1', name: 'rest-fs-detail', title: 'REST FS Detail Skill', stage: 'active', version: 3, created_at: 1700000102, updated_at: 1700000103})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'rest-fs-skill-detail-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp skill prefix lookup read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill) WHERE s.id STARTS WITH $key OR s.id CONTAINS $key RETURN s.id, s.version, s.use_count, s.metadata, s.name, s.title, s.bundle_path ORDER BY s.updated_at DESC LIMIT 1",
BTreeMap::from([(
"key".to_string(),
Value::String("mcp-skill-prefix".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("s.id", Value::String("mcp-skill-prefix-newer".to_string())),
("s.version", Value::Int(3)),
("s.use_count", Value::Int(7)),
("s.metadata", Value::String("{\"rank\":2}".to_string())),
("s.name", Value::String("mcp-prefix-newer".to_string())),
("s.title", Value::String("MCP Prefix Newer".to_string())),
(
"s.bundle_path",
Value::String("/tmp/mcp-prefix-newer".to_string()),
),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'mcp-skill-prefix-older', version: 2, use_count: 4, metadata: '{\"rank\":1}', name: 'mcp-prefix-older', title: 'MCP Prefix Older', bundle_path: '/tmp/mcp-prefix-older', updated_at: 10})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'mcp-skill-prefix-newer', version: 3, use_count: 7, metadata: '{\"rank\":2}', name: 'mcp-prefix-newer', title: 'MCP Prefix Newer', bundle_path: '/tmp/mcp-prefix-newer', updated_at: 20})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill) WHERE s.id IN ['mcp-skill-prefix-older', 'mcp-skill-prefix-newer'] DETACH DELETE s",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp skill exact lookup read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $key}) RETURN s.id, s.version, s.use_count, s.metadata, s.name, s.title, s.bundle_path",
BTreeMap::from([(
"key".to_string(),
Value::String("mcp-skill-exact".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("s.id", Value::String("mcp-skill-exact".to_string())),
("s.version", Value::Int(5)),
("s.use_count", Value::Int(11)),
("s.metadata", Value::String("{\"kind\":\"exact\"}".to_string())),
("s.name", Value::String("mcp-exact".to_string())),
("s.title", Value::String("MCP Exact Skill".to_string())),
(
"s.bundle_path",
Value::String("/tmp/mcp-exact".to_string()),
),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'mcp-skill-exact', version: 5, use_count: 11, metadata: '{\"kind\":\"exact\"}', name: 'mcp-exact', title: 'MCP Exact Skill', bundle_path: '/tmp/mcp-exact', updated_at: 30})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'mcp-skill-exact'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp skill catalog read",
CypherFixtureStatement::new(
"MATCH (s:Skill) WHERE s.stage IN ['active','draft','stale','candidate','promotable','rejected'] RETURN s.id, s.stage, s.name, s.title, s.description, s.triggers, s.content_hash, s.metadata, s.space_id ORDER BY s.updated_at DESC LIMIT 1500",
),
ExpectedRows::Exact(vec![
compatibility_row([
("s.id", Value::String("mcp-skill-catalog-active".to_string())),
("s.stage", Value::String("active".to_string())),
("s.name", Value::String("catalog-active".to_string())),
("s.title", Value::String("Catalog Active".to_string())),
(
"s.description",
Value::String("active catalog skill".to_string()),
),
("s.triggers", Value::String("[\"catalog\"]".to_string())),
("s.content_hash", Value::String("hash-active".to_string())),
("s.metadata", Value::String("{\"stage\":\"active\"}".to_string())),
("s.space_id", Value::String("default".to_string())),
]),
compatibility_row([
("s.id", Value::String("mcp-skill-catalog-draft".to_string())),
("s.stage", Value::String("draft".to_string())),
("s.name", Value::String("catalog-draft".to_string())),
("s.title", Value::String("Catalog Draft".to_string())),
(
"s.description",
Value::String("draft catalog skill".to_string()),
),
("s.triggers", Value::String("[\"draft\"]".to_string())),
("s.content_hash", Value::String("hash-draft".to_string())),
("s.metadata", Value::String("{\"stage\":\"draft\"}".to_string())),
("s.space_id", Value::String("default".to_string())),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'mcp-skill-catalog-active', stage: 'active', name: 'catalog-active', title: 'Catalog Active', description: 'active catalog skill', triggers: '[\"catalog\"]', content_hash: 'hash-active', metadata: '{\"stage\":\"active\"}', space_id: 'default', updated_at: 20})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'mcp-skill-catalog-draft', stage: 'draft', name: 'catalog-draft', title: 'Catalog Draft', description: 'draft catalog skill', triggers: '[\"draft\"]', content_hash: 'hash-draft', metadata: '{\"stage\":\"draft\"}', space_id: 'default', updated_at: 10})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'mcp-skill-catalog-archived', stage: 'archived', name: 'catalog-archived', title: 'Catalog Archived', updated_at: 30})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill) WHERE s.id IN ['mcp-skill-catalog-active', 'mcp-skill-catalog-draft', 'mcp-skill-catalog-archived'] DETACH DELETE s",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp active skill list read",
CypherFixtureStatement::new(
"MATCH (s:Skill) WHERE s.stage = 'active' RETURN s.id, s.title, s.name, s.description, s.triggers, s.stage ORDER BY s.updated_at DESC LIMIT 200",
),
ExpectedRows::Exact(vec![compatibility_row([
("s.id", Value::String("mcp-skill-active-newer".to_string())),
("s.title", Value::String("MCP Active Newer".to_string())),
("s.name", Value::String("mcp-active-newer".to_string())),
(
"s.description",
Value::String("newer active skill".to_string()),
),
("s.triggers", Value::String("[\"newer\"]".to_string())),
("s.stage", Value::String("active".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'mcp-skill-active-newer', title: 'MCP Active Newer', name: 'mcp-active-newer', description: 'newer active skill', triggers: '[\"newer\"]', stage: 'active', updated_at: 20})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'mcp-skill-active-draft', title: 'MCP Active Draft', name: 'mcp-active-draft', description: 'draft skill', triggers: '[\"draft\"]', stage: 'draft', updated_at: 30})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill) WHERE s.id IN ['mcp-skill-active-newer', 'mcp-skill-active-draft'] DETACH DELETE s",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph skill overview ranking read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill) WHERE s.stage IS NULL OR (s.stage <> 'archived' AND s.stage <> 'rejected' AND s.stage <> 'deprecated') WITH s, CASE WHEN s.stage = 'active' THEN 4 WHEN s.stage = 'promotable' THEN 3 WHEN s.stage = 'candidate' THEN 2 WHEN s.stage = 'draft' THEN 1 ELSE 0 END AS stage_rank, COALESCE(s.evidence_count, 0) AS evidence_score ORDER BY stage_rank DESC, evidence_score DESC, s.updated_at DESC LIMIT $limit RETURN s.id, COALESCE(s.name, s.title, 'Skill'), s.stage, s.kind, COALESCE(s.evidence_count, 0), s.confidence, COALESCE(s.use_count, 0), s.space_id, s.description, s.bundle_path, s.updated_at",
BTreeMap::from([("limit".to_string(), Value::Int(1))]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'rest-graph-skill-overview', name: 'Rest Graph Skill Overview', title: 'Rest Graph Skill Overview', stage: 'active', kind: 'skill', evidence_count: 999999, confidence: 0.97, use_count: 7, space_id: 'default', description: 'overview fixture', bundle_path: '/tmp/rest-graph-skill-overview', updated_at: 999999})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'rest-graph-skill-overview'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp memory prefix ownership read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id STARTS WITH $p RETURN m.id, m.space_id LIMIT 2",
BTreeMap::from([(
"p".to_string(),
Value::String("mcp-prefix-memory".to_string()),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([
(
"m.id",
Value::String("mcp-prefix-memory-1".to_string()),
),
("m.space_id", Value::String("default".to_string())),
]),
compatibility_row([
(
"m.id",
Value::String("mcp-prefix-memory-2".to_string()),
),
("m.space_id", Value::String("research".to_string())),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-prefix-memory-1', space_id: 'default'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-prefix-memory-2', space_id: 'research'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'other-prefix-memory', space_id: 'default'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['mcp-prefix-memory-1', 'mcp-prefix-memory-2', 'other-prefix-memory'] DETACH DELETE m",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"skill stage projection list read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill) WHERE s.stage = $stage RETURN s.id, s.title, s.name, s.version, s.success_rate, s.metadata, s.description, s.triggers ORDER BY s.updated_at DESC LIMIT $limit",
BTreeMap::from([
("stage".to_string(), Value::String("active".to_string())),
("limit".to_string(), Value::Int(2)),
]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("s.id", Value::String("skill-stage-projection-2".to_string())),
("s.title", Value::String("Stage Projection Two".to_string())),
("s.name", Value::String("stage-projection-two".to_string())),
("s.version", Value::String("2.0.0".to_string())),
("s.success_rate", Value::Float(0.8)),
("s.metadata", Value::String("{\"rank\":2}".to_string())),
(
"s.description",
Value::String("second active skill".to_string()),
),
("s.triggers", Value::String("[\"two\"]".to_string())),
]),
compatibility_row([
("s.id", Value::String("skill-stage-projection-1".to_string())),
("s.title", Value::String("Stage Projection One".to_string())),
("s.name", Value::String("stage-projection-one".to_string())),
("s.version", Value::String("1.0.0".to_string())),
("s.success_rate", Value::Float(0.7)),
("s.metadata", Value::String("{\"rank\":1}".to_string())),
(
"s.description",
Value::String("first active skill".to_string()),
),
("s.triggers", Value::String("[\"one\"]".to_string())),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'skill-stage-projection-1', title: 'Stage Projection One', name: 'stage-projection-one', version: '1.0.0', success_rate: 0.7, metadata: '{\"rank\":1}', description: 'first active skill', triggers: '[\"one\"]', stage: 'active', updated_at: 10})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'skill-stage-projection-2', title: 'Stage Projection Two', name: 'stage-projection-two', version: '2.0.0', success_rate: 0.8, metadata: '{\"rank\":2}', description: 'second active skill', triggers: '[\"two\"]', stage: 'active', updated_at: 20})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'skill-stage-projection-draft', title: 'Stage Projection Draft', name: 'stage-projection-draft', version: '0.1.0', success_rate: 0.2, metadata: '{\"rank\":0}', description: 'draft skill', triggers: '[\"draft\"]', stage: 'draft', updated_at: 30})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill) WHERE s.id IN ['skill-stage-projection-1', 'skill-stage-projection-2', 'skill-stage-projection-draft'] DETACH DELETE s",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"skill detail read",
CypherFixtureStatement::with_parameters(
"MATCH (sk:Skill {id: $id}) RETURN sk.title, sk.name, sk.stage, sk.scope, sk.rationale, sk.evidence_count, sk.metadata",
BTreeMap::from([(
"id".to_string(),
Value::String("skill-detail-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("sk.title", Value::String("Skill Detail".to_string())),
("sk.name", Value::String("skill-detail".to_string())),
("sk.stage", Value::String("published".to_string())),
("sk.scope", Value::String("workspace".to_string())),
("sk.rationale", Value::String("detail read".to_string())),
("sk.evidence_count", Value::Int(4)),
("sk.metadata", Value::String("{\"kind\":\"skill\"}".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'skill-detail-1', title: 'Skill Detail', name: 'skill-detail', stage: 'published', scope: 'workspace', rationale: 'detail read', evidence_count: 4, metadata: '{\"kind\":\"skill\"}'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (sk:Skill {id: 'skill-detail-1'}) DETACH DELETE sk",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"skill synthesized memory detail read",
CypherFixtureStatement::with_parameters(
"MATCH (sk:Skill {id: $id})-[:SYNTHESIZED_FROM]->(m:Memory) RETURN m.id, m.title, m.content, m.unit_type ORDER BY m.created_at",
BTreeMap::from([(
"id".to_string(),
Value::String("skill-evidence-detail-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("m.id", Value::String("skill-evidence-memory-1".to_string())),
("m.title", Value::String("Evidence One".to_string())),
("m.content", Value::String("first evidence".to_string())),
("m.unit_type", Value::String("fact".to_string())),
]),
compatibility_row([
("m.id", Value::String("skill-evidence-memory-2".to_string())),
("m.title", Value::String("Evidence Two".to_string())),
("m.content", Value::String("second evidence".to_string())),
("m.unit_type", Value::String("context".to_string())),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'skill-evidence-detail-1', stage: 'published'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'skill-evidence-memory-2', title: 'Evidence Two', content: 'second evidence', unit_type: 'context', created_at: 20})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'skill-evidence-memory-1', title: 'Evidence One', content: 'first evidence', unit_type: 'fact', created_at: 10})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (sk:Skill {id: 'skill-evidence-detail-1'}), (m:Memory {id: 'skill-evidence-memory-1'}) CREATE (sk)-[:SYNTHESIZED_FROM]->(m)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (sk:Skill {id: 'skill-evidence-detail-1'}), (m:Memory {id: 'skill-evidence-memory-2'}) CREATE (sk)-[:SYNTHESIZED_FROM]->(m)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (sk:Skill {id: 'skill-evidence-detail-1'}) DETACH DELETE sk",
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'skill-evidence-memory-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'skill-evidence-memory-2'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"skill synthesized memory direct id read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id})-[:SYNTHESIZED_FROM]->(m:Memory) RETURN m.id",
BTreeMap::from([(
"id".to_string(),
Value::String("skill-evidence-id-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([(
"m.id",
Value::String("skill-evidence-id-memory-1".to_string()),
)]),
compatibility_row([(
"m.id",
Value::String("skill-evidence-id-memory-2".to_string()),
)]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'skill-evidence-id-1', stage: 'published'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'skill-evidence-id-memory-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'skill-evidence-id-memory-2'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'skill-evidence-id-1'}), (m:Memory {id: 'skill-evidence-id-memory-1'}) CREATE (s)-[:SYNTHESIZED_FROM]->(m)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'skill-evidence-id-1'}), (m:Memory {id: 'skill-evidence-id-memory-2'}) CREATE (s)-[:SYNTHESIZED_FROM]->(m)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'skill-evidence-id-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'skill-evidence-id-memory-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'skill-evidence-id-memory-2'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest list skill node detail read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id}) RETURN s",
BTreeMap::from([(
"id".to_string(),
Value::String("rest-list-skill-detail-1".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'rest-list-skill-detail-1', name: 'rest-list-skill', title: 'REST List Skill', stage: 'active', version: 1, metadata: '{}', updated_at: 110})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'rest-list-skill-detail-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest list skill evidence detail read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id})-[:SYNTHESIZED_FROM]->(m:Memory) RETURN m.id, m.title, m.content, m.created_at ORDER BY m.created_at DESC LIMIT $limit",
BTreeMap::from([
(
"id".to_string(),
Value::String("rest-list-skill-evidence-1".to_string()),
),
("limit".to_string(), Value::Int(12)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'rest-list-skill-evidence-1', stage: 'active'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-list-skill-evidence-memory-1', title: 'Evidence memory', content: 'evidence content', created_at: 111})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'rest-list-skill-evidence-1'}), (m:Memory {id: 'rest-list-skill-evidence-memory-1'}) CREATE (s)-[:SYNTHESIZED_FROM]->(m)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-list-skill-evidence-1', 'rest-list-skill-evidence-memory-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"skill metadata read",
CypherFixtureStatement::with_parameters(
"MATCH (sk:Skill {id: $id}) RETURN sk.stage, sk.metadata",
BTreeMap::from([(
"id".to_string(),
Value::String("skill-metadata-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("sk.stage", Value::String("published".to_string())),
("sk.metadata", Value::String("{\"owner\":\"mem\"}".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'skill-metadata-1', stage: 'published', metadata: '{\"owner\":\"mem\"}'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (sk:Skill {id: 'skill-metadata-1'}) DETACH DELETE sk",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"skill metadata version read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id}) RETURN s.metadata, s.version, s.content_hash, s.title",
BTreeMap::from([(
"id".to_string(),
Value::String("skill-version-metadata-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"s.metadata",
Value::String("{\"source\":\"write-api\"}".to_string()),
),
("s.version", Value::String("3.1.4".to_string())),
("s.content_hash", Value::String("hash-319".to_string())),
("s.title", Value::String("Versioned Skill".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'skill-version-metadata-1', metadata: '{\"source\":\"write-api\"}', version: '3.1.4', content_hash: 'hash-319', title: 'Versioned Skill'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'skill-version-metadata-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp skill candidate create",
CypherFixtureStatement::with_parameters(
"CREATE (s:Skill { id: $id, stage: 'candidate', title: $title, kind: $kind, rationale: $rationale, evidence_count: $evidence_count, confidence: 0.0, demand_signal: 0.0, rejected_at: $null_ts, name: $null_str, description: $null_str, triggers: $empty_strs, tools: $empty_strs, bundle_path: $null_str, content_hash: $null_str, version: 1, invalidation_reason: $null_str, write_origin: 'compiler', scope: $scope, freshness: 1.0, pinned: false, use_count: 0, success_rate: 0.0, last_activity_at: $null_ts, space_id: $space_id, created_at: $now, updated_at: $now, last_evidence_at: $now, metadata: $metadata })",
BTreeMap::from([
(
"id".to_string(),
Value::String("mcp-skill-candidate-1".to_string()),
),
(
"title".to_string(),
Value::String("MCP Candidate".to_string()),
),
("kind".to_string(), Value::String("workflow".to_string())),
(
"rationale".to_string(),
Value::String("candidate rationale".to_string()),
),
("evidence_count".to_string(), Value::Int(2)),
("null_ts".to_string(), Value::Null),
("null_str".to_string(), Value::Null),
("empty_strs".to_string(), Value::List(Vec::new())),
("scope".to_string(), Value::String("personal".to_string())),
("space_id".to_string(), Value::String("default".to_string())),
("now".to_string(), Value::Int(1_700_000_030)),
(
"metadata".to_string(),
Value::String("{\"source\":\"mcp\"}".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'mcp-skill-candidate-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp skill rollback delete",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id}) DETACH DELETE s",
BTreeMap::from([(
"id".to_string(),
Value::String("mcp-skill-rollback-1".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'mcp-skill-rollback-1', stage: 'candidate'})",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp skill evidence memory id read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![
Value::String("mcp-skill-evidence-1".to_string()),
Value::String("mcp-skill-evidence-2".to_string()),
Value::String("missing-evidence".to_string()),
]),
)]),
),
ExpectedRows::Unordered(vec![
compatibility_row([(
"m.id",
Value::String("mcp-skill-evidence-1".to_string()),
)]),
compatibility_row([(
"m.id",
Value::String("mcp-skill-evidence-2".to_string()),
)]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-skill-evidence-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-skill-evidence-2'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['mcp-skill-evidence-1', 'mcp-skill-evidence-2'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp skill synthesized keyed merge",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $skill_id}), (m:Memory {id: $memory_id}) MERGE (s)-[r:SYNTHESIZED_FROM]->(m) ON CREATE SET r.weight = 1.0, r.occasion_key = $occasion_key, r.created_at = $now",
BTreeMap::from([
(
"skill_id".to_string(),
Value::String("mcp-skill-link-1".to_string()),
),
(
"memory_id".to_string(),
Value::String("mcp-skill-link-memory-1".to_string()),
),
(
"occasion_key".to_string(),
Value::String("occasion-1".to_string()),
),
("now".to_string(), Value::Int(1_700_000_031)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'mcp-skill-link-1', stage: 'candidate'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-skill-link-memory-1'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['mcp-skill-link-1', 'mcp-skill-link-memory-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp skill stage metadata space read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id}) RETURN s.stage, s.metadata, s.space_id",
BTreeMap::from([(
"id".to_string(),
Value::String("mcp-skill-stage-meta-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("s.stage", Value::String("candidate".to_string())),
("s.metadata", Value::String("{\"phase\":\"candidate\"}".to_string())),
("s.space_id", Value::String("default".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'mcp-skill-stage-meta-1', stage: 'candidate', metadata: '{\"phase\":\"candidate\"}', space_id: 'default'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'mcp-skill-stage-meta-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp skill promotion update",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id}) SET s.rationale = $rationale, s.stage = 'promotable', s.updated_at = $updated_at",
BTreeMap::from([
(
"id".to_string(),
Value::String("mcp-skill-promote-1".to_string()),
),
(
"rationale".to_string(),
Value::String("ready to promote".to_string()),
),
("updated_at".to_string(), Value::Int(1_700_000_032)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'mcp-skill-promote-1', stage: 'candidate', rationale: '', updated_at: 1})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'mcp-skill-promote-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp skill write draft update",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id}) SET s.name = $name, s.description = $description, s.triggers = $triggers, s.tools = $tools, s.bundle_path = $bundle_path, s.content_hash = $content_hash, s.write_origin = 'compiler', s.stage = 'draft', s.updated_at = $updated_at",
BTreeMap::from([
(
"id".to_string(),
Value::String("mcp-skill-write-1".to_string()),
),
("name".to_string(), Value::String("mcp-skill".to_string())),
(
"description".to_string(),
Value::String("compiled skill".to_string()),
),
(
"triggers".to_string(),
Value::List(vec![Value::String("compile".to_string())]),
),
(
"tools".to_string(),
Value::List(vec![Value::String("shell".to_string())]),
),
(
"bundle_path".to_string(),
Value::String("/tmp/mcp-skill".to_string()),
),
(
"content_hash".to_string(),
Value::String("hash-write".to_string()),
),
("updated_at".to_string(), Value::Int(1_700_000_033)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'mcp-skill-write-1', stage: 'promotable'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'mcp-skill-write-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp skill compiled metadata read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id}) RETURN s.version, s.content_hash, s.bundle_path, s.metadata",
BTreeMap::from([(
"id".to_string(),
Value::String("mcp-skill-compiled-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("s.version", Value::Int(4)),
("s.content_hash", Value::String("hash-compiled".to_string())),
(
"s.bundle_path",
Value::String("/tmp/mcp-compiled".to_string()),
),
("s.metadata", Value::String("{\"compiled\":true}".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'mcp-skill-compiled-1', version: 4, content_hash: 'hash-compiled', bundle_path: '/tmp/mcp-compiled', metadata: '{\"compiled\":true}'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'mcp-skill-compiled-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"skill metadata update",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id}) SET s.metadata = $metadata, s.updated_at = $updated_at",
BTreeMap::from([
(
"id".to_string(),
Value::String("skill-metadata-update-1".to_string()),
),
(
"metadata".to_string(),
Value::String("{\"stage\":\"reviewed\"}".to_string()),
),
("updated_at".to_string(), Value::Int(700)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'skill-metadata-update-1', stage: 'candidate', metadata: '{}', updated_at: 100})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'skill-metadata-update-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"skill usage stats update",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id}) SET s.use_count = $use_count, s.success_rate = $success_rate, s.last_activity_at = $last_activity_at, s.updated_at = $updated_at, s.metadata = $metadata",
BTreeMap::from([
(
"id".to_string(),
Value::String("skill-usage-update-1".to_string()),
),
("use_count".to_string(), Value::Int(8)),
("success_rate".to_string(), Value::Float(0.75)),
("last_activity_at".to_string(), Value::Int(810)),
("updated_at".to_string(), Value::Int(820)),
(
"metadata".to_string(),
Value::String("{\"runs\":8}".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'skill-usage-update-1', use_count: 1, success_rate: 0.5, metadata: '{}', updated_at: 100})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'skill-usage-update-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory metadata update",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $memory_id}) SET m.metadata = $metadata, m.updated_at = $updated_at",
BTreeMap::from([
(
"memory_id".to_string(),
Value::String("memory-metadata-update-1".to_string()),
),
(
"metadata".to_string(),
Value::String("{\"stage\":\"synced\"}".to_string()),
),
("updated_at".to_string(), Value::Int(900)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-metadata-update-1', metadata: '{}', updated_at: 100})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'memory-metadata-update-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory metadata replace update",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $id}) SET m.metadata = $metadata",
BTreeMap::from([
(
"id".to_string(),
Value::String("memory-metadata-replace-1".to_string()),
),
(
"metadata".to_string(),
Value::String("{\"stage\":\"replaced\"}".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'memory-metadata-replace-1', metadata: '{}'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'memory-metadata-replace-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread metadata update",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $thread_uuid}) SET t.metadata = $metadata, t.updated_at = $updated_at",
BTreeMap::from([
(
"thread_uuid".to_string(),
Value::String("thread-metadata-update-1".to_string()),
),
(
"metadata".to_string(),
Value::String("{\"status\":\"indexed\"}".to_string()),
),
("updated_at".to_string(), Value::Int(910)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-metadata-update-1', metadata: '{}', updated_at: 100})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'thread-metadata-update-1'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread metadata read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $thread_uuid}) RETURN t.metadata as metadata",
BTreeMap::from([(
"thread_uuid".to_string(),
Value::String("thread-metadata-read-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"metadata",
Value::String("{\"status\":\"stored\"}".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-metadata-read-1', metadata: '{\"status\":\"stored\"}'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'thread-metadata-read-1'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread distill identity metadata read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $thread_uuid}) RETURN t.metadata",
BTreeMap::from([(
"thread_uuid".to_string(),
Value::String("thread-distill-metadata-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"t.metadata",
Value::String("{\"agent_id\":\"agent-1\"}".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-distill-metadata-1', metadata: '{\"agent_id\":\"agent-1\"}'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'thread-distill-metadata-1'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest thread repair identities read",
CypherFixtureStatement::new(
"MATCH (ti:ThreadIdentity) RETURN ti.id, ti.thread_node_id, CASE WHEN ti.space_id IS NULL OR ti.space_id = '' THEN 'default' ELSE ti.space_id END",
),
ExpectedRows::RowCount(2),
)
.with_setup_query(CypherFixtureStatement::new(
"MATCH (ti:ThreadIdentity) DETACH DELETE ti",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:ThreadIdentity {id: 'repair-identity-read-1', thread_node_id: 'repair-thread-a', space_id: ''})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:ThreadIdentity {id: 'repair-identity-read-2', thread_node_id: 'repair-thread-b', space_id: 'archive'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (ti:ThreadIdentity) WHERE ti.id IN ['repair-identity-read-1', 'repair-identity-read-2'] DETACH DELETE ti",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest thread repair summary read",
CypherFixtureStatement::new(
"MATCH (t:Thread) OPTIONAL MATCH (ti:ThreadIdentity) WHERE ti.thread_node_id = t.id WITH t, COUNT(ti) AS identity_refs OPTIONAL MATCH (t)-[:CONTAINS]->(msg:Message) WITH t, identity_refs, COUNT(msg) AS legacy_messages OPTIONAL MATCH (t)-[:COMPACTS_TO]->(m:Memory) RETURN t.id, t.thread_id, CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END, COALESCE(t.message_count, 0), identity_refs, legacy_messages, COUNT(m) ORDER BY t.id ASC",
),
ExpectedRows::Exact(vec![
compatibility_row([
("t.id", Value::String("repair-summary-thread-a".to_string())),
(
"t.thread_id",
Value::String("repair-summary-logical-a".to_string()),
),
(
"CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END",
Value::String("default".to_string()),
),
("COALESCE(t.message_count, 0)", Value::Int(5)),
("identity_refs", Value::Int(1)),
("legacy_messages", Value::Int(2)),
("COUNT(m)", Value::Int(1)),
]),
compatibility_row([
("t.id", Value::String("repair-summary-thread-b".to_string())),
(
"t.thread_id",
Value::String("repair-summary-logical-b".to_string()),
),
(
"CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END",
Value::String("team".to_string()),
),
("COALESCE(t.message_count, 0)", Value::Int(0)),
("identity_refs", Value::Int(0)),
("legacy_messages", Value::Int(0)),
("COUNT(m)", Value::Int(0)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'repair-summary-thread-a', thread_id: 'repair-summary-logical-a', space_id: '', message_count: 5})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'repair-summary-thread-b', thread_id: 'repair-summary-logical-b', space_id: 'team'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:ThreadIdentity {id: 'repair-summary-identity-a', thread_node_id: 'repair-summary-thread-a'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Message {id: 'repair-summary-message-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Message {id: 'repair-summary-message-2'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'repair-summary-memory-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'repair-summary-thread-a'}), (m:Message {id: 'repair-summary-message-1'}) CREATE (t)-[:CONTAINS]->(m)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'repair-summary-thread-a'}), (m:Message {id: 'repair-summary-message-2'}) CREATE (t)-[:CONTAINS]->(m)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'repair-summary-thread-a'}), (m:Memory {id: 'repair-summary-memory-1'}) CREATE (t)-[:COMPACTS_TO]->(m)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['repair-summary-thread-a', 'repair-summary-thread-b', 'repair-summary-identity-a', 'repair-summary-message-1', 'repair-summary-message-2', 'repair-summary-memory-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(6),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest thread repair storage delete",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $storage_id}) DETACH DELETE t",
BTreeMap::from([(
"storage_id".to_string(),
Value::String("repair-delete-thread".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'repair-delete-thread', thread_id: 'repair-delete-logical'})",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest thread message transcript read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $thread_uuid})-[c:CONTAINS]->(m:Message) RETURN m.role, m.content, m.timestamp, m.created_at, COALESCE(c.order_index, m.order_index) ORDER BY COALESCE(c.order_index, m.order_index)",
BTreeMap::from([(
"thread_uuid".to_string(),
Value::String("thread-transcript-1".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-transcript-1'})-[:CONTAINS {order_index: 1}]->(:Message {id: 'thread-transcript-message-1', role: 'user', content: 'hello', timestamp: 10, created_at: 11})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'thread-transcript-1'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest thread skill stages read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill) WHERE s.stage IN $stages RETURN s.id, s.name LIMIT 500",
BTreeMap::from([(
"stages".to_string(),
Value::List(vec![Value::String("promotable".to_string())]),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'thread-skill-stage-1', name: 'Thread Skill', stage: 'promotable'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'thread-skill-stage-1'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest thread metadata uuid read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $uuid}) RETURN t.metadata",
BTreeMap::from([(
"uuid".to_string(),
Value::String("thread-metadata-uuid-read".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-metadata-uuid-read', metadata: '{\"skill\":true}'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'thread-metadata-uuid-read'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest thread skill usage read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id}) RETURN s.metadata, s.use_count",
BTreeMap::from([(
"id".to_string(),
Value::String("thread-skill-usage-read".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'thread-skill-usage-read', metadata: '{\"runs\":2}', use_count: 2})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'thread-skill-usage-read'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest thread skill usage update",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill {id: $id}) SET s.use_count = $use_count, s.last_activity_at = $now, s.updated_at = $now, s.metadata = $metadata",
BTreeMap::from([
(
"id".to_string(),
Value::String("thread-skill-usage-update".to_string()),
),
("use_count".to_string(), Value::Int(5)),
("now".to_string(), Value::Int(1_700_000_050)),
(
"metadata".to_string(),
Value::String("{\"runs\":5}".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'thread-skill-usage-update', metadata: '{}', use_count: 1})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'thread-skill-usage-update'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest thread metadata now update",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $uuid}) SET t.metadata = $metadata, t.updated_at = $now",
BTreeMap::from([
(
"uuid".to_string(),
Value::String("thread-metadata-now-update".to_string()),
),
(
"metadata".to_string(),
Value::String("{\"skill_usage\":true}".to_string()),
),
("now".to_string(), Value::Int(1_700_000_051)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-metadata-now-update', metadata: '{}', updated_at: 1})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'thread-metadata-now-update'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest thread candidate source read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE t.thread_id IN $candidate_ids AND CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END = $source_space_id RETURN t.thread_id",
BTreeMap::from([
(
"candidate_ids".to_string(),
Value::List(vec![
Value::String("thread-candidate-1".to_string()),
Value::String("thread-candidate-2".to_string()),
]),
),
(
"source_space_id".to_string(),
Value::String("default".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-candidate-storage-1', thread_id: 'thread-candidate-1', space_id: ''})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-candidate-storage-2', thread_id: 'thread-candidate-2', space_id: 'archive'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread) WHERE t.thread_id IN ['thread-candidate-1', 'thread-candidate-2'] DETACH DELETE t",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest thread candidate target exclusion read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE t.thread_id IN $candidate_ids AND CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END <> $target_space_id RETURN t.thread_id",
BTreeMap::from([
(
"candidate_ids".to_string(),
Value::List(vec![
Value::String("thread-target-1".to_string()),
Value::String("thread-target-2".to_string()),
]),
),
(
"target_space_id".to_string(),
Value::String("default".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-target-storage-1', thread_id: 'thread-target-1', space_id: ''})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-target-storage-2', thread_id: 'thread-target-2', space_id: 'archive'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread) WHERE t.thread_id IN ['thread-target-1', 'thread-target-2'] DETACH DELETE t",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest thread source space count read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END = $source_space_id RETURN count(t)",
BTreeMap::from([(
"source_space_id".to_string(),
Value::String("thread-count-space".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-count-space-1', thread_id: 'thread-count-1', space_id: 'thread-count-space'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'thread-count-space-1'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest thread source space limit read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END = $source_space_id RETURN t.thread_id LIMIT $limit",
BTreeMap::from([
(
"source_space_id".to_string(),
Value::String("thread-limit-space".to_string()),
),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-limit-space-1', thread_id: 'thread-limit-1', space_id: 'thread-limit-space'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'thread-limit-space-1'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest thread duplicate source-space read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE t.thread_id IN $thread_ids AND CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END = $source_space_id WITH t.thread_id AS thread_id, count(t) AS row_count WHERE row_count > 1 RETURN thread_id, row_count",
BTreeMap::from([
(
"thread_ids".to_string(),
Value::List(vec![Value::String("thread-duplicate-1".to_string())]),
),
(
"source_space_id".to_string(),
Value::String("default".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-duplicate-storage-1a', thread_id: 'thread-duplicate-1', space_id: ''})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-duplicate-storage-1b', thread_id: 'thread-duplicate-1'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread) WHERE t.thread_id = 'thread-duplicate-1' DETACH DELETE t",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest thread duplicate global read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE t.thread_id IN $thread_ids WITH t.thread_id AS thread_id, count(t) AS row_count WHERE row_count > 1 RETURN thread_id, row_count",
BTreeMap::from([(
"thread_ids".to_string(),
Value::List(vec![Value::String("thread-duplicate-global".to_string())]),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-duplicate-global-a', thread_id: 'thread-duplicate-global', space_id: 'a'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-duplicate-global-b', thread_id: 'thread-duplicate-global', space_id: 'b'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread) WHERE t.thread_id = 'thread-duplicate-global' DETACH DELETE t",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest thread source-space rows read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE t.thread_id IN $thread_ids AND CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END = $source_space_id RETURN t.id, t.thread_id, t.space_id",
BTreeMap::from([
(
"thread_ids".to_string(),
Value::List(vec![
Value::String("thread-source-row-1".to_string()),
Value::String("thread-source-row-2".to_string()),
]),
),
(
"source_space_id".to_string(),
Value::String("default".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-source-row-storage-1', thread_id: 'thread-source-row-1', space_id: ''})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-source-row-storage-2', thread_id: 'thread-source-row-2', space_id: 'archive'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread) WHERE t.thread_id IN ['thread-source-row-1', 'thread-source-row-2'] DETACH DELETE t",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest thread rows read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE t.thread_id IN $thread_ids RETURN t.id, t.thread_id, t.space_id",
BTreeMap::from([(
"thread_ids".to_string(),
Value::List(vec![
Value::String("thread-row-1".to_string()),
Value::String("thread-row-2".to_string()),
]),
)]),
),
ExpectedRows::RowCount(2),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-row-storage-1', thread_id: 'thread-row-1', space_id: 'default'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-row-storage-2', thread_id: 'thread-row-2', space_id: 'archive'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread) WHERE t.thread_id IN ['thread-row-1', 'thread-row-2'] DETACH DELETE t",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest thread move target update returning ids",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE t.thread_id IN $thread_ids AND CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END <> $target_space_id SET t.space_id = $target_space_id, t.updated_at = $updated_at RETURN t.thread_id",
BTreeMap::from([
(
"thread_ids".to_string(),
Value::List(vec![
Value::String("thread-move-target-1".to_string()),
Value::String("thread-move-target-2".to_string()),
]),
),
(
"target_space_id".to_string(),
Value::String("archive".to_string()),
),
("updated_at".to_string(), Value::Int(1_700_000_060)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-move-target-storage-1', thread_id: 'thread-move-target-1', space_id: 'default'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-move-target-storage-2', thread_id: 'thread-move-target-2', space_id: 'archive'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread) WHERE t.thread_id IN ['thread-move-target-1', 'thread-move-target-2'] DETACH DELETE t",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest thread identity source-space update",
CypherFixtureStatement::with_parameters(
"MATCH (ti:ThreadIdentity) WHERE ti.thread_id IN $thread_ids AND CASE WHEN ti.space_id IS NULL OR ti.space_id = '' THEN 'default' ELSE ti.space_id END = $source_space_id SET ti.space_id = $target_space_id, ti.updated_at = $updated_at",
BTreeMap::from([
(
"thread_ids".to_string(),
Value::List(vec![
Value::String("identity-source-update-1".to_string()),
Value::String("identity-source-update-2".to_string()),
]),
),
(
"source_space_id".to_string(),
Value::String("default".to_string()),
),
(
"target_space_id".to_string(),
Value::String("archive".to_string()),
),
("updated_at".to_string(), Value::Int(1_700_000_061)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:ThreadIdentity {id: 'identity-source-update-node-1', thread_id: 'identity-source-update-1', space_id: ''})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:ThreadIdentity {id: 'identity-source-update-node-2', thread_id: 'identity-source-update-2', space_id: 'team'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (ti:ThreadIdentity) WHERE ti.thread_id IN ['identity-source-update-1', 'identity-source-update-2'] DETACH DELETE ti",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest thread identity target-space update",
CypherFixtureStatement::with_parameters(
"MATCH (ti:ThreadIdentity) WHERE ti.thread_id IN $thread_ids AND CASE WHEN ti.space_id IS NULL OR ti.space_id = '' THEN 'default' ELSE ti.space_id END <> $target_space_id SET ti.space_id = $target_space_id, ti.updated_at = $updated_at",
BTreeMap::from([
(
"thread_ids".to_string(),
Value::List(vec![
Value::String("identity-target-update-1".to_string()),
Value::String("identity-target-update-2".to_string()),
]),
),
(
"target_space_id".to_string(),
Value::String("archive".to_string()),
),
("updated_at".to_string(), Value::Int(1_700_000_062)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:ThreadIdentity {id: 'identity-target-update-node-1', thread_id: 'identity-target-update-1', space_id: ''})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:ThreadIdentity {id: 'identity-target-update-node-2', thread_id: 'identity-target-update-2', space_id: 'archive'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (ti:ThreadIdentity) WHERE ti.thread_id IN ['identity-target-update-1', 'identity-target-update-2'] DETACH DELETE ti",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest write compaction link create",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $thread_uuid}), (m:Memory {id: $memory_id}) CREATE (t)-[:COMPACTS_TO {compaction_method: $method, created_at: $created_at, properties: '{}'}]->(m)",
BTreeMap::from([
(
"thread_uuid".to_string(),
Value::String("rest-write-compact-thread".to_string()),
),
(
"memory_id".to_string(),
Value::String("rest-write-compact-memory".to_string()),
),
("method".to_string(), Value::String("manual".to_string())),
("created_at".to_string(), Value::Int(1_700_000_063)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'rest-write-compact-thread'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-write-compact-memory'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-write-compact-thread', 'rest-write-compact-memory'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest write message indices read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $thread_uuid})-[:CONTAINS]->(m:Message) WHERE m.order_index IN $indices RETURN m.id ORDER BY m.order_index",
BTreeMap::from([
(
"thread_uuid".to_string(),
Value::String("rest-write-index-thread".to_string()),
),
(
"indices".to_string(),
Value::List(vec![Value::Int(1), Value::Int(3)]),
),
]),
),
ExpectedRows::RowCount(2),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'rest-write-index-thread'})-[:CONTAINS]->(:Message {id: 'rest-write-index-message-1', order_index: 1})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'rest-write-index-thread'})-[:CONTAINS]->(:Message {id: 'rest-write-index-message-3', order_index: 3})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'rest-write-index-thread'}) DETACH DELETE t",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest write crystal source count read",
CypherFixtureStatement::with_parameters(
"MATCH (c:Memory)-[:SYNTHESIZED_FROM]->(m:Memory {id: $id}) RETURN c.id, COALESCE(c.source_unit_count, 0)",
BTreeMap::from([(
"id".to_string(),
Value::String("rest-write-source-memory".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-write-crystal-memory', source_unit_count: 2})-[:SYNTHESIZED_FROM]->(:Memory {id: 'rest-write-source-memory'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['rest-write-crystal-memory', 'rest-write-source-memory'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest write crystal source count decrement",
CypherFixtureStatement::with_parameters(
"MATCH (c:Memory {id: $cid}) SET c.source_unit_count = CASE WHEN c.source_unit_count > 0 THEN c.source_unit_count - 1 ELSE 0 END, c.updated_at = CURRENT_TIMESTAMP()",
BTreeMap::from([(
"cid".to_string(),
Value::String("rest-write-crystal-decrement".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-write-crystal-decrement', source_unit_count: 2})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (c:Memory {id: 'rest-write-crystal-decrement'}) RETURN c.source_unit_count AS source_unit_count",
),
ExpectedRows::Exact(vec![compatibility_row([(
"source_unit_count",
Value::Int(1),
)])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest write memory mentions read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $id})-[:MENTIONS]->(e:Entity) RETURN e.id",
BTreeMap::from([(
"id".to_string(),
Value::String("rest-write-mentioned-memory".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-write-mentioned-memory'})-[:MENTIONS]->(:Entity {id: 'rest-write-mentioned-entity'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-write-mentioned-memory', 'rest-write-mentioned-entity'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest write entity source reference read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity)-[r:RELATES_TO]-() WHERE r.source_reference = $id RETURN DISTINCT e.id",
BTreeMap::from([(
"id".to_string(),
Value::String("rest-write-source-ref".to_string()),
)]),
),
ExpectedRows::RowCount(2),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'rest-write-source-ref-a'})-[:RELATES_TO {source_reference: 'rest-write-source-ref'}]->(:Entity {id: 'rest-write-source-ref-b'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity) WHERE e.id IN ['rest-write-source-ref-a', 'rest-write-source-ref-b'] DETACH DELETE e",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest write entity mention count read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {id: $eid})<-[:MENTIONS]-(other:Memory) WHERE other.id <> $mid RETURN count(*)",
BTreeMap::from([
(
"eid".to_string(),
Value::String("rest-write-mention-count-entity".to_string()),
),
(
"mid".to_string(),
Value::String("rest-write-mention-excluded".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-write-mention-other'})-[:MENTIONS]->(:Entity {id: 'rest-write-mention-count-entity'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-write-mention-excluded'})-[:MENTIONS]->(:Entity {id: 'rest-write-mention-count-entity'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-write-mention-other', 'rest-write-mention-excluded', 'rest-write-mention-count-entity'] DETACH DELETE n",
),
ExpectedRows::RowCount(4),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest write entity label count read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {id: $eid})-[:HAS_LABEL]-() RETURN count(*)",
BTreeMap::from([(
"eid".to_string(),
Value::String("rest-write-label-count-entity".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'rest-write-label-count-entity'})-[:HAS_LABEL]->(:Label {id: 'rest-write-label-count-label'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-write-label-count-entity', 'rest-write-label-count-label'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest write entity source reference relationship count sum",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {id: $eid}) OPTIONAL MATCH (e)-[r1:RELATES_TO]-() WHERE r1.source_reference <> $mid OR r1.source_reference IS NULL OR r1.source_reference = '' OPTIONAL MATCH ()-[r2:RELATES_TO]->(e) WHERE r2.source_reference <> $mid OR r2.source_reference IS NULL OR r2.source_reference = '' RETURN (count(r1) + count(r2))",
BTreeMap::from([
(
"eid".to_string(),
Value::String("rest-write-count-sum-entity".to_string()),
),
(
"mid".to_string(),
Value::String("rest-write-count-sum-excluded".to_string()),
),
]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"(count(r1) + count(r2))",
Value::Int(4),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'rest-write-count-sum-entity'})-[:RELATES_TO {source_reference: 'other-source'}]->(:Entity {id: 'rest-write-count-sum-out'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'rest-write-count-sum-in-empty'})-[:RELATES_TO {source_reference: ''}]->(:Entity {id: 'rest-write-count-sum-entity'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'rest-write-count-sum-in-excluded'})-[:RELATES_TO {source_reference: 'rest-write-count-sum-excluded'}]->(:Entity {id: 'rest-write-count-sum-entity'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'rest-write-count-sum-entity'})-[:RELATES_TO]->(:Entity {id: 'rest-write-count-sum-null'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity) WHERE e.id IN ['rest-write-count-sum-entity', 'rest-write-count-sum-out', 'rest-write-count-sum-in-empty', 'rest-write-count-sum-in-excluded', 'rest-write-count-sum-null'] DETACH DELETE e",
),
ExpectedRows::RowCount(8),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest write entity distinct relationship count sum",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {id: $eid}) OPTIONAL MATCH (e)-[r1]-() OPTIONAL MATCH ()-[r2]->(e) RETURN (count(DISTINCT r1) + count(DISTINCT r2))",
BTreeMap::from([(
"eid".to_string(),
Value::String("rest-write-distinct-count-sum-entity".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"(count(DISTINCT r1) + count(DISTINCT r2))",
Value::Int(3),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'rest-write-distinct-count-sum-entity'})-[:RELATES_TO]->(:Entity {id: 'rest-write-distinct-count-sum-out'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'rest-write-distinct-count-sum-in'})-[:RELATES_TO]->(:Entity {id: 'rest-write-distinct-count-sum-entity'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity) WHERE e.id IN ['rest-write-distinct-count-sum-entity', 'rest-write-distinct-count-sum-out', 'rest-write-distinct-count-sum-in'] DETACH DELETE e",
),
ExpectedRows::RowCount(4),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest write entity delete",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {id: $eid}) DETACH DELETE e",
BTreeMap::from([(
"eid".to_string(),
Value::String("rest-write-delete-entity".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'rest-write-delete-entity'})",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest write compact thread metadata read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread)-[:COMPACTS_TO]->(m:Memory {id: $id}) RETURN t.id, t.metadata",
BTreeMap::from([(
"id".to_string(),
Value::String("rest-write-compact-meta-memory".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'rest-write-compact-meta-thread', metadata: '{\"source\":\"rest\"}'})-[:COMPACTS_TO]->(:Memory {id: 'rest-write-compact-meta-memory'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-write-compact-meta-thread', 'rest-write-compact-meta-memory'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest write compact memory count read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $uuid})-[:COMPACTS_TO]->(m:Memory) RETURN count(m)",
BTreeMap::from([(
"uuid".to_string(),
Value::String("rest-write-compact-count-thread".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'rest-write-compact-count-thread'})-[:COMPACTS_TO]->(:Memory {id: 'rest-write-compact-count-memory'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-write-compact-count-thread', 'rest-write-compact-count-memory'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest write thread metadata replace",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $uuid}) SET t.metadata = $metadata",
BTreeMap::from([
(
"uuid".to_string(),
Value::String("rest-write-thread-metadata".to_string()),
),
(
"metadata".to_string(),
Value::String("{\"updated\":true}".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'rest-write-thread-metadata', metadata: '{}'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'rest-write-thread-metadata'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"scheduler dedup reviewed update",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $ids SET m.dedup_reviewed_at = $reviewed_at",
BTreeMap::from([
(
"ids".to_string(),
Value::List(vec![Value::String("scheduler-dedup-1".to_string())]),
),
("reviewed_at".to_string(), Value::Int(1_700_000_070)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'scheduler-dedup-1'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'scheduler-dedup-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"scheduler skill stage node read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill) WHERE s.stage = $stage RETURN s ORDER BY s.updated_at DESC LIMIT $limit",
BTreeMap::from([
("stage".to_string(), Value::String("active".to_string())),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'scheduler-stage-skill', stage: 'active', updated_at: 1})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'scheduler-stage-skill'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"scheduler memory prefix read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id STARTS WITH $prefix RETURN m.id, m.space_id LIMIT 2",
BTreeMap::from([(
"prefix".to_string(),
Value::String("scheduler-prefix-".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'scheduler-prefix-1', space_id: 'default'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'scheduler-prefix-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"scheduler memory compact detail read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, m.title, m.content, m.unit_type",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![Value::String("scheduler-memory-detail".to_string())]),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'scheduler-memory-detail', title: 'Scheduler Memory', content: 'detail', unit_type: 'fact'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'scheduler-memory-detail'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"scheduler memory import detail read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, m.title, m.content, m.unit_type, m.importance, m.created_at, m.space_id, m.is_crystal",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![Value::String("scheduler-memory-import".to_string())]),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'scheduler-memory-import', title: 'Import Memory', content: 'import', unit_type: 'fact', importance: 0.7, created_at: 10, space_id: 'default', is_crystal: false})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'scheduler-memory-import'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"scheduler community snapshot read",
CypherFixtureStatement::new(
"MATCH (c:Community) RETURN c.id, c.community_id, COALESCE(c.name, ''), COALESCE(c.description, ''), COALESCE(c.ai_summary, ''), COALESCE(c.member_count, 0)",
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'scheduler-community', community_id: 700, name: 'Scheduler Community', description: 'desc', ai_summary: 'summary', member_count: 3})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (c:Community {id: 'scheduler-community'}) DETACH DELETE c",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"scheduler memory metadata read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $id}) RETURN m.metadata",
BTreeMap::from([(
"id".to_string(),
Value::String("scheduler-memory-metadata".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'scheduler-memory-metadata', metadata: '{\"scheduler\":true}'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'scheduler-memory-metadata'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"scheduler entity ids read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) WHERE e.id IN $entity_ids RETURN e.id, e.name, e.entity_type, e.description",
BTreeMap::from([(
"entity_ids".to_string(),
Value::List(vec![Value::String("scheduler-entity-1".to_string())]),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'scheduler-entity-1', name: 'Scheduler Entity', entity_type: 'concept', description: 'entity desc'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'scheduler-entity-1'}) DETACH DELETE e",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"scheduler thread transcript read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $thread_uuid})-[c:CONTAINS]->(m:Message) RETURN COALESCE(c.order_index, m.order_index), m.role, m.content, m.timestamp ORDER BY COALESCE(c.order_index, m.order_index)",
BTreeMap::from([(
"thread_uuid".to_string(),
Value::String("scheduler-thread-transcript".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'scheduler-thread-transcript'})-[:CONTAINS {order_index: 1}]->(:Message {id: 'scheduler-thread-transcript-message', role: 'user', content: 'hello', timestamp: 10})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'scheduler-thread-transcript'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"scheduler thread message count read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $thread_uuid})-[:CONTAINS]->(m:Message) RETURN count(m)",
BTreeMap::from([(
"thread_uuid".to_string(),
Value::String("scheduler-thread-count".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'scheduler-thread-count'})-[:CONTAINS]->(:Message {id: 'scheduler-thread-count-message'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'scheduler-thread-count'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"scheduler compact metadata bulk read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread)-[:COMPACTS_TO]->(m:Memory) WHERE m.id IN $ids RETURN m.id, t.metadata",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![Value::String("scheduler-compact-memory".to_string())]),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'scheduler-compact-thread', metadata: '{\"thread\":true}'})-[:COMPACTS_TO]->(:Memory {id: 'scheduler-compact-memory'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['scheduler-compact-thread', 'scheduler-compact-memory'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"scheduler thread summary read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $thread_uuid}) RETURN t.title, t.summary, t.source LIMIT 1",
BTreeMap::from([(
"thread_uuid".to_string(),
Value::String("scheduler-thread-summary".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'scheduler-thread-summary', title: 'Scheduler Thread', summary: 'summary', source: 'codex'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'scheduler-thread-summary'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"scheduler memory full detail read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id = $id RETURN m.id, m.title, m.content, m.unit_type, m.created_at, m.importance, m.metadata, m.lifecycle_state LIMIT 1",
BTreeMap::from([(
"id".to_string(),
Value::String("scheduler-memory-full-detail".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'scheduler-memory-full-detail', title: 'Full Detail', content: 'content', unit_type: 'fact', created_at: 10, importance: 0.7, metadata: '{}', lifecycle_state: 'active'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'scheduler-memory-full-detail'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"scheduler memory source detail read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id = $id RETURN m.id, m.title, m.content, m.unit_type, m.source, m.space_id, m.created_at LIMIT 1",
BTreeMap::from([(
"id".to_string(),
Value::String("scheduler-memory-source-detail".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'scheduler-memory-source-detail', title: 'Source Detail', content: 'content', unit_type: 'fact', source: 'agent', space_id: 'default', created_at: 11})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'scheduler-memory-source-detail'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"scheduler memory decay detail read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id = $id RETURN m.id, m.title, m.content, m.unit_type, m.source, m.space_id, m.created_at, m.decay_score_cached, m.metadata, m.is_latest, m.lifecycle_state LIMIT 1",
BTreeMap::from([(
"id".to_string(),
Value::String("scheduler-memory-decay-detail".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'scheduler-memory-decay-detail', title: 'Decay Detail', content: 'content', unit_type: 'fact', source: 'agent', space_id: 'default', created_at: 12, decay_score_cached: 0.4, metadata: '{}', is_latest: true, lifecycle_state: 'active'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'scheduler-memory-decay-detail'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"scheduler memory bulk detail read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, m.title, m.content, m.unit_type, m.source, m.importance, m.created_at, m.metadata, m.is_latest, m.lifecycle_state",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![Value::String("scheduler-memory-bulk-detail".to_string())]),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'scheduler-memory-bulk-detail', title: 'Bulk Detail', content: 'content', unit_type: 'fact', source: 'agent', importance: 0.8, created_at: 13, metadata: '{}', is_latest: true, lifecycle_state: 'active'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'scheduler-memory-bulk-detail'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"scheduler evolves neighbor read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[r:EVOLVES]-(n:Memory) WHERE m.id = $id RETURN n.id, n.title, n.unit_type, 'EVOLVES' as edge_type, r.content_relation as relation, n.created_at LIMIT 20",
BTreeMap::from([(
"id".to_string(),
Value::String("scheduler-evolves-source".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'scheduler-evolves-source'})-[:EVOLVES {content_relation: 'updates'}]->(:Memory {id: 'scheduler-evolves-target', title: 'Target', unit_type: 'fact', created_at: 14})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['scheduler-evolves-source', 'scheduler-evolves-target'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"scheduler community ai summary read",
CypherFixtureStatement::new(
"MATCH (c:Community) WHERE c.community_id IS NOT NULL AND c.community_id >= 0 AND c.ai_summary IS NOT NULL AND c.ai_summary <> '' RETURN c.community_id, c.name, c.description, c.ai_summary, c.member_count",
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'scheduler-community-ai', community_id: 800, name: 'Community AI', description: 'desc', ai_summary: 'summary', member_count: 9})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (c:Community {id: 'scheduler-community-ai'}) DETACH DELETE c",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"scheduler entity community ids read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) WHERE e.community_id IN $cids RETURN e.community_id, e.id",
BTreeMap::from([(
"cids".to_string(),
Value::List(vec![Value::Int(801)]),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'scheduler-community-entity', community_id: 801})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'scheduler-community-entity'}) DETACH DELETE e",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"skill routing stage projection read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Skill) WHERE s.stage = $stage RETURN s.id, s.name, s.title, s.description, s.triggers, s.metadata, s.content_hash, s.version ORDER BY s.updated_at DESC LIMIT $limit",
BTreeMap::from([
("stage".to_string(), Value::String("active".to_string())),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Skill {id: 'skill-routing-stage', name: 'route', title: 'Route', description: 'desc', triggers: ['route'], metadata: '{}', content_hash: 'hash', version: 1, stage: 'active', updated_at: 10})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Skill {id: 'skill-routing-stage'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"learning memory latest read",
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.unit_type = 'learning' AND m.is_crystal = false AND m.is_latest = true RETURN m.id, m.title, m.content ORDER BY m.created_at DESC LIMIT 40",
),
ExpectedRows::Exact(vec![
compatibility_row([
("m.id", Value::String("learning-memory-2".to_string())),
("m.title", Value::String("Learning Two".to_string())),
("m.content", Value::String("newer learning".to_string())),
]),
compatibility_row([
("m.id", Value::String("learning-memory-1".to_string())),
("m.title", Value::String("Learning One".to_string())),
("m.content", Value::String("older learning".to_string())),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'learning-memory-1', title: 'Learning One', content: 'older learning', unit_type: 'learning', is_crystal: false, is_latest: true, created_at: 10})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'learning-memory-2', title: 'Learning Two', content: 'newer learning', unit_type: 'learning', is_crystal: false, is_latest: true, created_at: 20})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'learning-memory-crystal', title: 'Crystal Learning', content: 'excluded crystal', unit_type: 'learning', is_crystal: true, is_latest: true, created_at: 30})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'learning-memory-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'learning-memory-2'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'learning-memory-crystal'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source parsed path list read",
CypherFixtureStatement::new(
"MATCH (src:Source) WHERE src.parsed_path IS NOT NULL RETURN src.id, src.original_name, src.parsed_path ORDER BY src.created_at DESC LIMIT 12",
),
ExpectedRows::Exact(vec![
compatibility_row([
("src.id", Value::String("parsed-source-2".to_string())),
("src.original_name", Value::String("Parsed Two".to_string())),
(
"src.parsed_path",
Value::String("/tmp/parsed-two.md".to_string()),
),
]),
compatibility_row([
("src.id", Value::String("parsed-source-1".to_string())),
("src.original_name", Value::String("Parsed One".to_string())),
(
"src.parsed_path",
Value::String("/tmp/parsed-one.md".to_string()),
),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'parsed-source-1', original_name: 'Parsed One', parsed_path: '/tmp/parsed-one.md', created_at: 10})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'parsed-source-2', original_name: 'Parsed Two', parsed_path: '/tmp/parsed-two.md', created_at: 20})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'parsed-source-null', original_name: 'Parsed Null', parsed_path: NULL, created_at: 30})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (src:Source {id: 'parsed-source-1'}) DETACH DELETE src",
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (src:Source {id: 'parsed-source-2'}) DETACH DELETE src",
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (src:Source {id: 'parsed-source-null'}) DETACH DELETE src",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"community summarized list read",
CypherFixtureStatement::new(
"MATCH (c:Community) WHERE c.ai_summary IS NOT NULL AND c.ai_summary <> '' RETURN c.community_id, c.name, c.ai_summary ORDER BY c.member_count DESC LIMIT 40",
),
ExpectedRows::Exact(vec![
compatibility_row([
("c.community_id", Value::Int(9520)),
(
"c.name",
Value::String("Summarized Community Two".to_string()),
),
(
"c.ai_summary",
Value::String("higher member summary".to_string()),
),
]),
compatibility_row([
("c.community_id", Value::Int(9510)),
(
"c.name",
Value::String("Summarized Community One".to_string()),
),
(
"c.ai_summary",
Value::String("lower member summary".to_string()),
),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'summarized-community-1', community_id: 9510, name: 'Summarized Community One', ai_summary: 'lower member summary', member_count: 10})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'summarized-community-2', community_id: 9520, name: 'Summarized Community Two', ai_summary: 'higher member summary', member_count: 20})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'summarized-community-empty', community_id: 9530, name: 'Summarized Community Empty', ai_summary: '', member_count: 100})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'summarized-community-null', community_id: 9540, name: 'Summarized Community Null', member_count: 200})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['summarized-community-1', 'summarized-community-2', 'summarized-community-empty', 'summarized-community-null'] DETACH DELETE n",
),
ExpectedRows::RowCount(4),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"agent context summarized community task read",
CypherFixtureStatement::new(
"MATCH (c:Community) WHERE c.ai_summary IS NOT NULL AND c.ai_summary <> '' RETURN c.id, c.name, c.ai_summary, c.member_count ORDER BY c.member_count DESC LIMIT 10",
),
ExpectedRows::Exact(vec![
compatibility_row([
(
"c.id",
Value::String("task-summarized-community-2".to_string()),
),
(
"c.name",
Value::String("Task Summary Community Two".to_string()),
),
(
"c.ai_summary",
Value::String("higher task summary".to_string()),
),
("c.member_count", Value::Int(12)),
]),
compatibility_row([
(
"c.id",
Value::String("task-summarized-community-1".to_string()),
),
(
"c.name",
Value::String("Task Summary Community One".to_string()),
),
(
"c.ai_summary",
Value::String("lower task summary".to_string()),
),
("c.member_count", Value::Int(6)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'task-summarized-community-1', name: 'Task Summary Community One', ai_summary: 'lower task summary', member_count: 6})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'task-summarized-community-2', name: 'Task Summary Community Two', ai_summary: 'higher task summary', member_count: 12})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'task-summarized-community-empty', name: 'Task Summary Empty', ai_summary: '', member_count: 100})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['task-summarized-community-1', 'task-summarized-community-2', 'task-summarized-community-empty'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"community memory type-filter read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {community_id: $cid})<-[:MENTIONS]-(m:Memory) WHERE m.is_crystal = false AND m.unit_type IN $types RETURN m.id, m.title LIMIT 200",
BTreeMap::from([
("cid".to_string(), Value::Int(9600)),
(
"types".to_string(),
Value::List(vec![
Value::String("learning".to_string()),
Value::String("note".to_string()),
]),
),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"m.id",
Value::String("community-type-memory-hit".to_string()),
),
(
"m.title",
Value::String("Community Type Memory Hit".to_string()),
),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'community-type-entity', community_id: 9600})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'community-type-memory-hit', title: 'Community Type Memory Hit', unit_type: 'note', is_crystal: false})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'community-type-memory-crystal', title: 'Community Type Memory Crystal', unit_type: 'note', is_crystal: true})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'community-type-memory-type', title: 'Community Type Memory Type', unit_type: 'message', is_crystal: false})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'community-type-memory-hit'}), (e:Entity {id: 'community-type-entity'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'community-type-memory-crystal'}), (e:Entity {id: 'community-type-entity'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'community-type-memory-type'}), (e:Entity {id: 'community-type-entity'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['community-type-memory-hit', 'community-type-memory-crystal', 'community-type-memory-type', 'community-type-entity'] DETACH DELETE n",
),
ExpectedRows::RowCount(4),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"search projection entity candidate read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) WHERE lower(e.name) CONTAINS $raw_query OR lower(e.name) CONTAINS $normalized_query OR list_contains(e.aliases, $raw_input) OPTIONAL MATCH (m:Memory)-[:MENTIONS]->(e) RETURN e.id, e.name, e.entity_type, e.aliases, e.description, e.confidence, e.community_id, e.pagerank_score, COUNT(m) AS memory_count ORDER BY CASE WHEN lower(e.name) = $raw_query THEN 0 WHEN lower(e.name) = $normalized_query THEN 0 WHEN list_contains(e.aliases, $raw_input) THEN 1 ELSE 2 END ASC, memory_count DESC, e.pagerank_score DESC LIMIT $limit",
BTreeMap::from([
(
"raw_query".to_string(),
Value::String("spqx".to_string()),
),
(
"normalized_query".to_string(),
Value::String("spqx".to_string()),
),
(
"raw_input".to_string(),
Value::String("SPQX Alias".to_string()),
),
("limit".to_string(), Value::Int(2)),
]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("e.id", Value::String("search-projection-entity-exact".to_string())),
("e.name", Value::String("spqx".to_string())),
("e.entity_type", Value::String("concept".to_string())),
(
"e.aliases",
Value::List(vec![Value::String("exact alias".to_string())]),
),
(
"e.description",
Value::String("exact search projection entity".to_string()),
),
("e.confidence", Value::Float(0.7)),
("e.community_id", Value::Int(5620)),
("e.pagerank_score", Value::Float(0.2)),
("memory_count", Value::Int(2)),
]),
compatibility_row([
("e.id", Value::String("search-projection-entity-alias".to_string())),
("e.name", Value::String("Alias Only Candidate".to_string())),
("e.entity_type", Value::String("concept".to_string())),
(
"e.aliases",
Value::List(vec![Value::String("SPQX Alias".to_string())]),
),
(
"e.description",
Value::String("alias search projection entity".to_string()),
),
("e.confidence", Value::Float(0.9)),
("e.community_id", Value::Int(5621)),
("e.pagerank_score", Value::Float(0.9)),
("memory_count", Value::Int(3)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'search-projection-entity-exact', name: 'spqx', entity_type: 'concept', aliases: ['exact alias'], description: 'exact search projection entity', confidence: 0.7, community_id: 5620, pagerank_score: 0.2})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'search-projection-entity-alias', name: 'Alias Only Candidate', entity_type: 'concept', aliases: ['SPQX Alias'], description: 'alias search projection entity', confidence: 0.9, community_id: 5621, pagerank_score: 0.9})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'search-projection-memory-exact-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'search-projection-memory-exact-2'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'search-projection-memory-alias-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'search-projection-memory-alias-2'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'search-projection-memory-alias-3'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'search-projection-memory-exact-1'}), (e:Entity {id: 'search-projection-entity-exact'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'search-projection-memory-exact-2'}), (e:Entity {id: 'search-projection-entity-exact'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'search-projection-memory-alias-1'}), (e:Entity {id: 'search-projection-entity-alias'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'search-projection-memory-alias-2'}), (e:Entity {id: 'search-projection-entity-alias'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'search-projection-memory-alias-3'}), (e:Entity {id: 'search-projection-entity-alias'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['search-projection-entity-exact', 'search-projection-entity-alias', 'search-projection-memory-exact-1', 'search-projection-memory-exact-2', 'search-projection-memory-alias-1', 'search-projection-memory-alias-2', 'search-projection-memory-alias-3'] DETACH DELETE n",
),
ExpectedRows::RowCount(7),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"search projection community seed entity read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) WHERE e.community_id = $community_id OPTIONAL MATCH (m:Memory)-[:MENTIONS]->(e) RETURN e.id, e.name, e.entity_type, e.confidence, e.community_id, e.pagerank_score, COUNT(m) AS memory_count ORDER BY memory_count DESC, e.pagerank_score DESC, e.confidence DESC LIMIT $limit",
BTreeMap::from([
("community_id".to_string(), Value::Int(7610)),
("limit".to_string(), Value::Int(4)),
]),
),
ExpectedRows::Exact(vec![
compatibility_row([
(
"e.id",
Value::String("search-projection-seed-high".to_string()),
),
("e.name", Value::String("Seed High".to_string())),
("e.entity_type", Value::String("concept".to_string())),
("e.confidence", Value::Float(0.2)),
("e.community_id", Value::Int(7610)),
("e.pagerank_score", Value::Float(0.4)),
("memory_count", Value::Int(2)),
]),
compatibility_row([
(
"e.id",
Value::String("search-projection-seed-pagerank".to_string()),
),
("e.name", Value::String("Seed Pagerank".to_string())),
("e.entity_type", Value::String("concept".to_string())),
("e.confidence", Value::Float(0.1)),
("e.community_id", Value::Int(7610)),
("e.pagerank_score", Value::Float(0.9)),
("memory_count", Value::Int(1)),
]),
compatibility_row([
(
"e.id",
Value::String("search-projection-seed-confidence".to_string()),
),
("e.name", Value::String("Seed Confidence".to_string())),
("e.entity_type", Value::String("concept".to_string())),
("e.confidence", Value::Float(0.8)),
("e.community_id", Value::Int(7610)),
("e.pagerank_score", Value::Float(0.5)),
("memory_count", Value::Int(1)),
]),
compatibility_row([
(
"e.id",
Value::String("search-projection-seed-empty".to_string()),
),
("e.name", Value::String("Seed Empty".to_string())),
("e.entity_type", Value::String("concept".to_string())),
("e.confidence", Value::Float(0.7)),
("e.community_id", Value::Int(7610)),
("e.pagerank_score", Value::Float(0.1)),
("memory_count", Value::Int(0)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'search-projection-seed-high', name: 'Seed High', entity_type: 'concept', confidence: 0.2, community_id: 7610, pagerank_score: 0.4})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'search-projection-seed-pagerank', name: 'Seed Pagerank', entity_type: 'concept', confidence: 0.1, community_id: 7610, pagerank_score: 0.9})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'search-projection-seed-confidence', name: 'Seed Confidence', entity_type: 'concept', confidence: 0.8, community_id: 7610, pagerank_score: 0.5})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'search-projection-seed-empty', name: 'Seed Empty', entity_type: 'concept', confidence: 0.7, community_id: 7610, pagerank_score: 0.1})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'search-projection-seed-outside', name: 'Seed Outside', entity_type: 'concept', confidence: 1.0, community_id: 7611, pagerank_score: 1.0})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'search-projection-seed-memory-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'search-projection-seed-memory-2'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'search-projection-seed-memory-3'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'search-projection-seed-memory-4'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'search-projection-seed-memory-1'}), (e:Entity {id: 'search-projection-seed-high'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'search-projection-seed-memory-2'}), (e:Entity {id: 'search-projection-seed-high'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'search-projection-seed-memory-3'}), (e:Entity {id: 'search-projection-seed-pagerank'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'search-projection-seed-memory-4'}), (e:Entity {id: 'search-projection-seed-confidence'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['search-projection-seed-high', 'search-projection-seed-pagerank', 'search-projection-seed-confidence', 'search-projection-seed-empty', 'search-projection-seed-outside', 'search-projection-seed-memory-1', 'search-projection-seed-memory-2', 'search-projection-seed-memory-3', 'search-projection-seed-memory-4'] DETACH DELETE n",
),
ExpectedRows::RowCount(9),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"community entity memory-count read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) WHERE e.community_id = $community_id OPTIONAL MATCH (m:Memory)-[:MENTIONS]->(e) RETURN e.id, e.name, e.entity_type, COUNT(m) AS memory_count ORDER BY memory_count DESC LIMIT 10",
BTreeMap::from([("community_id".to_string(), Value::Int(9700))]),
),
ExpectedRows::Exact(vec![
compatibility_row([
(
"e.id",
Value::String("community-count-entity-1".to_string()),
),
("e.name", Value::String("Count Entity One".to_string())),
("e.entity_type", Value::String("concept".to_string())),
("memory_count", Value::Int(2)),
]),
compatibility_row([
(
"e.id",
Value::String("community-count-entity-2".to_string()),
),
("e.name", Value::String("Count Entity Two".to_string())),
("e.entity_type", Value::String("concept".to_string())),
("memory_count", Value::Int(0)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'community-count-entity-1', name: 'Count Entity One', entity_type: 'concept', community_id: 9700})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'community-count-entity-2', name: 'Count Entity Two', entity_type: 'concept', community_id: 9700})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'community-count-entity-outside', name: 'Count Entity Outside', entity_type: 'concept', community_id: 9701})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'community-count-memory-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'community-count-memory-2'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'community-count-memory-1'}), (e:Entity {id: 'community-count-entity-1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'community-count-memory-2'}), (e:Entity {id: 'community-count-entity-1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['community-count-memory-1', 'community-count-memory-2', 'community-count-entity-1', 'community-count-entity-2', 'community-count-entity-outside'] DETACH DELETE n",
),
ExpectedRows::RowCount(5),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"synthesized source coverage lookup",
CypherFixtureStatement::with_parameters(
"MATCH (c:Memory)-[:SYNTHESIZED_FROM]->(s:Memory) WHERE c.is_crystal = true AND s.id IN $source_ids WITH c.id AS cid, count(DISTINCT s.id) AS covered WHERE covered = $n RETURN cid LIMIT 1",
BTreeMap::from([
(
"source_ids".to_string(),
Value::List(vec![
Value::String("coverage-s1".to_string()),
Value::String("coverage-s2".to_string()),
]),
),
("n".to_string(), Value::Int(2)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"cid",
Value::String("coverage-c1".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'coverage-c1', is_crystal: true, crystal_title: 'Coverage Crystal'})-[:SYNTHESIZED_FROM]->(:Memory {id: 'coverage-s1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'coverage-s2'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (c:Memory {id: 'coverage-c1'}), (s:Memory {id: 'coverage-s2'}) CREATE (c)-[:SYNTHESIZED_FROM]->(s)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (c:Memory {id: 'coverage-c1'}), (s:Memory {id: 'coverage-s2'}) CREATE (c)-[:SYNTHESIZED_FROM]->(s)",
)),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"synthesized source coverage title lookup",
CypherFixtureStatement::with_parameters(
"MATCH (c:Memory)-[:SYNTHESIZED_FROM]->(s:Memory) WHERE c.is_crystal = true AND s.id IN $source_ids WITH c.id AS cid, c.crystal_title AS ct, count(DISTINCT s.id) AS covered WHERE covered = $n RETURN cid, ct LIMIT 1",
BTreeMap::from([
(
"source_ids".to_string(),
Value::List(vec![
Value::String("coverage-s1".to_string()),
Value::String("coverage-s2".to_string()),
]),
),
("n".to_string(), Value::Int(2)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
("cid", Value::String("coverage-c1".to_string())),
("ct", Value::String("Coverage Crystal".to_string())),
])]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"top entities by degree",
CypherFixtureStatement::new(
"MATCH (e:Entity) OPTIONAL MATCH (e)-[r]-() WITH e, COUNT(r) as degree RETURN e.id, e.name, degree ORDER BY degree DESC LIMIT 10",
),
ExpectedRows::RowCount(2),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"entity mention-count list read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) OPTIONAL MATCH (:Memory)-[r:MENTIONS]->(e) RETURN e.id, e.name, e.entity_type, e.description, e.aliases, e.confidence, e.community_id, e.created_at, COUNT(r) AS mention_count ORDER BY mention_count DESC, e.name ASC LIMIT $limit",
BTreeMap::from([("limit".to_string(), Value::Int(10))]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("e.id", Value::Int(11)),
("e.name", Value::String("Cypher".to_string())),
("e.entity_type", Value::Null),
("e.description", Value::Null),
("e.aliases", Value::Null),
("e.confidence", Value::Null),
("e.community_id", Value::Null),
("e.created_at", Value::Null),
("mention_count", Value::Int(1)),
]),
compatibility_row([
("e.id", Value::Int(10)),
("e.name", Value::String("Rust".to_string())),
("e.entity_type", Value::Null),
("e.description", Value::Null),
(
"e.aliases",
Value::List(vec![
Value::String("Ferris".to_string()),
Value::String("Rustacean".to_string()),
]),
),
("e.confidence", Value::Null),
("e.community_id", Value::Null),
("e.created_at", Value::Null),
("mention_count", Value::Int(1)),
]),
]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"node detail neighbor counts",
CypherFixtureStatement::with_parameters(
"MATCH (n)-[r]-(neighbor) WHERE n.id = $node_id RETURN COUNT(DISTINCT neighbor), COUNT(r)",
BTreeMap::from([(
"node_id".to_string(),
Value::Int(1),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("count(DISTINCT neighbor)", Value::Int(2)),
("count(r)", Value::Int(3)),
])]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label total count read",
CypherFixtureStatement::new("MATCH (l:Label) RETURN count(*) as label_count"),
ExpectedRows::Exact(vec![compatibility_row([(
"label_count",
Value::Int(2),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-count-1', name: 'Count One'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-count-2', name: 'Count Two'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (l:Label) WHERE l.id IN ['label-count-1', 'label-count-2'] DETACH DELETE l",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label usage count read",
CypherFixtureStatement::new(
"MATCH (l:Label) OPTIONAL MATCH (l)<-[:HAS_LABEL]-(n) WITH l, COUNT(n) as usage_count RETURN l.id, l.name, l.canonical_name, usage_count ORDER BY usage_count DESC, l.id ASC",
),
ExpectedRows::Exact(vec![
compatibility_row([
("l.id", Value::String("usage-label-1".to_string())),
("l.name", Value::String("Important".to_string())),
("l.canonical_name", Value::String("important".to_string())),
("usage_count", Value::Int(2)),
]),
compatibility_row([
("l.id", Value::String("usage-label-2".to_string())),
("l.name", Value::String("Unused".to_string())),
("l.canonical_name", Value::String("unused".to_string())),
("usage_count", Value::Int(0)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"MERGE (:Label {id: 'usage-label-1', name: 'Important', canonical_name: 'important'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MERGE (:Label {id: 'usage-label-2', name: 'Unused', canonical_name: 'unused'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 1}), (l:Label {id: 'usage-label-1'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (e:Entity {id: 10}), (l:Label {id: 'usage-label-1'}) CREATE (e)-[:HAS_LABEL]->(l)",
)),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"label usage context summary read",
CypherFixtureStatement::new(
"MATCH (l:Label) OPTIONAL MATCH (l)<-[:HAS_LABEL]-(n) WITH l, COUNT(n) as usage_count RETURN l.name as name, usage_count ORDER BY usage_count DESC SKIP 0 LIMIT 200",
),
ExpectedRows::Exact(vec![
compatibility_row([
("name", Value::String("Important".to_string())),
("usage_count", Value::Int(2)),
]),
compatibility_row([
("name", Value::String("Unused".to_string())),
("usage_count", Value::Int(0)),
]),
]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"label usage direct optional count read",
CypherFixtureStatement::with_parameters(
"MATCH (l:Label) OPTIONAL MATCH (m:Memory)-[:HAS_LABEL]->(l) RETURN l.id, l.name, COUNT(m) AS usage_count ORDER BY l.name ASC SKIP $offset LIMIT $limit",
BTreeMap::from([
("offset".to_string(), Value::Int(0)),
("limit".to_string(), Value::Int(200)),
]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("l.id", Value::String("usage-label-1".to_string())),
("l.name", Value::String("Important".to_string())),
("usage_count", Value::Int(1)),
]),
compatibility_row([
("l.id", Value::String("usage-label-2".to_string())),
("l.name", Value::String("Unused".to_string())),
("usage_count", Value::Int(0)),
]),
]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"entity mention fan-in count",
CypherFixtureStatement::with_parameters(
"MATCH (:Memory)-[r:MENTIONS]->(e:Entity {id: $id}) RETURN COUNT(r)",
BTreeMap::from([("id".to_string(), Value::Int(10))]),
),
ExpectedRows::Exact(vec![compatibility_row([("count(r)", Value::Int(1))])]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"entity lifecycle detail projection",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {id: $id}) RETURN e.id, e.name, e.entity_type, e.description, e.aliases",
BTreeMap::from([(
"id".to_string(),
Value::String("entity-life-a".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("e.id", Value::String("entity-life-a".to_string())),
("e.name", Value::String("Lifecycle A".to_string())),
("e.entity_type", Value::String("concept".to_string())),
(
"e.description",
Value::String("Lifecycle entity".to_string()),
),
(
"e.aliases",
Value::List(vec![Value::String("life-a".to_string())]),
),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-life-a', name: 'Lifecycle A', entity_type: 'concept', description: 'Lifecycle entity', aliases: ['life-a']})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-life-b', name: 'Lifecycle B', entity_type: 'concept', description: 'Related entity', aliases: ['life-b']})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Entity {id: 'entity-life-a'}), (b:Entity {id: 'entity-life-b'}) CREATE (a)-[:RELATES_TO {confidence: 0.9, strength: 0.8, relation_type: 'supports'}]->(b)",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'entity-life-label', name: 'Lifecycle', canonical_name: 'lifecycle'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'entity-life-a'}), (l:Label {id: 'entity-life-label'}) CREATE (e)-[:HAS_LABEL {assigned_by: 'system'}]->(l)",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'entity-life-community', name: 'Lifecycle Community'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'entity-life-a'}), (c:Community {id: 'entity-life-community'}) CREATE (e)-[:BELONGS_TO {score: 0.7}]->(c)",
)),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"entity outgoing relates count",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {id: $id})-[r:RELATES_TO]->(:Entity) RETURN COUNT(r)",
BTreeMap::from([(
"id".to_string(),
Value::String("entity-life-a".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([("count(r)", Value::Int(1))])]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"entity incoming relates count",
CypherFixtureStatement::with_parameters(
"MATCH (:Entity)-[r:RELATES_TO]->(e:Entity {id: $id}) RETURN COUNT(r)",
BTreeMap::from([(
"id".to_string(),
Value::String("entity-life-b".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([("count(r)", Value::Int(1))])]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source relationship source-reference count read",
CypherFixtureStatement::with_parameters(
"MATCH (e1:Entity)-[r:RELATES_TO]->(e2:Entity) WHERE r.source_reference = $id RETURN count(r)",
BTreeMap::from([(
"id".to_string(),
Value::String("source-ref-count".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([("count(r)", Value::Int(1))])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'source-ref-count-e1', name: 'Source Ref Count One'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'source-ref-count-e2', name: 'Source Ref Count Two'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'source-ref-count-e3', name: 'Source Ref Count Three'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Entity {id: 'source-ref-count-e1'}), (b:Entity {id: 'source-ref-count-e2'}) CREATE (a)-[:RELATES_TO {source_reference: 'source-ref-count'}]->(b)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Entity {id: 'source-ref-count-e1'}), (b:Entity {id: 'source-ref-count-e3'}) CREATE (a)-[:RELATES_TO {source_reference: 'other-source'}]->(b)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['source-ref-count-e1', 'source-ref-count-e2', 'source-ref-count-e3'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source relationship source-reference delete",
CypherFixtureStatement::with_parameters(
"MATCH (e1:Entity)-[r:RELATES_TO]->(e2:Entity) WHERE r.source_reference = $id DELETE r",
BTreeMap::from([(
"id".to_string(),
Value::String("source-ref-delete".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'source-ref-delete-e1', name: 'Source Ref Delete One'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'source-ref-delete-e2', name: 'Source Ref Delete Two'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'source-ref-delete-e3', name: 'Source Ref Delete Three'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Entity {id: 'source-ref-delete-e1'}), (b:Entity {id: 'source-ref-delete-e2'}) CREATE (a)-[:RELATES_TO {source_reference: 'source-ref-delete'}]->(b)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Entity {id: 'source-ref-delete-e1'}), (b:Entity {id: 'source-ref-delete-e3'}) CREATE (a)-[:RELATES_TO {source_reference: 'other-source'}]->(b)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['source-ref-delete-e1', 'source-ref-delete-e2', 'source-ref-delete-e3'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"entity outgoing relation preview",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {id: $id})-[r:RELATES_TO]->(other:Entity) RETURN other.id, r",
BTreeMap::from([(
"id".to_string(),
Value::String("entity-life-a".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"entity incoming relation preview",
CypherFixtureStatement::with_parameters(
"MATCH (other:Entity)-[r:RELATES_TO]->(e:Entity {id: $id}) RETURN other.id, r",
BTreeMap::from([(
"id".to_string(),
Value::String("entity-life-b".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"entity has label count",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {id: $id})-[r:HAS_LABEL]->(:Label) RETURN COUNT(r)",
BTreeMap::from([(
"id".to_string(),
Value::String("entity-life-a".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([("count(r)", Value::Int(1))])]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"entity has label preview",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {id: $id})-[r:HAS_LABEL]->(n:Label) RETURN n.id, r",
BTreeMap::from([(
"id".to_string(),
Value::String("entity-life-a".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"entity belongs community count",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {id: $id})-[r:BELONGS_TO]->(:Community) RETURN COUNT(r)",
BTreeMap::from([(
"id".to_string(),
Value::String("entity-life-a".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([("count(r)", Value::Int(1))])]),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"entity belongs community preview",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {id: $id})-[r:BELONGS_TO]->(n:Community) RETURN n.id, r",
BTreeMap::from([(
"id".to_string(),
Value::String("entity-life-a".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"entity detach delete cascade",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {id: $id}) DETACH DELETE e",
BTreeMap::from([(
"id".to_string(),
Value::String("entity-delete-target".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-delete-target', name: 'Delete Target'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 1}), (e:Entity {id: 'entity-delete-target'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'entity-delete-target'}) OPTIONAL MATCH (:Memory)-[r:MENTIONS]->(e) RETURN count(e) AS entities, count(r) AS rels",
),
ExpectedRows::Exact(vec![compatibility_row([
("entities", Value::Int(0)),
("rels", Value::Int(0)),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"graph orphan entity read",
CypherFixtureStatement::new(
"MATCH (e:Entity) WHERE NOT (e)<-[:MENTIONS]-(:Memory) AND NOT (e)-[:RELATES_TO]-() AND NOT (e)-[:HAS_LABEL]-() RETURN e.id, e.name, e.entity_type",
),
ExpectedRows::Exact(vec![compatibility_row([
("e.id", Value::String("orphan-entity".to_string())),
("e.name", Value::String("Orphan Entity".to_string())),
("e.entity_type", Value::String("concept".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'orphan-entity', name: 'Orphan Entity', entity_type: 'concept'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'orphan-labeled', name: 'Labeled Orphan Candidate', entity_type: 'concept'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'orphan-blocking-label', name: 'Blocking Label'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'orphan-labeled'}), (l:Label {id: 'orphan-blocking-label'}) CREATE (e)-[:HAS_LABEL]->(l)",
)),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"graph orphan cleanup candidate read",
CypherFixtureStatement::new(
"MATCH (e:Entity) WHERE NOT (e)<-[:MENTIONS]-(:Memory) AND NOT (e)-[:RELATES_TO]-() AND NOT (e)-[:HAS_LABEL]-() RETURN e.id",
),
ExpectedRows::Exact(vec![compatibility_row([(
"e.id",
Value::String("orphan-entity".to_string()),
)])]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"augmentation job create",
CypherFixtureStatement::with_parameters(
"CREATE (j:AugmentationJob { job_id: $job_id, job_type: $job_type, status: 'pending', progress: 0.0, message: 'Job created', parameters: $parameters, result: '{}', error_message: '', started_at: NULL, completed_at: NULL, created_at: CURRENT_TIMESTAMP() })",
BTreeMap::from([
(
"job_id".to_string(),
Value::String("job-ledger-1".to_string()),
),
(
"job_type".to_string(),
Value::String("pagerank_calculation".to_string()),
),
("parameters".to_string(), Value::String("{}".to_string())),
]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (j:AugmentationJob {job_id: 'job-ledger-1'}) RETURN j.status AS status, j.progress AS progress, count(j.created_at) AS created, count(j.started_at) AS started",
),
ExpectedRows::Exact(vec![compatibility_row([
("status", Value::String("pending".to_string())),
("progress", Value::Float(0.0)),
("created", Value::Int(1)),
("started", Value::Int(0)),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"augmentation job mark running",
CypherFixtureStatement::with_parameters(
"MATCH (j:AugmentationJob {job_id: $job_id}) WHERE j.status = 'pending' SET j.status = 'running', j.started_at = CURRENT_TIMESTAMP(), j.message = 'Job started' RETURN j.job_id",
BTreeMap::from([(
"job_id".to_string(),
Value::String("job-ledger-1".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (j:AugmentationJob {job_id: 'job-ledger-1'}) RETURN j.status AS status, j.message AS message, count(j.started_at) AS started",
),
ExpectedRows::Exact(vec![compatibility_row([
("status", Value::String("running".to_string())),
("message", Value::String("Job started".to_string())),
("started", Value::Int(1)),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"augmentation job progress update",
CypherFixtureStatement::with_parameters(
"MATCH (j:AugmentationJob {job_id: $job_id}) WHERE j.status = 'running' SET j.progress = $progress, j.message = $message RETURN j.job_id",
BTreeMap::from([
(
"job_id".to_string(),
Value::String("job-ledger-1".to_string()),
),
("progress".to_string(), Value::Float(30.0)),
(
"message".to_string(),
Value::String("Running PageRank algorithm...".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (j:AugmentationJob {job_id: 'job-ledger-1'}) RETURN j.progress AS progress, j.message AS message",
),
ExpectedRows::Exact(vec![compatibility_row([
("progress", Value::Float(30.0)),
(
"message",
Value::String("Running PageRank algorithm...".to_string()),
),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"augmentation job mark completed",
CypherFixtureStatement::with_parameters(
"MATCH (j:AugmentationJob {job_id: $job_id}) WHERE j.status = 'running' SET j.status = 'completed', j.progress = 100.0, j.message = 'Job completed successfully', j.result = $result, j.completed_at = CURRENT_TIMESTAMP() RETURN j.job_id",
BTreeMap::from([
(
"job_id".to_string(),
Value::String("job-ledger-1".to_string()),
),
(
"result".to_string(),
Value::String("{\"summary_only\":true}".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (j:AugmentationJob {job_id: 'job-ledger-1'}) RETURN j.status AS status, j.progress AS progress, j.message AS message, j.result AS result, count(j.completed_at) AS completed",
),
ExpectedRows::Exact(vec![compatibility_row([
("status", Value::String("completed".to_string())),
("progress", Value::Float(100.0)),
(
"message",
Value::String("Job completed successfully".to_string()),
),
("result", Value::String("{\"summary_only\":true}".to_string())),
("completed", Value::Int(1)),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"augmentation job mark failed",
CypherFixtureStatement::with_parameters(
"MATCH (j:AugmentationJob {job_id: $job_id}) WHERE j.status = 'pending' OR j.status = 'running' SET j.status = 'failed', j.message = 'Job failed', j.error_message = $error_message, j.completed_at = CURRENT_TIMESTAMP() RETURN j.job_id",
BTreeMap::from([
(
"job_id".to_string(),
Value::String("job-ledger-fail".to_string()),
),
(
"error_message".to_string(),
Value::String("boom".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:AugmentationJob {job_id: 'job-ledger-fail', job_type: 'community_detection', status: 'running', progress: 5.0, message: 'Running', result: '{}', error_message: '', created_at: 1})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (j:AugmentationJob {job_id: 'job-ledger-fail'}) RETURN j.status AS status, j.message AS message, j.error_message AS error, count(j.completed_at) AS completed",
),
ExpectedRows::Exact(vec![compatibility_row([
("status", Value::String("failed".to_string())),
("message", Value::String("Job failed".to_string())),
("error", Value::String("boom".to_string())),
("completed", Value::Int(1)),
])]),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"augmentation job status read",
CypherFixtureStatement::with_parameters(
"MATCH (j:AugmentationJob {job_id: $job_id}) RETURN j.job_type, j.status, j.progress, j.message, j.result, j.error_message, j.started_at, j.completed_at",
BTreeMap::from([(
"job_id".to_string(),
Value::String("job-ledger-1".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"augmentation job filtered list read",
CypherFixtureStatement::with_parameters(
"MATCH (j:AugmentationJob) WHERE j.status = $status RETURN j.job_id, j.job_type, j.status, j.progress, j.message, j.started_at, j.completed_at ORDER BY j.started_at DESC LIMIT $limit",
BTreeMap::from([
("status".to_string(), Value::String("completed".to_string())),
("limit".to_string(), Value::Int(10)),
]),
),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"augmentation job list read",
CypherFixtureStatement::with_parameters(
"MATCH (j:AugmentationJob) RETURN j.job_id, j.job_type, j.status, j.progress, j.message, j.started_at, j.completed_at ORDER BY j.started_at DESC LIMIT $limit",
BTreeMap::from([("limit".to_string(), Value::Int(10))]),
),
ExpectedRows::RowCount(2),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"augmentation stale interrupt write",
CypherFixtureStatement::with_parameters(
"MATCH (j:AugmentationJob) WHERE j.status = 'pending' OR j.status = 'running' SET j.status = 'failed', j.message = 'Interrupted before completion', j.error_message = $reason, j.completed_at = CURRENT_TIMESTAMP() RETURN count(j)",
BTreeMap::from([(
"reason".to_string(),
Value::String(
"Interrupted because the app restarted before completion."
.to_string(),
),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([("count(j)", Value::Int(2))])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:AugmentationJob {job_id: 'job-stale-pending', job_type: 'pagerank_calculation', status: 'pending', progress: 0.0, message: 'Job created', created_at: 10})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:AugmentationJob {job_id: 'job-stale-running', job_type: 'community_detection', status: 'running', progress: 10.0, message: 'Running', created_at: 11})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (j:AugmentationJob) WHERE j.job_id IN ['job-stale-pending', 'job-stale-running'] RETURN j.job_id AS id, j.status AS status ORDER BY id ASC",
),
ExpectedRows::Exact(vec![
compatibility_row([
("id", Value::String("job-stale-pending".to_string())),
("status", Value::String("failed".to_string())),
]),
compatibility_row([
("id", Value::String("job-stale-running".to_string())),
("status", Value::String("failed".to_string())),
]),
]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph augmentation jobs filtered list read",
CypherFixtureStatement::with_parameters(
"MATCH (j:AugmentationJob) WHERE j.status = $status_filter RETURN j.job_id, j.job_type, j.status, j.progress, j.message, j.created_at ORDER BY j.created_at DESC LIMIT $job_limit",
BTreeMap::from([
(
"status_filter".to_string(),
Value::String("rest_graph_done".to_string()),
),
("job_limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"j.job_id",
Value::String("rest-graph-job-filtered-new".to_string()),
),
("j.job_type", Value::String("pagerank".to_string())),
("j.status", Value::String("rest_graph_done".to_string())),
("j.progress", Value::Float(100.0)),
("j.message", Value::String("new done".to_string())),
("j.created_at", Value::Int(920)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:AugmentationJob {job_id: 'rest-graph-job-filtered-old', job_type: 'pagerank', status: 'rest_graph_done', progress: 10.0, message: 'old done', created_at: 910})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:AugmentationJob {job_id: 'rest-graph-job-filtered-new', job_type: 'pagerank', status: 'rest_graph_done', progress: 100.0, message: 'new done', created_at: 920})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (j:AugmentationJob) WHERE j.job_id IN ['rest-graph-job-filtered-old', 'rest-graph-job-filtered-new'] DETACH DELETE j",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph augmentation jobs list read",
CypherFixtureStatement::with_parameters(
"MATCH (j:AugmentationJob) RETURN j.job_id, j.job_type, j.status, j.progress, j.message, j.created_at ORDER BY j.created_at DESC LIMIT $job_limit",
BTreeMap::from([("job_limit".to_string(), Value::Int(1))]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:AugmentationJob {job_id: 'rest-graph-job-list-old', job_type: 'community', status: 'queued', progress: 0.0, message: 'queued old', created_at: 930})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:AugmentationJob {job_id: 'rest-graph-job-list-new', job_type: 'community', status: 'queued', progress: 0.0, message: 'queued new', created_at: 940})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (j:AugmentationJob) WHERE j.job_id IN ['rest-graph-job-list-old', 'rest-graph-job-list-new'] DETACH DELETE j",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph augmentation job status read",
CypherFixtureStatement::with_parameters(
"MATCH (j:AugmentationJob {job_id: $job_id}) RETURN j.job_type, j.status, j.progress, j.message, j.result, j.error_message, j.started_at, j.completed_at, j.created_at",
BTreeMap::from([(
"job_id".to_string(),
Value::String("rest-graph-job-status".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("j.job_type", Value::String("pagerank".to_string())),
("j.status", Value::String("completed".to_string())),
("j.progress", Value::Float(100.0)),
("j.message", Value::String("done".to_string())),
("j.result", Value::String("{\"ok\":true}".to_string())),
("j.error_message", Value::String(String::new())),
("j.started_at", Value::Int(950)),
("j.completed_at", Value::Int(960)),
("j.created_at", Value::Int(945)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:AugmentationJob {job_id: 'rest-graph-job-status', job_type: 'pagerank', status: 'completed', progress: 100.0, message: 'done', result: '{\"ok\":true}', error_message: '', started_at: 950, completed_at: 960, created_at: 945})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (j:AugmentationJob {job_id: 'rest-graph-job-status'}) DETACH DELETE j",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"thread move source space selection",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE t.thread_id IN $thread_ids AND CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END = $source_space_id RETURN t.id, t.thread_id, t.space_id ORDER BY t.id",
BTreeMap::from([
(
"thread_ids".to_string(),
Value::List(vec![
Value::String("logical-1".to_string()),
Value::String("logical-2".to_string()),
Value::String("logical-3".to_string()),
]),
),
(
"source_space_id".to_string(),
Value::String("default".to_string()),
),
]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("t.id", Value::String("storage-1".to_string())),
("t.thread_id", Value::String("logical-1".to_string())),
("t.space_id", Value::Null),
]),
compatibility_row([
("t.id", Value::String("storage-2".to_string())),
("t.thread_id", Value::String("logical-2".to_string())),
("t.space_id", Value::String(String::new())),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'storage-1', thread_id: 'logical-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'storage-2', thread_id: 'logical-2', space_id: ''})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'storage-3', thread_id: 'logical-3', space_id: 'team'})",
))),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"thread move target space exclusion",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE t.thread_id IN $candidate_ids AND CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END <> $target_space_id RETURN t.thread_id ORDER BY t.thread_id",
BTreeMap::from([
(
"candidate_ids".to_string(),
Value::List(vec![
Value::String("logical-4".to_string()),
Value::String("logical-5".to_string()),
Value::String("logical-6".to_string()),
]),
),
(
"target_space_id".to_string(),
Value::String("default".to_string()),
),
]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"t.thread_id",
Value::String("logical-6".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'storage-4', thread_id: 'logical-4'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'storage-5', thread_id: 'logical-5', space_id: ''})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'storage-6', thread_id: 'logical-6', space_id: 'team'})",
))),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread move source space update returning ids",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE t.thread_id IN $thread_ids AND CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END = $source_space_id SET t.space_id = $target_space_id, t.updated_at = $updated_at RETURN t.thread_id",
BTreeMap::from([
(
"thread_ids".to_string(),
Value::List(vec![
Value::String("logical-7".to_string()),
Value::String("logical-8".to_string()),
Value::String("logical-9".to_string()),
]),
),
(
"source_space_id".to_string(),
Value::String("default".to_string()),
),
(
"target_space_id".to_string(),
Value::String("archive".to_string()),
),
("updated_at".to_string(), Value::Int(77)),
]),
),
ExpectedRows::Exact(vec![
compatibility_row([(
"t.thread_id",
Value::String("logical-7".to_string()),
)]),
compatibility_row([(
"t.thread_id",
Value::String("logical-8".to_string()),
)]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'storage-7', thread_id: 'logical-7'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'storage-8', thread_id: 'logical-8', space_id: ''})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'storage-9', thread_id: 'logical-9', space_id: 'team'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread) WHERE t.thread_id IN ['logical-7', 'logical-8', 'logical-9'] RETURN t.thread_id, t.space_id ORDER BY t.thread_id",
),
ExpectedRows::Exact(vec![
compatibility_row([
("t.thread_id", Value::String("logical-7".to_string())),
("t.space_id", Value::String("archive".to_string())),
]),
compatibility_row([
("t.thread_id", Value::String("logical-8".to_string())),
("t.space_id", Value::String("archive".to_string())),
]),
compatibility_row([
("t.thread_id", Value::String("logical-9".to_string())),
("t.space_id", Value::String("team".to_string())),
]),
]),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"thread distill optional source count all",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE t.thread_id IS NOT NULL AND (CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END) = $space_id AND ($source IS NULL OR t.source = $source) RETURN COUNT(t)",
BTreeMap::from([
(
"space_id".to_string(),
Value::String("distill-space".to_string()),
),
("source".to_string(), Value::Null),
]),
),
ExpectedRows::Exact(vec![compatibility_row([("count(t)", Value::Int(2))])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'distill-thread-1', thread_id: 'distill-logical-1', source: 'codex', space_id: 'distill-space'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'distill-thread-2', thread_id: 'distill-logical-2', source: 'claude', space_id: 'distill-space'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'distill-thread-3', thread_id: 'distill-logical-3', source: 'codex', space_id: 'other-space'})",
))),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"thread distill optional source count filtered",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE t.thread_id IS NOT NULL AND (CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END) = $space_id AND ($source IS NULL OR t.source = $source) RETURN COUNT(t)",
BTreeMap::from([
(
"space_id".to_string(),
Value::String("distill-space".to_string()),
),
("source".to_string(), Value::String("codex".to_string())),
]),
),
ExpectedRows::Exact(vec![compatibility_row([("count(t)", Value::Int(1))])]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread distill candidate page read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE t.thread_id IS NOT NULL AND (CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END) = $space_id AND ($source IS NULL OR t.source = $source) RETURN t.thread_id ORDER BY COALESCE(t.updated_at, t.import_date, t.created_at) DESC, t.thread_id ASC LIMIT $limit",
BTreeMap::from([
(
"space_id".to_string(),
Value::String("distill-space".to_string()),
),
("source".to_string(), Value::String("codex".to_string())),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"t.thread_id",
Value::String("distill-logical-1".to_string()),
)])]),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread) WHERE t.thread_id IN ['distill-logical-1', 'distill-logical-2', 'distill-logical-3'] DETACH DELETE t",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"thread optional message count",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $thread_uuid}) OPTIONAL MATCH (t)-[:CONTAINS]->(m:Message) RETURN COUNT(m)",
BTreeMap::from([(
"thread_uuid".to_string(),
Value::String("thread-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([("count(m)", Value::Int(2))])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-1'})-[:CONTAINS]->(:Message {id: 'msg-1', order_index: 1})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Message {id: 'msg-2', order_index: 2})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'thread-1'}), (m:Message {id: 'msg-2'}) CREATE (t)-[:CONTAINS]->(m)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (mem:Memory {id: 1}), (msg:Message {id: 'msg-1'}) CREATE (mem)-[:EXTRACTED_FROM]->(msg)",
))),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread message ordered read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $thread_uuid})-[c:CONTAINS]->(m:Message) RETURN m.id, m.content, m.role, COALESCE(c.order_index, m.order_index), m.timestamp ORDER BY COALESCE(c.order_index, m.order_index)",
BTreeMap::from([(
"thread_uuid".to_string(),
Value::String("thread-ordered-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("m.id", Value::String("ordered-msg-2".to_string())),
("m.content", Value::String("second by node".to_string())),
("m.role", Value::String("assistant".to_string())),
("coalesce", Value::Int(0)),
("m.timestamp", Value::Int(20)),
]),
compatibility_row([
("m.id", Value::String("ordered-msg-1".to_string())),
("m.content", Value::String("first by rel".to_string())),
("m.role", Value::String("user".to_string())),
("coalesce", Value::Int(1)),
("m.timestamp", Value::Int(10)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-ordered-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Message {id: 'ordered-msg-1', content: 'first by rel', role: 'user', order_index: 100, timestamp: 10})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Message {id: 'ordered-msg-2', content: 'second by node', role: 'assistant', order_index: 0, timestamp: 20})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'thread-ordered-1'}), (m:Message {id: 'ordered-msg-1'}) CREATE (t)-[:CONTAINS {order_index: 1}]->(m)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'thread-ordered-1'}), (m:Message {id: 'ordered-msg-2'}) CREATE (t)-[:CONTAINS]->(m)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['thread-ordered-1', 'ordered-msg-1', 'ordered-msg-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread distill legacy message read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $thread_uuid})-[c:CONTAINS]->(m:Message) RETURN COALESCE(c.order_index, m.order_index), m.role, m.content, m.metadata ORDER BY COALESCE(c.order_index, m.order_index)",
BTreeMap::from([(
"thread_uuid".to_string(),
Value::String("thread-distill-legacy-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("coalesce", Value::Int(0)),
("m.role", Value::String("assistant".to_string())),
("m.content", Value::String("second legacy".to_string())),
("m.metadata", Value::String("{\"keep\":true}".to_string())),
]),
compatibility_row([
("coalesce", Value::Int(1)),
("m.role", Value::String("user".to_string())),
("m.content", Value::String("first legacy".to_string())),
("m.metadata", Value::String("{\"kind\":\"question\"}".to_string())),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-distill-legacy-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Message {id: 'distill-legacy-msg-1', content: 'first legacy', role: 'user', order_index: 100, metadata: '{\"kind\":\"question\"}'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Message {id: 'distill-legacy-msg-2', content: 'second legacy', role: 'assistant', order_index: 0, metadata: '{\"keep\":true}'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'thread-distill-legacy-1'}), (m:Message {id: 'distill-legacy-msg-1'}) CREATE (t)-[:CONTAINS {order_index: 1}]->(m)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'thread-distill-legacy-1'}), (m:Message {id: 'distill-legacy-msg-2'}) CREATE (t)-[:CONTAINS]->(m)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['thread-distill-legacy-1', 'distill-legacy-msg-1', 'distill-legacy-msg-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread distill total message count read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $thread_uuid}) OPTIONAL MATCH (t)-[:CONTAINS]->(m:Message) WITH t, COUNT(m) AS counted RETURN COALESCE(t.message_count, counted)",
BTreeMap::from([(
"thread_uuid".to_string(),
Value::String("thread-distill-count-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"coalesce",
Value::Int(2),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-distill-count-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Message {id: 'distill-count-msg-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Message {id: 'distill-count-msg-2'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'thread-distill-count-1'}), (m:Message {id: 'distill-count-msg-1'}) CREATE (t)-[:CONTAINS]->(m)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'thread-distill-count-1'}), (m:Message {id: 'distill-count-msg-2'}) CREATE (t)-[:CONTAINS]->(m)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['thread-distill-count-1', 'distill-count-msg-1', 'distill-count-msg-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"thread message detach delete",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $thread_uuid})-[:CONTAINS]->(m:Message) DETACH DELETE m",
BTreeMap::from([(
"thread_uuid".to_string(),
Value::String("thread-delete-1".to_string()),
)]),
),
ExpectedRows::RowCount(2),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'thread-delete-1'})-[:CONTAINS]->(:Message {id: 'delete-msg-1', order_index: 1})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Message {id: 'delete-msg-2', order_index: 2})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'thread-delete-1'}), (m:Message {id: 'delete-msg-2'}) CREATE (t)-[:CONTAINS]->(m)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Message) WHERE m.id STARTS WITH 'delete-msg-' RETURN count(m) AS messages",
),
ExpectedRows::Exact(vec![compatibility_row([("messages", Value::Int(0))])]),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"legacy tail extracted refs count",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread {id: $thread_uuid})-[:CONTAINS]->(m:Message) WHERE m.order_index >= $start_index OPTIONAL MATCH (:Memory)-[r:EXTRACTED_FROM]->(m) RETURN COUNT(r)",
BTreeMap::from([
(
"thread_uuid".to_string(),
Value::String("thread-1".to_string()),
),
("start_index".to_string(), Value::Int(0)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([("count(r)", Value::Int(1))])]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"merge node on create set",
CypherFixtureStatement::with_parameters(
"MERGE (m:SchemaMigrationLog {id: $id}) ON CREATE SET m.applied_at = CURRENT_TIMESTAMP()",
BTreeMap::from([(
"id".to_string(),
Value::String("migration-1".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:SchemaMigrationLog {id: 'migration-1'}) RETURN count(m.applied_at) AS applied",
),
ExpectedRows::Exact(vec![compatibility_row([("applied", Value::Int(1))])]),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"schema migration log ids read",
CypherFixtureStatement::new("MATCH (m:SchemaMigrationLog) RETURN m.id"),
ExpectedRows::Exact(vec![compatibility_row([(
"m.id",
Value::String("migration-1".to_string()),
)])]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"graph meta merge post set",
CypherFixtureStatement::new(
"MERGE (m:GraphMeta {meta_id: 'main'}) SET m.pagerank_applied = true, m.pagerank_algorithm = 'pagerank', m.pagerank_damping = 0.85, m.pagerank_iterations = 20, m.pagerank_computed_at = CURRENT_TIMESTAMP(), m.updated_at = CURRENT_TIMESTAMP()",
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:GraphMeta {meta_id: 'main'}) RETURN m.pagerank_applied AS applied, m.pagerank_algorithm AS algorithm, m.pagerank_damping AS damping, m.pagerank_iterations AS iterations, count(m.pagerank_computed_at) AS computed",
),
ExpectedRows::Exact(vec![compatibility_row([
("applied", Value::Bool(true)),
("algorithm", Value::String("pagerank".to_string())),
("damping", Value::Float(0.85)),
("iterations", Value::Int(20)),
("computed", Value::Int(1)),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"pagerank entity membership read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) WHERE e.id IN $node_ids RETURN e.id",
BTreeMap::from([(
"node_ids".to_string(),
Value::List(vec![
Value::String("pagerank-entity-1".to_string()),
Value::String("missing-pagerank-entity".to_string()),
]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"e.id",
Value::String("pagerank-entity-1".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'pagerank-entity-1', name: 'Pagerank Entity'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'pagerank-entity-1'}) DETACH DELETE e",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"pagerank memory membership read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $node_ids RETURN m.id",
BTreeMap::from([(
"node_ids".to_string(),
Value::List(vec![
Value::String("pagerank-memory-1".to_string()),
Value::String("missing-pagerank-memory".to_string()),
]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"m.id",
Value::String("pagerank-memory-1".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'pagerank-memory-1'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'pagerank-memory-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"pagerank memory visibility read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $memory_ids RETURN m.id, m.metadata, COALESCE(m.is_latest, true)",
BTreeMap::from([(
"memory_ids".to_string(),
Value::List(vec![
Value::String("pagerank-visible-memory".to_string()),
Value::String("pagerank-hidden-memory".to_string()),
]),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([
(
"m.id",
Value::String("pagerank-visible-memory".to_string()),
),
("m.metadata", Value::String("{}".to_string())),
("coalesce", Value::Bool(true)),
]),
compatibility_row([
(
"m.id",
Value::String("pagerank-hidden-memory".to_string()),
),
(
"m.metadata",
Value::String("{\"lifecycle_state\":\"archived\"}".to_string()),
),
("coalesce", Value::Bool(false)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'pagerank-visible-memory', metadata: '{}', is_latest: true})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'pagerank-hidden-memory', metadata: '{\"lifecycle_state\":\"archived\"}', is_latest: false})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['pagerank-visible-memory', 'pagerank-hidden-memory'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"pagerank entity score write",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) WHERE e.id = $id SET e.pagerank_score = $score",
BTreeMap::from([
(
"id".to_string(),
Value::String("pagerank-score-entity".to_string()),
),
("score".to_string(), Value::Float(0.42)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'pagerank-score-entity', name: 'Score Entity'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'pagerank-score-entity'}) DETACH DELETE e",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"pagerank memory score write",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id = $id SET m.pagerank_score = $score",
BTreeMap::from([
(
"id".to_string(),
Value::String("pagerank-score-memory".to_string()),
),
("score".to_string(), Value::Float(0.64)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'pagerank-score-memory'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'pagerank-score-memory'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"pagerank central entity name read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {id: $entity_id}) RETURN e.name",
BTreeMap::from([(
"entity_id".to_string(),
Value::String("pagerank-central-entity".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"e.name",
Value::String("Central Entity".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'pagerank-central-entity', name: 'Central Entity'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'pagerank-central-entity'}) DETACH DELETE e",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"pagerank clear entity scores",
CypherFixtureStatement::new(
"MATCH (e:Entity) WHERE e.pagerank_score IS NOT NULL SET e.pagerank_score = NULL",
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'pagerank-clear-entity', pagerank_score: 0.9})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'pagerank-clear-entity'}) DETACH DELETE e",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"pagerank clear memory scores",
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.pagerank_score IS NOT NULL SET m.pagerank_score = NULL",
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'pagerank-clear-memory', pagerank_score: 0.8})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'pagerank-clear-memory'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"graph meta pagerank clear stamp",
CypherFixtureStatement::new(
"MERGE (m:GraphMeta {meta_id: 'main'}) SET m.pagerank_applied = false, m.pagerank_computed_at = NULL, m.updated_at = CURRENT_TIMESTAMP()",
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:GraphMeta {meta_id: 'main'}) RETURN m.pagerank_applied AS applied, count(m.pagerank_computed_at) AS computed",
),
ExpectedRows::Exact(vec![compatibility_row([
("applied", Value::Bool(false)),
("computed", Value::Int(0)),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph pagerank plan graph meta read",
CypherFixtureStatement::new(
"MATCH (m:GraphMeta {meta_id: 'main'}) RETURN m.pagerank_applied, m.pagerank_computed_at",
),
ExpectedRows::Exact(vec![compatibility_row([
("m.pagerank_applied", Value::Bool(true)),
("m.pagerank_computed_at", Value::Int(404)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"MERGE (m:GraphMeta {meta_id: 'main'}) SET m.pagerank_applied = true, m.pagerank_computed_at = 404",
))
.with_effect_query(
CypherFixtureStatement::new("MATCH (m:GraphMeta {meta_id: 'main'}) DELETE m"),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"pagerank memory node count",
CypherFixtureStatement::new("MATCH (m:Memory) RETURN COUNT(m)"),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"pagerank entity node count",
CypherFixtureStatement::new("MATCH (e:Entity) RETURN COUNT(e)"),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"pagerank entity relation count",
CypherFixtureStatement::new(
"MATCH (:Entity)-[r:RELATES_TO]->(:Entity) RETURN COUNT(r)",
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'pagerank-relates-source'})-[:RELATES_TO]->(:Entity {id: 'pagerank-relates-target'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity) WHERE e.id IN ['pagerank-relates-source', 'pagerank-relates-target'] DETACH DELETE e",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"rest graph stats non-crystal memory count",
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.is_crystal IS NULL OR m.is_crystal = false RETURN COUNT(m)",
),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"rest graph stats thread count",
CypherFixtureStatement::new("MATCH (t:Thread) RETURN COUNT(t)"),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"rest graph stats community count",
CypherFixtureStatement::new("MATCH (c:Community) RETURN COUNT(c)"),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"rest read batch community count",
CypherFixtureStatement::new("MATCH (c:Community) RETURN count(c)"),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"rest graph stats label count",
CypherFixtureStatement::new("MATCH (l:Label) RETURN COUNT(l)"),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"rest read batch label count",
CypherFixtureStatement::new("MATCH (l:Label) RETURN count(l)"),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"rest graph stats mentions relationship count",
CypherFixtureStatement::new("MATCH ()-[r:MENTIONS]->() RETURN COUNT(r)"),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"rest graph stats relates relationship count",
CypherFixtureStatement::new("MATCH ()-[r:RELATES_TO]->() RETURN COUNT(r)"),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"rest read batch relates relationship count",
CypherFixtureStatement::new("MATCH ()-[r:RELATES_TO]->() RETURN count(r)"),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"rest graph stats memory relation count",
CypherFixtureStatement::new("MATCH ()-[r:MEMORY_RELATES_TO]->() RETURN COUNT(r)"),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"rest read batch memory relation count",
CypherFixtureStatement::new("MATCH ()-[r:MEMORY_RELATES_TO]->() RETURN count(r)"),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"rest graph stats contains relationship count",
CypherFixtureStatement::new("MATCH ()-[r:CONTAINS]->() RETURN COUNT(r)"),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"rest graph stats compacts relationship count",
CypherFixtureStatement::new("MATCH ()-[r:COMPACTS_TO]->() RETURN COUNT(r)"),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph community analysis list read",
CypherFixtureStatement::new(
"MATCH (c:Community) RETURN c.community_id, c.name, c.description, c.member_count, c.algorithm, c.resolution ORDER BY c.member_count DESC",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest read batch community member count ranking",
CypherFixtureStatement::with_parameters(
"MATCH (c:Community) WHERE c.member_count > 0 RETURN c.name, c.member_count, c.description ORDER BY c.member_count DESC LIMIT $limit",
BTreeMap::from([("limit".to_string(), Value::Int(2))]),
),
ExpectedRows::RowCount(2),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'read-batch-community-low', name: 'Batch Low', description: 'low community', member_count: 3})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'read-batch-community-high', name: 'Batch High', description: 'high community', member_count: 7})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'read-batch-community-empty', name: 'Batch Empty', description: 'empty community', member_count: 0})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (c:Community) WHERE c.id IN ['read-batch-community-low', 'read-batch-community-high', 'read-batch-community-empty'] DETACH DELETE c",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest read batch entity relation pair count",
CypherFixtureStatement::with_parameters(
"MATCH (e1:Entity)-[r:RELATES_TO]->(e2:Entity) RETURN e1.name, e2.name, COUNT(r) as count ORDER BY count DESC LIMIT $limit",
BTreeMap::from([("limit".to_string(), Value::Int(2))]),
),
ExpectedRows::RowCount(2),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'read-batch-rel-e1', name: 'Batch Relation One'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'read-batch-rel-e2', name: 'Batch Relation Two'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'read-batch-rel-e3', name: 'Batch Relation Three'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Entity {id: 'read-batch-rel-e1'}), (b:Entity {id: 'read-batch-rel-e2'}) CREATE (a)-[:RELATES_TO]->(b)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Entity {id: 'read-batch-rel-e1'}), (b:Entity {id: 'read-batch-rel-e3'}) CREATE (a)-[:RELATES_TO]->(b)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity) WHERE e.id IN ['read-batch-rel-e1', 'read-batch-rel-e2', 'read-batch-rel-e3'] DETACH DELETE e",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest read batch entity detail",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {id: $entity_id}) RETURN e",
BTreeMap::from([(
"entity_id".to_string(),
Value::String("read-batch-entity-detail".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'read-batch-entity-detail', name: 'Batch Entity Detail', entity_type: 'concept'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'read-batch-entity-detail'}) DETACH DELETE e",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest read batch entity related detail",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {id: $entity_id})-[r:RELATES_TO]-(related:Entity) RETURN e.id, e.name, e.entity_type, related.id, related.name, related.entity_type, related.description, COALESCE(r.relation_type, 'RELATES_TO'), COALESCE(r.confidence, 0.5), COALESCE(r.strength, 0.5) ORDER BY COALESCE(r.confidence, 0.5) DESC LIMIT $limit",
BTreeMap::from([
(
"entity_id".to_string(),
Value::String("read-batch-related-source".to_string()),
),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'read-batch-related-source', name: 'Related Source', entity_type: 'concept'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'read-batch-related-target', name: 'Related Target', entity_type: 'concept', description: 'related description'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Entity {id: 'read-batch-related-source'}), (b:Entity {id: 'read-batch-related-target'}) CREATE (a)-[:RELATES_TO {relation_type: 'supports', confidence: 0.8, strength: 0.7}]->(b)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity) WHERE e.id IN ['read-batch-related-source', 'read-batch-related-target'] DETACH DELETE e",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest read batch entity memory mentions",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[r:MENTIONS]->(e:Entity {id: $entity_id}) RETURN m.id, COALESCE(m.title, ''), LEFT(COALESCE(m.content, ''), 200), COALESCE(r.confidence, 0.5), COALESCE(r.mention_count, 1) ORDER BY COALESCE(r.confidence, 0.5) DESC LIMIT $limit",
BTreeMap::from([
(
"entity_id".to_string(),
Value::String("read-batch-mentions-entity".to_string()),
),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'read-batch-mentions-memory', title: 'Mention Memory', content: 'mention memory content'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'read-batch-mentions-entity', name: 'Mention Entity'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'read-batch-mentions-memory'}), (e:Entity {id: 'read-batch-mentions-entity'}) CREATE (m)-[:MENTIONS {confidence: 0.9, mention_count: 2}]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['read-batch-mentions-memory', 'read-batch-mentions-entity'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest read batch community detail by cid",
CypherFixtureStatement::with_parameters(
"MATCH (c:Community) WHERE c.community_id = $cid RETURN c.name, c.ai_summary, c.description, c.member_count LIMIT 1",
BTreeMap::from([("cid".to_string(), Value::Int(180001))]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'read-batch-community-detail', community_id: 180001, name: 'Batch Community Detail', ai_summary: 'batch summary', description: 'batch detail', member_count: 11})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (c:Community {id: 'read-batch-community-detail'}) DETACH DELETE c",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest search memory bulk projection",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, m.unit_type, m.metadata, COALESCE(m.importance, 0.5), COALESCE(m.confidence, 0.5), m.event_start, m.created_at, m.temporal_context",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![Value::String("rest-search-memory-1".to_string())]),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-search-memory-1', unit_type: 'fact', metadata: '{}', importance: 0.7, confidence: 0.8, event_start: 10, created_at: 20, temporal_context: 'timeless'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-search-memory-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest search entity bulk projection",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) WHERE e.id IN $ids RETURN e.id, COALESCE(e.name, e.id), e.entity_type, e.description, COALESCE(e.pagerank_score, e.confidence, 0.5), e.community_id, e.confidence",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![Value::String("rest-search-entity-1".to_string())]),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'rest-search-entity-1', name: 'Search Entity', entity_type: 'concept', description: 'search entity', pagerank_score: 0.6, community_id: 9101, confidence: 0.7})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'rest-search-entity-1'}) DETACH DELETE e",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest search entity memory edge projection",
CypherFixtureStatement::with_parameters(
"MATCH (a:Entity)-[r]-(m:Memory) WHERE a.id IN $ids RETURN a.id, m.id, COALESCE(m.title, LEFT(COALESCE(m.content, ''), 60)), m.title, LEFT(COALESCE(m.content, ''), 200), COALESCE(m.pagerank_score, m.importance, 0.5), m.community_id, m.space_id, m.created_at, m.updated_at, m.source, m.event_start, m.event_end, m.importance, label(r), COALESCE(r.strength, r.confidence, 0.5) LIMIT $limit",
BTreeMap::from([
(
"ids".to_string(),
Value::List(vec![Value::String("rest-search-edge-entity".to_string())]),
),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'rest-search-edge-entity', name: 'Search Edge Entity'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-search-edge-memory', title: 'Search Edge Memory', content: 'search memory edge content', pagerank_score: 0.6, community_id: 9102, space_id: 'default', created_at: 21, updated_at: 22, source: 'rest_search', event_start: 23, event_end: 24, importance: 0.7})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-search-edge-memory'}), (e:Entity {id: 'rest-search-edge-entity'}) CREATE (m)-[:MENTIONS {confidence: 0.9}]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-search-edge-entity', 'rest-search-edge-memory'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest search entity entity edge projection",
CypherFixtureStatement::with_parameters(
"MATCH (a:Entity)-[r]-(b:Entity) WHERE a.id IN $ids RETURN a.id, b.id, COALESCE(b.name, b.id), b.entity_type, b.description, COALESCE(b.pagerank_score, b.confidence, 0.5), b.community_id, b.confidence, label(r), COALESCE(r.strength, r.confidence, 0.5) LIMIT $limit",
BTreeMap::from([
(
"ids".to_string(),
Value::List(vec![Value::String("rest-search-entity-a".to_string())]),
),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'rest-search-entity-a', name: 'Entity A'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'rest-search-entity-b', name: 'Entity B', entity_type: 'concept', description: 'entity b', confidence: 0.8, community_id: 9103})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Entity {id: 'rest-search-entity-a'}), (b:Entity {id: 'rest-search-entity-b'}) CREATE (a)-[:RELATES_TO {strength: 0.8, confidence: 0.7}]->(b)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity) WHERE e.id IN ['rest-search-entity-a', 'rest-search-entity-b'] DETACH DELETE e",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest search source memory edge projection",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[r:SOURCED_FROM]->(s:Source) WHERE s.id IN $ids RETURN s.id, m.id, COALESCE(m.title, LEFT(COALESCE(m.content, ''), 60)), m.title, LEFT(COALESCE(m.content, ''), 200), COALESCE(m.pagerank_score, m.importance, 0.5), m.community_id, m.space_id, m.created_at, m.updated_at, m.source, m.event_start, m.event_end, m.importance LIMIT $limit",
BTreeMap::from([
(
"ids".to_string(),
Value::List(vec![Value::String("rest-search-source-1".to_string())]),
),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'rest-search-source-1', title: 'Search Source'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-search-source-memory', title: 'Source Memory', content: 'source memory content', pagerank_score: 0.5, community_id: 9104, space_id: 'default', created_at: 31, updated_at: 32, source: 'rest_search', event_start: 33, event_end: 34, importance: 0.6})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-search-source-memory'}), (s:Source {id: 'rest-search-source-1'}) CREATE (m)-[:SOURCED_FROM]->(s)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-search-source-1', 'rest-search-source-memory'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest search thread bulk projection",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE t.id IN $ids RETURN t.id, COALESCE(t.title, t.source, 'Thread'), t.source, t.summary, t.message_count, t.project, t.workspace",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![Value::String("rest-search-thread-1".to_string())]),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'rest-search-thread-1', title: 'Search Thread', source: 'codex', summary: 'thread summary', message_count: 3, project: 'hawdb', workspace: 'default'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'rest-search-thread-1'}) DETACH DELETE t",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest search thread compacts memory projection",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread)-[r:COMPACTS_TO]->(m:Memory) WHERE t.id IN $ids RETURN t.id, m.id, COALESCE(m.title, LEFT(COALESCE(m.content, ''), 60)), m.title, LEFT(COALESCE(m.content, ''), 200), COALESCE(m.pagerank_score, m.importance, 0.5), m.community_id, m.space_id, m.created_at, m.updated_at, m.source, m.event_start, m.event_end, m.importance LIMIT $limit",
BTreeMap::from([
(
"ids".to_string(),
Value::List(vec![Value::String("rest-search-compact-thread".to_string())]),
),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'rest-search-compact-thread', title: 'Compact Thread'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-search-compact-memory', title: 'Compact Memory', content: 'compact memory content', pagerank_score: 0.4, community_id: 9105, space_id: 'default', created_at: 41, updated_at: 42, source: 'rest_search', event_start: 43, event_end: 44, importance: 0.5})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'rest-search-compact-thread'}), (m:Memory {id: 'rest-search-compact-memory'}) CREATE (t)-[:COMPACTS_TO]->(m)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-search-compact-thread', 'rest-search-compact-memory'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph node detail memory lookup",
CypherFixtureStatement::with_parameters(
"MATCH (n:Memory {id: $node_id}) RETURN n",
BTreeMap::from([(
"node_id".to_string(),
Value::String("node-detail-memory".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'node-detail-memory', title: 'Node Detail Memory'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n:Memory {id: 'node-detail-memory'}) DETACH DELETE n",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph node detail entity lookup",
CypherFixtureStatement::with_parameters(
"MATCH (n:Entity {id: $node_id}) RETURN n",
BTreeMap::from([(
"node_id".to_string(),
Value::String("node-detail-entity".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'node-detail-entity', name: 'Node Detail Entity'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n:Entity {id: 'node-detail-entity'}) DETACH DELETE n",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph node detail source lookup",
CypherFixtureStatement::with_parameters(
"MATCH (n:Source {id: $node_id}) RETURN n",
BTreeMap::from([(
"node_id".to_string(),
Value::String("node-detail-source".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'node-detail-source', original_name: 'Node Detail Source'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n:Source {id: 'node-detail-source'}) DETACH DELETE n",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph node detail thread lookup",
CypherFixtureStatement::with_parameters(
"MATCH (n:Thread {id: $node_id}) RETURN n",
BTreeMap::from([(
"node_id".to_string(),
Value::String("node-detail-thread".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'node-detail-thread', title: 'Node Detail Thread'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n:Thread {id: 'node-detail-thread'}) DETACH DELETE n",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph seed memory nodes read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, COALESCE(m.title, LEFT(COALESCE(m.content, ''), 60)), m.title, LEFT(COALESCE(m.content, ''), 200), COALESCE(m.pagerank_score, m.importance, 0.5), m.community_id, m.space_id, m.created_at, m.updated_at, m.source, m.event_start, m.event_end, m.importance",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![Value::String("seed-memory-node".to_string())]),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'seed-memory-node', title: 'Seed Memory Node', content: 'seed content', importance: 0.7})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'seed-memory-node'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph seed memory neighbor read",
CypherFixtureStatement::with_parameters(
"MATCH (a:Memory)-[r]-(b:Memory) WHERE a.id IN $ids RETURN a.id, b.id, COALESCE(b.title, LEFT(COALESCE(b.content, ''), 60)), b.title, LEFT(COALESCE(b.content, ''), 200), COALESCE(b.pagerank_score, b.importance, 0.5), b.community_id, b.space_id, b.created_at, b.updated_at, b.source, b.event_start, b.event_end, b.importance, label(r), COALESCE(r.strength, r.confidence, 0.5) LIMIT $limit",
BTreeMap::from([
(
"ids".to_string(),
Value::List(vec![Value::String("seed-memory-source".to_string())]),
),
("limit".to_string(), Value::Int(5)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'seed-memory-source', title: 'Seed Memory Source'})-[:MEMORY_RELATES_TO {strength: 0.8}]->(:Memory {id: 'seed-memory-target', title: 'Seed Memory Target', importance: 0.6})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['seed-memory-source', 'seed-memory-target'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph seed entity neighbor read",
CypherFixtureStatement::with_parameters(
"MATCH (a:Memory)-[r]-(e:Entity) WHERE a.id IN $ids RETURN a.id, e.id, COALESCE(e.name, e.id), e.entity_type, e.description, COALESCE(e.pagerank_score, e.confidence, 0.5), e.community_id, e.confidence, label(r), COALESCE(r.strength, r.confidence, 0.5) LIMIT $limit",
BTreeMap::from([
(
"ids".to_string(),
Value::List(vec![Value::String("seed-entity-memory".to_string())]),
),
("limit".to_string(), Value::Int(5)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'seed-entity-memory', title: 'Seed Entity Memory'})-[:MENTIONS {confidence: 0.7}]->(:Entity {id: 'seed-entity-target', name: 'Seed Entity Target', entity_type: 'concept'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['seed-entity-memory', 'seed-entity-target'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph space-scoped overview seed read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.space_id = $space_id OR ($space_id = $default_space_id AND (m.space_id IS NULL OR m.space_id = '')) RETURN m.id ORDER BY COALESCE(m.pagerank_score, m.importance, 0.5) DESC LIMIT $limit",
BTreeMap::from([
(
"space_id".to_string(),
Value::String("rest-graph-space-seed".to_string()),
),
(
"default_space_id".to_string(),
Value::String("default".to_string()),
),
("limit".to_string(), Value::Int(5)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-graph-space-seed-memory', space_id: 'rest-graph-space-seed', title: 'Rest Graph Space Seed', importance: 0.9})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-graph-space-seed-memory'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph scoped search seed read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.space_id = $space_id AND (contains(LOWER(COALESCE(m.title, '')), LOWER($q)) OR contains(LOWER(COALESCE(m.content, '')), LOWER($q))) RETURN m.id ORDER BY COALESCE(m.pagerank_score, m.importance, 0.5) DESC LIMIT $limit",
BTreeMap::from([
(
"space_id".to_string(),
Value::String("rest-graph-search-space".to_string()),
),
("q".to_string(), Value::String("scoped needle".to_string())),
("limit".to_string(), Value::Int(5)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-graph-scoped-search-memory', space_id: 'rest-graph-search-space', title: 'Scoped Needle Memory', content: 'space scoped search body', importance: 0.8})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-graph-scoped-search-memory'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph global search seed read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE contains(LOWER(COALESCE(m.title, '')), LOWER($q)) OR contains(LOWER(COALESCE(m.content, '')), LOWER($q)) RETURN m.id ORDER BY COALESCE(m.pagerank_score, m.importance, 0.5) DESC LIMIT $limit",
BTreeMap::from([
("q".to_string(), Value::String("global needle".to_string())),
("limit".to_string(), Value::Int(5)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-graph-global-search-memory', title: 'Global Needle Memory', content: 'global graph search body', importance: 0.85})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-graph-global-search-memory'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph community member entity read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) WHERE e.community_id = $cid RETURN e.id, COALESCE(e.name, e.id), COALESCE(e.pagerank_score, e.confidence, 0.5)",
BTreeMap::from([("cid".to_string(), Value::Int(3408))]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'community-member-entity', name: 'Community Member Entity', community_id: 3408, confidence: 0.7})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'community-member-entity'}) DETACH DELETE e",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph community member memory read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.community_id = $cid RETURN m.id, COALESCE(m.title, LEFT(m.content, 60)), COALESCE(m.pagerank_score, m.importance, 0.5)",
BTreeMap::from([("cid".to_string(), Value::Int(3424))]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'community-member-memory', title: 'Community Member Memory', community_id: 3424, importance: 0.8})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'community-member-memory'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph community subgraph entity ranking read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) WHERE e.community_id = $cid OPTIONAL MATCH (:Memory)-[r:MENTIONS]->(e) RETURN e.id, e.name, e.entity_type, e.confidence, COUNT(r) AS mention_count ORDER BY mention_count DESC, e.name ASC LIMIT $max_entities",
BTreeMap::from([
("cid".to_string(), Value::Int(3505)),
("max_entities".to_string(), Value::Int(5)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'community-subgraph-mention-memory'})-[:MENTIONS]->(:Entity {id: 'community-subgraph-entity', name: 'Community Subgraph Entity', entity_type: 'concept', community_id: 3505, confidence: 0.9})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['community-subgraph-mention-memory', 'community-subgraph-entity'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph community subgraph relation edge read",
CypherFixtureStatement::with_parameters(
"MATCH (e1:Entity)-[r:RELATES_TO]-(e2:Entity) WHERE e1.id IN $ids AND e2.id IN $ids AND e1.id < e2.id RETURN e1.id, e2.id, r.confidence, r.relation_type",
BTreeMap::from([(
"ids".to_string(),
Value::List(vec![
Value::String("community-edge-alpha".to_string()),
Value::String("community-edge-beta".to_string()),
]),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'community-edge-alpha'})-[:RELATES_TO {confidence: 0.77, relation_type: 'related'}]->(:Entity {id: 'community-edge-beta'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity) WHERE e.id IN ['community-edge-alpha', 'community-edge-beta'] DETACH DELETE e",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph community recent memories read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[:MENTIONS]->(e:Entity) WHERE e.community_id = $cid WITH m, COUNT(DISTINCT e) AS mention_breadth ORDER BY m.created_at DESC LIMIT $limit RETURN m.id, m.title, m.content, m.importance, m.created_at, m.updated_at, m.is_crystal, mention_breadth",
BTreeMap::from([
("cid".to_string(), Value::Int(3676)),
("limit".to_string(), Value::Int(5)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'community-recent-memory', title: 'Community Recent Memory', content: 'recent body', importance: 0.9, created_at: 1700000001, is_crystal: false})-[:MENTIONS]->(:Entity {id: 'community-recent-entity', community_id: 3676})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['community-recent-memory', 'community-recent-entity'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph cleanup orphan entity delete",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {id: $entity_id}) DETACH DELETE e",
BTreeMap::from([(
"entity_id".to_string(),
Value::String("rest-graph-orphan-entity".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'rest-graph-orphan-entity', name: 'Rest Graph Orphan Entity'})",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph kg existing entities context read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) RETURN e.name, e.entity_type, e.description ORDER BY e.created_at DESC LIMIT $limit",
BTreeMap::from([("limit".to_string(), Value::Int(1))]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'kg-existing-entity', name: 'KG Existing Entity', entity_type: 'concept', description: 'entity context', created_at: 1700000002})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'kg-existing-entity'}) DETACH DELETE e",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph kg memory detail read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $id}) RETURN m.title, m.content, m.metadata, m.is_latest, m.lifecycle_state",
BTreeMap::from([(
"id".to_string(),
Value::String("kg-memory-detail".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'kg-memory-detail', title: 'KG Memory Detail', content: 'memory content', metadata: '{}', is_latest: true, lifecycle_state: 'active'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'kg-memory-detail'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest label action label name read",
CypherFixtureStatement::with_parameters(
"MATCH (l:Label {id: $id}) RETURN l.name",
BTreeMap::from([(
"id".to_string(),
Value::String("label-action-name".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-action-name', name: 'Label Action Name'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (l:Label {id: 'label-action-name'}) DETACH DELETE l",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest library crystal source memories read",
CypherFixtureStatement::with_parameters(
"MATCH (c:Memory {id: $crystal_id})-[r:SYNTHESIZED_FROM]->(s:Memory) WHERE c.is_crystal = true RETURN s.id, s.title, s.content, s.importance, s.created_at, r.weight ORDER BY r.weight DESC, s.importance DESC LIMIT $limit",
BTreeMap::from([
(
"crystal_id".to_string(),
Value::String("library-crystal-source-crystal".to_string()),
),
("limit".to_string(), Value::Int(10)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'library-crystal-source-crystal', title: 'Library Crystal', is_crystal: true})-[:SYNTHESIZED_FROM {weight: 0.9}]->(:Memory {id: 'library-crystal-source-memory', title: 'Library Source Memory', content: 'source body', importance: 0.7, created_at: 1700000003})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['library-crystal-source-crystal', 'library-crystal-source-memory'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"pagerank mention edge count",
CypherFixtureStatement::new(
"MATCH (:Memory)-[r:MENTIONS]->(:Entity) RETURN COUNT(r)",
),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"pagerank changed memory count",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.created_at > timestamp($cutoff) OR m.updated_at > timestamp($cutoff) RETURN COUNT(m)",
BTreeMap::from([(
"cutoff".to_string(),
Value::String("1970-01-01T00:00:00".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'pagerank-changed-memory', created_at: 2, updated_at: 3})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'pagerank-changed-memory'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"pagerank changed entity count",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) WHERE e.created_at > timestamp($cutoff) OR e.updated_at > timestamp($cutoff) RETURN COUNT(e)",
BTreeMap::from([(
"cutoff".to_string(),
Value::String("1970-01-01T00:00:00".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'pagerank-changed-entity', created_at: 2, updated_at: 3})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'pagerank-changed-entity'}) DETACH DELETE e",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"pagerank changed mentions count",
CypherFixtureStatement::with_parameters(
"MATCH (:Memory)-[r:MENTIONS]->(:Entity) WHERE r.created_at > timestamp($cutoff) RETURN COUNT(r)",
BTreeMap::from([(
"cutoff".to_string(),
Value::String("1970-01-01T00:00:00".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'pagerank-changed-mention-memory'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'pagerank-changed-mention-entity'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'pagerank-changed-mention-memory'}), (e:Entity {id: 'pagerank-changed-mention-entity'}) CREATE (m)-[:MENTIONS {created_at: 2}]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['pagerank-changed-mention-memory', 'pagerank-changed-mention-entity'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"pagerank changed entity relation count",
CypherFixtureStatement::with_parameters(
"MATCH (:Entity)-[r:RELATES_TO]->(:Entity) WHERE r.created_at > timestamp($cutoff) RETURN COUNT(r)",
BTreeMap::from([(
"cutoff".to_string(),
Value::String("1970-01-01T00:00:00".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'pagerank-changed-rel-source'})-[:RELATES_TO {created_at: 2}]->(:Entity {id: 'pagerank-changed-rel-target'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity) WHERE e.id IN ['pagerank-changed-rel-source', 'pagerank-changed-rel-target'] DETACH DELETE e",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"pagerank active memory relation count",
CypherFixtureStatement::new(
"MATCH (:Memory)-[r:MEMORY_RELATES_TO]->(:Memory) WHERE r.status = 'active' RETURN COUNT(r)",
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'pagerank-rel-source'})-[:MEMORY_RELATES_TO {status: 'active'}]->(:Memory {id: 'pagerank-rel-target'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['pagerank-rel-source', 'pagerank-rel-target'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"pagerank changed memory relation count",
CypherFixtureStatement::with_parameters(
"MATCH (:Memory)-[r:MEMORY_RELATES_TO]->(:Memory) WHERE r.status = 'active' AND (r.created_at > timestamp($cutoff) OR r.updated_at > timestamp($cutoff)) RETURN COUNT(r)",
BTreeMap::from([(
"cutoff".to_string(),
Value::String("1970-01-01T00:00:00".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'pagerank-changed-memory-rel-source'})-[:MEMORY_RELATES_TO {status: 'active', created_at: 2, updated_at: 3}]->(:Memory {id: 'pagerank-changed-memory-rel-target'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['pagerank-changed-memory-rel-source', 'pagerank-changed-memory-rel-target'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest graph active memory relation overview read",
CypherFixtureStatement::with_parameters(
"MATCH (source:Memory)-[r:MEMORY_RELATES_TO]->(target:Memory) WHERE r.status = 'active' RETURN source.id, COALESCE(source.title, LEFT(source.content, 60)), COALESCE(source.importance, 0.5), source.community_id, source.title, LEFT(COALESCE(source.content, ''), 200), source.space_id, target.id, COALESCE(target.title, LEFT(target.content, 60)), COALESCE(target.importance, 0.5), target.community_id, target.title, LEFT(COALESCE(target.content, ''), 200), target.space_id, r.id, r.relation_type, r.strength, r.confidence, r.reason, r.status, r.source ORDER BY r.updated_at DESC, r.created_at DESC LIMIT $limit",
BTreeMap::from([("limit".to_string(), Value::Int(1))]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-graph-memory-rel-source', title: 'Rest Graph Relation Source', content: 'source content', importance: 0.8, community_id: 501, space_id: 'default'})-[:MEMORY_RELATES_TO {id: 'rest-graph-memory-rel-1', relation_type: 'supports', strength: 0.82, confidence: 0.83, reason: 'fixture', status: 'active', source: 'compat', created_at: 999998, updated_at: 999999}]->(:Memory {id: 'rest-graph-memory-rel-target', title: 'Rest Graph Relation Target', content: 'target content', importance: 0.7, community_id: 502, space_id: 'default'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['rest-graph-memory-rel-source', 'rest-graph-memory-rel-target'] DETACH DELETE m",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"decay evolves relation counts",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[e:EVOLVES]->(:Memory) WHERE m.id IN $memory_ids AND e.content_relation IN ['confirms', 'enriches'] RETURN m.id, COUNT(e)",
BTreeMap::from([(
"memory_ids".to_string(),
Value::List(vec![Value::String("decay-source".to_string())]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("m.id", Value::String("decay-source".to_string())),
("count(e)", Value::Int(2)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'decay-source'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'decay-target-confirm'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'decay-target-enrich'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'decay-target-ignore'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'decay-source'}), (n:Memory {id: 'decay-target-confirm'}) CREATE (m)-[:EVOLVES {content_relation: 'confirms'}]->(n)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'decay-source'}), (n:Memory {id: 'decay-target-enrich'}) CREATE (m)-[:EVOLVES {content_relation: 'enriches'}]->(n)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'decay-source'}), (n:Memory {id: 'decay-target-ignore'}) CREATE (m)-[:EVOLVES {content_relation: 'contradicts'}]->(n)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['decay-source', 'decay-target-confirm', 'decay-target-enrich', 'decay-target-ignore'] DETACH DELETE m",
),
ExpectedRows::RowCount(4),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"decay crystal synthesis counts",
CypherFixtureStatement::with_parameters(
"MATCH (c:Memory)-[:SYNTHESIZED_FROM]->(m:Memory) WHERE m.id IN $memory_ids AND c.is_crystal = true RETURN m.id, COUNT(c)",
BTreeMap::from([(
"memory_ids".to_string(),
Value::List(vec![Value::String("decay-base".to_string())]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("m.id", Value::String("decay-base".to_string())),
("count(c)", Value::Int(1)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'decay-base'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'decay-crystal', is_crystal: true})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'decay-non-crystal', is_crystal: false})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (c:Memory {id: 'decay-crystal'}), (m:Memory {id: 'decay-base'}) CREATE (c)-[:SYNTHESIZED_FROM]->(m)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (c:Memory {id: 'decay-non-crystal'}), (m:Memory {id: 'decay-base'}) CREATE (c)-[:SYNTHESIZED_FROM]->(m)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['decay-base', 'decay-crystal', 'decay-non-crystal'] DETACH DELETE m",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source metadata timestamp update",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source {id: $id}) SET s.metadata = $metadata, s.updated_at = timestamp($updated_at)",
BTreeMap::from([
(
"id".to_string(),
Value::String("metadata-source-1".to_string()),
),
("metadata".to_string(), Value::String("{\"ocr\":true}".to_string())),
(
"updated_at".to_string(),
Value::String("1970-01-01T00:00:00".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'metadata-source-1', metadata: '{}', updated_at: 1})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'metadata-source-1'}) RETURN s.metadata AS metadata, s.updated_at AS updated_at",
),
ExpectedRows::Exact(vec![compatibility_row([
("metadata", Value::String("{\"ocr\":true}".to_string())),
("updated_at", Value::Int(0)),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest sources html parsed update",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source {id: $id}) SET s.lifecycle_state = 'parsed', s.parsed_path = $parsed_path, s.original_name = $original_name, s.mime_type = 'text/html', s.source_url = $source_url, s.summary = $summary, s.sha256 = $sha256, s.size_bytes = $size_bytes, s.updated_at = timestamp($updated_at), s.metadata = $metadata",
BTreeMap::from([
("id".to_string(), Value::String("rest-source-html-update".to_string())),
("parsed_path".to_string(), Value::String("/tmp/html.parsed".to_string())),
("original_name".to_string(), Value::String("HTML Source".to_string())),
("source_url".to_string(), Value::String("https://example.test/html".to_string())),
("summary".to_string(), Value::String("html summary".to_string())),
("sha256".to_string(), Value::String("sha-html".to_string())),
("size_bytes".to_string(), Value::Int(101)),
(
"updated_at".to_string(),
Value::String("1970-01-01T00:00:00".to_string()),
),
("metadata".to_string(), Value::String("{\"html\":true}".to_string())),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'rest-source-html-update', lifecycle_state: 'ingested'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'rest-source-html-update'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest sources file parsed update",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source {id: $id}) SET s.lifecycle_state = 'parsed', s.parsed_path = $parsed_path, s.file_path = $file_path, s.original_name = $original_name, s.mime_type = $mime_type, s.source_url = $source_url, s.summary = $summary, s.sha256 = $sha256, s.size_bytes = $size_bytes, s.updated_at = timestamp($updated_at), s.metadata = $metadata",
BTreeMap::from([
("id".to_string(), Value::String("rest-source-file-update".to_string())),
("parsed_path".to_string(), Value::String("/tmp/file.parsed".to_string())),
("file_path".to_string(), Value::String("/tmp/file.md".to_string())),
("original_name".to_string(), Value::String("File Source".to_string())),
("mime_type".to_string(), Value::String("text/markdown".to_string())),
("source_url".to_string(), Value::String("".to_string())),
("summary".to_string(), Value::String("file summary".to_string())),
("sha256".to_string(), Value::String("sha-file".to_string())),
("size_bytes".to_string(), Value::Int(102)),
(
"updated_at".to_string(),
Value::String("1970-01-01T00:00:01".to_string()),
),
("metadata".to_string(), Value::String("{\"file\":true}".to_string())),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'rest-source-file-update', lifecycle_state: 'ingested'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'rest-source-file-update'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest sources version lookup",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source) WHERE s.original_name = $name AND s.space_id = $space_id RETURN s.id, s.version ORDER BY s.version DESC LIMIT 1",
BTreeMap::from([
("name".to_string(), Value::String("Versioned Source".to_string())),
("space_id".to_string(), Value::String("default".to_string())),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'rest-source-version-1', original_name: 'Versioned Source', space_id: 'default', version: 1})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'rest-source-version-2', original_name: 'Versioned Source', space_id: 'default', version: 2})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source) WHERE s.id IN ['rest-source-version-1', 'rest-source-version-2'] DETACH DELETE s",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest sources revised edge create",
CypherFixtureStatement::with_parameters(
"MATCH (newer:Source {id: $newer_id}), (older:Source {id: $older_id}) CREATE (newer)-[:REVISED_AS { diff_summary: '', sections_changed: '[]', revision_type: 'update', detected_by: 'filename_match', created_at: timestamp($created_at) }]->(older)",
BTreeMap::from([
("newer_id".to_string(), Value::String("rest-source-newer".to_string())),
("older_id".to_string(), Value::String("rest-source-older".to_string())),
(
"created_at".to_string(),
Value::String("1970-01-01T00:00:02".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'rest-source-newer'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'rest-source-older'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source) WHERE s.id IN ['rest-source-newer', 'rest-source-older'] DETACH DELETE s",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest sources markdown file create",
CypherFixtureStatement::with_parameters(
"CREATE (s:Source { id: $id, source_type: 'file', original_name: $original_name, mime_type: 'text/markdown', file_path: $file_path, parsed_path: $parsed_path, source_url: '', sha256: $sha256, size_bytes: $size_bytes, version: $version, space_id: $space_id, lifecycle_state: 'parsed', chunk_count: 0, memory_count: 0, section_tree: '', summary: $summary, error_message: '', created_at: timestamp($created_at), updated_at: timestamp($updated_at), metadata: $metadata })",
BTreeMap::from([
("id".to_string(), Value::String("rest-source-markdown-versioned".to_string())),
("original_name".to_string(), Value::String("Versioned Markdown".to_string())),
("file_path".to_string(), Value::String("/tmp/versioned.md".to_string())),
("parsed_path".to_string(), Value::String("/tmp/versioned.parsed".to_string())),
("sha256".to_string(), Value::String("sha-md-versioned".to_string())),
("size_bytes".to_string(), Value::Int(201)),
("version".to_string(), Value::Int(3)),
("space_id".to_string(), Value::String("default".to_string())),
("summary".to_string(), Value::String("markdown summary".to_string())),
(
"created_at".to_string(),
Value::String("1970-01-01T00:00:03".to_string()),
),
(
"updated_at".to_string(),
Value::String("1970-01-01T00:00:04".to_string()),
),
("metadata".to_string(), Value::String("{\"md\":true}".to_string())),
]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'rest-source-markdown-versioned'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest sources url create",
CypherFixtureStatement::with_parameters(
"CREATE (s:Source { id: $id, source_type: 'url', original_name: $original_name, mime_type: 'text/html', file_path: '', parsed_path: $parsed_path, source_url: $source_url, sha256: $sha256, size_bytes: $size_bytes, version: 1, space_id: $space_id, lifecycle_state: 'parsed', chunk_count: 0, memory_count: 0, section_tree: $section_tree, summary: $summary, error_message: '', created_at: timestamp($created_at), updated_at: timestamp($updated_at), metadata: $metadata })",
BTreeMap::from([
("id".to_string(), Value::String("rest-source-url-create".to_string())),
("original_name".to_string(), Value::String("URL Source".to_string())),
("parsed_path".to_string(), Value::String("/tmp/url.parsed".to_string())),
("source_url".to_string(), Value::String("https://example.test".to_string())),
("sha256".to_string(), Value::String("sha-url".to_string())),
("size_bytes".to_string(), Value::Int(202)),
("space_id".to_string(), Value::String("default".to_string())),
("section_tree".to_string(), Value::String("{}".to_string())),
("summary".to_string(), Value::String("url summary".to_string())),
(
"created_at".to_string(),
Value::String("1970-01-01T00:00:05".to_string()),
),
(
"updated_at".to_string(),
Value::String("1970-01-01T00:00:06".to_string()),
),
("metadata".to_string(), Value::String("{\"url\":true}".to_string())),
]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'rest-source-url-create'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest sources pdf create",
CypherFixtureStatement::with_parameters(
"CREATE (s:Source { id: $id, source_type: 'file', original_name: $original_name, mime_type: 'application/pdf', file_path: $file_path, parsed_path: $parsed_path, source_url: $source_url, sha256: $sha256, size_bytes: $size_bytes, version: $version, space_id: $space_id, lifecycle_state: 'parsed', chunk_count: 0, memory_count: 0, section_tree: '', summary: $summary, error_message: '', created_at: timestamp($created_at), updated_at: timestamp($updated_at), metadata: $metadata })",
BTreeMap::from([
("id".to_string(), Value::String("rest-source-pdf-create".to_string())),
("original_name".to_string(), Value::String("PDF Source".to_string())),
("file_path".to_string(), Value::String("/tmp/source.pdf".to_string())),
("parsed_path".to_string(), Value::String("/tmp/source.pdf.parsed".to_string())),
("source_url".to_string(), Value::String("file:///tmp/source.pdf".to_string())),
("sha256".to_string(), Value::String("sha-pdf".to_string())),
("size_bytes".to_string(), Value::Int(203)),
("version".to_string(), Value::Int(1)),
("space_id".to_string(), Value::String("default".to_string())),
("summary".to_string(), Value::String("pdf summary".to_string())),
(
"created_at".to_string(),
Value::String("1970-01-01T00:00:07".to_string()),
),
(
"updated_at".to_string(),
Value::String("1970-01-01T00:00:08".to_string()),
),
("metadata".to_string(), Value::String("{\"pdf\":true}".to_string())),
]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'rest-source-pdf-create'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest sources generic file create",
CypherFixtureStatement::with_parameters(
"CREATE (s:Source { id: $id, source_type: 'file', original_name: $original_name, mime_type: $mime_type, file_path: $file_path, parsed_path: $parsed_path, source_url: '', sha256: $sha256, size_bytes: $size_bytes, version: $version, space_id: $space_id, lifecycle_state: 'parsed', chunk_count: 0, memory_count: 0, section_tree: '', summary: $summary, error_message: '', created_at: timestamp($created_at), updated_at: timestamp($updated_at), metadata: $metadata })",
BTreeMap::from([
("id".to_string(), Value::String("rest-source-generic-file".to_string())),
("original_name".to_string(), Value::String("Generic File".to_string())),
("mime_type".to_string(), Value::String("text/plain".to_string())),
("file_path".to_string(), Value::String("/tmp/generic.txt".to_string())),
("parsed_path".to_string(), Value::String("/tmp/generic.parsed".to_string())),
("sha256".to_string(), Value::String("sha-generic".to_string())),
("size_bytes".to_string(), Value::Int(204)),
("version".to_string(), Value::Int(2)),
("space_id".to_string(), Value::String("default".to_string())),
("summary".to_string(), Value::String("generic summary".to_string())),
(
"created_at".to_string(),
Value::String("1970-01-01T00:00:09".to_string()),
),
(
"updated_at".to_string(),
Value::String("1970-01-01T00:00:10".to_string()),
),
("metadata".to_string(), Value::String("{\"generic\":true}".to_string())),
]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'rest-source-generic-file'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest sources markdown import create",
CypherFixtureStatement::with_parameters(
"CREATE (s:Source { id: $id, source_type: 'file', original_name: $original_name, mime_type: 'text/markdown', file_path: $file_path, parsed_path: $parsed_path, source_url: '', sha256: $sha256, size_bytes: $size_bytes, version: 1, space_id: $space_id, lifecycle_state: 'parsed', chunk_count: 0, memory_count: 0, section_tree: '', summary: $summary, error_message: '', created_at: timestamp($created_at), updated_at: timestamp($updated_at), metadata: $metadata })",
BTreeMap::from([
("id".to_string(), Value::String("rest-source-markdown-import".to_string())),
("original_name".to_string(), Value::String("Markdown Import".to_string())),
("file_path".to_string(), Value::String("/tmp/import.md".to_string())),
("parsed_path".to_string(), Value::String("/tmp/import.parsed".to_string())),
("sha256".to_string(), Value::String("sha-md-import".to_string())),
("size_bytes".to_string(), Value::Int(205)),
("space_id".to_string(), Value::String("default".to_string())),
("summary".to_string(), Value::String("import summary".to_string())),
(
"created_at".to_string(),
Value::String("1970-01-01T00:00:11".to_string()),
),
(
"updated_at".to_string(),
Value::String("1970-01-01T00:00:12".to_string()),
),
("metadata".to_string(), Value::String("{\"import\":true}".to_string())),
]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'rest-source-markdown-import'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest sources parsed path summary update",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source {id: $id}) SET s.lifecycle_state = 'parsed', s.parsed_path = $parsed_path, s.summary = $summary, s.sha256 = $sha256, s.size_bytes = $size_bytes, s.updated_at = timestamp($updated_at)",
BTreeMap::from([
("id".to_string(), Value::String("rest-source-parsed-update".to_string())),
("parsed_path".to_string(), Value::String("/tmp/parsed-update".to_string())),
("summary".to_string(), Value::String("parsed update summary".to_string())),
("sha256".to_string(), Value::String("sha-parsed-update".to_string())),
("size_bytes".to_string(), Value::Int(301)),
(
"updated_at".to_string(),
Value::String("1970-01-01T00:00:13".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'rest-source-parsed-update', lifecycle_state: 'ingested'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'rest-source-parsed-update'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest sources summary update",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source {id: $id}) SET s.lifecycle_state = 'parsed', s.summary = $summary, s.sha256 = $sha256, s.size_bytes = $size_bytes, s.updated_at = timestamp($updated_at)",
BTreeMap::from([
("id".to_string(), Value::String("rest-source-summary-update".to_string())),
("summary".to_string(), Value::String("summary update".to_string())),
("sha256".to_string(), Value::String("sha-summary-update".to_string())),
("size_bytes".to_string(), Value::Int(302)),
(
"updated_at".to_string(),
Value::String("1970-01-01T00:00:14".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'rest-source-summary-update', lifecycle_state: 'ingested'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'rest-source-summary-update'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest sources whole node read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source {id: $source_id}) RETURN s",
BTreeMap::from([(
"source_id".to_string(),
Value::String("rest-source-whole-read".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'rest-source-whole-read', original_name: 'Whole Source'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'rest-source-whole-read'}) DETACH DELETE s",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest sources sha version read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source) WHERE s.sha256 = $sha256 AND s.space_id = $space_id RETURN s ORDER BY s.version DESC LIMIT 1",
BTreeMap::from([
("sha256".to_string(), Value::String("sha-source-version".to_string())),
("space_id".to_string(), Value::String("default".to_string())),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'rest-source-sha-version-1', sha256: 'sha-source-version', space_id: 'default', version: 1})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'rest-source-sha-version-2', sha256: 'sha-source-version', space_id: 'default', version: 2})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source) WHERE s.id IN ['rest-source-sha-version-1', 'rest-source-sha-version-2'] DETACH DELETE s",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest sources label name read",
CypherFixtureStatement::with_parameters(
"MATCH (l:Label {id: $label_id}) RETURN l.name LIMIT 1",
BTreeMap::from([(
"label_id".to_string(),
Value::String("rest-source-label-name".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'rest-source-label-name', name: 'Source Label'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (l:Label {id: 'rest-source-label-name'}) DETACH DELETE l",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory relation multi property update",
CypherFixtureStatement::with_parameters(
"MATCH (source:Memory)-[r:MEMORY_RELATES_TO]->(target:Memory) WHERE r.id = $relation_id SET r.relation_type = $relation_type, r.strength = $strength, r.confidence = $confidence, r.status = $status, r.reason = $reason, r.updated_at = timestamp($updated_at)",
BTreeMap::from([
("relation_id".to_string(), Value::String("rel-1".to_string())),
("relation_type".to_string(), Value::String("supports".to_string())),
("strength".to_string(), Value::Float(0.7)),
("confidence".to_string(), Value::Float(0.8)),
("status".to_string(), Value::String("reviewed".to_string())),
("reason".to_string(), Value::String("fixture".to_string())),
(
"updated_at".to_string(),
Value::String("1970-01-01T00:00:00".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE RELATIONSHIP TYPE MEMORY_RELATES_TO",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rel-source'})-[:MEMORY_RELATES_TO {id: 'rel-1', relation_type: 'old', strength: 0.1, confidence: 0.2, status: 'draft', reason: '', updated_at: 10}]->(:Memory {id: 'rel-target'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (:Memory)-[r:MEMORY_RELATES_TO]->(:Memory) WHERE r.id = 'rel-1' RETURN r.relation_type AS relation_type, r.strength AS strength, r.confidence AS confidence, r.status AS status, r.reason AS reason, r.updated_at AS updated_at",
),
ExpectedRows::Exact(vec![compatibility_row([
("relation_type", Value::String("supports".to_string())),
("strength", Value::Float(0.7)),
("confidence", Value::Float(0.8)),
("status", Value::String("reviewed".to_string())),
("reason", Value::String("fixture".to_string())),
("updated_at", Value::Int(0)),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp memory relation full update",
CypherFixtureStatement::with_parameters(
"MATCH (source:Memory)-[r:MEMORY_RELATES_TO]->(target:Memory) WHERE r.id = $relation_id SET r.relation_type = $relation_type, r.strength = $strength, r.confidence = $confidence, r.bidirectional = $bidirectional, r.status = $status, r.reviewed = $reviewed, r.source = $source, r.agent_id = $agent_id, r.source_app = $source_app, r.reason = $reason, r.updated_at = timestamp($updated_at)",
BTreeMap::from([
(
"relation_id".to_string(),
Value::String("mcp-rel-full-1".to_string()),
),
(
"relation_type".to_string(),
Value::String("contradicts".to_string()),
),
("strength".to_string(), Value::Float(0.61)),
("confidence".to_string(), Value::Float(0.62)),
("bidirectional".to_string(), Value::Bool(true)),
("status".to_string(), Value::String("active".to_string())),
("reviewed".to_string(), Value::Bool(true)),
("source".to_string(), Value::String("mcp".to_string())),
(
"agent_id".to_string(),
Value::String("agent-full".to_string()),
),
("source_app".to_string(), Value::String("codex".to_string())),
(
"reason".to_string(),
Value::String("full update".to_string()),
),
("updated_at".to_string(), Value::Int(1_700_000_020)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-rel-full-source'})-[:MEMORY_RELATES_TO {id: 'mcp-rel-full-1', relation_type: 'supports', strength: 0.1, confidence: 0.2, bidirectional: false, status: 'suggested', reviewed: false, source: 'fixture', agent_id: '', source_app: 'fixture', reason: 'old', updated_at: 1}]->(:Memory {id: 'mcp-rel-full-target'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['mcp-rel-full-source', 'mcp-rel-full-target'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest memory relation full update write",
CypherFixtureStatement::with_parameters(
"MATCH (source:Memory)-[r:MEMORY_RELATES_TO]->(target:Memory) WHERE r.id = $relation_id SET r.relation_type = $relation_type, r.strength = $strength, r.confidence = $confidence, r.bidirectional = $bidirectional, r.status = $status, r.reviewed = $reviewed, r.source = $source, r.author_id = $author_id, r.agent_id = $agent_id, r.source_app = $source_app, r.reason = $reason, r.properties = $properties, r.updated_at = timestamp($updated_at)",
BTreeMap::from([
(
"relation_id".to_string(),
Value::String("rest-mrel-update-1".to_string()),
),
(
"relation_type".to_string(),
Value::String("contradicts".to_string()),
),
("strength".to_string(), Value::Float(0.51)),
("confidence".to_string(), Value::Float(0.52)),
("bidirectional".to_string(), Value::Bool(true)),
("status".to_string(), Value::String("active".to_string())),
("reviewed".to_string(), Value::Bool(true)),
("source".to_string(), Value::String("rest".to_string())),
(
"author_id".to_string(),
Value::String("author-updated".to_string()),
),
(
"agent_id".to_string(),
Value::String("agent-updated".to_string()),
),
(
"source_app".to_string(),
Value::String("app-updated".to_string()),
),
(
"reason".to_string(),
Value::String("rest update".to_string()),
),
(
"properties".to_string(),
Value::String("{\"updated\":true}".to_string()),
),
(
"updated_at".to_string(),
Value::String("1970-01-01T00:00:02".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-mrel-update-source'})-[:MEMORY_RELATES_TO {id: 'rest-mrel-update-1', relation_type: 'supports', strength: 0.1, confidence: 0.2, bidirectional: false, status: 'suggested', reviewed: false, source: 'fixture', author_id: '', agent_id: '', source_app: 'fixture', reason: 'old', properties: '{}', updated_at: 1}]->(:Memory {id: 'rest-mrel-update-target'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-mrel-update-source', 'rest-mrel-update-target'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp memory relation create",
CypherFixtureStatement::with_parameters(
"MATCH (source:Memory), (target:Memory) WHERE source.id = $source_memory_id AND target.id = $target_memory_id CREATE (source)-[:MEMORY_RELATES_TO { id: $relation_id, relation_type: $relation_type, strength: $strength, confidence: $confidence, bidirectional: $bidirectional, status: $status, reviewed: $reviewed, source: $source, author_id: $author_id, agent_id: $agent_id, source_app: $source_app, reason: $reason, properties: $properties, created_at: timestamp($created_at), updated_at: timestamp($updated_at) }]->(target)",
BTreeMap::from([
(
"source_memory_id".to_string(),
Value::String("mcp-rel-create-source".to_string()),
),
(
"target_memory_id".to_string(),
Value::String("mcp-rel-create-target".to_string()),
),
(
"relation_id".to_string(),
Value::String("mcp-rel-create-1".to_string()),
),
(
"relation_type".to_string(),
Value::String("supports".to_string()),
),
("strength".to_string(), Value::Float(0.71)),
("confidence".to_string(), Value::Float(0.72)),
("bidirectional".to_string(), Value::Bool(false)),
("status".to_string(), Value::String("active".to_string())),
("reviewed".to_string(), Value::Bool(true)),
("source".to_string(), Value::String("mcp".to_string())),
("author_id".to_string(), Value::Null),
(
"agent_id".to_string(),
Value::String("agent-create".to_string()),
),
("source_app".to_string(), Value::String("codex".to_string())),
(
"reason".to_string(),
Value::String("create relation".to_string()),
),
("properties".to_string(), Value::String("{}".to_string())),
("created_at".to_string(), Value::Int(1_700_000_021)),
("updated_at".to_string(), Value::Int(1_700_000_022)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-rel-create-source'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-rel-create-target'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['mcp-rel-create-source', 'mcp-rel-create-target'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest memory relation create write",
CypherFixtureStatement::with_parameters(
"MATCH (source:Memory {id: $source_memory_id}), (target:Memory {id: $target_memory_id}) CREATE (source)-[r:MEMORY_RELATES_TO { id: $relation_id, relation_type: $relation_type, strength: $strength, confidence: $confidence, bidirectional: $bidirectional, status: $status, reviewed: $reviewed, source: $source, author_id: $author_id, agent_id: $agent_id, source_app: $source_app, reason: $reason, properties: $properties, created_at: timestamp($created_at), updated_at: timestamp($updated_at) }]->(target)",
BTreeMap::from([
(
"source_memory_id".to_string(),
Value::String("rest-mrel-create-source".to_string()),
),
(
"target_memory_id".to_string(),
Value::String("rest-mrel-create-target".to_string()),
),
(
"relation_id".to_string(),
Value::String("rest-mrel-create-1".to_string()),
),
(
"relation_type".to_string(),
Value::String("supports".to_string()),
),
("strength".to_string(), Value::Float(0.81)),
("confidence".to_string(), Value::Float(0.82)),
("bidirectional".to_string(), Value::Bool(false)),
("status".to_string(), Value::String("active".to_string())),
("reviewed".to_string(), Value::Bool(true)),
("source".to_string(), Value::String("rest".to_string())),
(
"author_id".to_string(),
Value::String("author-1".to_string()),
),
("agent_id".to_string(), Value::String("agent-1".to_string())),
("source_app".to_string(), Value::String("app-1".to_string())),
(
"reason".to_string(),
Value::String("rest create".to_string()),
),
("properties".to_string(), Value::String("{}".to_string())),
(
"created_at".to_string(),
Value::String("1970-01-01T00:00:00".to_string()),
),
(
"updated_at".to_string(),
Value::String("1970-01-01T00:00:01".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-mrel-create-source'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-mrel-create-target'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-mrel-create-source', 'rest-mrel-create-target'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp memory relation identity read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $memory_id}) RETURN m.id, CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END",
BTreeMap::from([(
"memory_id".to_string(),
Value::String("mcp-rel-identity-memory".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"m.id",
Value::String("mcp-rel-identity-memory".to_string()),
),
("space_id", Value::String("default".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-rel-identity-memory', space_id: ''})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'mcp-rel-identity-memory'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp memory relation endpoint spaces read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $memory_id}), (s:Source {id: $source_id}) RETURN m.space_id, s.space_id",
BTreeMap::from([
(
"memory_id".to_string(),
Value::String("mcp-relation-space-memory".to_string()),
),
(
"source_id".to_string(),
Value::String("mcp-relation-space-source".to_string()),
),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
("m.space_id", Value::String("team".to_string())),
("s.space_id", Value::String("team".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-relation-space-memory', space_id: 'team'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'mcp-relation-space-source', space_id: 'team'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['mcp-relation-space-memory', 'mcp-relation-space-source'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest memory relation identity detail read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $memory_id}) RETURN m.id, CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END, m.metadata, m.is_latest, m.lifecycle_state",
BTreeMap::from([(
"memory_id".to_string(),
Value::String("rest-mrel-identity-memory".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-mrel-identity-memory', space_id: '', metadata: '{}', is_latest: true, lifecycle_state: 'active'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'rest-mrel-identity-memory'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp memory relation existing id lookup",
CypherFixtureStatement::with_parameters(
"MATCH (source:Memory)-[r:MEMORY_RELATES_TO]->(target:Memory) WHERE source.id = $source_memory_id AND target.id = $target_memory_id AND COALESCE(r.status, 'active') <> 'deleted' RETURN r.id ORDER BY r.updated_at DESC LIMIT 1",
BTreeMap::from([
(
"source_memory_id".to_string(),
Value::String("mcp-rel-existing-source".to_string()),
),
(
"target_memory_id".to_string(),
Value::String("mcp-rel-existing-target".to_string()),
),
]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"r.id",
Value::String("mcp-rel-existing-newer".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-rel-existing-source'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-rel-existing-target'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (source:Memory {id: 'mcp-rel-existing-source'}), (target:Memory {id: 'mcp-rel-existing-target'}) CREATE (source)-[:MEMORY_RELATES_TO {id: 'mcp-rel-existing-older', status: 'active', updated_at: 20}]->(target)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (source:Memory {id: 'mcp-rel-existing-source'}), (target:Memory {id: 'mcp-rel-existing-target'}) CREATE (source)-[:MEMORY_RELATES_TO {id: 'mcp-rel-existing-newer', status: 'suggested', updated_at: 30}]->(target)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (source:Memory {id: 'mcp-rel-existing-source'}), (target:Memory {id: 'mcp-rel-existing-target'}) CREATE (source)-[:MEMORY_RELATES_TO {id: 'mcp-rel-existing-deleted', status: 'deleted', updated_at: 40}]->(target)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['mcp-rel-existing-source', 'mcp-rel-existing-target'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest memory relation existing bidirectional lookup",
CypherFixtureStatement::with_parameters(
"MATCH (source:Memory)-[r:MEMORY_RELATES_TO]->(target:Memory) WHERE r.status <> 'deleted' AND ( (source.id = $source_memory_id AND target.id = $target_memory_id) OR ( source.id = $target_memory_id AND target.id = $source_memory_id AND r.bidirectional = true ) ) RETURN r.id LIMIT 1",
BTreeMap::from([
(
"source_memory_id".to_string(),
Value::String("rest-mrel-existing-source".to_string()),
),
(
"target_memory_id".to_string(),
Value::String("rest-mrel-existing-target".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-mrel-existing-source'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'rest-mrel-existing-target'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (source:Memory {id: 'rest-mrel-existing-target'}), (target:Memory {id: 'rest-mrel-existing-source'}) CREATE (source)-[:MEMORY_RELATES_TO {id: 'rest-mrel-existing-1', status: 'active', bidirectional: true}]->(target)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['rest-mrel-existing-source', 'rest-mrel-existing-target'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp memory relation outgoing read",
CypherFixtureStatement::with_parameters(
"MATCH (a:Memory)-[r:MEMORY_RELATES_TO]->(b:Memory) WHERE a.id = $id AND r.status = 'active' RETURN r.id, b.id, b.title, r.relation_type, r.strength, r.confidence, r.bidirectional, r.reason, r.source, r.source_app, b.metadata, b.is_latest, b.lifecycle_state",
BTreeMap::from([(
"id".to_string(),
Value::String("mcp-rel-source".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("r.id", Value::String("mcp-rel-1".to_string())),
("b.id", Value::String("mcp-rel-target".to_string())),
("b.title", Value::String("MCP Relation Target".to_string())),
("r.relation_type", Value::String("supports".to_string())),
("r.strength", Value::Float(0.7)),
("r.confidence", Value::Float(0.8)),
("r.bidirectional", Value::Bool(true)),
("r.reason", Value::String("fixture".to_string())),
("r.source", Value::String("agent".to_string())),
("r.source_app", Value::String("mcp".to_string())),
("b.metadata", Value::String("{\"side\":\"target\"}".to_string())),
("b.is_latest", Value::Bool(true)),
("b.lifecycle_state", Value::String("active".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-rel-source', title: 'MCP Relation Source', metadata: '{\"side\":\"source\"}', is_latest: true, lifecycle_state: 'active'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-rel-target', title: 'MCP Relation Target', metadata: '{\"side\":\"target\"}', is_latest: true, lifecycle_state: 'active'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Memory {id: 'mcp-rel-source'}), (b:Memory {id: 'mcp-rel-target'}) CREATE (a)-[:MEMORY_RELATES_TO {id: 'mcp-rel-1', relation_type: 'supports', strength: 0.7, confidence: 0.8, bidirectional: true, status: 'active', reason: 'fixture', source: 'agent', source_app: 'mcp', updated_at: 10}]->(b)",
)),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"mcp memory relation incoming read",
CypherFixtureStatement::with_parameters(
"MATCH (a:Memory)-[r:MEMORY_RELATES_TO]->(b:Memory) WHERE b.id = $id AND r.status = 'active' RETURN r.id, a.id, a.title, r.relation_type, r.strength, r.confidence, r.bidirectional, r.reason, r.source, r.source_app, a.metadata, a.is_latest, a.lifecycle_state",
BTreeMap::from([(
"id".to_string(),
Value::String("mcp-rel-target".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("r.id", Value::String("mcp-rel-1".to_string())),
("a.id", Value::String("mcp-rel-source".to_string())),
("a.title", Value::String("MCP Relation Source".to_string())),
("r.relation_type", Value::String("supports".to_string())),
("r.strength", Value::Float(0.7)),
("r.confidence", Value::Float(0.8)),
("r.bidirectional", Value::Bool(true)),
("r.reason", Value::String("fixture".to_string())),
("r.source", Value::String("agent".to_string())),
("r.source_app", Value::String("mcp".to_string())),
("a.metadata", Value::String("{\"side\":\"source\"}".to_string())),
("a.is_latest", Value::Bool(true)),
("a.lifecycle_state", Value::String("active".to_string())),
])]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source revision history path read",
CypherFixtureStatement::with_parameters(
"MATCH p = (s:Source {id: $source_id})-[:REVISED_AS*1..10]->(older:Source) RETURN older.id as id, older.original_name as name, older.version as version, older.sha256 as sha256, older.created_at as created_at ORDER BY older.version DESC",
BTreeMap::from([(
"source_id".to_string(),
Value::String("source-current".to_string()),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("id", Value::String("source-v2".to_string())),
("name", Value::String("Draft v2".to_string())),
("version", Value::Int(2)),
("sha256", Value::String("sha-v2".to_string())),
("created_at", Value::Int(20)),
]),
compatibility_row([
("id", Value::String("source-v1".to_string())),
("name", Value::String("Draft v1".to_string())),
("version", Value::Int(1)),
("sha256", Value::String("sha-v1".to_string())),
("created_at", Value::Int(10)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-current', original_name: 'Draft current', version: 3, sha256: 'sha-current', created_at: 30})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-v2', original_name: 'Draft v2', version: 2, sha256: 'sha-v2', created_at: 20})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'source-v1', original_name: 'Draft v1', version: 1, sha256: 'sha-v1', created_at: 10})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (newer:Source {id: 'source-current'}), (older:Source {id: 'source-v2'}) CREATE (newer)-[:REVISED_AS]->(older)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (newer:Source {id: 'source-v2'}), (older:Source {id: 'source-v1'}) CREATE (newer)-[:REVISED_AS]->(older)",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"source detach delete cascade",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source {id: $id}) DETACH DELETE s",
BTreeMap::from([(
"id".to_string(),
Value::String("delete-source-1".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'delete-source-1', original_name: 'Delete me'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 1}), (s:Source {id: 'delete-source-1'}) CREATE (m)-[:SOURCED_FROM {chunk_index: 9}]->(s)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source {id: 'delete-source-1'}) OPTIONAL MATCH (:Memory)-[r:SOURCED_FROM]->(s) RETURN count(s) AS sources, count(r) AS rels",
),
ExpectedRows::Exact(vec![compatibility_row([
("sources", Value::Int(0)),
("rels", Value::Int(0)),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label merge node on create seed",
CypherFixtureStatement::new(
"MERGE (l:Label {id: 'label-1'}) ON CREATE SET l.name = 'Important', l.canonical_name = null, l.created_at = CURRENT_TIMESTAMP(), l.updated_at = 1",
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (l:Label {id: 'label-1'}) RETURN l.name AS name, count(l.created_at) AS created",
),
ExpectedRows::Exact(vec![compatibility_row([
("name", Value::String("Important".to_string())),
("created", Value::Int(1)),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label merge node on create and match set",
CypherFixtureStatement::new(
"MERGE (l:Label {id: 'label-1'}) ON CREATE SET l.name = 'Important', l.canonical_name = null, l.created_at = CURRENT_TIMESTAMP(), l.updated_at = 1 ON MATCH SET l.updated_at = 2, l.canonical_name = COALESCE(l.canonical_name, 'important')",
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (l:Label {id: 'label-1'}) RETURN l.name AS name, l.canonical_name AS canonical, l.updated_at AS updated, count(l.created_at) AS created",
),
ExpectedRows::Exact(vec![compatibility_row([
("name", Value::String("Important".to_string())),
("canonical", Value::String("important".to_string())),
("updated", Value::Int(2)),
("created", Value::Int(1)),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"matched relationship merge on create set",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $memory_id}), (l:Label {id: $label_id}) MERGE (m)-[r:HAS_LABEL]->(l) ON CREATE SET r.assigned_by = $assigned_by, r.created_at = $created_at, r.properties = $properties",
BTreeMap::from([
("memory_id".to_string(), Value::Int(1)),
("label_id".to_string(), Value::String("label-1".to_string())),
(
"assigned_by".to_string(),
Value::String("system".to_string()),
),
("created_at".to_string(), Value::Int(77)),
("properties".to_string(), Value::String("{}".to_string())),
]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 1})-[r:HAS_LABEL]->(l:Label {id: 'label-1'}) RETURN count(r) AS total, min(r.assigned_by) AS assigned_by, min(r.created_at) AS created_at, min(r.properties) AS properties",
),
ExpectedRows::Exact(vec![compatibility_row([
("total", Value::Int(1)),
("assigned_by", Value::String("system".to_string())),
("created_at", Value::Int(77)),
("properties", Value::String("{}".to_string())),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label merge transfer retarget relationship",
CypherFixtureStatement::new(
"MATCH (n:Memory)-[:HAS_LABEL]->(src:Label {id: 'label-1'}) MATCH (tgt:Label {id: 'label-2'}) MERGE (n)-[r:HAS_LABEL]->(tgt) ON CREATE SET r.assigned_by = 'label_merge', r.created_at = 7, r.properties = '{}'",
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-2', name: 'Merged'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 1})-[r:HAS_LABEL]->(l:Label {id: 'label-2'}) RETURN count(r) AS total, min(r.assigned_by) AS assigned_by, min(r.created_at) AS created_at",
),
ExpectedRows::Exact(vec![compatibility_row([
("total", Value::Int(1)),
("assigned_by", Value::String("label_merge".to_string())),
("created_at", Value::Int(7)),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label canonical lookup",
CypherFixtureStatement::with_parameters(
"MATCH (l:Label) WHERE l.canonical_name = $c RETURN l.id LIMIT 1",
BTreeMap::from([(
"c".to_string(),
Value::String("canonical_lookup_unique".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"l.id",
Value::String("label-canonical-1".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-canonical-1', name: 'Canonical', canonical_name: 'canonical_lookup_unique'})",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label canonical backfill read",
CypherFixtureStatement::new(
"MATCH (l:Label) WHERE l.canonical_name IS NULL RETURN l.id, l.name",
),
ExpectedRows::Unordered(vec![
compatibility_row([
("l.id", Value::String("orphan-blocking-label".to_string())),
("l.name", Value::String("Blocking Label".to_string())),
]),
compatibility_row([
("l.id", Value::String("label-2".to_string())),
("l.name", Value::String("Merged".to_string())),
]),
compatibility_row([
(
"l.id",
Value::String("label-canonical-backfill-1".to_string()),
),
(
"l.name",
Value::String("Canonical Backfill".to_string()),
),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-canonical-backfill-1', name: 'Canonical Backfill', canonical_name: NULL})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (l:Label {id: 'label-canonical-backfill-1'}) DETACH DELETE l",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label null-canonical bounded scan",
CypherFixtureStatement::with_parameters(
"MATCH (l:Label) WHERE l.canonical_name IS NULL RETURN l.id, l.name LIMIT $cap",
BTreeMap::from([("cap".to_string(), Value::Int(1))]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-null-scan-1', name: 'Null Scan Label', canonical_name: NULL})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (l:Label {id: 'label-null-scan-1'}) DETACH DELETE l",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label null-canonical backfill write",
CypherFixtureStatement::with_parameters(
"MATCH (l:Label {id: $id}) SET l.canonical_name = $c",
BTreeMap::from([
(
"id".to_string(),
Value::String("label-backfill-1".to_string()),
),
(
"c".to_string(),
Value::String("label_backfill".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-backfill-1', name: 'Label Backfill', canonical_name: NULL})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (l:Label {id: 'label-backfill-1'}) DETACH DELETE l",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label rename collision lookup",
CypherFixtureStatement::with_parameters(
"MATCH (l:Label) WHERE l.canonical_name = $c AND l.id <> $label_id RETURN l.id LIMIT 1",
BTreeMap::from([
(
"c".to_string(),
Value::String("collision_canonical".to_string()),
),
(
"label_id".to_string(),
Value::String("label-collision-source".to_string()),
),
]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"l.id",
Value::String("label-collision-target".to_string()),
)])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-collision-source', name: 'Collision Source', canonical_name: 'collision_source'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-collision-target', name: 'Collision Target', canonical_name: 'collision_canonical'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (l:Label) WHERE l.id IN ['label-collision-source', 'label-collision-target'] DETACH DELETE l",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label rename null-canonical collision scan",
CypherFixtureStatement::with_parameters(
"MATCH (l:Label) WHERE l.canonical_name IS NULL AND l.id <> $label_id RETURN l.id, l.name LIMIT 500",
BTreeMap::from([(
"label_id".to_string(),
Value::String("label-null-collision-source".to_string()),
)]),
),
ExpectedRows::RowCount(3),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-null-collision-source', name: 'Null Collision Source', canonical_name: 'null_collision_source'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-null-collision-target', name: 'Null Collision Target', canonical_name: NULL})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (l:Label) WHERE l.id IN ['label-null-collision-source', 'label-null-collision-target'] DETACH DELETE l",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"label existence lookup",
CypherFixtureStatement::with_parameters(
"MATCH (l:Label {id: $label_id}) RETURN l.id LIMIT 1",
BTreeMap::from([(
"label_id".to_string(),
Value::String("label-canonical-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([(
"l.id",
Value::String("label-canonical-1".to_string()),
)])]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label dynamic update set",
CypherFixtureStatement::with_parameters(
"MATCH (l:Label {id: $label_id}) SET l.updated_at = $updated_at, l.name = $name, l.canonical_name = $canonical",
BTreeMap::from([
(
"label_id".to_string(),
Value::String("label-1".to_string()),
),
("updated_at".to_string(), Value::Int(3)),
("name".to_string(), Value::String("Important Updated".to_string())),
(
"canonical".to_string(),
Value::String("important_updated".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (l:Label {id: 'label-1'}) RETURN l.name AS name, l.canonical_name AS canonical, l.updated_at AS updated",
),
ExpectedRows::Exact(vec![compatibility_row([
("name", Value::String("Important Updated".to_string())),
("canonical", Value::String("important_updated".to_string())),
("updated", Value::Int(3)),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label relationship remove from memory",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $memory_id})-[r:HAS_LABEL]->(l:Label {id: $label_id}) DELETE r",
BTreeMap::from([
("memory_id".to_string(), Value::Int(1)),
(
"label_id".to_string(),
Value::String("label-1".to_string()),
),
]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 1})-[r:HAS_LABEL]->(l:Label {id: 'label-1'}) RETURN count(r) AS total",
),
ExpectedRows::Exact(vec![compatibility_row([("total", Value::Int(0))])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label remove all from memory count",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $id})-[r:HAS_LABEL]->(:Label) RETURN COUNT(r)",
BTreeMap::from([(
"id".to_string(),
Value::String("label-remove-all-memory".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([("count(r)", Value::Int(2))])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'label-remove-all-memory'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-remove-all-a', name: 'Remove All A'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-remove-all-b', name: 'Remove All B'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'label-remove-all-memory'}), (l:Label {id: 'label-remove-all-a'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'label-remove-all-memory'}), (l:Label {id: 'label-remove-all-b'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['label-remove-all-memory', 'label-remove-all-a', 'label-remove-all-b'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label remove all from memory delete",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $id})-[r:HAS_LABEL]->(:Label) DELETE r",
BTreeMap::from([(
"id".to_string(),
Value::String("label-remove-all-delete-memory".to_string()),
)]),
),
ExpectedRows::RowCount(2),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'label-remove-all-delete-memory'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-remove-all-delete-a', name: 'Remove Delete A'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-remove-all-delete-b', name: 'Remove Delete B'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'label-remove-all-delete-memory'}), (l:Label {id: 'label-remove-all-delete-a'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'label-remove-all-delete-memory'}), (l:Label {id: 'label-remove-all-delete-b'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['label-remove-all-delete-memory', 'label-remove-all-delete-a', 'label-remove-all-delete-b'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"label detach delete",
CypherFixtureStatement::with_parameters(
"MATCH (l:Label {id: $label_id}) DETACH DELETE l",
BTreeMap::from([(
"label_id".to_string(),
Value::String("label-1".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mention relationship target-filter multi property update",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $memory_id})-[r:MENTIONS]->(e:Entity {id: $target_id}) SET r.confidence = $confidence, r.mention_count = $mention_count, r.created_at = $created_at",
BTreeMap::from([
(
"memory_id".to_string(),
Value::String("mention-memory".to_string()),
),
(
"target_id".to_string(),
Value::String("mention-entity".to_string()),
),
("confidence".to_string(), Value::Float(0.92)),
("mention_count".to_string(), Value::Int(3)),
("created_at".to_string(), Value::Int(42)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mention-memory'})-[:MENTIONS {confidence: 0.1, mention_count: 1, created_at: 1}]->(:Entity {id: 'mention-entity'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'mention-memory'})-[r:MENTIONS]->(e:Entity {id: 'mention-entity'}) RETURN r.confidence AS confidence, r.mention_count AS mention_count, r.created_at AS created_at",
),
ExpectedRows::Exact(vec![compatibility_row([
("confidence", Value::Float(0.92)),
("mention_count", Value::Int(3)),
("created_at", Value::Int(42)),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp memory mentions read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[r:MENTIONS]->(e:Entity) WHERE m.id = $id RETURN e.id, e.name, e.entity_type, r.confidence",
BTreeMap::from([(
"id".to_string(),
Value::String("mcp-rel-source".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("e.id", Value::String("mcp-mention-entity".to_string())),
("e.name", Value::String("MCP Mention Entity".to_string())),
("e.entity_type", Value::String("concept".to_string())),
("r.confidence", Value::Float(0.91)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'mcp-mention-entity', name: 'MCP Mention Entity', entity_type: 'concept'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'mcp-rel-source'}), (e:Entity {id: 'mcp-mention-entity'}) CREATE (m)-[:MENTIONS {confidence: 0.91}]->(e)",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp source synthesized crystal read",
CypherFixtureStatement::with_parameters(
"MATCH (c:Memory)-[r:SYNTHESIZED_FROM]->(s:Memory) WHERE s.id = $id RETURN c.id, c.crystal_title, r.weight",
BTreeMap::from([(
"id".to_string(),
Value::String("mcp-rel-source".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("c.id", Value::String("mcp-reverse-crystal".to_string())),
(
"c.crystal_title",
Value::String("MCP Reverse Crystal".to_string()),
),
("r.weight", Value::Float(0.44)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-reverse-crystal', crystal_title: 'MCP Reverse Crystal', is_crystal: true})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (c:Memory {id: 'mcp-reverse-crystal'}), (s:Memory {id: 'mcp-rel-source'}) CREATE (c)-[:SYNTHESIZED_FROM {weight: 0.44}]->(s)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['mcp-rel-source', 'mcp-rel-target', 'mcp-mention-entity', 'mcp-reverse-crystal'] DETACH DELETE n",
),
ExpectedRows::RowCount(4),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory monthly date part aggregate read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.created_at IS NOT NULL AND m.space_id = $space_id WITH date_part('year', m.created_at) AS year, date_part('month', m.created_at) AS month, COUNT(m) AS memory_count RETURN year, month, memory_count ORDER BY year DESC, month DESC LIMIT $months",
BTreeMap::from([
(
"space_id".to_string(),
Value::String("date-part-space".to_string()),
),
("months".to_string(), Value::Int(3)),
]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("year", Value::Int(2024)),
("month", Value::Int(2)),
("memory_count", Value::Int(2)),
]),
compatibility_row([
("year", Value::Int(2024)),
("month", Value::Int(1)),
("memory_count", Value::Int(1)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::with_parameters(
"CREATE (:Memory {id: 'date-part-jan', space_id: 'date-part-space', lifecycle_state: 'archived', created_at: timestamp($created_at)})",
BTreeMap::from([(
"created_at".to_string(),
Value::String("2024-01-15T00:00:00".to_string()),
)]),
))
.with_setup_query(CypherFixtureStatement::with_parameters(
"CREATE (:Memory {id: 'date-part-feb-1', space_id: 'date-part-space', lifecycle_state: 'archived', created_at: timestamp($created_at)})",
BTreeMap::from([(
"created_at".to_string(),
Value::String("2024-02-01T00:00:00".to_string()),
)]),
))
.with_setup_query(CypherFixtureStatement::with_parameters(
"CREATE (:Memory {id: 'date-part-feb-2', space_id: 'date-part-space', lifecycle_state: 'archived', created_at: timestamp($created_at)})",
BTreeMap::from([(
"created_at".to_string(),
Value::String("2024-02-20T00:00:00".to_string()),
)]),
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"relationship count aggregate order read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity)-[r:RELATES_TO]-(:Entity) WHERE r.confidence >= $conf AND r.strength >= $strength RETURN e.id, COUNT(r) ORDER BY COUNT(r) DESC LIMIT $limit",
BTreeMap::from([
("conf".to_string(), Value::Float(0.5)),
("strength".to_string(), Value::Float(0.5)),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
("e.id", Value::String("degree-e1".to_string())),
("count(r)", Value::Int(3)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'degree-e1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'degree-e2'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'degree-e3'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'degree-e4'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Entity {id: 'degree-e1'}), (b:Entity {id: 'degree-e2'}) CREATE (a)-[:RELATES_TO {confidence: 0.9, strength: 0.8}]->(b)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Entity {id: 'degree-e1'}), (b:Entity {id: 'degree-e3'}) CREATE (a)-[:RELATES_TO {confidence: 0.8, strength: 0.7}]->(b)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Entity {id: 'degree-e1'}), (b:Entity {id: 'degree-e4'}) CREATE (a)-[:RELATES_TO {confidence: 0.7, strength: 0.6}]->(b)",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory mention entity count aggregate read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {community_id: $community_id})<-[:MENTIONS]-(m:Memory) WHERE m.is_crystal = false WITH m, COUNT(e) AS entity_count RETURN m.id, m.title, m.content, m.unit_type, m.metadata, COALESCE(m.is_latest, true), entity_count ORDER BY entity_count DESC, m.importance DESC LIMIT $limit",
BTreeMap::from([
("community_id".to_string(), Value::Int(77)),
("limit".to_string(), Value::Int(2)),
]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("m.id", Value::String("mention-count-m1".to_string())),
("m.title", Value::String("Memory one".to_string())),
("m.content", Value::String("first".to_string())),
("m.unit_type", Value::String("fact".to_string())),
("m.metadata", Value::String("{}".to_string())),
("coalesce", Value::Bool(true)),
("entity_count", Value::Int(2)),
]),
compatibility_row([
("m.id", Value::String("mention-count-m2".to_string())),
("m.title", Value::String("Memory two".to_string())),
("m.content", Value::String("second".to_string())),
("m.unit_type", Value::String("fact".to_string())),
("m.metadata", Value::String("{}".to_string())),
("coalesce", Value::Bool(true)),
("entity_count", Value::Int(1)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'mention-count-e1', community_id: 77})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'mention-count-e2', community_id: 77})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mention-count-m1', title: 'Memory one', content: 'first', unit_type: 'fact', metadata: '{}', is_latest: true, is_crystal: false, importance: 0.6})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mention-count-m2', title: 'Memory two', content: 'second', unit_type: 'fact', metadata: '{}', is_latest: true, is_crystal: false, importance: 0.9})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'mention-count-m1'}), (e:Entity {id: 'mention-count-e1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'mention-count-m1'}), (e:Entity {id: 'mention-count-e2'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'mention-count-m2'}), (e:Entity {id: 'mention-count-e1'}) CREATE (m)-[:MENTIONS]->(e)",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"community top memory collect entity ids read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {community_id: $community_id})<-[:MENTIONS]-(m:Memory) WITH m, COUNT(e) as entity_count, COLLECT(DISTINCT e.id) as entity_ids RETURN m, entity_count, entity_ids ORDER BY entity_count DESC, m.importance DESC, COALESCE(m.pagerank_score, 0.0) DESC LIMIT 1",
BTreeMap::from([("community_id".to_string(), Value::Int(7800))]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'community-top-e1', community_id: 7800})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'community-top-e2', community_id: 7800})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'community-top-m1', title: 'Top Memory', importance: 0.8, pagerank_score: 0.4})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'community-top-m2', title: 'Other Memory', importance: 0.9, pagerank_score: 0.5})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'community-top-m1'}), (e:Entity {id: 'community-top-e1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'community-top-m1'}), (e:Entity {id: 'community-top-e2'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'community-top-m2'}), (e:Entity {id: 'community-top-e1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['community-top-e1', 'community-top-e2', 'community-top-m1', 'community-top-m2'] DETACH DELETE n",
),
ExpectedRows::RowCount(4),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"community memories collect entity ids read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {community_id: $community_id})<-[:MENTIONS]-(m:Memory) WITH m, COUNT(e) as entity_count, COLLECT(DISTINCT e.id) as entity_ids RETURN m, entity_count, entity_ids ORDER BY entity_count DESC, m.importance DESC, COALESCE(m.pagerank_score, 0.0) DESC LIMIT $limit",
BTreeMap::from([
("community_id".to_string(), Value::Int(7801)),
("limit".to_string(), Value::Int(2)),
]),
),
ExpectedRows::RowCount(2),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'community-list-e1', community_id: 7801})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'community-list-e2', community_id: 7801})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'community-list-m1', title: 'List Memory One', importance: 0.8, pagerank_score: 0.4})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'community-list-m2', title: 'List Memory Two', importance: 0.7, pagerank_score: 0.5})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'community-list-m1'}), (e:Entity {id: 'community-list-e1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'community-list-m1'}), (e:Entity {id: 'community-list-e2'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'community-list-m2'}), (e:Entity {id: 'community-list-e1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['community-list-e1', 'community-list-e2', 'community-list-m1', 'community-list-m2'] DETACH DELETE n",
),
ExpectedRows::RowCount(4),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"entity strategy collect entity nodes read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[:MENTIONS]->(e:Entity) WHERE e.id IN $entity_ids WITH m, COLLECT(DISTINCT e) as entity_nodes, COUNT(DISTINCT e) as entity_count RETURN m, entity_nodes, entity_count ORDER BY entity_count DESC, m.importance DESC, COALESCE(m.pagerank_score, 0.0) DESC LIMIT $limit",
BTreeMap::from([
(
"entity_ids".to_string(),
Value::List(vec![
Value::String("entity-strategy-e1".to_string()),
Value::String("entity-strategy-e2".to_string()),
]),
),
("limit".to_string(), Value::Int(2)),
]),
),
ExpectedRows::RowCount(2),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-strategy-e1', name: 'Strategy One'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-strategy-e2', name: 'Strategy Two'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'entity-strategy-m1', title: 'Strategy Memory One', importance: 0.9, pagerank_score: 0.4})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'entity-strategy-m2', title: 'Strategy Memory Two', importance: 0.8, pagerank_score: 0.5})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'entity-strategy-m1'}), (e:Entity {id: 'entity-strategy-e1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'entity-strategy-m1'}), (e:Entity {id: 'entity-strategy-e2'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'entity-strategy-m2'}), (e:Entity {id: 'entity-strategy-e1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['entity-strategy-e1', 'entity-strategy-e2', 'entity-strategy-m1', 'entity-strategy-m2'] DETACH DELETE n",
),
ExpectedRows::RowCount(4),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"community memory coalesced summary read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {community_id: $community_id})<-[:MENTIONS]-(m:Memory) WHERE COALESCE(m.is_crystal, false) = false WITH m, COUNT(e) AS entity_count RETURN m.id, COALESCE(m.title, ''), COALESCE(m.content, ''), entity_count ORDER BY entity_count DESC, COALESCE(m.importance, 0.5) DESC LIMIT 10",
BTreeMap::from([("community_id".to_string(), Value::Int(9800))]),
),
ExpectedRows::Exact(vec![
compatibility_row([
(
"m.id",
Value::String("coalesced-community-memory-2".to_string()),
),
("coalesce", Value::String(String::new())),
("coalesce#2", Value::String("body two".to_string())),
("entity_count", Value::Int(1)),
]),
compatibility_row([
(
"m.id",
Value::String("coalesced-community-memory-1".to_string()),
),
("coalesce", Value::String("Title One".to_string())),
("coalesce#2", Value::String(String::new())),
("entity_count", Value::Int(1)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'coalesced-community-entity-1', community_id: 9800})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'coalesced-community-entity-2', community_id: 9800})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'coalesced-community-memory-1', title: 'Title One'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'coalesced-community-memory-2', content: 'body two', is_crystal: false, importance: 0.8})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'coalesced-community-memory-1'}), (e:Entity {id: 'coalesced-community-entity-1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'coalesced-community-memory-2'}), (e:Entity {id: 'coalesced-community-entity-2'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['coalesced-community-memory-1', 'coalesced-community-memory-2', 'coalesced-community-entity-1', 'coalesced-community-entity-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(4),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"rest list community summary ranked read",
CypherFixtureStatement::with_parameters(
"MATCH (c:Community) WHERE c.ai_summary IS NOT NULL AND c.ai_summary <> '' RETURN c.id, c.community_id, c.name, c.description, c.ai_summary, c.member_count ORDER BY c.member_count DESC LIMIT $limit",
BTreeMap::from([("limit".to_string(), Value::Int(10))]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'rest-list-community-summary-1', community_id: 9901, name: 'REST List Community', description: 'community description', ai_summary: 'community summary', member_count: 41})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'rest-list-community-empty-1', community_id: 9902, name: 'Empty Summary Community', ai_summary: '', member_count: 99})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (c:Community) WHERE c.id IN ['rest-list-community-summary-1', 'rest-list-community-empty-1'] DETACH DELETE c",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label distinct memory count aggregate read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[:HAS_LABEL]->(l:Label) WITH l, COUNT(DISTINCT m) AS memory_count RETURN l.name, memory_count ORDER BY memory_count DESC, l.name ASC SKIP $offset LIMIT $limit",
BTreeMap::from([
("offset".to_string(), Value::Int(0)),
("limit".to_string(), Value::Int(10)),
]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("l.name", Value::String("alpha".to_string())),
("memory_count", Value::Int(2)),
]),
compatibility_row([
("l.name", Value::String("Important".to_string())),
("memory_count", Value::Int(1)),
]),
compatibility_row([
("l.name", Value::String("Merged".to_string())),
("memory_count", Value::Int(1)),
]),
compatibility_row([
("l.name", Value::String("beta".to_string())),
("memory_count", Value::Int(1)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'label-count-m1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'label-count-m2'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-count-alpha', name: 'alpha'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-count-beta', name: 'beta'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'label-count-m1'}), (l:Label {id: 'label-count-alpha'}) CREATE (m)-[:HAS_LABEL {source: 'first'}]->(l)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'label-count-m1'}), (l:Label {id: 'label-count-alpha'}) CREATE (m)-[:HAS_LABEL {source: 'duplicate'}]->(l)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'label-count-m2'}), (l:Label {id: 'label-count-alpha'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'label-count-m2'}), (l:Label {id: 'label-count-beta'}) CREATE (m)-[:HAS_LABEL]->(l)",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"label regex memory connection aggregate read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[hl:HAS_LABEL]->(l:Label) WHERE l.name =~ $pattern RETURN DISTINCT m, l.name as label_name, COUNT(*) as label_connections ORDER BY label_connections DESC LIMIT $limit",
BTreeMap::from([
(
"pattern".to_string(),
Value::String("^regex-(alpha|beta)$".to_string()),
),
("limit".to_string(), Value::Int(10)),
]),
),
ExpectedRows::RowCount(2),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'label-regex-m1', importance: 0.9})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'label-regex-m2', importance: 0.8})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-regex-alpha', name: 'regex-alpha'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-regex-beta', name: 'regex-beta'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-regex-gamma', name: 'regex-gamma'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'label-regex-m1'}), (l:Label {id: 'label-regex-alpha'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'label-regex-m2'}), (l:Label {id: 'label-regex-beta'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'label-regex-m2'}), (l:Label {id: 'label-regex-gamma'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['label-regex-m1', 'label-regex-m2', 'label-regex-alpha', 'label-regex-beta', 'label-regex-gamma'] DETACH DELETE n",
),
ExpectedRows::RowCount(5),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"okf export label rows read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[:HAS_LABEL]->(l:Label) WITH l, COUNT(DISTINCT m) AS member_count RETURN l.name, member_count ORDER BY member_count DESC, l.name ASC LIMIT $limit",
BTreeMap::from([("limit".to_string(), Value::Int(2))]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("l.name", Value::String("OKF Label Alpha".to_string())),
("member_count", Value::Int(4)),
]),
compatibility_row([
("l.name", Value::String("OKF Label Beta".to_string())),
("member_count", Value::Int(3)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'okf-label-row-alpha', name: 'OKF Label Alpha'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'okf-label-row-beta', name: 'OKF Label Beta'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'okf-label-row-gamma', name: 'OKF Label Gamma'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'okf-label-row-m1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'okf-label-row-m2'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'okf-label-row-m3'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'okf-label-row-m4'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'okf-label-row-m1'}), (l:Label {id: 'okf-label-row-alpha'}) CREATE (m)-[:HAS_LABEL {source: 'first'}]->(l)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'okf-label-row-m1'}), (l:Label {id: 'okf-label-row-alpha'}) CREATE (m)-[:HAS_LABEL {source: 'duplicate'}]->(l)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'okf-label-row-m2'}), (l:Label {id: 'okf-label-row-alpha'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'okf-label-row-m3'}), (l:Label {id: 'okf-label-row-alpha'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'okf-label-row-m4'}), (l:Label {id: 'okf-label-row-alpha'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'okf-label-row-m1'}), (l:Label {id: 'okf-label-row-beta'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'okf-label-row-m2'}), (l:Label {id: 'okf-label-row-beta'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'okf-label-row-m3'}), (l:Label {id: 'okf-label-row-beta'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'okf-label-row-m4'}), (l:Label {id: 'okf-label-row-gamma'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['okf-label-row-alpha', 'okf-label-row-beta', 'okf-label-row-gamma', 'okf-label-row-m1', 'okf-label-row-m2', 'okf-label-row-m3', 'okf-label-row-m4'] DETACH DELETE n",
),
ExpectedRows::RowCount(7),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mention breadth aggregate pre-return order read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[men:MENTIONS]->(e:Entity) WHERE e.id IN $ids WITH m, COUNT(DISTINCT e) AS mention_breadth ORDER BY mention_breadth DESC, COALESCE(m.importance, 0.5) DESC LIMIT $top_n RETURN m.id, m.title, m.content, m.importance, m.is_crystal, mention_breadth",
BTreeMap::from([
(
"ids".to_string(),
Value::List(vec![
Value::String("breadth-e1".to_string()),
Value::String("breadth-e2".to_string()),
]),
),
("top_n".to_string(), Value::Int(2)),
]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("m.id", Value::String("breadth-m1".to_string())),
("m.title", Value::String("Breadth one".to_string())),
("m.content", Value::String("first breadth".to_string())),
("m.importance", Value::Float(0.2)),
("m.is_crystal", Value::Bool(false)),
("mention_breadth", Value::Int(2)),
]),
compatibility_row([
("m.id", Value::String("breadth-m3".to_string())),
("m.title", Value::String("Breadth three".to_string())),
("m.content", Value::String("third breadth".to_string())),
("m.importance", Value::Float(0.9)),
("m.is_crystal", Value::Bool(false)),
("mention_breadth", Value::Int(1)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'breadth-e1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'breadth-e2'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'breadth-m1', title: 'Breadth one', content: 'first breadth', importance: 0.2, is_crystal: false})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'breadth-m2', title: 'Breadth two', content: 'second breadth', importance: 0.4, is_crystal: false})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'breadth-m3', title: 'Breadth three', content: 'third breadth', importance: 0.9, is_crystal: false})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'breadth-m1'}), (e:Entity {id: 'breadth-e1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'breadth-m1'}), (e:Entity {id: 'breadth-e1'}) CREATE (m)-[:MENTIONS {source: 'duplicate'}]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'breadth-m1'}), (e:Entity {id: 'breadth-e2'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'breadth-m2'}), (e:Entity {id: 'breadth-e1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'breadth-m3'}), (e:Entity {id: 'breadth-e2'}) CREATE (m)-[:MENTIONS]->(e)",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"entity bridge span aggregate read",
CypherFixtureStatement::with_parameters(
"MATCH (e1:Entity)-[:RELATES_TO]-(e2:Entity) WHERE e1.community_id IN $cids AND e2.community_id IN $cids AND e1.community_id <> e2.community_id WITH e1, COUNT(DISTINCT e2.community_id) AS community_span, COUNT(*) AS bridge_strength RETURN e1.id, e1.name, e1.community_id, community_span, bridge_strength ORDER BY community_span DESC, bridge_strength DESC LIMIT $limit",
BTreeMap::from([
(
"cids".to_string(),
Value::List(vec![
Value::Int(9010),
Value::Int(9020),
Value::Int(9030),
]),
),
("limit".to_string(), Value::Int(2)),
]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("e1.id", Value::String("bridge-e1".to_string())),
("e1.name", Value::String("Bridge One".to_string())),
("e1.community_id", Value::Int(9010)),
("community_span", Value::Int(2)),
("bridge_strength", Value::Int(3)),
]),
compatibility_row([
("e1.id", Value::String("bridge-e2".to_string())),
("e1.name", Value::String("Bridge Two".to_string())),
("e1.community_id", Value::Int(9020)),
("community_span", Value::Int(1)),
("bridge_strength", Value::Int(2)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'bridge-e1', name: 'Bridge One', community_id: 9010})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'bridge-e2', name: 'Bridge Two', community_id: 9020})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'bridge-e3', name: 'Bridge Three', community_id: 9030})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'bridge-e4', name: 'Bridge Four', community_id: 9020})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'bridge-e5', name: 'Bridge Five', community_id: 9010})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Entity {id: 'bridge-e1'}), (b:Entity {id: 'bridge-e2'}) CREATE (a)-[:RELATES_TO]->(b)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Entity {id: 'bridge-e1'}), (b:Entity {id: 'bridge-e3'}) CREATE (a)-[:RELATES_TO]->(b)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Entity {id: 'bridge-e1'}), (b:Entity {id: 'bridge-e4'}) CREATE (a)-[:RELATES_TO]->(b)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Entity {id: 'bridge-e5'}), (b:Entity {id: 'bridge-e2'}) CREATE (a)-[:RELATES_TO]->(b)",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"entity bridge span aggregate filter read",
CypherFixtureStatement::with_parameters(
"MATCH (e1:Entity)-[:RELATES_TO]-(e2:Entity) WHERE e1.community_id IS NOT NULL AND e2.community_id IS NOT NULL AND e1.community_id <> e2.community_id WITH e1, COUNT(DISTINCT e2.community_id) AS community_span, COUNT(*) AS bridge_strength WHERE community_span >= 2 RETURN e1.id, e1.name, e1.community_id, community_span, bridge_strength ORDER BY community_span DESC, bridge_strength DESC LIMIT $limit",
BTreeMap::from([("limit".to_string(), Value::Int(1))]),
),
ExpectedRows::Exact(vec![compatibility_row([
("e1.id", Value::String("bridge-filter-e1".to_string())),
("e1.name", Value::String("Bridge Filter One".to_string())),
("e1.community_id", Value::Int(9110)),
("community_span", Value::Int(4)),
("bridge_strength", Value::Int(4)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'bridge-filter-e1', name: 'Bridge Filter One', community_id: 9110})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'bridge-filter-e2', name: 'Bridge Filter Two', community_id: 9120})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'bridge-filter-e3', name: 'Bridge Filter Three', community_id: 9130})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'bridge-filter-e4', name: 'Bridge Filter Four', community_id: 9140})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'bridge-filter-e5', name: 'Bridge Filter Five', community_id: 9150})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Entity {id: 'bridge-filter-e1'}), (b:Entity {id: 'bridge-filter-e2'}) CREATE (a)-[:RELATES_TO]->(b)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Entity {id: 'bridge-filter-e1'}), (b:Entity {id: 'bridge-filter-e3'}) CREATE (a)-[:RELATES_TO]->(b)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Entity {id: 'bridge-filter-e1'}), (b:Entity {id: 'bridge-filter-e4'}) CREATE (a)-[:RELATES_TO]->(b)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Entity {id: 'bridge-filter-e1'}), (b:Entity {id: 'bridge-filter-e5'}) CREATE (a)-[:RELATES_TO]->(b)",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"search projection community candidate read",
CypherFixtureStatement::with_parameters(
"MATCH (c:Community) WITH c, CASE WHEN c.name IS NOT NULL THEN lower(c.name) ELSE '' END AS c_name, CASE WHEN c.description IS NOT NULL THEN lower(c.description) ELSE '' END AS c_description, CASE WHEN c.ai_summary IS NOT NULL THEN lower(c.ai_summary) ELSE '' END AS c_summary WHERE c_name CONTAINS $raw_query OR c_name CONTAINS $normalized_query OR c_description CONTAINS $raw_query OR c_description CONTAINS $normalized_query OR c_summary CONTAINS $raw_query OR c_summary CONTAINS $normalized_query RETURN c.community_id, c.name, c.description, c.ai_summary, c.member_count, CASE WHEN c_name = $raw_query THEN 3 WHEN c_name = $normalized_query THEN 3 WHEN c_name CONTAINS $raw_query THEN 2 WHEN c_name CONTAINS $normalized_query THEN 2 ELSE 1 END AS match_level ORDER BY match_level DESC, c.member_count DESC LIMIT $limit",
BTreeMap::from([
(
"raw_query".to_string(),
Value::String("graph search".to_string()),
),
(
"normalized_query".to_string(),
Value::String("graph search".to_string()),
),
("limit".to_string(), Value::Int(2)),
]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("c.community_id", Value::Int(6530)),
("c.name", Value::String("graph search".to_string())),
(
"c.description",
Value::String("exact community description".to_string()),
),
(
"c.ai_summary",
Value::String("exact community summary".to_string()),
),
("c.member_count", Value::Int(10)),
("match_level", Value::Int(3)),
]),
compatibility_row([
("c.community_id", Value::Int(6531)),
(
"c.name",
Value::String("Community Projection".to_string()),
),
(
"c.description",
Value::String("contains graph search in description".to_string()),
),
("c.ai_summary", Value::Null),
("c.member_count", Value::Int(50)),
("match_level", Value::Int(1)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'search-projection-community-exact', community_id: 6530, name: 'graph search', description: 'exact community description', ai_summary: 'exact community summary', member_count: 10})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'search-projection-community-description', community_id: 6531, name: 'Community Projection', description: 'contains graph search in description', ai_summary: NULL, member_count: 50})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (c:Community) WHERE c.id IN ['search-projection-community-exact', 'search-projection-community-description'] DETACH DELETE c",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"search projection source candidate read",
CypherFixtureStatement::with_parameters(
"MATCH (s:Source) WITH s, CASE WHEN s.original_name IS NOT NULL THEN lower(s.original_name) ELSE '' END AS s_name, CASE WHEN s.summary IS NOT NULL THEN lower(s.summary) ELSE '' END AS s_summary, CASE WHEN s.file_path IS NOT NULL THEN lower(s.file_path) ELSE '' END AS s_path, CASE WHEN s.source_type IS NOT NULL THEN lower(s.source_type) ELSE '' END AS s_type WHERE s_name CONTAINS $raw_query OR s_name CONTAINS $normalized_query OR s_summary CONTAINS $raw_query OR s_summary CONTAINS $normalized_query OR s_path CONTAINS $raw_query OR s_path CONTAINS $normalized_query OR s_type CONTAINS $raw_query OR s_type CONTAINS $normalized_query RETURN s.id, COALESCE(s.original_name, s.file_path, s.source_type, 'Source'), s.source_type, s.summary, s.file_path, s.memory_count, s.chunk_count, CASE WHEN s_name = $raw_query THEN 3 WHEN s_name = $normalized_query THEN 3 WHEN s_name CONTAINS $raw_query THEN 2 WHEN s_name CONTAINS $normalized_query THEN 2 ELSE 1 END AS match_level ORDER BY match_level DESC, COALESCE(s.memory_count, 0) DESC, COALESCE(s.chunk_count, 0) DESC LIMIT $limit",
BTreeMap::from([
(
"raw_query".to_string(),
Value::String("graph source".to_string()),
),
(
"normalized_query".to_string(),
Value::String("graph source".to_string()),
),
("limit".to_string(), Value::Int(3)),
]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("s.id", Value::String("search-source-exact".to_string())),
("coalesce", Value::String("graph source".to_string())),
("s.source_type", Value::String("document".to_string())),
("s.summary", Value::String("exact summary".to_string())),
(
"s.file_path",
Value::String("/tmp/exact-source.md".to_string()),
),
("s.memory_count", Value::Int(1)),
("s.chunk_count", Value::Int(1)),
("match_level", Value::Int(3)),
]),
compatibility_row([
("s.id", Value::String("search-source-summary".to_string())),
(
"coalesce",
Value::String("/tmp/summary-source.md".to_string()),
),
("s.source_type", Value::String("file".to_string())),
(
"s.summary",
Value::String("contains graph source context".to_string()),
),
(
"s.file_path",
Value::String("/tmp/summary-source.md".to_string()),
),
("s.memory_count", Value::Int(8)),
("s.chunk_count", Value::Int(2)),
("match_level", Value::Int(1)),
]),
compatibility_row([
("s.id", Value::String("search-source-path".to_string())),
(
"coalesce",
Value::String("/tmp/graph source path.md".to_string()),
),
("s.source_type", Value::String("file".to_string())),
("s.summary", Value::Null),
(
"s.file_path",
Value::String("/tmp/graph source path.md".to_string()),
),
("s.memory_count", Value::Null),
("s.chunk_count", Value::Int(7)),
("match_level", Value::Int(1)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'search-source-exact', original_name: 'graph source', source_type: 'document', summary: 'exact summary', file_path: '/tmp/exact-source.md', memory_count: 1, chunk_count: 1})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'search-source-summary', original_name: NULL, source_type: 'file', summary: 'contains graph source context', file_path: '/tmp/summary-source.md', memory_count: 8, chunk_count: 2})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'search-source-path', original_name: NULL, source_type: 'file', summary: NULL, file_path: '/tmp/graph source path.md', memory_count: NULL, chunk_count: 7})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Source {id: 'search-source-outside', original_name: 'unrelated', source_type: 'file', summary: 'outside', file_path: '/tmp/outside.md', memory_count: 99, chunk_count: 99})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (s:Source) WHERE s.id IN ['search-source-exact', 'search-source-summary', 'search-source-path', 'search-source-outside'] DETACH DELETE s",
),
ExpectedRows::RowCount(4),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"search projection thread candidate read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WITH t, CASE WHEN t.title IS NOT NULL THEN lower(t.title) ELSE '' END AS t_title, CASE WHEN t.summary IS NOT NULL THEN lower(t.summary) ELSE '' END AS t_summary, CASE WHEN t.source IS NOT NULL THEN lower(t.source) ELSE '' END AS t_source, CASE WHEN t.project IS NOT NULL THEN lower(t.project) ELSE '' END AS t_project, CASE WHEN t.workspace IS NOT NULL THEN lower(t.workspace) ELSE '' END AS t_workspace WHERE t_title CONTAINS $raw_query OR t_title CONTAINS $normalized_query OR t_summary CONTAINS $raw_query OR t_summary CONTAINS $normalized_query OR t_source CONTAINS $raw_query OR t_source CONTAINS $normalized_query OR t_project CONTAINS $raw_query OR t_project CONTAINS $normalized_query OR t_workspace CONTAINS $raw_query OR t_workspace CONTAINS $normalized_query RETURN t.id, COALESCE(t.title, t.source, 'Thread'), t.source, t.summary, t.message_count, t.project, t.workspace, CASE WHEN t_title = $raw_query THEN 3 WHEN t_title = $normalized_query THEN 3 WHEN t_title CONTAINS $raw_query THEN 2 WHEN t_title CONTAINS $normalized_query THEN 2 ELSE 1 END AS match_level ORDER BY match_level DESC, COALESCE(t.message_count, 0) DESC LIMIT $limit",
BTreeMap::from([
(
"raw_query".to_string(),
Value::String("graph thread".to_string()),
),
(
"normalized_query".to_string(),
Value::String("graph thread".to_string()),
),
("limit".to_string(), Value::Int(3)),
]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("t.id", Value::String("search-thread-exact".to_string())),
("coalesce", Value::String("graph thread".to_string())),
("t.source", Value::String("codex".to_string())),
("t.summary", Value::String("exact thread summary".to_string())),
("t.message_count", Value::Int(1)),
("t.project", Value::String("hawdb".to_string())),
("t.workspace", Value::String("local".to_string())),
("match_level", Value::Int(3)),
]),
compatibility_row([
(
"t.id",
Value::String("search-thread-title-contains".to_string()),
),
("coalesce", Value::String("Graph Thread Notes".to_string())),
("t.source", Value::String("codex".to_string())),
(
"t.summary",
Value::String("title contains query".to_string()),
),
("t.message_count", Value::Null),
("t.project", Value::String("hawdb".to_string())),
("t.workspace", Value::String("local".to_string())),
("match_level", Value::Int(2)),
]),
compatibility_row([
("t.id", Value::String("search-thread-summary".to_string())),
("coalesce", Value::String("thread-source".to_string())),
("t.source", Value::String("thread-source".to_string())),
(
"t.summary",
Value::String("contains graph thread context".to_string()),
),
("t.message_count", Value::Int(8)),
("t.project", Value::String("hawdb".to_string())),
("t.workspace", Value::String("local".to_string())),
("match_level", Value::Int(1)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'search-thread-exact', title: 'graph thread', source: 'codex', summary: 'exact thread summary', message_count: 1, project: 'hawdb', workspace: 'local'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'search-thread-title-contains', title: 'Graph Thread Notes', source: 'codex', summary: 'title contains query', message_count: NULL, project: 'hawdb', workspace: 'local'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'search-thread-summary', title: NULL, source: 'thread-source', summary: 'contains graph thread context', message_count: 8, project: 'hawdb', workspace: 'local'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'search-thread-workspace', title: NULL, source: 'workspace-source', summary: 'workspace candidate', message_count: 4, project: 'other', workspace: 'graph thread workspace'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'search-thread-outside', title: 'unrelated', source: 'outside', summary: 'outside', message_count: 99, project: 'other', workspace: 'other'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (t:Thread) WHERE t.id IN ['search-thread-exact', 'search-thread-title-contains', 'search-thread-summary', 'search-thread-workspace', 'search-thread-outside'] DETACH DELETE t",
),
ExpectedRows::RowCount(5),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"community bridge lookup after aggregate read",
CypherFixtureStatement::with_parameters(
"MATCH (e1:Entity)-[:RELATES_TO]-(e2:Entity) WHERE e1.community_id = $cid AND e2.community_id IS NOT NULL AND e2.community_id <> $cid WITH e2.community_id AS other_cid, COUNT(*) AS shared_edge_count ORDER BY shared_edge_count DESC LIMIT $limit MATCH (c:Community) WHERE c.community_id = other_cid RETURN c.community_id, c.name, c.ai_summary, c.description, c.member_count, shared_edge_count",
BTreeMap::from([
("cid".to_string(), Value::Int(9210)),
("limit".to_string(), Value::Int(2)),
]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("c.community_id", Value::Int(9220)),
("c.name", Value::String("Bridge Community Two".to_string())),
("c.ai_summary", Value::String("two summary".to_string())),
("c.description", Value::String("two description".to_string())),
("c.member_count", Value::Int(20)),
("shared_edge_count", Value::Int(2)),
]),
compatibility_row([
("c.community_id", Value::Int(9230)),
("c.name", Value::String("Bridge Community Three".to_string())),
("c.ai_summary", Value::String("three summary".to_string())),
("c.description", Value::String("three description".to_string())),
("c.member_count", Value::Int(10)),
("shared_edge_count", Value::Int(1)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'bridge-community-2', community_id: 9220, name: 'Bridge Community Two', ai_summary: 'two summary', description: 'two description', member_count: 20})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'bridge-community-3', community_id: 9230, name: 'Bridge Community Three', ai_summary: 'three summary', description: 'three description', member_count: 10})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'bridge-lookup-e1', name: 'Bridge Lookup One', community_id: 9210})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'bridge-lookup-e2', name: 'Bridge Lookup Two', community_id: 9220})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'bridge-lookup-e3', name: 'Bridge Lookup Three', community_id: 9220})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'bridge-lookup-e4', name: 'Bridge Lookup Four', community_id: 9230})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Entity {id: 'bridge-lookup-e1'}), (b:Entity {id: 'bridge-lookup-e2'}) CREATE (a)-[:RELATES_TO]->(b)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Entity {id: 'bridge-lookup-e1'}), (b:Entity {id: 'bridge-lookup-e3'}) CREATE (a)-[:RELATES_TO]->(b)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Entity {id: 'bridge-lookup-e1'}), (b:Entity {id: 'bridge-lookup-e4'}) CREATE (a)-[:RELATES_TO]->(b)",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"community memory count optional lookup read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[:MENTIONS]->(e:Entity) WHERE m.space_id IN $space_ids AND e.community_id IS NOT NULL WITH e.community_id AS community_id, COUNT(DISTINCT m) AS memory_count OPTIONAL MATCH (c:Community) WHERE c.community_id = community_id RETURN c.name, memory_count, c.description ORDER BY memory_count DESC LIMIT $limit",
BTreeMap::from([
(
"space_ids".to_string(),
Value::List(vec![Value::String("bridge-space".to_string())]),
),
("limit".to_string(), Value::Int(2)),
]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("c.name", Value::String("Mention Community".to_string())),
("memory_count", Value::Int(2)),
("c.description", Value::String("mention description".to_string())),
]),
compatibility_row([
("c.name", Value::Null),
("memory_count", Value::Int(1)),
("c.description", Value::Null),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'mention-community', community_id: 9310, name: 'Mention Community', description: 'mention description'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'mention-community-e1', community_id: 9310})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'mention-community-e2', community_id: 9320})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mention-community-m1', space_id: 'bridge-space'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mention-community-m2', space_id: 'bridge-space'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mention-community-m3', space_id: 'bridge-space'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'mention-community-m1'}), (e:Entity {id: 'mention-community-e1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'mention-community-m2'}), (e:Entity {id: 'mention-community-e1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'mention-community-m3'}), (e:Entity {id: 'mention-community-e2'}) CREATE (m)-[:MENTIONS]->(e)",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"community summary presence ranked read",
CypherFixtureStatement::with_parameters(
"MATCH (c:Community) WHERE c.community_id IS NOT NULL AND c.community_id >= 0 RETURN c.community_id, c.name, c.description, c.ai_summary, c.member_count, c.updated_at ORDER BY CASE WHEN c.ai_summary IS NOT NULL AND c.ai_summary <> '' THEN 0 ELSE 1 END, c.member_count DESC LIMIT $limit",
BTreeMap::from([("limit".to_string(), Value::Int(2))]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("c.community_id", Value::Int(9410)),
("c.name", Value::String("Summary Ranked One".to_string())),
("c.description", Value::String("ranked one".to_string())),
("c.ai_summary", Value::String("summary one".to_string())),
("c.member_count", Value::Int(200)),
("c.updated_at", Value::Int(100)),
]),
compatibility_row([
("c.community_id", Value::Int(9420)),
("c.name", Value::String("Summary Ranked Two".to_string())),
("c.description", Value::String("ranked two".to_string())),
("c.ai_summary", Value::String("summary two".to_string())),
("c.member_count", Value::Int(150)),
("c.updated_at", Value::Int(200)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'summary-ranked-one', community_id: 9410, name: 'Summary Ranked One', description: 'ranked one', ai_summary: 'summary one', member_count: 200, updated_at: 100})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'summary-ranked-two', community_id: 9420, name: 'Summary Ranked Two', description: 'ranked two', ai_summary: 'summary two', member_count: 150, updated_at: 200})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'summary-ranked-empty', community_id: 9430, name: 'Summary Ranked Empty', description: 'ranked empty', ai_summary: '', member_count: 1000, updated_at: 300})",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"wiki community entity anchor visibility read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) WHERE e.community_id IN $cids OPTIONAL MATCH (m:Memory)-[r:MENTIONS]->(e) RETURN e.community_id, e.id, e.name, e.entity_type, m.id, m.metadata, COALESCE(m.is_latest, true), m.lifecycle_state ORDER BY e.community_id, e.name ASC",
BTreeMap::from([(
"cids".to_string(),
Value::List(vec![Value::Int(9790)]),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("e.community_id", Value::Int(9790)),
("e.id", Value::String("entity-anchor-alpha".to_string())),
("e.name", Value::String("Alpha Anchor".to_string())),
("e.entity_type", Value::String("concept".to_string())),
("m.id", Value::Null),
("m.metadata", Value::Null),
("coalesce", Value::Bool(true)),
("m.lifecycle_state", Value::Null),
]),
compatibility_row([
("e.community_id", Value::Int(9790)),
("e.id", Value::String("entity-anchor-beta".to_string())),
("e.name", Value::String("Beta Anchor".to_string())),
("e.entity_type", Value::String("concept".to_string())),
("m.id", Value::String("entity-anchor-memory".to_string())),
(
"m.metadata",
Value::String("{\"state\":\"active\"}".to_string()),
),
("coalesce", Value::Bool(true)),
("m.lifecycle_state", Value::String("active".to_string())),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-anchor-alpha', name: 'Alpha Anchor', entity_type: 'concept', community_id: 9790})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'entity-anchor-beta', name: 'Beta Anchor', entity_type: 'concept', community_id: 9790})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'entity-anchor-memory', metadata: '{\"state\":\"active\"}', is_latest: true, lifecycle_state: 'active'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'entity-anchor-memory'}), (e:Entity {id: 'entity-anchor-beta'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['entity-anchor-alpha', 'entity-anchor-beta', 'entity-anchor-memory'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"wiki community crystal source visibility read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[:SYNTHESIZED_FROM]->(src:Memory)-[:MENTIONS]->(e:Entity) WHERE m.is_crystal = true AND e.community_id IN $cids RETURN m.id, m.crystal_title, m.title, m.content, m.importance, e.community_id, m.metadata, COALESCE(m.is_latest, true), m.lifecycle_state, src.metadata, COALESCE(src.is_latest, true), src.lifecycle_state",
BTreeMap::from([(
"cids".to_string(),
Value::List(vec![Value::Int(9800)]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("m.id", Value::String("community-crystal".to_string())),
(
"m.crystal_title",
Value::String("Community Crystal".to_string()),
),
("m.title", Value::String("Crystal Fallback".to_string())),
("m.content", Value::String("crystal content".to_string())),
("m.importance", Value::Float(0.88)),
("e.community_id", Value::Int(9800)),
(
"m.metadata",
Value::String("{\"state\":\"active\"}".to_string()),
),
("coalesce", Value::Bool(true)),
("m.lifecycle_state", Value::String("active".to_string())),
(
"src.metadata",
Value::String("{\"state\":\"active\"}".to_string()),
),
("coalesce#2", Value::Bool(true)),
("src.lifecycle_state", Value::String("active".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'community-crystal', crystal_title: 'Community Crystal', title: 'Crystal Fallback', content: 'crystal content', importance: 0.88, is_crystal: true, metadata: '{\"state\":\"active\"}', is_latest: true, lifecycle_state: 'active'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'community-crystal-source', metadata: '{\"state\":\"active\"}', is_latest: true, lifecycle_state: 'active'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'community-crystal-entity', community_id: 9800})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'community-crystal'}), (src:Memory {id: 'community-crystal-source'}) CREATE (m)-[:SYNTHESIZED_FROM]->(src)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (src:Memory {id: 'community-crystal-source'}), (e:Entity {id: 'community-crystal-entity'}) CREATE (src)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['community-crystal', 'community-crystal-source', 'community-crystal-entity'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"wiki entity listing mention-count read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) WHERE e.name IS NOT NULL AND e.id IS NOT NULL OPTIONAL MATCH (:Memory)-[r:MENTIONS]->(e) WITH e, COUNT(r) AS mention_count RETURN e.id, e.name, e.updated_at, mention_count ORDER BY mention_count DESC, e.name ASC LIMIT $limit",
BTreeMap::from([("limit".to_string(), Value::Int(3))]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("e.id", Value::String("wiki-list-entity-alpha".to_string())),
("e.name", Value::String("Alpha Entity".to_string())),
("e.updated_at", Value::Int(300)),
("mention_count", Value::Int(4)),
]),
compatibility_row([
("e.id", Value::String("wiki-list-entity-beta".to_string())),
("e.name", Value::String("Beta Entity".to_string())),
("e.updated_at", Value::Int(200)),
("mention_count", Value::Int(3)),
]),
compatibility_row([
("e.id", Value::String("wiki-list-entity-gamma".to_string())),
("e.name", Value::String("Gamma Entity".to_string())),
("e.updated_at", Value::Int(100)),
("mention_count", Value::Int(2)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'wiki-list-entity-alpha', name: 'Alpha Entity', updated_at: 300})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'wiki-list-entity-beta', name: 'Beta Entity', updated_at: 200})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'wiki-list-entity-gamma', name: 'Gamma Entity', updated_at: 100})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'wiki-list-entity-missing-name', updated_at: 50})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-list-memory-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-list-memory-2'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-list-memory-3'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-list-memory-4'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-list-memory-5'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-list-memory-6'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-list-memory-7'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-list-memory-8'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-list-memory-1'}), (e:Entity {id: 'wiki-list-entity-alpha'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-list-memory-2'}), (e:Entity {id: 'wiki-list-entity-alpha'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-list-memory-3'}), (e:Entity {id: 'wiki-list-entity-alpha'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-list-memory-4'}), (e:Entity {id: 'wiki-list-entity-alpha'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-list-memory-5'}), (e:Entity {id: 'wiki-list-entity-beta'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-list-memory-6'}), (e:Entity {id: 'wiki-list-entity-beta'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-list-memory-7'}), (e:Entity {id: 'wiki-list-entity-beta'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-list-memory-8'}), (e:Entity {id: 'wiki-list-entity-gamma'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-list-memory-9'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-list-memory-9'}), (e:Entity {id: 'wiki-list-entity-gamma'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['wiki-list-entity-alpha', 'wiki-list-entity-beta', 'wiki-list-entity-gamma', 'wiki-list-entity-missing-name', 'wiki-list-memory-1', 'wiki-list-memory-2', 'wiki-list-memory-3', 'wiki-list-memory-4', 'wiki-list-memory-5', 'wiki-list-memory-6', 'wiki-list-memory-7', 'wiki-list-memory-8', 'wiki-list-memory-9'] DETACH DELETE n",
),
ExpectedRows::RowCount(13),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"wiki entity listing mention-count cursor read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) WHERE e.name IS NOT NULL AND e.id IS NOT NULL OPTIONAL MATCH (:Memory)-[r:MENTIONS]->(e) WITH e, COUNT(r) AS mention_count WHERE mention_count < $after_count OR (mention_count = $after_count AND e.name > $after_name) RETURN e.id, e.name, e.updated_at, mention_count ORDER BY mention_count DESC, e.name ASC LIMIT $limit",
BTreeMap::from([
("after_count".to_string(), Value::Int(3)),
("after_name".to_string(), Value::String("Cursor A".to_string())),
("limit".to_string(), Value::Int(2)),
]),
),
ExpectedRows::Exact(vec![
compatibility_row([
(
"e.id",
Value::String("wiki-cursor-entity-beta".to_string()),
),
("e.name", Value::String("Cursor Beta".to_string())),
("e.updated_at", Value::Int(200)),
("mention_count", Value::Int(3)),
]),
compatibility_row([
(
"e.id",
Value::String("wiki-cursor-entity-gamma".to_string()),
),
("e.name", Value::String("Cursor Gamma".to_string())),
("e.updated_at", Value::Int(100)),
("mention_count", Value::Int(2)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'wiki-cursor-entity-alpha', name: 'Cursor Alpha', updated_at: 300})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'wiki-cursor-entity-beta', name: 'Cursor Beta', updated_at: 200})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'wiki-cursor-entity-gamma', name: 'Cursor Gamma', updated_at: 100})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'wiki-cursor-entity-missing-name', updated_at: 50})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-cursor-memory-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-cursor-memory-2'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-cursor-memory-3'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-cursor-memory-4'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-cursor-memory-5'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-cursor-memory-6'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-cursor-memory-7'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-cursor-memory-8'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-cursor-memory-1'}), (e:Entity {id: 'wiki-cursor-entity-alpha'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-cursor-memory-2'}), (e:Entity {id: 'wiki-cursor-entity-alpha'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-cursor-memory-3'}), (e:Entity {id: 'wiki-cursor-entity-alpha'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-cursor-memory-4'}), (e:Entity {id: 'wiki-cursor-entity-alpha'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-cursor-memory-5'}), (e:Entity {id: 'wiki-cursor-entity-beta'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-cursor-memory-6'}), (e:Entity {id: 'wiki-cursor-entity-beta'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-cursor-memory-7'}), (e:Entity {id: 'wiki-cursor-entity-beta'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-cursor-memory-8'}), (e:Entity {id: 'wiki-cursor-entity-gamma'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-cursor-memory-9'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-cursor-memory-9'}), (e:Entity {id: 'wiki-cursor-entity-gamma'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['wiki-cursor-entity-alpha', 'wiki-cursor-entity-beta', 'wiki-cursor-entity-gamma', 'wiki-cursor-entity-missing-name', 'wiki-cursor-memory-1', 'wiki-cursor-memory-2', 'wiki-cursor-memory-3', 'wiki-cursor-memory-4', 'wiki-cursor-memory-5', 'wiki-cursor-memory-6', 'wiki-cursor-memory-7', 'wiki-cursor-memory-8', 'wiki-cursor-memory-9'] DETACH DELETE n",
),
ExpectedRows::RowCount(13),
),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"wiki export summary entity count",
CypherFixtureStatement::new("MATCH (e:Entity) RETURN COUNT(e)"),
ExpectedRows::RowCount(1),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"wiki export summary crystal count",
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.is_crystal = true RETURN COUNT(m)",
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-summary-crystal', is_crystal: true})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-summary-crystal'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"wiki export summary community count",
CypherFixtureStatement::new(
"MATCH (c:Community) WHERE c.community_id IS NOT NULL AND c.community_id >= 0 AND c.ai_summary IS NOT NULL AND c.ai_summary <> '' AND c.name <> 'Knowledge Network' AND c.name <> 'Concept Cluster' AND c.name <> 'Small Group' RETURN COUNT(c)",
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'wiki-summary-community', community_id: 9510, name: 'Wiki Summary Community', ai_summary: 'summary'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'wiki-summary-community-excluded', community_id: 9520, name: 'Knowledge Network', ai_summary: 'summary'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (c:Community) WHERE c.id IN ['wiki-summary-community', 'wiki-summary-community-excluded'] DETACH DELETE c",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"wiki topic entity mention-count read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) WHERE e.community_id = $cid OPTIONAL MATCH (:Memory)-[r:MENTIONS]->(e) RETURN e.id, e.name, e.entity_type, COUNT(r) AS mention_count ORDER BY mention_count DESC, e.name ASC LIMIT $limit",
BTreeMap::from([
("cid".to_string(), Value::Int(9750)),
("limit".to_string(), Value::Int(2)),
]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("e.id", Value::String("wiki-topic-entity-alpha".to_string())),
("e.name", Value::String("Wiki Topic Alpha".to_string())),
("e.entity_type", Value::String("concept".to_string())),
("mention_count", Value::Int(3)),
]),
compatibility_row([
("e.id", Value::String("wiki-topic-entity-beta".to_string())),
("e.name", Value::String("Wiki Topic Beta".to_string())),
("e.entity_type", Value::String("topic".to_string())),
("mention_count", Value::Int(2)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'wiki-topic-entity-alpha', name: 'Wiki Topic Alpha', entity_type: 'concept', community_id: 9750})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'wiki-topic-entity-beta', name: 'Wiki Topic Beta', entity_type: 'topic', community_id: 9750})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'wiki-topic-entity-other', name: 'Wiki Topic Other', entity_type: 'topic', community_id: 9751})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-topic-entity-m1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-topic-entity-m2'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-topic-entity-m3'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-topic-entity-m4'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-topic-entity-m5'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-topic-entity-m1'}), (e:Entity {id: 'wiki-topic-entity-alpha'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-topic-entity-m2'}), (e:Entity {id: 'wiki-topic-entity-alpha'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-topic-entity-m3'}), (e:Entity {id: 'wiki-topic-entity-alpha'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-topic-entity-m4'}), (e:Entity {id: 'wiki-topic-entity-beta'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-topic-entity-m5'}), (e:Entity {id: 'wiki-topic-entity-beta'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['wiki-topic-entity-alpha', 'wiki-topic-entity-beta', 'wiki-topic-entity-other', 'wiki-topic-entity-m1', 'wiki-topic-entity-m2', 'wiki-topic-entity-m3', 'wiki-topic-entity-m4', 'wiki-topic-entity-m5'] DETACH DELETE n",
),
ExpectedRows::RowCount(8),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"wiki topic crystal ranking read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[:SYNTHESIZED_FROM]->(src:Memory)-[:MENTIONS]->(e:Entity) WHERE m.is_crystal = true AND e.community_id = $cid RETURN m.id, m.crystal_title, m.title, m.content, m.importance, COUNT(e) AS hits ORDER BY hits DESC, m.importance DESC LIMIT $limit",
BTreeMap::from([
("cid".to_string(), Value::Int(9760)),
("limit".to_string(), Value::Int(2)),
]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("m.id", Value::String("wiki-topic-crystal-alpha".to_string())),
(
"m.crystal_title",
Value::String("Wiki Crystal Alpha".to_string()),
),
("m.title", Value::String("Alpha fallback".to_string())),
("m.content", Value::String("alpha crystal body".to_string())),
("m.importance", Value::Float(0.8)),
("hits", Value::Int(3)),
]),
compatibility_row([
("m.id", Value::String("wiki-topic-crystal-beta".to_string())),
(
"m.crystal_title",
Value::String("Wiki Crystal Beta".to_string()),
),
("m.title", Value::String("Beta fallback".to_string())),
("m.content", Value::String("beta crystal body".to_string())),
("m.importance", Value::Float(0.9)),
("hits", Value::Int(2)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-topic-crystal-alpha', crystal_title: 'Wiki Crystal Alpha', title: 'Alpha fallback', content: 'alpha crystal body', importance: 0.8, is_crystal: true})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-topic-crystal-beta', crystal_title: 'Wiki Crystal Beta', title: 'Beta fallback', content: 'beta crystal body', importance: 0.9, is_crystal: true})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-topic-crystal-other', crystal_title: 'Wiki Crystal Other', title: 'Other fallback', content: 'other crystal body', importance: 1.0, is_crystal: true})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-topic-crystal-src-a1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-topic-crystal-src-a2'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-topic-crystal-src-a3'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-topic-crystal-src-b1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-topic-crystal-src-b2'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-topic-crystal-src-other'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'wiki-topic-crystal-entity-a1', community_id: 9760})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'wiki-topic-crystal-entity-a2', community_id: 9760})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'wiki-topic-crystal-entity-a3', community_id: 9760})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'wiki-topic-crystal-entity-b1', community_id: 9760})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'wiki-topic-crystal-entity-b2', community_id: 9760})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'wiki-topic-crystal-entity-other', community_id: 9761})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-topic-crystal-alpha'}), (src:Memory {id: 'wiki-topic-crystal-src-a1'}) CREATE (m)-[:SYNTHESIZED_FROM]->(src)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-topic-crystal-alpha'}), (src:Memory {id: 'wiki-topic-crystal-src-a2'}) CREATE (m)-[:SYNTHESIZED_FROM]->(src)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-topic-crystal-alpha'}), (src:Memory {id: 'wiki-topic-crystal-src-a3'}) CREATE (m)-[:SYNTHESIZED_FROM]->(src)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-topic-crystal-beta'}), (src:Memory {id: 'wiki-topic-crystal-src-b1'}) CREATE (m)-[:SYNTHESIZED_FROM]->(src)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-topic-crystal-beta'}), (src:Memory {id: 'wiki-topic-crystal-src-b2'}) CREATE (m)-[:SYNTHESIZED_FROM]->(src)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-topic-crystal-other'}), (src:Memory {id: 'wiki-topic-crystal-src-other'}) CREATE (m)-[:SYNTHESIZED_FROM]->(src)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (src:Memory {id: 'wiki-topic-crystal-src-a1'}), (e:Entity {id: 'wiki-topic-crystal-entity-a1'}) CREATE (src)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (src:Memory {id: 'wiki-topic-crystal-src-a2'}), (e:Entity {id: 'wiki-topic-crystal-entity-a2'}) CREATE (src)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (src:Memory {id: 'wiki-topic-crystal-src-a3'}), (e:Entity {id: 'wiki-topic-crystal-entity-a3'}) CREATE (src)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (src:Memory {id: 'wiki-topic-crystal-src-b1'}), (e:Entity {id: 'wiki-topic-crystal-entity-b1'}) CREATE (src)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (src:Memory {id: 'wiki-topic-crystal-src-b2'}), (e:Entity {id: 'wiki-topic-crystal-entity-b2'}) CREATE (src)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (src:Memory {id: 'wiki-topic-crystal-src-other'}), (e:Entity {id: 'wiki-topic-crystal-entity-other'}) CREATE (src)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['wiki-topic-crystal-alpha', 'wiki-topic-crystal-beta', 'wiki-topic-crystal-other', 'wiki-topic-crystal-src-a1', 'wiki-topic-crystal-src-a2', 'wiki-topic-crystal-src-a3', 'wiki-topic-crystal-src-b1', 'wiki-topic-crystal-src-b2', 'wiki-topic-crystal-src-other', 'wiki-topic-crystal-entity-a1', 'wiki-topic-crystal-entity-a2', 'wiki-topic-crystal-entity-a3', 'wiki-topic-crystal-entity-b1', 'wiki-topic-crystal-entity-b2', 'wiki-topic-crystal-entity-other'] DETACH DELETE n",
),
ExpectedRows::RowCount(15),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"wiki entity id-or-name lookup read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) WHERE e.id = $key OR LOWER(e.name) = LOWER($key) RETURN e.id, e.name, e.entity_type, e.description, e.aliases, e.confidence, e.community_id, e.created_at LIMIT 1",
BTreeMap::from([(
"key".to_string(),
Value::String("wiki lookup entity".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("e.id", Value::String("wiki-entity-lookup".to_string())),
("e.name", Value::String("Wiki Lookup Entity".to_string())),
("e.entity_type", Value::String("concept".to_string())),
(
"e.description",
Value::String("wiki lookup description".to_string()),
),
(
"e.aliases",
Value::List(vec![Value::String("lookup alias".to_string())]),
),
("e.confidence", Value::Float(0.91)),
("e.community_id", Value::Int(9770)),
("e.created_at", Value::Int(1_700_000_000_000_000_200)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'wiki-entity-lookup', name: 'Wiki Lookup Entity', entity_type: 'concept', description: 'wiki lookup description', aliases: ['lookup alias'], confidence: 0.91, community_id: 9770, created_at: 1700000000000000200})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'wiki-entity-lookup'}) DETACH DELETE e",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"wiki entity community context read",
CypherFixtureStatement::with_parameters(
"MATCH (c:Community) WHERE c.community_id = $cid RETURN c.name, c.ai_summary, c.description LIMIT 1",
BTreeMap::from([("cid".to_string(), Value::Int(9780))]),
),
ExpectedRows::Exact(vec![compatibility_row([
("c.name", Value::String("Wiki Entity Community".to_string())),
(
"c.ai_summary",
Value::String("entity community summary".to_string()),
),
(
"c.description",
Value::String("entity community description".to_string()),
),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'wiki-entity-community', community_id: 9780, name: 'Wiki Entity Community', ai_summary: 'entity community summary', description: 'entity community description'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (c:Community {id: 'wiki-entity-community'}) DETACH DELETE c",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp community detail read",
CypherFixtureStatement::with_parameters(
"MATCH (c:Community) WHERE c.id = $cid RETURN c.id, c.community_id, c.name, c.description, c.ai_summary, c.member_count",
BTreeMap::from([(
"cid".to_string(),
Value::String("mcp-community-detail".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("c.id", Value::String("mcp-community-detail".to_string())),
("c.community_id", Value::Int(9901)),
("c.name", Value::String("MCP Community".to_string())),
(
"c.description",
Value::String("mcp community description".to_string()),
),
(
"c.ai_summary",
Value::String("mcp community summary".to_string()),
),
("c.member_count", Value::Int(42)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'mcp-community-detail', community_id: 9901, name: 'MCP Community', description: 'mcp community description', ai_summary: 'mcp community summary', member_count: 42})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (c:Community {id: 'mcp-community-detail'}) DETACH DELETE c",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp community entity mention read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) WHERE e.community_id = $louvain_id OPTIONAL MATCH (m:Memory)-[:MENTIONS]->(e) RETURN e.id, e.name, e.entity_type, m.id, m.metadata, COALESCE(m.is_latest, true) ORDER BY e.name ASC",
BTreeMap::from([("louvain_id".to_string(), Value::Int(9902))]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("e.id", Value::String("mcp-community-entity-a".to_string())),
("e.name", Value::String("Alpha MCP".to_string())),
("e.entity_type", Value::String("concept".to_string())),
("m.id", Value::String("mcp-community-mention-a".to_string())),
("m.metadata", Value::String("{\"kind\":\"mcp\"}".to_string())),
("coalesce", Value::Bool(true)),
]),
compatibility_row([
("e.id", Value::String("mcp-community-entity-b".to_string())),
("e.name", Value::String("Beta MCP".to_string())),
("e.entity_type", Value::String("topic".to_string())),
("m.id", Value::Null),
("m.metadata", Value::Null),
("coalesce", Value::Bool(true)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'mcp-community-entity-a', name: 'Alpha MCP', entity_type: 'concept', community_id: 9902})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'mcp-community-entity-b', name: 'Beta MCP', entity_type: 'topic', community_id: 9902})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-community-mention-a', metadata: '{\"kind\":\"mcp\"}', is_latest: true})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'mcp-community-mention-a'}), (e:Entity {id: 'mcp-community-entity-a'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['mcp-community-entity-a', 'mcp-community-entity-b', 'mcp-community-mention-a'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp community memory ranking read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {community_id: $louvain_id})<-[:MENTIONS]-(m:Memory) WHERE m.is_crystal = false WITH m, COUNT(e) AS entity_count RETURN m.id, m.title, m.content, m.unit_type, m.metadata, COALESCE(m.is_latest, true) ORDER BY entity_count DESC, m.importance DESC",
BTreeMap::from([("louvain_id".to_string(), Value::Int(9903))]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("m.id", Value::String("mcp-community-rank-m1".to_string())),
("m.title", Value::String("MCP Rank One".to_string())),
("m.content", Value::String("rank one".to_string())),
("m.unit_type", Value::String("fact".to_string())),
("m.metadata", Value::String("{\"rank\":1}".to_string())),
("coalesce", Value::Bool(true)),
]),
compatibility_row([
("m.id", Value::String("mcp-community-rank-m2".to_string())),
("m.title", Value::String("MCP Rank Two".to_string())),
("m.content", Value::String("rank two".to_string())),
("m.unit_type", Value::String("note".to_string())),
("m.metadata", Value::String("{\"rank\":2}".to_string())),
("coalesce", Value::Bool(true)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'mcp-community-rank-e1', community_id: 9903})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'mcp-community-rank-e2', community_id: 9903})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-community-rank-m1', title: 'MCP Rank One', content: 'rank one', unit_type: 'fact', metadata: '{\"rank\":1}', is_latest: true, is_crystal: false, importance: 0.5})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-community-rank-m2', title: 'MCP Rank Two', content: 'rank two', unit_type: 'note', metadata: '{\"rank\":2}', is_latest: true, is_crystal: false, importance: 0.9})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'mcp-community-rank-m1'}), (e:Entity {id: 'mcp-community-rank-e1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'mcp-community-rank-m1'}), (e:Entity {id: 'mcp-community-rank-e2'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'mcp-community-rank-m2'}), (e:Entity {id: 'mcp-community-rank-e1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['mcp-community-rank-e1', 'mcp-community-rank-e2', 'mcp-community-rank-m1', 'mcp-community-rank-m2'] DETACH DELETE n",
),
ExpectedRows::RowCount(4),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp community summary list read",
CypherFixtureStatement::with_parameters(
"MATCH (c:Community) WHERE c.ai_summary IS NOT NULL AND c.ai_summary <> '' RETURN c.id, c.community_id, c.name, c.ai_summary, c.member_count ORDER BY c.member_count DESC LIMIT $limit",
BTreeMap::from([("limit".to_string(), Value::Int(1))]),
),
ExpectedRows::Exact(vec![compatibility_row([
("c.id", Value::String("mcp-summary-community".to_string())),
("c.community_id", Value::Int(9904)),
("c.name", Value::String("MCP Summary Community".to_string())),
("c.ai_summary", Value::String("summary body".to_string())),
("c.member_count", Value::Int(1000)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'mcp-summary-community', community_id: 9904, name: 'MCP Summary Community', ai_summary: 'summary body', member_count: 1000})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'mcp-summary-empty', community_id: 9905, name: 'MCP Empty Summary', ai_summary: '', member_count: 2000})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (c:Community) WHERE c.id IN ['mcp-summary-community', 'mcp-summary-empty'] DETACH DELETE c",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"okf export community list read",
CypherFixtureStatement::with_parameters(
"MATCH (c:Community) WHERE c.ai_summary IS NOT NULL AND c.ai_summary <> '' AND c.name <> 'Knowledge Network' AND c.name <> 'Concept Cluster' AND c.name <> 'Small Group' RETURN c.community_id, c.name, c.ai_summary, c.description, c.member_count ORDER BY c.member_count DESC LIMIT $limit",
BTreeMap::from([("limit".to_string(), Value::Int(1))]),
),
ExpectedRows::Exact(vec![compatibility_row([
("c.community_id", Value::Int(9610)),
("c.name", Value::String("OKF Community".to_string())),
("c.ai_summary", Value::String("okf summary".to_string())),
("c.description", Value::String("okf description".to_string())),
("c.member_count", Value::Int(20_000)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'okf-community', community_id: 9610, name: 'OKF Community', ai_summary: 'okf summary', description: 'okf description', member_count: 20000})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'okf-community-excluded', community_id: 9620, name: 'Small Group', ai_summary: 'ignored', description: 'ignored', member_count: 999})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (c:Community) WHERE c.id IN ['okf-community', 'okf-community-excluded'] DETACH DELETE c",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"okf export entity list read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) OPTIONAL MATCH (:Memory)-[r:MENTIONS]->(e) RETURN e.id, e.name, e.entity_type, e.description, e.aliases, e.confidence, e.community_id, e.created_at, COUNT(r) AS mention_count ORDER BY mention_count DESC, e.name ASC LIMIT $limit",
BTreeMap::from([("limit".to_string(), Value::Int(2))]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("e.id", Value::String("okf-entity-alpha".to_string())),
("e.name", Value::String("OKF Alpha".to_string())),
("e.entity_type", Value::String("concept".to_string())),
("e.description", Value::String("alpha description".to_string())),
(
"e.aliases",
Value::List(vec![
Value::String("alpha alias".to_string()),
Value::String("alpha short".to_string()),
]),
),
("e.confidence", Value::Float(0.95)),
("e.community_id", Value::Int(9710)),
("e.created_at", Value::Int(1_700_000_000_000_000_000)),
("mention_count", Value::Int(5)),
]),
compatibility_row([
("e.id", Value::String("okf-entity-beta".to_string())),
("e.name", Value::String("OKF Beta".to_string())),
("e.entity_type", Value::String("person".to_string())),
("e.description", Value::String("beta description".to_string())),
("e.aliases", Value::List(Vec::new())),
("e.confidence", Value::Float(0.85)),
("e.community_id", Value::Int(9720)),
("e.created_at", Value::Int(1_700_000_000_000_000_100)),
("mention_count", Value::Int(4)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'okf-entity-alpha', name: 'OKF Alpha', entity_type: 'concept', description: 'alpha description', aliases: ['alpha alias', 'alpha short'], confidence: 0.95, community_id: 9710, created_at: 1700000000000000000})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'okf-entity-beta', name: 'OKF Beta', entity_type: 'person', description: 'beta description', aliases: [], confidence: 0.85, community_id: 9720, created_at: 1700000000000000100})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'okf-entity-m1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'okf-entity-m2'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'okf-entity-m3'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'okf-entity-m4'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'okf-entity-m5'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'okf-entity-m6'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'okf-entity-m7'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'okf-entity-m8'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'okf-entity-m9'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'okf-entity-m1'}), (e:Entity {id: 'okf-entity-alpha'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'okf-entity-m2'}), (e:Entity {id: 'okf-entity-alpha'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'okf-entity-m3'}), (e:Entity {id: 'okf-entity-alpha'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'okf-entity-m6'}), (e:Entity {id: 'okf-entity-alpha'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'okf-entity-m7'}), (e:Entity {id: 'okf-entity-alpha'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'okf-entity-m4'}), (e:Entity {id: 'okf-entity-beta'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'okf-entity-m5'}), (e:Entity {id: 'okf-entity-beta'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'okf-entity-m8'}), (e:Entity {id: 'okf-entity-beta'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'okf-entity-m9'}), (e:Entity {id: 'okf-entity-beta'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['okf-entity-alpha', 'okf-entity-beta', 'okf-entity-m1', 'okf-entity-m2', 'okf-entity-m3', 'okf-entity-m4', 'okf-entity-m5', 'okf-entity-m6', 'okf-entity-m7', 'okf-entity-m8', 'okf-entity-m9'] DETACH DELETE n",
),
ExpectedRows::RowCount(11),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"okf export crystal list read",
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.is_crystal = true RETURN m.id, m.crystal_title, m.title, m.content, m.importance, m.unit_type, m.created_at ORDER BY m.importance DESC, m.created_at DESC",
),
ExpectedRows::Exact(vec![
compatibility_row([
("m.id", Value::String("okf-crystal".to_string())),
("m.crystal_title", Value::String("Crystal Title".to_string())),
("m.title", Value::String("Fallback Title".to_string())),
("m.content", Value::String("crystal content".to_string())),
("m.importance", Value::Float(20.0)),
("m.unit_type", Value::String("fact".to_string())),
("m.created_at", Value::Int(1000)),
]),
compatibility_row([
("m.id", Value::Int(3)),
("m.crystal_title", Value::Null),
("m.title", Value::String("Cloud projection".to_string())),
("m.content", Value::Null),
("m.importance", Value::Null),
("m.unit_type", Value::String("decision".to_string())),
("m.created_at", Value::Int(200)),
]),
compatibility_row([
("m.id", Value::String("coverage-c1".to_string())),
(
"m.crystal_title",
Value::String("Coverage Crystal".to_string()),
),
("m.title", Value::Null),
("m.content", Value::Null),
("m.importance", Value::Null),
("m.unit_type", Value::Null),
("m.created_at", Value::Null),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'okf-crystal', crystal_title: 'Crystal Title', title: 'Fallback Title', content: 'crystal content', importance: 20.0, unit_type: 'fact', created_at: 1000, is_crystal: true})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'okf-crystal'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp crystal list read",
CypherFixtureStatement::with_parameters(
"MATCH (c:Memory) WHERE c.is_crystal = true RETURN c.id, c.crystal_title, c.content, c.unit_type, c.importance, c.source_unit_count, c.created_at ORDER BY c.created_at DESC SKIP $offset LIMIT $limit",
BTreeMap::from([
("offset".to_string(), Value::Int(0)),
("limit".to_string(), Value::Int(1)),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
("c.id", Value::String("mcp-crystal-list-1".to_string())),
(
"c.crystal_title",
Value::String("MCP Crystal List".to_string()),
),
("c.content", Value::String("mcp crystal content".to_string())),
("c.unit_type", Value::String("context".to_string())),
("c.importance", Value::Float(0.95)),
("c.source_unit_count", Value::Int(2)),
("c.created_at", Value::Int(9_000_000_000_000_000_000)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-crystal-list-1', crystal_title: 'MCP Crystal List', content: 'mcp crystal content', unit_type: 'context', importance: 0.95, source_unit_count: 2, created_at: 9000000000000000000, is_crystal: true})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-crystal-source-1', title: 'MCP Crystal Source'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (c:Memory {id: 'mcp-crystal-list-1'}), (s:Memory {id: 'mcp-crystal-source-1'}) CREATE (c)-[:SYNTHESIZED_FROM {weight: 0.75}]->(s)",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp crystal source read",
CypherFixtureStatement::with_parameters(
"MATCH (c:Memory)-[r:SYNTHESIZED_FROM]->(s:Memory) WHERE c.id = $id RETURN s.id, s.title, r.weight",
BTreeMap::from([(
"id".to_string(),
Value::String("mcp-crystal-list-1".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"s.id",
Value::String("mcp-crystal-source-1".to_string()),
),
("s.title", Value::String("MCP Crystal Source".to_string())),
("r.weight", Value::Float(0.75)),
])]),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['mcp-crystal-list-1', 'mcp-crystal-source-1'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp memory duplicate candidate read",
CypherFixtureStatement::with_parameters(
"MATCH (memory:Memory) WHERE memory.space_id = $space_id AND memory.content = $content AND (memory.is_latest IS NULL OR memory.is_latest = true) AND (memory.is_crystal IS NULL OR memory.is_crystal = false) RETURN memory.id, memory.title, memory.content LIMIT 3",
BTreeMap::from([
("space_id".to_string(), Value::String("mcp-space".to_string())),
(
"content".to_string(),
Value::String("candidate content".to_string()),
),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"memory.id",
Value::String("mcp-duplicate-memory".to_string()),
),
(
"memory.title",
Value::String("MCP Duplicate Candidate".to_string()),
),
(
"memory.content",
Value::String("candidate content".to_string()),
),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-duplicate-memory', title: 'MCP Duplicate Candidate', content: 'candidate content', space_id: 'mcp-space', is_latest: true, is_crystal: false})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-duplicate-stale', title: 'MCP Duplicate Stale', content: 'candidate content', space_id: 'mcp-space', is_latest: false, is_crystal: false})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-duplicate-crystal', title: 'MCP Duplicate Crystal', content: 'candidate content', space_id: 'mcp-space', is_latest: true, is_crystal: true})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['mcp-duplicate-memory', 'mcp-duplicate-stale', 'mcp-duplicate-crystal'] DETACH DELETE m",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp source metadata read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id IN $source_ids RETURN m.id, m.space_id, m.unit_type",
BTreeMap::from([(
"source_ids".to_string(),
Value::List(vec![
Value::String("mcp-source-meta-1".to_string()),
Value::String("mcp-source-meta-missing".to_string()),
]),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("m.id", Value::String("mcp-source-meta-1".to_string())),
("m.space_id", Value::String("mcp-space".to_string())),
("m.unit_type", Value::String("fact".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-source-meta-1', space_id: 'mcp-space', unit_type: 'fact'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'mcp-source-meta-1'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp crystal create write",
CypherFixtureStatement::with_parameters(
"CREATE (m:Memory { id: $id, title: $title, content: $content, unit_type: $unit_type, is_crystal: true, is_latest: true, importance: 0.8, created_at: $now, updated_at: $now, last_evaluated_at: $now, source: 'agent', review_status: '', space_id: $space_id, crystal_title: $title, source_unit_count: $source_count, extraction_method: 'agent', version: 1, confidence: 0.5, access_count: 0, appearances: 0, clicks: 0, total_dwell_time_ms: 0, reindex_needed: false, temporal_context: 'timeless' })",
BTreeMap::from([
(
"id".to_string(),
Value::String("mcp-created-crystal".to_string()),
),
(
"title".to_string(),
Value::String("MCP Created Crystal".to_string()),
),
(
"content".to_string(),
Value::String("created crystal content".to_string()),
),
("unit_type".to_string(), Value::String("context".to_string())),
("now".to_string(), Value::Int(12_345)),
("space_id".to_string(), Value::String("mcp-space".to_string())),
("source_count".to_string(), Value::Int(2)),
]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id = $id RETURN m.title, m.content, m.created_at, m.source",
BTreeMap::from([(
"id".to_string(),
Value::String("mcp-created-crystal".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"m.title",
Value::String("MCP Created Crystal".to_string()),
),
(
"m.content",
Value::String("created crystal content".to_string()),
),
("m.created_at", Value::Int(12_345)),
("m.source", Value::String("agent".to_string())),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp crystal source link merge",
CypherFixtureStatement::with_parameters(
"MATCH (c:Memory), (s:Memory) WHERE c.id = $crystal_id AND s.id = $src_id MERGE (c)-[r:SYNTHESIZED_FROM]->(s) ON CREATE SET r.weight = $weight, r.occasion_key = '', r.created_at = $now",
BTreeMap::from([
(
"crystal_id".to_string(),
Value::String("mcp-created-crystal".to_string()),
),
(
"src_id".to_string(),
Value::String("mcp-crystal-link-source".to_string()),
),
("weight".to_string(), Value::Float(0.6)),
("now".to_string(), Value::Int(12_346)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-crystal-link-source', title: 'MCP Link Source'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (c:Memory {id: 'mcp-created-crystal'})-[r:SYNTHESIZED_FROM]->(s:Memory {id: 'mcp-crystal-link-source'}) RETURN count(r) AS total, min(r.weight) AS weight, min(r.created_at) AS created_at",
),
ExpectedRows::Exact(vec![compatibility_row([
("total", Value::Int(1)),
("weight", Value::Float(0.6)),
("created_at", Value::Int(12_346)),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp crystal delete write",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $id}) DETACH DELETE m",
BTreeMap::from([(
"id".to_string(),
Value::String("mcp-created-crystal".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory) WHERE m.id IN ['mcp-created-crystal', 'mcp-crystal-link-source'] DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"okf export crystal entity community read",
CypherFixtureStatement::new(
"MATCH (m:Memory)-[:SYNTHESIZED_FROM]->(src:Memory)-[:MENTIONS]->(e:Entity) WHERE m.is_crystal = true AND e.community_id IS NOT NULL RETURN m.id, e.community_id",
),
ExpectedRows::Exact(vec![compatibility_row([
("m.id", Value::String("okf-crystal-community".to_string())),
("e.community_id", Value::Int(9630)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'okf-crystal-community', is_crystal: true})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'okf-crystal-source'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'okf-crystal-entity', community_id: 9630})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'okf-crystal-community'}), (src:Memory {id: 'okf-crystal-source'}) CREATE (m)-[:SYNTHESIZED_FROM]->(src)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (src:Memory {id: 'okf-crystal-source'}), (e:Entity {id: 'okf-crystal-entity'}) CREATE (src)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['okf-crystal-community', 'okf-crystal-source', 'okf-crystal-entity'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"export entity mention detail read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[:MENTIONS]->(e:Entity {id: $id}) RETURN m.id, m.title, m.content, m.is_crystal, COALESCE(m.crystal_title, m.title) AS display_title, m.importance ORDER BY m.is_crystal DESC, m.importance DESC LIMIT $limit",
BTreeMap::from([
(
"id".to_string(),
Value::String("export-detail-entity".to_string()),
),
("limit".to_string(), Value::Int(2)),
]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("m.id", Value::String("export-detail-crystal".to_string())),
("m.title", Value::String("Crystal Fallback".to_string())),
("m.content", Value::String("crystal body".to_string())),
("m.is_crystal", Value::Bool(true)),
("display_title", Value::String("Crystal Display".to_string())),
("m.importance", Value::Float(20.0)),
]),
compatibility_row([
("m.id", Value::String("export-detail-memory".to_string())),
("m.title", Value::String("Memory Title".to_string())),
("m.content", Value::String("memory body".to_string())),
("m.is_crystal", Value::Bool(false)),
("display_title", Value::String("Memory Title".to_string())),
("m.importance", Value::Float(10.0)),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'export-detail-entity'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'export-detail-crystal', title: 'Crystal Fallback', crystal_title: 'Crystal Display', content: 'crystal body', is_crystal: true, importance: 20.0})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'export-detail-memory', title: 'Memory Title', content: 'memory body', is_crystal: false, importance: 10.0})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'export-detail-crystal'}), (e:Entity {id: 'export-detail-entity'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'export-detail-memory'}), (e:Entity {id: 'export-detail-entity'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['export-detail-entity', 'export-detail-crystal', 'export-detail-memory'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"export related entity read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity {id: $id})-[:RELATES_TO]-(other:Entity) WHERE other.id <> $id RETURN DISTINCT other.id, other.name, other.entity_type LIMIT 30",
BTreeMap::from([(
"id".to_string(),
Value::String("export-related-entity".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("other.id", Value::String("export-related-peer".to_string())),
("other.name", Value::String("Related Peer".to_string())),
("other.entity_type", Value::String("concept".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'export-related-entity', name: 'Export Entity', entity_type: 'topic'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'export-related-peer', name: 'Related Peer', entity_type: 'concept'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'export-related-entity'}), (other:Entity {id: 'export-related-peer'}) CREATE (e)-[:RELATES_TO]->(other)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['export-related-entity', 'export-related-peer'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"okf export memory rows with labels read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE (m.is_crystal IS NULL OR m.is_crystal = false) OPTIONAL MATCH (m)-[:HAS_LABEL]->(l:Label) RETURN m.id, m.title, m.content, m.unit_type, m.importance, m.confidence, m.created_at, m.source, m.metadata, m.is_latest, m.lifecycle_state, COLLECT(DISTINCT l.name) AS labels ORDER BY m.created_at DESC LIMIT $limit",
BTreeMap::from([("limit".to_string(), Value::Int(2))]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("m.id", Value::String("okf-memory-row-two".to_string())),
("m.title", Value::String("Memory Row Two".to_string())),
("m.content", Value::String("body two".to_string())),
("m.unit_type", Value::String("fact".to_string())),
("m.importance", Value::Float(0.6)),
("m.confidence", Value::Float(0.7)),
("m.created_at", Value::Int(1_900_000_000_000_000_000)),
("m.source", Value::String("source two".to_string())),
("m.metadata", Value::String("{\"rank\":2}".to_string())),
("m.is_latest", Value::Bool(false)),
("m.lifecycle_state", Value::String("active".to_string())),
("labels", Value::List(Vec::new())),
]),
compatibility_row([
("m.id", Value::String("okf-memory-row-one".to_string())),
("m.title", Value::String("Memory Row One".to_string())),
("m.content", Value::String("body one".to_string())),
("m.unit_type", Value::String("note".to_string())),
("m.importance", Value::Float(0.9)),
("m.confidence", Value::Float(0.8)),
("m.created_at", Value::Int(1_800_000_000_000_000_000)),
("m.source", Value::String("source one".to_string())),
("m.metadata", Value::String("{\"rank\":1}".to_string())),
("m.is_latest", Value::Bool(true)),
("m.lifecycle_state", Value::String("active".to_string())),
(
"labels",
Value::List(vec![
Value::String("alpha".to_string()),
Value::String("beta".to_string()),
]),
),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'okf-memory-row-one', title: 'Memory Row One', content: 'body one', unit_type: 'note', importance: 0.9, confidence: 0.8, created_at: 1800000000000000000, source: 'source one', metadata: '{\"rank\":1}', is_latest: true, lifecycle_state: 'active', is_crystal: false})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'okf-memory-row-two', title: 'Memory Row Two', content: 'body two', unit_type: 'fact', importance: 0.6, confidence: 0.7, created_at: 1900000000000000000, source: 'source two', metadata: '{\"rank\":2}', is_latest: false, lifecycle_state: 'active'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'okf-memory-row-crystal', title: 'Crystal Skip', is_crystal: true, created_at: 3000})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'okf-memory-row-label-a', name: 'alpha'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'okf-memory-row-label-b', name: 'beta'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'okf-memory-row-one'}), (l:Label {id: 'okf-memory-row-label-a'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'okf-memory-row-one'}), (l:Label {id: 'okf-memory-row-label-b'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'okf-memory-row-one'}), (l:Label {id: 'okf-memory-row-label-b'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['okf-memory-row-one', 'okf-memory-row-two', 'okf-memory-row-crystal', 'okf-memory-row-label-a', 'okf-memory-row-label-b'] DETACH DELETE n",
),
ExpectedRows::RowCount(5),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"wiki export community mention memory ranking read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[:MENTIONS]->(e:Entity) WHERE e.community_id IN $cids RETURN e.community_id, m.id, m.title, m.content, m.importance, m.created_at, m.is_crystal, COUNT(DISTINCT e.id) AS mention_breadth, m.metadata, COALESCE(m.is_latest, true), m.lifecycle_state ORDER BY e.community_id ASC, mention_breadth DESC, CASE WHEN m.importance IS NOT NULL THEN m.importance ELSE 0.5 END DESC, m.created_at DESC",
BTreeMap::from([(
"cids".to_string(),
Value::List(vec![Value::Int(9721), Value::Int(9722)]),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("e.community_id", Value::Int(9721)),
("m.id", Value::String("wiki-top-mention-m1".to_string())),
("m.title", Value::String("Mention One".to_string())),
("m.content", Value::String("mention one body".to_string())),
("m.importance", Value::Float(0.4)),
("m.created_at", Value::Int(1100)),
("m.is_crystal", Value::Bool(false)),
("mention_breadth", Value::Int(2)),
("m.metadata", Value::String("{\"kind\":\"mention\"}".to_string())),
("coalesce", Value::Bool(true)),
("m.lifecycle_state", Value::String("active".to_string())),
]),
compatibility_row([
("e.community_id", Value::Int(9721)),
("m.id", Value::String("wiki-top-mention-m2".to_string())),
("m.title", Value::String("Mention Two".to_string())),
("m.content", Value::String("mention two body".to_string())),
("m.importance", Value::Float(0.9)),
("m.created_at", Value::Int(1200)),
("m.is_crystal", Value::Bool(false)),
("mention_breadth", Value::Int(1)),
("m.metadata", Value::String("{\"kind\":\"mention\"}".to_string())),
("coalesce", Value::Bool(false)),
("m.lifecycle_state", Value::String("active".to_string())),
]),
compatibility_row([
("e.community_id", Value::Int(9722)),
("m.id", Value::String("wiki-top-mention-m3".to_string())),
("m.title", Value::String("Mention Three".to_string())),
("m.content", Value::String("mention three body".to_string())),
("m.importance", Value::Null),
("m.created_at", Value::Int(1300)),
("m.is_crystal", Value::Bool(false)),
("mention_breadth", Value::Int(1)),
("m.metadata", Value::String("{\"kind\":\"mention\"}".to_string())),
("coalesce", Value::Bool(true)),
("m.lifecycle_state", Value::String("active".to_string())),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'wiki-top-mention-e1', community_id: 9721})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'wiki-top-mention-e2', community_id: 9721})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'wiki-top-mention-e3', community_id: 9722})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-top-mention-m1', title: 'Mention One', content: 'mention one body', importance: 0.4, created_at: 1100, is_crystal: false, metadata: '{\"kind\":\"mention\"}', is_latest: true, lifecycle_state: 'active'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-top-mention-m2', title: 'Mention Two', content: 'mention two body', importance: 0.9, created_at: 1200, is_crystal: false, metadata: '{\"kind\":\"mention\"}', is_latest: false, lifecycle_state: 'active'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-top-mention-m3', title: 'Mention Three', content: 'mention three body', created_at: 1300, is_crystal: false, metadata: '{\"kind\":\"mention\"}', lifecycle_state: 'active'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-top-mention-m1'}), (e:Entity {id: 'wiki-top-mention-e1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-top-mention-m1'}), (e:Entity {id: 'wiki-top-mention-e2'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-top-mention-m1'}), (e:Entity {id: 'wiki-top-mention-e2'}) CREATE (m)-[:MENTIONS {source: 'duplicate'}]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-top-mention-m2'}), (e:Entity {id: 'wiki-top-mention-e1'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'wiki-top-mention-m3'}), (e:Entity {id: 'wiki-top-mention-e3'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['wiki-top-mention-e1', 'wiki-top-mention-e2', 'wiki-top-mention-e3', 'wiki-top-mention-m1', 'wiki-top-mention-m2', 'wiki-top-mention-m3'] DETACH DELETE n",
),
ExpectedRows::RowCount(6),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"wiki export community direct memory ranking read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.community_id IN $cids AND (m.is_crystal IS NULL OR m.is_crystal = false) RETURN m.community_id, m.id, m.title, m.content, m.importance, m.created_at, m.is_crystal, 0 AS mention_breadth, m.metadata, COALESCE(m.is_latest, true), m.lifecycle_state ORDER BY m.community_id ASC, CASE WHEN m.importance IS NOT NULL THEN m.importance ELSE 0.5 END DESC, m.created_at DESC",
BTreeMap::from([(
"cids".to_string(),
Value::List(vec![Value::Int(9731), Value::Int(9732)]),
)]),
),
ExpectedRows::Exact(vec![
compatibility_row([
("m.community_id", Value::Int(9731)),
("m.id", Value::String("wiki-top-direct-m2".to_string())),
("m.title", Value::String("Direct Two".to_string())),
("m.content", Value::String("direct two body".to_string())),
("m.importance", Value::Float(0.9)),
("m.created_at", Value::Int(2200)),
("m.is_crystal", Value::Bool(false)),
("mention_breadth", Value::Int(0)),
("m.metadata", Value::String("{\"kind\":\"direct\"}".to_string())),
("coalesce", Value::Bool(false)),
("m.lifecycle_state", Value::String("active".to_string())),
]),
compatibility_row([
("m.community_id", Value::Int(9731)),
("m.id", Value::String("wiki-top-direct-m1".to_string())),
("m.title", Value::String("Direct One".to_string())),
("m.content", Value::String("direct one body".to_string())),
("m.importance", Value::Float(0.2)),
("m.created_at", Value::Int(2100)),
("m.is_crystal", Value::Bool(false)),
("mention_breadth", Value::Int(0)),
("m.metadata", Value::String("{\"kind\":\"direct\"}".to_string())),
("coalesce", Value::Bool(true)),
("m.lifecycle_state", Value::String("active".to_string())),
]),
compatibility_row([
("m.community_id", Value::Int(9732)),
("m.id", Value::String("wiki-top-direct-m3".to_string())),
("m.title", Value::String("Direct Three".to_string())),
("m.content", Value::String("direct three body".to_string())),
("m.importance", Value::Null),
("m.created_at", Value::Int(2300)),
("m.is_crystal", Value::Null),
("mention_breadth", Value::Int(0)),
("m.metadata", Value::String("{\"kind\":\"direct\"}".to_string())),
("coalesce", Value::Bool(true)),
("m.lifecycle_state", Value::String("active".to_string())),
]),
]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-top-direct-m1', community_id: 9731, title: 'Direct One', content: 'direct one body', importance: 0.2, created_at: 2100, is_crystal: false, metadata: '{\"kind\":\"direct\"}', is_latest: true, lifecycle_state: 'active'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-top-direct-m2', community_id: 9731, title: 'Direct Two', content: 'direct two body', importance: 0.9, created_at: 2200, is_crystal: false, metadata: '{\"kind\":\"direct\"}', is_latest: false, lifecycle_state: 'active'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-top-direct-m3', community_id: 9732, title: 'Direct Three', content: 'direct three body', created_at: 2300, metadata: '{\"kind\":\"direct\"}', lifecycle_state: 'active'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'wiki-top-direct-crystal', community_id: 9731, title: 'Direct Crystal Skip', is_crystal: true, created_at: 2400})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['wiki-top-direct-m1', 'wiki-top-direct-m2', 'wiki-top-direct-m3', 'wiki-top-direct-crystal'] DETACH DELETE n",
),
ExpectedRows::RowCount(4),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"memory label transfer retarget relationship",
CypherFixtureStatement::with_parameters(
"MATCH (older:Memory {id: $older_id})-[:HAS_LABEL]->(label:Label), (newer:Memory {id: $newer_id}) WHERE older.space_id = $space_id AND newer.space_id = $space_id MERGE (newer)-[edge:HAS_LABEL]->(label) ON CREATE SET edge.assigned_by = 'system', edge.created_at = $created_at, edge.properties = '{}'",
BTreeMap::from([
(
"older_id".to_string(),
Value::String("label-transfer-older".to_string()),
),
(
"newer_id".to_string(),
Value::String("label-transfer-newer".to_string()),
),
("space_id".to_string(), Value::String("default".to_string())),
("created_at".to_string(), Value::Int(7100)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'label-transfer-older', space_id: 'default'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'label-transfer-newer', space_id: 'default'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Label {id: 'label-transfer-label', name: 'Transferred'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'label-transfer-older'}), (l:Label {id: 'label-transfer-label'}) CREATE (m)-[:HAS_LABEL]->(l)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'label-transfer-newer'})-[r:HAS_LABEL]->(l:Label {id: 'label-transfer-label'}) RETURN count(r) AS total, min(r.assigned_by) AS assigned_by, min(r.created_at) AS created_at, min(r.properties) AS properties",
),
ExpectedRows::Exact(vec![compatibility_row([
("total", Value::Int(1)),
("assigned_by", Value::String("system".to_string())),
("created_at", Value::Int(7100)),
("properties", Value::String("{}".to_string())),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp entity wiki lookup read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) WHERE e.id = $id OR LOWER(COALESCE(e.name, '')) = $needle RETURN e.id, e.name, e.entity_type, e.description, e.community_id LIMIT 1",
BTreeMap::from([
(
"id".to_string(),
Value::String("mcp-wiki-entity".to_string()),
),
(
"needle".to_string(),
Value::String("mcp wiki entity".to_string()),
),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
("e.id", Value::String("mcp-wiki-entity".to_string())),
("e.name", Value::String("MCP Wiki Entity".to_string())),
("e.entity_type", Value::String("concept".to_string())),
(
"e.description",
Value::String("entity description".to_string()),
),
("e.community_id", Value::Int(9810)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'mcp-wiki-entity', name: 'MCP Wiki Entity', entity_type: 'concept', description: 'entity description', community_id: 9810})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (e:Entity {id: 'mcp-wiki-entity'}) DETACH DELETE e",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp entity wiki memory read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory)-[r:MENTIONS]->(e:Entity {id: $entity_id}) RETURN m.id, COALESCE(m.title, ''), COALESCE(m.content, ''), COALESCE(r.confidence, 0.5) ORDER BY COALESCE(r.confidence, 0.5) DESC, COALESCE(m.importance, 0.5) DESC LIMIT 10",
BTreeMap::from([(
"entity_id".to_string(),
Value::String("mcp-wiki-memory-entity".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("m.id", Value::String("mcp-wiki-memory".to_string())),
("coalesce", Value::String("MCP Wiki Memory".to_string())),
("coalesce#2", Value::String("memory content".to_string())),
("coalesce#3", Value::Float(0.9)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'mcp-wiki-memory-entity', name: 'MCP Wiki Memory Entity'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-wiki-memory', title: 'MCP Wiki Memory', content: 'memory content', importance: 0.8})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'mcp-wiki-memory'}), (e:Entity {id: 'mcp-wiki-memory-entity'}) CREATE (m)-[:MENTIONS {confidence: 0.9}]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['mcp-wiki-memory-entity', 'mcp-wiki-memory'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp crystal wiki detail read",
CypherFixtureStatement::with_parameters(
"MATCH (c:Memory) WHERE c.id = $id AND COALESCE(c.is_crystal, false) = true RETURN c.id, c.crystal_title, c.title, c.content, c.source_unit_count, c.importance, c.created_at LIMIT 1",
BTreeMap::from([(
"id".to_string(),
Value::String("mcp-wiki-crystal".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("c.id", Value::String("mcp-wiki-crystal".to_string())),
("c.crystal_title", Value::String("MCP Crystal".to_string())),
("c.title", Value::String("Fallback Crystal".to_string())),
("c.content", Value::String("crystal content".to_string())),
("c.source_unit_count", Value::Int(2)),
("c.importance", Value::Float(0.95)),
("c.created_at", Value::Int(1_700_000_040)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-wiki-crystal', crystal_title: 'MCP Crystal', title: 'Fallback Crystal', content: 'crystal content', source_unit_count: 2, importance: 0.95, created_at: 1700000040, is_crystal: true})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (c:Memory {id: 'mcp-wiki-crystal'}) DETACH DELETE c",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp crystal wiki source read",
CypherFixtureStatement::with_parameters(
"MATCH (c:Memory {id: $id})-[r:SYNTHESIZED_FROM]->(s:Memory) RETURN s.id, COALESCE(s.title, ''), COALESCE(s.content, ''), COALESCE(r.weight, 0.0) ORDER BY COALESCE(r.weight, 0.0) DESC LIMIT 10",
BTreeMap::from([(
"id".to_string(),
Value::String("mcp-wiki-crystal-source".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("s.id", Value::String("mcp-wiki-source".to_string())),
("coalesce", Value::String("MCP Source Memory".to_string())),
("coalesce#2", Value::String("source content".to_string())),
("coalesce#3", Value::Float(0.75)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-wiki-crystal-source', is_crystal: true})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-wiki-source', title: 'MCP Source Memory', content: 'source content'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (c:Memory {id: 'mcp-wiki-crystal-source'}), (s:Memory {id: 'mcp-wiki-source'}) CREATE (c)-[:SYNTHESIZED_FROM {weight: 0.75}]->(s)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['mcp-wiki-crystal-source', 'mcp-wiki-source'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp topic wiki community read",
CypherFixtureStatement::with_parameters(
"MATCH (c:Community) WHERE c.community_id = $community_id RETURN c.id, c.community_id, c.name, c.description, c.ai_summary, c.member_count LIMIT 1",
BTreeMap::from([("community_id".to_string(), Value::Int(9820))]),
),
ExpectedRows::Exact(vec![compatibility_row([
("c.id", Value::String("mcp-wiki-community".to_string())),
("c.community_id", Value::Int(9820)),
("c.name", Value::String("MCP Wiki Community".to_string())),
(
"c.description",
Value::String("community description".to_string()),
),
("c.ai_summary", Value::String("community summary".to_string())),
("c.member_count", Value::Int(12)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Community {id: 'mcp-wiki-community', community_id: 9820, name: 'MCP Wiki Community', description: 'community description', ai_summary: 'community summary', member_count: 12})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (c:Community {id: 'mcp-wiki-community'}) DETACH DELETE c",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp explore seed memory read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $id}) RETURN m.id, COALESCE(m.title, LEFT(COALESCE(m.content, ''), 60)), COALESCE(m.importance, 0.5), COALESCE(m.is_crystal, false), COALESCE(m.content, ''), m.created_at, m.community_id LIMIT 1",
BTreeMap::from([(
"id".to_string(),
Value::String("mcp-explore-seed".to_string()),
)]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-explore-seed', title: 'MCP Explore Seed', content: 'seed content', importance: 0.6, is_crystal: false, created_at: 1700000041, community_id: 9821})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'mcp-explore-seed'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp explore mentions read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $id})-[r:MENTIONS]->(e:Entity) RETURN e.id, COALESCE(e.name, e.id), e.entity_type, e.community_id, COALESCE(r.confidence, 0.5), m.id ORDER BY COALESCE(r.confidence, 0.5) DESC LIMIT $limit",
BTreeMap::from([
(
"id".to_string(),
Value::String("mcp-explore-mentions-memory".to_string()),
),
("limit".to_string(), Value::Int(5)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-explore-mentions-memory'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'mcp-explore-mentions-entity', name: 'MCP Explore Entity', entity_type: 'concept', community_id: 9822})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'mcp-explore-mentions-memory'}), (e:Entity {id: 'mcp-explore-mentions-entity'}) CREATE (m)-[:MENTIONS {confidence: 0.7}]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['mcp-explore-mentions-memory', 'mcp-explore-mentions-entity'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp explore memory relation read",
CypherFixtureStatement::with_parameters(
"MATCH (a:Memory)-[r:MEMORY_RELATES_TO]-(b:Memory) WHERE (a.id = $id OR b.id = $id) AND COALESCE(r.status, 'active') = 'active' RETURN a.id, COALESCE(a.title, LEFT(COALESCE(a.content, ''), 60)), COALESCE(a.importance, 0.5), COALESCE(a.is_crystal, false), COALESCE(a.content, ''), a.created_at, a.community_id, b.id, COALESCE(b.title, LEFT(COALESCE(b.content, ''), 60)), COALESCE(b.importance, 0.5), COALESCE(b.is_crystal, false), COALESCE(b.content, ''), b.created_at, b.community_id, r.id, r.relation_type, r.reason, r.strength, r.confidence LIMIT $limit",
BTreeMap::from([
(
"id".to_string(),
Value::String("mcp-explore-rel-a".to_string()),
),
("limit".to_string(), Value::Int(5)),
]),
),
ExpectedRows::RowCount(2),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-explore-rel-a', title: 'Explore A', content: 'a content', importance: 0.6, is_crystal: false, created_at: 1700000042, community_id: 9823})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-explore-rel-b', title: 'Explore B', content: 'b content', importance: 0.7, is_crystal: false, created_at: 1700000043, community_id: 9823})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Memory {id: 'mcp-explore-rel-a'}), (b:Memory {id: 'mcp-explore-rel-b'}) CREATE (a)-[:MEMORY_RELATES_TO {id: 'mcp-explore-rel-edge', status: 'active', relation_type: 'supports', reason: 'explore', strength: 0.8, confidence: 0.9}]->(b)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['mcp-explore-rel-a', 'mcp-explore-rel-b'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp explore evolves read",
CypherFixtureStatement::with_parameters(
"MATCH (a:Memory)-[r:EVOLVES]-(b:Memory) WHERE a.id = $id OR b.id = $id RETURN a.id, COALESCE(a.title, LEFT(COALESCE(a.content, ''), 60)), COALESCE(a.importance, 0.5), COALESCE(a.is_crystal, false), COALESCE(a.content, ''), a.created_at, a.community_id, b.id, COALESCE(b.title, LEFT(COALESCE(b.content, ''), 60)), COALESCE(b.importance, 0.5), COALESCE(b.is_crystal, false), COALESCE(b.content, ''), b.created_at, b.community_id, r.content_relation, r.confidence LIMIT $limit",
BTreeMap::from([
(
"id".to_string(),
Value::String("mcp-explore-evolves-a".to_string()),
),
("limit".to_string(), Value::Int(5)),
]),
),
ExpectedRows::RowCount(2),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-explore-evolves-a', title: 'Evolves A', content: 'a evolves', importance: 0.6, is_crystal: false, created_at: 1700000044, community_id: 9824})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-explore-evolves-b', title: 'Evolves B', content: 'b evolves', importance: 0.7, is_crystal: false, created_at: 1700000045, community_id: 9824})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Memory {id: 'mcp-explore-evolves-a'}), (b:Memory {id: 'mcp-explore-evolves-b'}) CREATE (a)-[:EVOLVES {content_relation: 'updates', confidence: 0.8}]->(b)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['mcp-explore-evolves-a', 'mcp-explore-evolves-b'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp explore synthesized read",
CypherFixtureStatement::with_parameters(
"MATCH (c:Memory)-[r:SYNTHESIZED_FROM]-(s:Memory) WHERE c.id = $id OR s.id = $id RETURN c.id, COALESCE(c.crystal_title, c.title, LEFT(COALESCE(c.content, ''), 60)), COALESCE(c.importance, 0.5), true, COALESCE(c.content, ''), c.created_at, c.community_id, s.id, COALESCE(s.title, LEFT(COALESCE(s.content, ''), 60)), COALESCE(s.importance, 0.5), COALESCE(s.is_crystal, false), COALESCE(s.content, ''), s.created_at, s.community_id, r.weight LIMIT $limit",
BTreeMap::from([
(
"id".to_string(),
Value::String("mcp-explore-crystal".to_string()),
),
("limit".to_string(), Value::Int(5)),
]),
),
ExpectedRows::RowCount(2),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-explore-crystal', crystal_title: 'Explore Crystal', title: 'Explore Crystal Fallback', content: 'crystal explore', importance: 0.9, is_crystal: true, created_at: 1700000046, community_id: 9825})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-explore-source', title: 'Explore Source', content: 'source explore', importance: 0.5, is_crystal: false, created_at: 1700000047, community_id: 9825})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (c:Memory {id: 'mcp-explore-crystal'}), (s:Memory {id: 'mcp-explore-source'}) CREATE (c)-[:SYNTHESIZED_FROM {weight: 0.65}]->(s)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['mcp-explore-crystal', 'mcp-explore-source'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp evolves chain backward read",
CypherFixtureStatement::with_parameters(
"MATCH (a:Memory)-[e:EVOLVES]->(b:Memory) WHERE b.id = $id RETURN a.id, a.title, a.content, e.content_relation, e.confidence, a.is_latest, a.unit_type LIMIT 1",
BTreeMap::from([(
"id".to_string(),
Value::String("mcp-chain-current".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("a.id", Value::String("mcp-chain-prev".to_string())),
("a.title", Value::String("MCP Chain Previous".to_string())),
("a.content", Value::String("previous content".to_string())),
("e.content_relation", Value::String("revises".to_string())),
("e.confidence", Value::Float(0.81)),
("a.is_latest", Value::Bool(false)),
("a.unit_type", Value::String("fact".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-chain-prev', title: 'MCP Chain Previous', content: 'previous content', is_latest: false, unit_type: 'fact'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-chain-current', title: 'MCP Chain Current', content: 'current content', is_latest: true, unit_type: 'fact'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Memory {id: 'mcp-chain-prev'}), (b:Memory {id: 'mcp-chain-current'}) CREATE (a)-[:EVOLVES {content_relation: 'revises', confidence: 0.81}]->(b)",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp evolves chain forward read",
CypherFixtureStatement::with_parameters(
"MATCH (a:Memory)-[e:EVOLVES]->(b:Memory) WHERE a.id = $id RETURN b.id, b.title, b.content, e.content_relation, e.confidence, b.is_latest, b.unit_type LIMIT 1",
BTreeMap::from([(
"id".to_string(),
Value::String("mcp-chain-current".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("b.id", Value::String("mcp-chain-next".to_string())),
("b.title", Value::String("MCP Chain Next".to_string())),
("b.content", Value::String("next content".to_string())),
("e.content_relation", Value::String("supersedes".to_string())),
("e.confidence", Value::Float(0.91)),
("b.is_latest", Value::Bool(true)),
("b.unit_type", Value::String("fact".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-chain-next', title: 'MCP Chain Next', content: 'next content', is_latest: true, unit_type: 'fact'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Memory {id: 'mcp-chain-current'}), (b:Memory {id: 'mcp-chain-next'}) CREATE (a)-[:EVOLVES {content_relation: 'supersedes', confidence: 0.91}]->(b)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m) WHERE m.id IN ['mcp-chain-prev', 'mcp-chain-current', 'mcp-chain-next'] DETACH DELETE m",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp memory summary read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id = $id RETURN m.id, m.title, m.content, m.is_latest, m.unit_type, m.is_crystal, m.importance, m.metadata, m.lifecycle_state",
BTreeMap::from([(
"id".to_string(),
Value::String("mcp-summary-memory".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("m.id", Value::String("mcp-summary-memory".to_string())),
("m.title", Value::String("MCP Summary Memory".to_string())),
("m.content", Value::String("summary content".to_string())),
("m.is_latest", Value::Bool(true)),
("m.unit_type", Value::String("fact".to_string())),
("m.is_crystal", Value::Bool(false)),
("m.importance", Value::Float(0.73)),
("m.metadata", Value::String("{\"state\":\"active\"}".to_string())),
("m.lifecycle_state", Value::String("active".to_string())),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-summary-memory', title: 'MCP Summary Memory', content: 'summary content', is_latest: true, unit_type: 'fact', is_crystal: false, importance: 0.73, metadata: '{\"state\":\"active\"}', lifecycle_state: 'active'})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'mcp-summary-memory'}) DETACH DELETE m",
),
ExpectedRows::RowCount(1),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp graph node memory detail read",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory) WHERE m.id = $id OPTIONAL MATCH (m)-[r]-() RETURN m.id, m.title, m.created_at, COUNT(r), m.content, m.is_crystal, m.is_latest, m.unit_type, m.importance, m.community_id",
BTreeMap::from([(
"id".to_string(),
Value::String("mcp-node-memory".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("m.id", Value::String("mcp-node-memory".to_string())),
("m.title", Value::String("MCP Node Memory".to_string())),
("m.created_at", Value::Int(1_700_000_050)),
("count(r)", Value::Int(1)),
("m.content", Value::String("node memory content".to_string())),
("m.is_crystal", Value::Bool(false)),
("m.is_latest", Value::Bool(true)),
("m.unit_type", Value::String("fact".to_string())),
("m.importance", Value::Float(0.62)),
("m.community_id", Value::Int(9830)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-node-memory', title: 'MCP Node Memory', created_at: 1700000050, content: 'node memory content', is_crystal: false, is_latest: true, unit_type: 'fact', importance: 0.62, community_id: 9830})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'mcp-node-memory-entity'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'mcp-node-memory'}), (e:Entity {id: 'mcp-node-memory-entity'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['mcp-node-memory', 'mcp-node-memory-entity'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp graph node entity detail read",
CypherFixtureStatement::with_parameters(
"MATCH (e:Entity) WHERE e.id = $id OPTIONAL MATCH (m:Memory)-[:MENTIONS]->(e) RETURN e.id, e.name, e.entity_type, COUNT(m), e.description, e.community_id, e.pagerank_score",
BTreeMap::from([(
"id".to_string(),
Value::String("mcp-node-entity".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("e.id", Value::String("mcp-node-entity".to_string())),
("e.name", Value::String("MCP Node Entity".to_string())),
("e.entity_type", Value::String("concept".to_string())),
("count(m)", Value::Int(1)),
("e.description", Value::String("entity detail".to_string())),
("e.community_id", Value::Int(9831)),
("e.pagerank_score", Value::Float(0.44)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'mcp-node-entity', name: 'MCP Node Entity', entity_type: 'concept', description: 'entity detail', community_id: 9831, pagerank_score: 0.44})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'mcp-node-entity-memory'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'mcp-node-entity-memory'}), (e:Entity {id: 'mcp-node-entity'}) CREATE (m)-[:MENTIONS]->(e)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['mcp-node-entity', 'mcp-node-entity-memory'] DETACH DELETE n",
),
ExpectedRows::RowCount(2),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp graph node thread detail read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE t.id = $id RETURN t.id, t.title, t.source, t.message_count",
BTreeMap::from([(
"id".to_string(),
Value::String("mcp-node-thread".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([
("t.id", Value::String("mcp-node-thread".to_string())),
("t.title", Value::String("MCP Node Thread".to_string())),
("t.source", Value::String("codex".to_string())),
("t.message_count", Value::Null),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Thread {id: 'mcp-node-thread', title: 'MCP Node Thread', source: 'codex', message_count: null})",
)),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp graph node thread message count read",
CypherFixtureStatement::with_parameters(
"MATCH (t:Thread) WHERE t.id = $id OPTIONAL MATCH (t)-[:CONTAINS]->(msg:Message) RETURN COUNT(msg)",
BTreeMap::from([(
"id".to_string(),
Value::String("mcp-node-thread".to_string()),
)]),
),
ExpectedRows::Exact(vec![compatibility_row([("count(msg)", Value::Int(2))])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Message {id: 'mcp-node-msg-1'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Message {id: 'mcp-node-msg-2'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'mcp-node-thread'}), (m:Message {id: 'mcp-node-msg-1'}) CREATE (t)-[:CONTAINS]->(m)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (t:Thread {id: 'mcp-node-thread'}), (m:Message {id: 'mcp-node-msg-2'}) CREATE (t)-[:CONTAINS]->(m)",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (n) WHERE n.id IN ['mcp-node-thread', 'mcp-node-msg-1', 'mcp-node-msg-2'] DETACH DELETE n",
),
ExpectedRows::RowCount(3),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"mcp graph all shortest path read",
CypherFixtureStatement::with_parameters(
"MATCH p = (a)-[e* ALL SHORTEST 1..3]-(b) WHERE a.id = $from_id AND b.id = $to_id RETURN properties(nodes(p), 'id') AS node_ids, properties(nodes(p), 'name') AS names, length(p) AS hops",
BTreeMap::from([
("from_id".to_string(), Value::String("path-a".to_string())),
("to_id".to_string(), Value::String("path-c".to_string())),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"node_ids",
Value::List(vec![
Value::String("path-a".to_string()),
Value::String("path-b".to_string()),
Value::String("path-c".to_string()),
]),
),
(
"names",
Value::List(vec![
Value::String("Alpha".to_string()),
Value::String("Beta".to_string()),
Value::String("Gamma".to_string()),
]),
),
("hops", Value::Int(2)),
])]),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'path-a', name: 'Alpha'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'path-b', name: 'Beta'})",
))
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Entity {id: 'path-c', name: 'Gamma'})",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (a:Entity {id: 'path-a'}), (b:Entity {id: 'path-b'}) CREATE (a)-[:MENTIONS]->(b)",
))
.with_setup_query(CypherFixtureStatement::new(
"MATCH (b:Entity {id: 'path-b'}), (c:Entity {id: 'path-c'}) CREATE (b)-[:MENTIONS]->(c)",
)),
),
CompatibilityCheck::Cypher(CypherFixtureCheck::expect_rows(
"rest graph all shortest path read",
CypherFixtureStatement::with_parameters(
"MATCH p = (a)-[e* ALL SHORTEST 1..3]-(b) WHERE a.id = $from_id AND b.id = $to_id RETURN properties(nodes(p), 'id') AS node_ids, properties(nodes(p), 'name') AS node_names, length(p) AS hops",
BTreeMap::from([
("from_id".to_string(), Value::String("path-a".to_string())),
("to_id".to_string(), Value::String("path-c".to_string())),
]),
),
ExpectedRows::Exact(vec![compatibility_row([
(
"node_ids",
Value::List(vec![
Value::String("path-a".to_string()),
Value::String("path-b".to_string()),
Value::String("path-c".to_string()),
]),
),
(
"node_names",
Value::List(vec![
Value::String("Alpha".to_string()),
Value::String("Beta".to_string()),
Value::String("Gamma".to_string()),
]),
),
("hops", Value::Int(2)),
])]),
)),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"decay refresh score and confidence update",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $id}) SET m.decay_score_cached = $decay, m.confidence = $conf",
BTreeMap::from([
(
"id".to_string(),
Value::String("decay-refresh-memory-1".to_string()),
),
("decay".to_string(), Value::Float(0.42)),
("conf".to_string(), Value::Float(0.77)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'decay-refresh-memory-1', kind: 'fixture', status: 'fixture', is_crystal: false, lifecycle_state: 'archived', decay_score_cached: 1.0, confidence: 0.1})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'decay-refresh-memory-1'}) RETURN m.decay_score_cached AS decay, m.confidence AS confidence",
),
ExpectedRows::Exact(vec![compatibility_row([
("decay", Value::Float(0.42)),
("confidence", Value::Float(0.77)),
])]),
),
),
CompatibilityCheck::Cypher(
CypherFixtureCheck::expect_rows(
"decay refresh score update",
CypherFixtureStatement::with_parameters(
"MATCH (m:Memory {id: $id}) SET m.decay_score_cached = $decay",
BTreeMap::from([
(
"id".to_string(),
Value::String("decay-refresh-memory-2".to_string()),
),
("decay".to_string(), Value::Float(0.31)),
]),
),
ExpectedRows::RowCount(1),
)
.with_setup_query(CypherFixtureStatement::new(
"CREATE (:Memory {id: 'decay-refresh-memory-2', kind: 'fixture', status: 'fixture', is_crystal: false, lifecycle_state: 'archived', decay_score_cached: 1.0})",
))
.with_effect_query(
CypherFixtureStatement::new(
"MATCH (m:Memory {id: 'decay-refresh-memory-2'}) RETURN m.decay_score_cached AS decay",
),
ExpectedRows::Exact(vec![compatibility_row([(
"decay",
Value::Float(0.31),
)])]),
),
),
],
}
}
pub fn nowledge_memory_core_inventory() -> CompatibilityQueryInventory {
build_compatibility_query_inventory(
"nowledge-memory-core-inventory",
[
CompatibilityQueryCallSite::new(
"parameterized lookup uses small-label scan",
"parameterized_read",
"nowledge-memory-core::lookup",
)
.with_cypher("MATCH (m:Memory) WHERE m.id = $id RETURN m.title AS title"),
CompatibilityQueryCallSite::new(
"checkpoint control statement",
"transaction_control",
"nmem-graph::client::checkpoint",
)
.with_cypher("CHECKPOINT"),
CompatibilityQueryCallSite::new(
"begin transaction control statement",
"transaction_control",
"nmem-graph::client::with_write_transaction",
)
.with_cypher("BEGIN TRANSACTION"),
CompatibilityQueryCallSite::new(
"commit transaction control statement",
"transaction_control",
"nmem-graph::client::with_write_transaction",
)
.with_cypher("COMMIT"),
CompatibilityQueryCallSite::new(
"rollback transaction control statement",
"transaction_control",
"nmem-graph::client::with_write_transaction",
)
.with_cypher("ROLLBACK"),
CompatibilityQueryCallSite::new(
"community relates edge endpoint read",
"community_read",
"nmem-graph::community::load_edge_endpoints",
)
.with_cypher("MATCH (e1:Entity)-[r:RELATES_TO]->(e2:Entity) RETURN e1.id, e2.id"),
CompatibilityQueryCallSite::new(
"community memory mention hit ranking read",
"community_read",
"nmem-graph::community::rank_memories_for_entities",
)
.with_cypher("MATCH (m:Memory)-[:MENTIONS]->(e:Entity) WHERE e.id IN $entity_ids RETURN m.title, m.content, m.importance, COUNT(e) AS hits, m.metadata, COALESCE(m.is_latest, true) ORDER BY hits DESC, m.importance DESC, m.title ASC LIMIT 8"),
CompatibilityQueryCallSite::new(
"community entity topic candidate read",
"community_read",
"nmem-graph::community::load_topic_candidate_entities",
)
.with_cypher("MATCH (e:Entity) WHERE e.id IN $entity_ids RETURN e.name, e.entity_type, e.confidence ORDER BY e.confidence DESC, e.name ASC LIMIT 30"),
CompatibilityQueryCallSite::new(
"community entity relation edge detail read",
"community_read",
"nmem-graph::community::load_relation_edge_details",
)
.with_cypher("MATCH (e1:Entity)-[r:RELATES_TO]->(e2:Entity) WHERE e1.id IN $entity_ids AND e2.id IN $entity_ids RETURN e1.name, e2.name, r.relation_type, r.strength, r.context, r.confidence ORDER BY r.strength DESC, r.confidence DESC LIMIT 20"),
CompatibilityQueryCallSite::new(
"community topic signal reset write",
"community_write",
"nmem-graph::community::reset_topic_signals",
)
.with_cypher("MATCH (e:Entity) SET e.topic_graph_eligible = false, e.topic_signal_score = 0.0, e.topic_signal_updated_at = CURRENT_TIMESTAMP()"),
CompatibilityQueryCallSite::new(
"community topic signal enable write",
"community_write",
"nmem-graph::community::enable_topic_signal",
)
.with_cypher("MATCH (e:Entity {id: $entity_id}) SET e.topic_graph_eligible = true, e.topic_signal_score = $score, e.topic_signal_updated_at = CURRENT_TIMESTAMP()"),
CompatibilityQueryCallSite::new(
"community topic eligible entity read",
"community_read",
"nmem-graph::community::load_topic_eligible_entities",
)
.with_cypher("MATCH (e:Entity) WHERE e.topic_graph_eligible = true RETURN e.id"),
CompatibilityQueryCallSite::new(
"community node assignment write",
"community_write",
"nmem-graph::community::assign_node_community",
)
.with_cypher("MATCH (n) WHERE n.id = $node_id SET n.community_id = $community_id"),
CompatibilityQueryCallSite::new(
"community entity assignment reset write",
"community_write",
"nmem-graph::community::reset_entity_communities",
)
.with_cypher("MATCH (e:Entity) SET e.community_id = NULL"),
CompatibilityQueryCallSite::new(
"community memory assignment reset write",
"community_write",
"nmem-graph::community::reset_memory_communities",
)
.with_cypher("MATCH (m:Memory) SET m.community_id = NULL"),
CompatibilityQueryCallSite::new(
"community mention detail read",
"community_read",
"nmem-graph::community::load_mention_details_for_entities",
)
.with_cypher("MATCH (m:Memory)-[:MENTIONS]->(e:Entity) WHERE e.id IN $entity_ids RETURN e.id, m.id, m.metadata, COALESCE(m.is_latest, true)"),
CompatibilityQueryCallSite::new(
"community node cleanup delete",
"community_write",
"nmem-graph::community::replace_communities",
)
.with_cypher("MATCH (c:Community) DELETE c"),
CompatibilityQueryCallSite::new(
"community detection result create",
"community_write",
"nmem-graph::community::replace_communities",
)
.with_cypher("CREATE (c:Community { id: $id, community_id: $community_id, name: $name, description: $description, ai_summary: $ai_summary, member_count: $member_count, algorithm: 'louvain', resolution: $resolution, created_at: CURRENT_TIMESTAMP(), updated_at: CURRENT_TIMESTAMP() })"),
CompatibilityQueryCallSite::new(
"community graph meta update",
"community_write",
"nmem-graph::community::replace_communities",
)
.with_cypher("MATCH (m:GraphMeta {meta_id: 'main'}) SET m.community_detection_applied = true, m.community_algorithm = 'louvain', m.community_resolution = $resolution, m.community_count = $count, m.community_detection_computed_at = CURRENT_TIMESTAMP(), m.last_augmentation_at = CURRENT_TIMESTAMP(), m.updated_at = CURRENT_TIMESTAMP()"),
CompatibilityQueryCallSite::new(
"graph meta pagerank sentinel read",
"schema_read",
"nmem-graph::schema::SCHEMA_SENTINEL",
)
.with_cypher("MATCH (m:GraphMeta) RETURN m.pagerank_computed_at LIMIT 1"),
CompatibilityQueryCallSite::new(
"community latest updated read",
"community_read",
"nmem-graph::community_plan::latest_community_update",
)
.with_cypher("MATCH (c:Community) WHERE c.updated_at IS NOT NULL RETURN c.updated_at ORDER BY c.updated_at DESC LIMIT 1"),
CompatibilityQueryCallSite::new(
"community summary corpus read",
"community_read",
"nmem-graph::community_plan::load_summary_corpus",
)
.with_cypher("MATCH (c:Community) WHERE c.community_id IS NOT NULL AND c.community_id >= 0 RETURN c.ai_summary"),
CompatibilityQueryCallSite::new(
"entity lifecycle mention memory id read",
"entity_lifecycle_read",
"nmem-graph::entity_lifecycle::memory_mentions_for_entity",
)
.with_cypher("MATCH (m:Memory)-[:MENTIONS]->(e:Entity {id: $id}) RETURN m.id"),
CompatibilityQueryCallSite::new(
"entity lifecycle relationship create",
"entity_lifecycle_write",
"nmem-graph::entity_lifecycle::create_entity_relationship",
)
.with_cypher("MATCH (source:Entity {id: $source_id}), (target:Entity {id: $target_id}) CREATE (source)-[:RELATES_TO { relation_type: $relation_type, strength: $strength, confidence: $confidence, context: $context, conditions: $conditions, temporal_info: $temporal_info, source_reference: $source_reference, bidirectional: $bidirectional, created_at: $created_at, properties: $properties, temporal_type: $temporal_type, rel_start: $rel_start, rel_end: $rel_end, temporal_precision: $temporal_precision, is_ongoing: $is_ongoing, temporal_confidence: $temporal_confidence }]->(target)"),
CompatibilityQueryCallSite::new(
"entity lifecycle graph meta reset",
"entity_lifecycle_write",
"nmem-graph::entity_lifecycle::invalidate_graph_meta",
)
.with_cypher("MERGE (m:GraphMeta {meta_id: 'main'}) SET m.pagerank_applied = false, m.pagerank_computed_at = NULL, m.community_detection_applied = false, m.community_detection_computed_at = NULL, m.updated_at = CURRENT_TIMESTAMP()"),
CompatibilityQueryCallSite::new(
"entity lifecycle label id read",
"entity_lifecycle_read",
"nmem-graph::entity_lifecycle::label_ids_for_entity",
)
.with_cypher("MATCH (e:Entity {id: $id})-[:HAS_LABEL]->(n:Label) RETURN n.id"),
CompatibilityQueryCallSite::new(
"entity lifecycle label relationship create",
"entity_lifecycle_write",
"nmem-graph::entity_lifecycle::create_entity_label_edge",
)
.with_cypher("MATCH (e:Entity {id: $target_id}), (n:Label {id: $label_id}) CREATE (e)-[:HAS_LABEL { assigned_by: $assigned_by, created_at: $created_at, properties: $properties }]->(n)"),
CompatibilityQueryCallSite::new(
"entity lifecycle community id read",
"entity_lifecycle_read",
"nmem-graph::entity_lifecycle::community_ids_for_entity",
)
.with_cypher("MATCH (e:Entity {id: $id})-[:BELONGS_TO]->(n:Community) RETURN n.id"),
CompatibilityQueryCallSite::new(
"entity lifecycle community relationship create",
"entity_lifecycle_write",
"nmem-graph::entity_lifecycle::create_entity_community_edge",
)
.with_cypher("MATCH (e:Entity {id: $target_id}), (n:Community {id: $community_id}) CREATE (e)-[:BELONGS_TO { strength: $strength, created_at: $created_at, properties: $properties }]->(n)"),
CompatibilityQueryCallSite::new(
"entity lifecycle endpoint metadata read",
"entity_lifecycle_read",
"nmem-graph::entity_lifecycle::endpoint_metadata",
)
.with_cypher("MATCH (source:Entity {id: $source_id}), (target:Entity {id: $target_id}) RETURN source.metadata, target.metadata"),
CompatibilityQueryCallSite::new(
"entity lifecycle mention relationship read",
"entity_lifecycle_read",
"nmem-graph::entity_lifecycle::mention_relationships_for_entity",
)
.with_cypher("MATCH (m:Memory)-[r:MENTIONS]->(e:Entity {id: $id}) RETURN m.id, r"),
CompatibilityQueryCallSite::new(
"entity lifecycle mention relationship create",
"entity_lifecycle_write",
"nmem-graph::entity_lifecycle::create_mention_edge",
)
.with_cypher("MATCH (m:Memory {id: $memory_id}), (e:Entity {id: $target_id}) CREATE (m)-[:MENTIONS {confidence: $confidence, mention_count: $mention_count, created_at: $created_at, properties: $properties}]->(e)"),
CompatibilityQueryCallSite::new(
"entity lifecycle target metadata update",
"entity_lifecycle_write",
"nmem-graph::entity_lifecycle::merge_target_metadata",
)
.with_cypher("MATCH (target:Entity {id: $target_id}) SET target.aliases = $aliases, target.metadata = $metadata, target.updated_at = $updated_at, target.pagerank_score = 0.0, target.topic_graph_eligible = false, target.topic_signal_score = 0.0"),
CompatibilityQueryCallSite::new(
"entity lifecycle source detach delete",
"entity_lifecycle_write",
"nmem-graph::entity_lifecycle::delete_source_entity",
)
.with_cypher("MATCH (source:Entity {id: $source_id}) DETACH DELETE source"),
CompatibilityQueryCallSite::new(
"label lifecycle snapshot read",
"label_lifecycle_read",
"nmem-graph::label_write::load_label_snapshot",
)
.with_cypher("MATCH (l:Label {id: $id}) RETURN l.id, l.name, l.canonical_name, l.color, l.description, l.metadata, l.updated_at"),
CompatibilityQueryCallSite::new(
"label governance receipt read",
"label_lifecycle_read",
"nmem-graph::label_write::prior_lifecycle_receipt",
)
.with_cypher("MATCH (o:GovernanceOperation {id: $id}) RETURN o.operation_type, o.source_id, o.target_id, o.payload"),
CompatibilityQueryCallSite::new(
"label governance receipt create",
"label_lifecycle_write",
"nmem-graph::label_write::write_lifecycle_receipt",
)
.with_cypher("CREATE (o:GovernanceOperation { id: $id, operation_type: $operation_type, source_id: $source_id, target_id: $target_id, payload: $payload, created_at: $created_at })"),
CompatibilityQueryCallSite::new(
"label canonical usage read",
"label_lifecycle_read",
"nmem-graph::label_write::find_canonical_duplicate_groups",
)
.with_cypher("MATCH (l:Label) WHERE l.canonical_name IS NOT NULL OPTIONAL MATCH (l)<-[:HAS_LABEL]-(n) WITH l, COUNT(n) AS usage RETURN l.id, l.name, l.canonical_name, usage"),
CompatibilityQueryCallSite::new(
"label row usage read",
"label_lifecycle_read",
"nmem-graph::label_write::label_row_json",
)
.with_cypher("MATCH (l:Label {id: $label_id}) OPTIONAL MATCH (l)<-[:HAS_LABEL]-(n) WITH l, COUNT(n) as usage_count RETURN l.id, l.name, l.color, l.description, l.created_at, l.updated_at, usage_count"),
CompatibilityQueryCallSite::new(
"label canonical merge write",
"label_lifecycle_write",
"nmem-graph::label_write::resolve_or_create_label",
)
.with_cypher("MERGE (l:Label {id: $label_id}) ON CREATE SET l.name = $label_name, l.canonical_name = $canonical, l.color = $color, l.description = $description, l.created_at = $now, l.updated_at = $now, l.metadata = $metadata ON MATCH SET l.updated_at = $now, l.canonical_name = COALESCE(l.canonical_name, $canonical)"),
CompatibilityQueryCallSite::new(
"label memory edge count read",
"label_lifecycle_read",
"nmem-graph::label_write::remove_label_from_memory",
)
.with_cypher("MATCH (m:Memory {id: $memory_id})-[r:HAS_LABEL]->(l:Label {id: $label_id}) RETURN COUNT(r)"),
CompatibilityQueryCallSite::new(
"label semantic pairing usage read",
"label_lifecycle_read",
"nmem-graph::label_write::scan_labels_for_semantic_pairing",
)
.with_cypher("MATCH (l:Label) WHERE l.canonical_name IS NOT NULL OPTIONAL MATCH (l)<-[:HAS_LABEL]-(n) WITH l, COUNT(n) AS usage RETURN l.id, l.name, l.canonical_name, usage ORDER BY usage DESC LIMIT $cap"),
CompatibilityQueryCallSite::new(
"label metadata update",
"label_lifecycle_write",
"nmem-graph::label_write::apply_label_merge",
)
.with_cypher("MATCH (l:Label {id: $id}) SET l.metadata = $meta, l.updated_at = $now"),
CompatibilityQueryCallSite::new(
"label source detach delete",
"label_lifecycle_write",
"nmem-graph::label_write::apply_label_merge",
)
.with_cypher("MATCH (source:Label {id: $source_id}) DETACH DELETE source"),
CompatibilityQueryCallSite::new(
"whole node projection",
"record_projection_read",
"nmem-graph::repo::get_by_id",
)
.with_cypher("MATCH (m:Memory {id: $memory_id}) RETURN m"),
CompatibilityQueryCallSite::new(
"rest agent memory attachment node read",
"memory_read",
"nmem-server::rest_agent::attached_source.memory",
)
.with_cypher("MATCH (m:Memory {id: $id}) RETURN m"),
CompatibilityQueryCallSite::new(
"source memory count increment",
"source_provenance_write",
"nmem-graph::source_write::create_sourced_from",
)
.with_cypher("MATCH (s:Source {id: $id}) SET s.memory_count = s.memory_count + 1"),
CompatibilityQueryCallSite::new(
"source provenance endpoint existence",
"source_provenance_write",
"nmem-graph::source_write::create_sourced_from",
)
.with_cypher(
"MATCH (m:Memory {id: $memory_id}), (s:Source {id: $source_id}) RETURN count(m)",
),
CompatibilityQueryCallSite::new(
"source provenance source endpoint existence",
"source_provenance_write",
"nmem-graph::source_write::create_sourced_from",
)
.with_cypher(
"MATCH (m:Memory {id: $memory_id}), (s:Source {id: $source_id}) RETURN count(m)",
),
CompatibilityQueryCallSite::new(
"entity relationship endpoint existence",
"entity_relationship_write",
"nmem-graph::entity_write::create_entity_relationship",
)
.with_cypher(
"MATCH (source:Entity {id: $source_entity_id}) MATCH (target:Entity {id: $target_entity_id}) RETURN source.id, target.id",
),
CompatibilityQueryCallSite::new(
"source provenance relationship create",
"source_provenance_write",
"nmem-graph::source_write::create_sourced_from",
)
.with_cypher(
"MATCH (m:Memory {id: $memory_id}), (s:Source {id: $source_id}) CREATE (m)-[:SOURCED_FROM {chunk_index: $chunk_index}]->(s)",
),
CompatibilityQueryCallSite::new(
"source provenance full relationship create",
"source_provenance_write",
"nmem-graph::source_write::create_sourced_from",
)
.with_cypher(
"MATCH (m:Memory {id: $memory_id}), (s:Source {id: $source_id}) CREATE (m)-[:SOURCED_FROM { chunk_index: $chunk_index, chunk_range: $chunk_range, source_version: $source_version, created_at: $created_at }]->(s)",
),
CompatibilityQueryCallSite::new(
"source provenance edge existence count",
"source_provenance_write",
"nmem-graph::source_write::edge_exists",
)
.with_cypher(
"MATCH (m:Memory {id: $memory_id})-[r:SOURCED_FROM]->(s:Source {id: $source_id}) RETURN count(r)",
),
CompatibilityQueryCallSite::new(
"source repair exact provenance candidate scan",
"source_provenance_repair",
"nmem-graph::source_write::repair_sourced_from_for_source",
)
.with_cypher(
"MATCH (m:Memory) WHERE ( m.source = $source_value OR m.metadata CONTAINS $compact_fragment OR m.metadata CONTAINS $spaced_fragment ) RETURN m.id ORDER BY m.created_at ASC, m.id ASC SKIP $offset LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"source memory count read",
"source_provenance_read",
"nmem-graph::source_write::memory_count",
)
.with_cypher("MATCH (s:Source {id: $id}) RETURN s.memory_count"),
CompatibilityQueryCallSite::new(
"source provenance global edge count",
"source_provenance_read",
"nmem-graph::source_write::edge_count",
)
.with_cypher("MATCH (:Memory)-[r:SOURCED_FROM]->(:Source) RETURN count(r)"),
CompatibilityQueryCallSite::new(
"source attribution read",
"source_attribution_read",
"nmem-server::context_wiring::source_attribution",
)
.with_cypher(
"MATCH (m:Memory)-[:SOURCED_FROM]->(s:Source) WHERE m.id IN $ids RETURN m.id, s.id",
),
CompatibilityQueryCallSite::new(
"source provenance memory detail read",
"source_read",
"nmem-server::source_repo::memories_for_source",
)
.with_cypher(
"MATCH (m:Memory)-[r:SOURCED_FROM]->(s:Source {id: $source_id}) RETURN m.id as memory_id, m.title as title, m.content as content, r.chunk_index as chunk_index, r.chunk_range as chunk_range, m.unit_type as unit_type, m.confidence as confidence ORDER BY r.chunk_index ASC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"source memory id list read",
"source_read",
"nmem-server::source_repo::memory_ids_for_source",
)
.with_cypher(
"MATCH (m:Memory)-[:SOURCED_FROM]->(s:Source {id: $sid}) RETURN m.id LIMIT 24",
),
CompatibilityQueryCallSite::new(
"memory source provenance id read",
"source_read",
"nmem-server::memory_delete::source_ids_for_memory",
)
.with_cypher(
"MATCH (m:Memory {id: $id})-[:SOURCED_FROM]->(s:Source) RETURN s.id",
),
CompatibilityQueryCallSite::new(
"source memory-count decrement floor write",
"source_write",
"nmem-server::memory_delete::decrement_source_memory_count",
)
.with_cypher(
"MATCH (s:Source {id: $id}) SET s.memory_count = CASE WHEN s.memory_count > 0 THEN s.memory_count - 1 ELSE 0 END",
),
CompatibilityQueryCallSite::new(
"source relationship source-reference count read",
"relationship_read",
"nmem-server::memory_delete::source_reference_relationship_count",
)
.with_cypher(
"MATCH (e1:Entity)-[r:RELATES_TO]->(e2:Entity) WHERE r.source_reference = $id RETURN count(r)",
),
CompatibilityQueryCallSite::new(
"source relationship source-reference delete",
"relationship_write",
"nmem-server::memory_delete::delete_source_reference_relationships",
)
.with_cypher(
"MATCH (e1:Entity)-[r:RELATES_TO]->(e2:Entity) WHERE r.source_reference = $id DELETE r",
),
CompatibilityQueryCallSite::new(
"memory cascade delete",
"memory_write",
"nmem-graph::repo::delete_memory_cascade",
)
.with_cypher("MATCH (m:Memory {id: $memory_id}) DETACH DELETE m"),
CompatibilityQueryCallSite::new(
"thread compaction attribution read",
"thread_compaction_read",
"nmem-server::context_wiring::thread_compaction_attribution",
)
.with_cypher(
"MATCH (t:Thread)-[:COMPACTS_TO]->(m:Memory) WHERE m.id IN $ids RETURN m.id, t.thread_id",
),
CompatibilityQueryCallSite::new(
"context skill thread source read",
"context_wiring_read",
"nmem-server::context_wiring::skill_thread_sources",
)
.with_cypher(
"MATCH (t:Thread)-[:COMPACTS_TO]->(m:Memory)<-[:SYNTHESIZED_FROM]-(sk:Skill {id: $id}) RETURN t.title, t.source",
),
CompatibilityQueryCallSite::new(
"memory metadata bulk read",
"memory_read",
"nmem-graph::repo::memory_metadata_for_ids",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, m.unit_type, m.metadata",
),
CompatibilityQueryCallSite::new(
"memory authority signal read",
"memory_read",
"nmem-graph::repo::memory_authority",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id IN $memory_ids RETURN m.id, m.importance, m.pagerank_score, m.metadata, m.is_latest, m.lifecycle_state",
),
CompatibilityQueryCallSite::new(
"source thread memory attribution read",
"thread_compaction_read",
"nmem-graph::repo::source_threads_for_memories",
)
.with_cypher(
"MATCH (t:Thread)-[:COMPACTS_TO]->(m:Memory) WHERE m.id IN $memory_ids RETURN m.id as memory_id, t.thread_id as thread_id, t.title as title, t.source as source, CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END AS space_id",
),
CompatibilityQueryCallSite::new(
"thread compacted-memory count read",
"thread_compaction_read",
"nmem-server::thread_repo::compacted_memory_count",
)
.with_cypher(
"MATCH (t:Thread {id: $thread_uuid})-[:COMPACTS_TO]->(m:Memory) RETURN COUNT(m)",
),
CompatibilityQueryCallSite::new(
"thread compacted-memory ids read",
"thread_compaction_read",
"nmem-graph::repo::memories_by_thread_uuid",
)
.with_cypher(
"MATCH (t:Thread {id: $thread_uuid})-[:COMPACTS_TO]->(m:Memory) RETURN m.id",
),
CompatibilityQueryCallSite::new(
"thread compacted-memory summary read",
"thread_compaction_read",
"nmem-server::thread_repo::compacted_memory_summary",
)
.with_cypher(
"MATCH (t:Thread {id: $uuid})-[:COMPACTS_TO]->(m:Memory) RETURN m.id, m.title, m.content LIMIT 200",
),
CompatibilityQueryCallSite::new(
"thread distill compaction link create",
"thread_distill_write",
"nmem-server::rest_distill::create_distilled_memory_link",
)
.with_cypher(
"MATCH (t:Thread {id: $thread_uuid}), (m:Memory {id: $memory_id}) CREATE (t)-[:COMPACTS_TO {compaction_method: $method, created_at: $created_at, properties: $props}]->(m)",
),
CompatibilityQueryCallSite::new(
"memory created-at bulk read",
"memory_timestamp_read",
"nmem-server::context_wiring::memory_created_at_bulk",
)
.with_cypher("MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, m.created_at"),
CompatibilityQueryCallSite::new(
"memory bulk metadata read",
"memory_read",
"nmem-server::mcp_server::memory_bulk_metadata; nmem-server::reindex::memory_bulk_metadata; nmem-server::scheduler_service::memory_bulk_metadata",
)
.with_cypher("MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, m.metadata"),
CompatibilityQueryCallSite::new(
"feed memory detail bulk read",
"memory_read",
"nmem-server::rest_feed::hydrate_memory_events",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, m.title, m.content, m.metadata, m.is_latest",
),
CompatibilityQueryCallSite::new(
"memory bulk space read",
"memory_read",
"nmem-server::mcp_server::memory_bulk_space; nmem-server::scheduler_service::memory_bulk_space",
)
.with_cypher("MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, m.space_id"),
CompatibilityQueryCallSite::new(
"feed memory normalized-space bulk read",
"memory_read",
"nmem-server::rest_feed::event_memory_spaces",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END",
),
CompatibilityQueryCallSite::new(
"rest fs memory unit-type count read",
"memory_read",
"nmem-server::rest_fs::ls_memory_unit_types",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.unit_type IS NOT NULL AND m.unit_type <> '' RETURN m.unit_type, COUNT(DISTINCT m) AS memory_count",
),
CompatibilityQueryCallSite::new(
"rest fs memory created-at scan read",
"memory_read",
"nmem-server::rest_fs::ls_memory_dates; nmem-server::rest_fs::ls_time_prefix_days.record",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.created_at IS NOT NULL RETURN m.created_at, m.metadata, m.is_latest LIMIT 5000",
),
CompatibilityQueryCallSite::new(
"rest fs memory event-start scan read",
"memory_read",
"nmem-server::rest_fs::ls_time_prefix_days.event",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.event_start IS NOT NULL RETURN m.event_start, m.metadata, m.is_latest LIMIT 5000",
),
CompatibilityQueryCallSite::new(
"rest fs memory id page read",
"memory_read",
"nmem-server::rest_fs::fetch_visible_memory_rows_page",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id > $after RETURN m.id, m.title, m.crystal_title, m.is_crystal, m.updated_at, m.metadata, m.is_latest ORDER BY m.id ASC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest fs memory detail token lookup read",
"memory_read",
"nmem-server::rest_fs::fetch_memory_for_kfs.token",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id = $lookup OR m.id STARTS WITH $lookup OR m.id CONTAINS $lookup OR m.id = $token OR m.id STARTS WITH $token OR m.id CONTAINS $token RETURN m.id, m.title, m.content, m.importance, m.confidence, COALESCE(m.is_crystal, false), m.crystal_title, m.created_at, m.updated_at, m.event_start, m.event_end, m.temporal_context, CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END, m.unit_type, m.source, m.metadata, m.lifecycle_state LIMIT 1",
),
CompatibilityQueryCallSite::new(
"rest fs memory detail lookup read",
"memory_read",
"nmem-server::rest_fs::fetch_memory_for_kfs.lookup",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id = $lookup OR m.id STARTS WITH $lookup OR m.id CONTAINS $lookup RETURN m.id, m.title, m.content, m.importance, m.confidence, COALESCE(m.is_crystal, false), m.crystal_title, m.created_at, m.updated_at, m.event_start, m.event_end, m.temporal_context, CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END, m.unit_type, m.source, m.metadata, m.lifecycle_state LIMIT 1",
),
CompatibilityQueryCallSite::new(
"memory compact detail fallback read",
"memory_read",
"nmem-server::memory_repo::compact_detail_fallback",
)
.with_cypher(
"MATCH (m:Memory {id: $memory_id}) RETURN m.id, COALESCE(m.title, ''), COALESCE(m.content, ''), COALESCE(m.unit_type, '')",
),
CompatibilityQueryCallSite::new(
"mcp memory content detail read",
"mcp_read",
"nmem-server::mcp_server::memory_detail.content",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id = $id RETURN m.title, m.content, m.created_at, m.source",
),
CompatibilityQueryCallSite::new(
"mcp memory metadata detail read",
"mcp_read",
"nmem-server::mcp_server::memory_detail.metadata",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id = $id RETURN m.unit_type, m.importance, m.space_id",
),
CompatibilityQueryCallSite::new(
"mcp memory compact detail read",
"mcp_read",
"nmem-server::mcp_server::memory_detail.compact",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id = $id RETURN m.id, m.title, m.content, m.unit_type",
),
CompatibilityQueryCallSite::new(
"memory label name list read",
"label_read",
"nmem-server::memory_repo::label_names_for_memory",
)
.with_cypher(
"MATCH (m:Memory {id: $memory_id})-[:HAS_LABEL]->(l:Label) RETURN l.name LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest memory label metadata read",
"label_read",
"nmem-server::rest::export_memory.labels",
)
.with_cypher(
"MATCH (m:Memory {id: $memory_id})-[:HAS_LABEL]->(l:Label) RETURN l.id, l.name, l.color, l.description ORDER BY l.name",
),
CompatibilityQueryCallSite::new(
"memory label names by id read",
"label_read",
"nmem-graph::repo::add_evolves_edge::label_names_for_replaced_memory",
)
.with_cypher(
"MATCH (m:Memory)-[:HAS_LABEL]->(l:Label) WHERE m.id = $id RETURN l.name",
),
CompatibilityQueryCallSite::new(
"memory label bulk name read",
"label_read",
"nmem-server::memory_repo::bulk_label_names_for_memories",
)
.with_cypher(
"MATCH (m:Memory)-[:HAS_LABEL]->(l:Label) WHERE m.id IN $ids RETURN m.id, l.name",
),
CompatibilityQueryCallSite::new(
"memory label fallback bulk read",
"label_read",
"nmem-server::memory_repo::bulk_label_fallback_for_memories",
)
.with_cypher(
"MATCH (m:Memory)-[:HAS_LABEL]->(l:Label) WHERE m.id IN $ids RETURN m.id, COALESCE(l.name, l.id)",
),
CompatibilityQueryCallSite::new(
"memory label endpoint bulk read",
"label_read",
"nmem-graph::label_repo::bulk_label_endpoints_for_memories",
)
.with_cypher(
"MATCH (m:Memory)-[:HAS_LABEL]->(l:Label) WHERE m.id IN $ids RETURN m.id, l.id",
),
CompatibilityQueryCallSite::new(
"memory label distinct name count read",
"label_read",
"nmem-server::memory_repo::bulk_label_name_hits_for_memories",
)
.with_cypher(
"MATCH (m:Memory)-[:HAS_LABEL]->(l:Label) WHERE m.id IN $ids AND l.name IN $names RETURN m.id, COUNT(DISTINCT l.name)",
),
CompatibilityQueryCallSite::new(
"rest fs memory label names read",
"label_read",
"nmem-server::rest_fs::labels_for_memory",
)
.with_cypher(
"MATCH (m:Memory {id: $id})-[:HAS_LABEL]->(l:Label) RETURN l.name ORDER BY l.name",
),
CompatibilityQueryCallSite::new(
"source label bulk name read",
"source_label_read",
"nmem-server::source_label_repo::bulk_label_names_for_sources",
)
.with_cypher(
"MATCH (s:Source)-[:HAS_LABEL]->(l:Label) WHERE s.id IN $ids RETURN s.id, l.name",
),
CompatibilityQueryCallSite::new(
"source label endpoint bulk read",
"source_label_read",
"nmem-server::source_label_repo::bulk_label_endpoints_for_sources",
)
.with_cypher(
"MATCH (s:Source)-[:HAS_LABEL]->(l:Label) WHERE s.id IN $ids RETURN s.id, l.id",
),
CompatibilityQueryCallSite::new(
"mcp label memory lookup read",
"mcp_read",
"nmem-server::mcp_server::label_lookup.memories",
)
.with_cypher(
"MATCH (m:Memory)-[:HAS_LABEL]->(l:Label) WHERE l.name = $label RETURN m.id, m.title, 'memory', m.importance LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"mcp label entity lookup read",
"mcp_read",
"nmem-server::mcp_server::label_lookup.entities",
)
.with_cypher(
"MATCH (e:Entity)-[:HAS_LABEL]->(l:Label) WHERE l.name = $label RETURN e.id, e.name, e.entity_type LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"mcp label source lookup read",
"mcp_read",
"nmem-server::mcp_server::label_lookup.sources",
)
.with_cypher(
"MATCH (s:Source)-[:HAS_LABEL]->(l:Label) WHERE l.name = $label RETURN s.id, s.original_name, s.source_type LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"source label relationship count read",
"source_label_read",
"nmem-server::source_label_repo::source_label_relationship_count",
)
.with_cypher(
"MATCH (s:Source {id: $source_id})-[r:HAS_LABEL]->(l:Label {id: $label_id}) RETURN COUNT(r)",
),
CompatibilityQueryCallSite::new(
"source label relationship merge",
"source_label_write",
"nmem-server::source_label_repo::assign_source_label",
)
.with_cypher(
"MATCH (s:Source {id: $source_id}), (l:Label {id: $label_id}) MERGE (s)-[r:HAS_LABEL]->(l) ON CREATE SET r.assigned_by = $assigned_by, r.created_at = $created_at, r.properties = $properties",
),
CompatibilityQueryCallSite::new(
"source label relationship delete",
"source_label_write",
"nmem-server::source_label_repo::remove_source_label",
)
.with_cypher(
"MATCH (s:Source {id: $source_id})-[r:HAS_LABEL]->(l:Label {id: $label_id}) DELETE r",
),
CompatibilityQueryCallSite::new(
"source detail normalized space read",
"source_read",
"nmem-server::source_repo::detail_normalized_space",
)
.with_cypher(
"MATCH (s:Source {id: $source_id}) RETURN s.id, s.original_name, CASE WHEN s.space_id IS NULL OR s.space_id = '' THEN 'default' ELSE s.space_id END, s.lifecycle_state, s.parsed_path",
),
CompatibilityQueryCallSite::new(
"source detail chunk-count read",
"source_read",
"nmem-server::source_repo::detail_chunk_count",
)
.with_cypher(
"MATCH (s:Source {id: $source_id}) RETURN s.original_name, CASE WHEN s.space_id IS NULL OR s.space_id = '' THEN 'default' ELSE s.space_id END, s.chunk_count",
),
CompatibilityQueryCallSite::new(
"source detail file-path read",
"source_read",
"nmem-server::source_repo::detail_file_path",
)
.with_cypher(
"MATCH (s:Source {id: $source_id}) RETURN s.original_name, CASE WHEN s.space_id IS NULL OR s.space_id = '' THEN 'default' ELSE s.space_id END, s.file_path",
),
CompatibilityQueryCallSite::new(
"source default metadata fallback read",
"source_read",
"nmem-server::source_repo::default_metadata_for_source",
)
.with_cypher(
"MATCH (s:Source {id: $id}) RETURN COALESCE(s.space_id, 'default'), COALESCE(s.source_type, 'file'), COALESCE(s.lifecycle_state, 'indexed'), COALESCE(s.mime_type, '')",
),
CompatibilityQueryCallSite::new(
"rest fs source grep single lookup read",
"source_read",
"nmem-server::rest_fs::grep_sources.single",
)
.with_cypher(
"MATCH (s:Source) WHERE s.id = $key OR s.id STARTS WITH $key OR s.id CONTAINS $key RETURN s.id, s.original_name, s.parsed_path, s.mime_type, s.created_at, s.updated_at, s.space_id, s.lifecycle_state, s.chunk_count, s.memory_count, s.size_bytes LIMIT 1",
),
CompatibilityQueryCallSite::new(
"rest fs source grep page read",
"source_read",
"nmem-server::rest_fs::grep_sources.page",
)
.with_cypher(
"MATCH (s:Source) WHERE s.id > $after RETURN s.id, s.original_name, s.parsed_path, s.mime_type, s.created_at, s.updated_at, s.space_id, s.lifecycle_state, s.chunk_count, s.memory_count, s.size_bytes ORDER BY s.id ASC LIMIT 200",
),
CompatibilityQueryCallSite::new(
"rest agent source attachment node read",
"source_read",
"nmem-server::rest_agent::attached_source.library",
)
.with_cypher("MATCH (s:Source {id: $id}) RETURN s"),
CompatibilityQueryCallSite::new(
"rest fs source listing page read",
"source_read",
"nmem-server::rest_fs::ls_sources",
)
.with_cypher(
"MATCH (s:Source) WHERE s.id > $after RETURN s.id, s.original_name, s.mime_type, s.updated_at, s.size_bytes, s.summary ORDER BY s.id ASC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest fs source detail lookup read",
"source_read",
"nmem-server::rest_fs::fetch_source_for_kfs",
)
.with_cypher(
"MATCH (s:Source) WHERE s.id = $key OR s.id STARTS WITH $key OR s.id CONTAINS $key RETURN s.id, s.original_name, s.mime_type, s.parsed_path, s.summary, s.size_bytes, s.chunk_count, s.memory_count, s.created_at, s.updated_at, s.space_id, s.lifecycle_state LIMIT 1",
),
CompatibilityQueryCallSite::new(
"rest fs imported artifact source page read",
"source_read",
"nmem-server::rest_fs::ls_imported_artifacts",
)
.with_cypher(
"MATCH (s:Source) WHERE s.id > $after RETURN s.id, s.original_name, s.mime_type, s.updated_at ORDER BY s.id ASC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest fs generated artifact source page read",
"source_read",
"nmem-server::rest_fs::ls_artifacts",
)
.with_cypher(
"MATCH (s:Source) WHERE s.id > $after AND s.metadata IS NOT NULL AND s.metadata CONTAINS $marker RETURN s.id, s.original_name, s.updated_at ORDER BY s.id ASC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"source list fallback page read",
"source_read",
"nmem-server::source_repo::list_sources_page",
)
.with_cypher(
"MATCH (s:Source) RETURN s.id, COALESCE(s.original_name, ''), COALESCE(s.summary, ''), COALESCE(s.mime_type, ''), COALESCE(s.source_type, 'file'), COALESCE(s.source_url, ''), COALESCE(s.size_bytes, 0), COALESCE(s.version, 1), COALESCE(s.memory_count, 0), COALESCE(s.chunk_count, 0), COALESCE(s.lifecycle_state, 'indexed'), COALESCE(s.space_id, 'default'), s.created_at, s.updated_at ORDER BY s.id SKIP $offset LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"reindex memory projection page read",
"reindex_read",
"nmem-server::reindex::reindex_memories",
)
.with_cypher(
"MATCH (m:Memory) RETURN m.id, m.title, m.content, m.importance, m.confidence, m.created_at, m.updated_at, m.is_latest, m.is_crystal, m.unit_type, m.review_status, m.space_id, m.metadata ORDER BY m.id SKIP $offset LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"reindex entity projection page read",
"reindex_read",
"nmem-server::reindex::reindex_entities",
)
.with_cypher(
"MATCH (e:Entity) RETURN e.id, e.name, e.description, e.entity_type, e.created_at ORDER BY e.id SKIP $offset LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"reindex community projection page read",
"reindex_read",
"nmem-server::reindex::reindex_communities",
)
.with_cypher(
"MATCH (c:Community) RETURN c.id, c.community_id, COALESCE(c.name, ''), COALESCE(c.description, ''), COALESCE(c.ai_summary, ''), COALESCE(c.member_count, 0), c.created_at ORDER BY c.id SKIP $offset LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"reindex thread projection page read",
"reindex_read",
"nmem-server::reindex::reindex_messages.thread_page",
)
.with_cypher(
"MATCH (t:Thread) RETURN t.id, t.thread_id, COALESCE(t.title, ''), COALESCE(t.source, ''), COALESCE(t.project, ''), COALESCE(t.workspace, ''), COALESCE(t.space_id, 'default') ORDER BY t.id SKIP $offset LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"source overview memory-count ranking read",
"source_read",
"nmem-server::source_repo::overview_by_memory_count",
)
.with_cypher(
"MATCH (s:Source) RETURN s.id, COALESCE(s.original_name, s.source_type, 'Source'), s.source_type, s.lifecycle_state, COALESCE(s.memory_count, 0) ORDER BY s.memory_count DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"source bulk summary fallback read",
"source_read",
"nmem-server::source_repo::bulk_source_summaries",
)
.with_cypher(
"MATCH (s:Source) WHERE s.id IN $ids RETURN s.id, COALESCE(s.original_name, s.file_path, s.source_type, 'Source'), s.source_type, s.summary, s.file_path, s.memory_count, s.chunk_count",
),
CompatibilityQueryCallSite::new(
"source count read",
"source_read",
"nmem-server::source_repo::count_sources",
)
.with_cypher("MATCH (s:Source) RETURN count(s)"),
CompatibilityQueryCallSite::new(
"source extracted id list read",
"source_read",
"nmem-server::source_repo::extracted_source_ids",
)
.with_cypher(
"MATCH (s:Source) WHERE s.id IN $ids AND s.lifecycle_state = 'extracted' RETURN s.id",
),
CompatibilityQueryCallSite::new(
"source extracted lifecycle mark indexed write",
"source_write",
"nmem-server::source_repo::mark_extracted_sources_indexed",
)
.with_cypher(
"MATCH (s:Source) WHERE s.id IN $ids AND s.lifecycle_state = 'extracted' SET s.lifecycle_state = 'indexed', s.updated_at = timestamp($updated_at)",
),
CompatibilityQueryCallSite::new(
"source lifecycle indexed chunk-count write",
"source_write",
"nmem-server::source_repo::mark_source_indexed",
)
.with_cypher(
"MATCH (s:Source {id: $id}) SET s.lifecycle_state = 'indexed', s.chunk_count = $chunk_count, s.updated_at = timestamp($updated_at)",
),
CompatibilityQueryCallSite::new(
"source lifecycle state update write",
"source_write",
"nmem-server::source_repo::set_source_lifecycle_state",
)
.with_cypher(
"MATCH (s:Source {id: $id}) SET s.lifecycle_state = $state, s.updated_at = timestamp($updated_at)",
),
CompatibilityQueryCallSite::new(
"source space update write",
"source_write",
"nmem-server::source_repo::set_source_space",
)
.with_cypher(
"MATCH (s:Source {id: $id}) SET s.space_id = $target_space_id, s.updated_at = timestamp($updated_at)",
),
CompatibilityQueryCallSite::new(
"source bulk normalized-space move write",
"source_write",
"nmem-server::source_repo::move_sources_to_space",
)
.with_cypher(
"MATCH (s:Source) WHERE s.id IN $ids AND CASE WHEN s.space_id IS NULL OR s.space_id = '' THEN 'default' ELSE s.space_id END = $source_space_id SET s.space_id = $target_space_id, s.updated_at = $updated_at",
),
CompatibilityQueryCallSite::new(
"source normalized-space id list read",
"source_read",
"nmem-server::source_repo::source_ids_in_space",
)
.with_cypher(
"MATCH (s:Source) WHERE CASE WHEN s.space_id IS NULL OR s.space_id = '' THEN 'default' ELSE s.space_id END = $space_id RETURN s.id",
),
CompatibilityQueryCallSite::new(
"memory normalized-space id list read",
"memory_read",
"nmem-server::memory_repo::memory_ids_in_space",
)
.with_cypher(
"MATCH (m:Memory) WHERE CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END = $space_id RETURN m.id",
),
CompatibilityQueryCallSite::new(
"memory bulk normalized-space move write",
"memory_write",
"nmem-server::memory_repo::move_memories_to_space",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id IN $ids AND CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END = $source_space_id SET m.space_id = $target_space_id, m.updated_at = $updated_at",
),
CompatibilityQueryCallSite::new(
"memory normalized-space limit-one read",
"memory_read",
"nmem-server::memory_repo::has_memory_in_space",
)
.with_cypher(
"MATCH (m:Memory) WHERE CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END = $space_id RETURN m.id LIMIT 1",
),
CompatibilityQueryCallSite::new(
"memory candidate normalized-space id read",
"memory_read",
"nmem-server::memory_repo::candidate_memory_ids_in_source_space",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id IN $candidate_ids AND CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END = $source_space_id RETURN m.id",
),
CompatibilityQueryCallSite::new(
"memory candidate normalized-space exclusion read",
"memory_read",
"nmem-server::memory_repo::candidate_memory_ids_outside_target_space",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id IN $candidate_ids AND CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END <> $target_space_id RETURN m.id",
),
CompatibilityQueryCallSite::new(
"memory normalized-space count read",
"memory_read",
"nmem-server::memory_repo::count_memories_in_space",
)
.with_cypher(
"MATCH (m:Memory) WHERE CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END = $source_space_id RETURN count(m)",
),
CompatibilityQueryCallSite::new(
"memory normalized-space limited id read",
"memory_read",
"nmem-server::memory_repo::limited_memory_ids_in_space",
)
.with_cypher(
"MATCH (m:Memory) WHERE CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END = $source_space_id RETURN m.id LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"memory unit type update returning id",
"memory_write",
"nmem-graph::repo::update_memory_unit_type",
)
.with_cypher(
"MATCH (m:Memory {id: $id}) SET m.unit_type = $unit_type, m.updated_at = $updated_at RETURN m.id",
),
CompatibilityQueryCallSite::new(
"memory lifecycle metadata update",
"memory_write",
"nmem-graph::repo::update_memory_lifecycle",
)
.with_cypher(
"MATCH (m:Memory {id: $id}) SET m.metadata = $metadata, m.is_latest = $is_latest, m.lifecycle_state = $lifecycle_state, m.updated_at = $updated_at",
),
CompatibilityQueryCallSite::new(
"memory id-list normalized-space move returning ids",
"memory_write",
"nmem-server::memory_repo::move_memory_ids_to_space_returning",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id IN $memory_ids AND CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END = $source_space_id SET m.space_id = $target_space_id, m.updated_at = $updated_at RETURN m.id",
),
CompatibilityQueryCallSite::new(
"memory id-list normalized-space exclusion move returning ids",
"memory_write",
"nmem-server::memory_repo::move_memory_ids_outside_target_space_returning",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id IN $memory_ids AND CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END <> $target_space_id SET m.space_id = $target_space_id, m.updated_at = $updated_at RETURN m.id",
),
CompatibilityQueryCallSite::new(
"thread normalized-space id pair read",
"thread_read",
"nmem-server::thread_repo::thread_ids_in_space",
)
.with_cypher(
"MATCH (t:Thread) WHERE CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END = $space_id RETURN t.id, t.thread_id",
),
CompatibilityQueryCallSite::new(
"thread bulk node-id normalized-space move write",
"thread_write",
"nmem-server::thread_repo::move_thread_nodes_to_space",
)
.with_cypher(
"MATCH (t:Thread) WHERE t.id IN $ids AND CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END = $source_space_id SET t.space_id = $target_space_id, t.updated_at = $updated_at",
),
CompatibilityQueryCallSite::new(
"thread denorm preserve newer update",
"thread_write",
"nmem-graph::repo::update_thread_denorm",
)
.with_cypher(
"MATCH (t:Thread {id: $thread_uuid}) SET t.message_count = $message_count, t.updated_at = CASE WHEN $updated_at IS NULL THEN t.updated_at WHEN $preserve_newer_existing_updated_at = true AND t.updated_at IS NOT NULL AND t.updated_at > $updated_at THEN t.updated_at ELSE $updated_at END",
),
CompatibilityQueryCallSite::new(
"thread identity normalized-space id read",
"thread_read",
"nmem-server::thread_repo::thread_identity_ids_in_space",
)
.with_cypher(
"MATCH (ti:ThreadIdentity) WHERE CASE WHEN ti.space_id IS NULL OR ti.space_id = '' THEN 'default' ELSE ti.space_id END = $space_id RETURN ti.thread_id",
),
CompatibilityQueryCallSite::new(
"rest thread source lookup read",
"thread_read",
"nmem-server::rest::export_memory.source_thread",
)
.with_cypher(
"MATCH (t:Thread) WHERE t.thread_id = $sid OR t.id = $sid RETURN t.thread_id, t.title, t.source, t.created_at LIMIT 1",
),
CompatibilityQueryCallSite::new(
"rest fs thread source distinct listing read",
"thread_read",
"nmem-server::rest_fs::ls_thread_sources",
)
.with_cypher(
"MATCH (t:Thread) WHERE t.source IS NOT NULL AND t.source <> '' RETURN DISTINCT t.source AS s ORDER BY s ASC",
),
CompatibilityQueryCallSite::new(
"rest fs thread source page read",
"thread_read",
"nmem-server::rest_fs::ls_threads_in_source",
)
.with_cypher(
"MATCH (t:Thread) WHERE t.source = $source AND t.id > $after RETURN t.id, t.title, t.updated_at ORDER BY t.id ASC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest fs thread meta lookup read",
"thread_read",
"nmem-server::rest_fs::render_thread_meta",
)
.with_cypher(
"MATCH (t:Thread) WHERE (t.id = $key OR t.id STARTS WITH $key OR t.id CONTAINS $key) AND t.source = $source RETURN t.id, t.thread_id, t.title, t.summary, t.message_count, t.source, t.created_at, t.updated_at, t.space_id, t.project, t.workspace LIMIT 1",
),
CompatibilityQueryCallSite::new(
"rest fs thread messages lookup read",
"thread_read",
"nmem-server::rest_fs::render_thread_messages.lookup",
)
.with_cypher(
"MATCH (t:Thread) WHERE (t.id = $key OR t.id STARTS WITH $key OR t.id CONTAINS $key) AND t.source = $source RETURN t.id, t.message_count, t.space_id LIMIT 1",
),
CompatibilityQueryCallSite::new(
"rest fs thread legacy messages read",
"thread_read",
"nmem-server::rest_fs::legacy_kuzu_messages_jsonl",
)
.with_cypher(
"MATCH (t:Thread {id: $thread_uuid})-[c:CONTAINS]->(m:Message) RETURN m.id, m.role, m.content, COALESCE(c.order_index, m.order_index), m.timestamp, m.token_count ORDER BY COALESCE(c.order_index, m.order_index)",
),
CompatibilityQueryCallSite::new(
"rest agent thread attachment title read",
"thread_read",
"nmem-server::rest_agent::attached_source.thread",
)
.with_cypher(
"MATCH (t:Thread) WHERE t.thread_id = $id OR t.id = $id RETURN t.title LIMIT 1",
),
CompatibilityQueryCallSite::new(
"thread identity resolve read",
"thread_read",
"nmem-graph::repo::resolve_thread_identity",
)
.with_cypher(
"MATCH (ti:ThreadIdentity {id: $identity_key}) RETURN ti.thread_node_id, ti.thread_id, ti.space_id, ti.source LIMIT 1",
),
CompatibilityQueryCallSite::new(
"thread identity compensation delete",
"thread_write",
"nmem-graph::repo::delete_thread_compensation::identity",
)
.with_cypher("MATCH (ti:ThreadIdentity {id: $identity_key}) DETACH DELETE ti"),
CompatibilityQueryCallSite::new(
"thread identity cascade delete",
"thread_write",
"nmem-graph::repo::delete_thread_cascade::identities",
)
.with_cypher(
"MATCH (ti:ThreadIdentity) WHERE ti.id = $public_thread_id OR ti.id = $input_thread_id OR ti.thread_node_id = $thread_uuid DETACH DELETE ti",
),
CompatibilityQueryCallSite::new(
"thread compensation delete",
"thread_write",
"nmem-graph::repo::delete_thread_compensation::thread",
)
.with_cypher("MATCH (t:Thread {id: $thread_uuid}) DETACH DELETE t"),
CompatibilityQueryCallSite::new(
"thread identity bulk normalized-space move write",
"thread_write",
"nmem-server::thread_repo::move_thread_identities_to_space",
)
.with_cypher(
"MATCH (ti:ThreadIdentity) WHERE ti.thread_id IN $ids AND CASE WHEN ti.space_id IS NULL OR ti.space_id = '' THEN 'default' ELSE ti.space_id END = $source_space_id SET ti.space_id = $target_space_id, ti.updated_at = $updated_at",
),
CompatibilityQueryCallSite::new(
"thread normalized-space logical id read",
"thread_read",
"nmem-server::thread_repo::logical_thread_ids_in_space",
)
.with_cypher(
"MATCH (t:Thread) WHERE CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END = $space_id RETURN t.thread_id",
),
CompatibilityQueryCallSite::new(
"thread logical fallback resolve read",
"thread_read",
"nmem-graph::repo::resolve_thread_identity::legacy_fallback",
)
.with_cypher(
"MATCH (t:Thread {thread_id: $thread_id}) RETURN t.id, t.thread_id, t.space_id, t.source LIMIT 2",
),
CompatibilityQueryCallSite::new(
"thread sync metadata coalesced read",
"thread_read",
"nmem-graph::repo::thread_sync_metadata",
)
.with_cypher(
"MATCH (t:Thread {id: $id}) RETURN COALESCE(t.title, ''), COALESCE(t.source, ''), COALESCE(t.project, ''), COALESCE(t.workspace, ''), COALESCE(t.space_id, 'default')",
),
CompatibilityQueryCallSite::new(
"thread create with identity payload write",
"thread_write",
"nmem-graph::repo::create_thread_with_identity::thread",
)
.with_cypher(
"CREATE (t:Thread { id: $id, thread_id: $thread_id, title: $title, summary: $summary, message_count: $message_count, participants: $participants, source: $source, created_at: $created_at, updated_at: $updated_at, space_id: $space_id, project: $project, workspace: $workspace, tool_version: $tool_version, import_date: $import_date, metadata: $metadata })",
),
CompatibilityQueryCallSite::new(
"thread identity create write",
"thread_write",
"nmem-graph::repo::create_thread_with_identity::identity",
)
.with_cypher(
"CREATE (ti:ThreadIdentity { id: $id, thread_id: $thread_id, thread_node_id: $thread_node_id, source: $source, space_id: $space_id, created_at: $created_at, updated_at: $updated_at })",
),
CompatibilityQueryCallSite::new(
"memory entity name list read",
"entity_read",
"nmem-server::memory_repo::entity_names_for_memory",
)
.with_cypher(
"MATCH (m:Memory {id: $memory_id})-[:MENTIONS]->(e:Entity) RETURN e.name LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest fs memory mention count read",
"entity_read",
"nmem-server::rest_fs::count_mentions",
)
.with_cypher(
"MATCH (m:Memory {id: $id})-[r:MENTIONS]->(:Entity) RETURN COUNT(r)",
),
CompatibilityQueryCallSite::new(
"rest fs memory back-reference count read",
"entity_read",
"nmem-server::rest_fs::count_back_references",
)
.with_cypher(
"MATCH (other:Memory)-[r:MENTIONS]->(:Entity)<-[:MENTIONS]-(m:Memory {id: $id}) WHERE other.id <> $id RETURN COUNT(DISTINCT other)",
),
CompatibilityQueryCallSite::new(
"rest memory related entity metadata read",
"entity_read",
"nmem-server::rest::export_memory.related_entities",
)
.with_cypher(
"MATCH (m:Memory {id: $memory_id})-[:MENTIONS]->(e:Entity) RETURN e.name, e.entity_type, e.confidence",
),
CompatibilityQueryCallSite::new(
"memory entity endpoint bulk read",
"entity_read",
"nmem-server::memory_repo::bulk_entity_endpoints_for_memories",
)
.with_cypher(
"MATCH (m:Memory)-[:MENTIONS]->(e:Entity) WHERE m.id IN $mids AND e.id IN $eids RETURN m.id, e.id",
),
CompatibilityQueryCallSite::new(
"source fan-in relationship count",
"source_read",
"nmem-server::rest_sources::move_source_to_space",
)
.with_cypher(
"MATCH (:Memory)-[r:SOURCED_FROM]->(:Source {id: $id}) RETURN count(r)",
),
CompatibilityQueryCallSite::new(
"source detail memory-count read",
"source_read",
"nmem-server::source_repo::detail_with_memory_count",
)
.with_cypher(
"MATCH (s:Source) WHERE s.id = $id OPTIONAL MATCH (m:Memory)-[:SOURCED_FROM]->(s) RETURN s.id, s.title, s.source_type, COUNT(m)",
),
CompatibilityQueryCallSite::new(
"memory review-status bulk read",
"memory_read",
"nmem-server::review_repo::bulk_memory_review_state",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, m.review_status, m.title, m.content",
),
CompatibilityQueryCallSite::new(
"memory ranked overview read",
"memory_read",
"nmem-server::memory_repo::ranked_overview",
)
.with_cypher(
"MATCH (m:Memory) RETURN m.id, COALESCE(m.title, LEFT(m.content, 60)), m.title, LEFT(COALESCE(m.content, ''), 200), COALESCE(m.pagerank_score, m.importance, 0.5), m.community_id, m.space_id, m.created_at, m.updated_at, m.source, m.event_start, m.event_end, m.importance ORDER BY COALESCE(m.pagerank_score, m.importance, 0.5) DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"source metadata timestamp update",
"source_write",
"nmem-server::rest_sources::mark_source_auto_ocr",
)
.with_cypher(
"MATCH (s:Source {id: $id}) SET s.metadata = $metadata, s.updated_at = timestamp($updated_at)",
),
CompatibilityQueryCallSite::new(
"rest sources html parsed update",
"source_write",
"nmem-server::rest_sources::mark_html_source_parsed",
)
.with_cypher(
"MATCH (s:Source {id: $id}) SET s.lifecycle_state = 'parsed', s.parsed_path = $parsed_path, s.original_name = $original_name, s.mime_type = 'text/html', s.source_url = $source_url, s.summary = $summary, s.sha256 = $sha256, s.size_bytes = $size_bytes, s.updated_at = timestamp($updated_at), s.metadata = $metadata",
),
CompatibilityQueryCallSite::new(
"rest sources file parsed update",
"source_write",
"nmem-server::rest_sources::mark_file_source_parsed",
)
.with_cypher(
"MATCH (s:Source {id: $id}) SET s.lifecycle_state = 'parsed', s.parsed_path = $parsed_path, s.file_path = $file_path, s.original_name = $original_name, s.mime_type = $mime_type, s.source_url = $source_url, s.summary = $summary, s.sha256 = $sha256, s.size_bytes = $size_bytes, s.updated_at = timestamp($updated_at), s.metadata = $metadata",
),
CompatibilityQueryCallSite::new(
"rest sources version lookup",
"source_read",
"nmem-server::rest_sources::find_source_version_by_name",
)
.with_cypher(
"MATCH (s:Source) WHERE s.original_name = $name AND s.space_id = $space_id RETURN s.id, s.version ORDER BY s.version DESC LIMIT 1",
),
CompatibilityQueryCallSite::new(
"rest sources revised edge create",
"source_write",
"nmem-server::rest_sources::create_source_revision_edge",
)
.with_cypher(
"MATCH (newer:Source {id: $newer_id}), (older:Source {id: $older_id}) CREATE (newer)-[:REVISED_AS { diff_summary: '', sections_changed: '[]', revision_type: 'update', detected_by: 'filename_match', created_at: timestamp($created_at) }]->(older)",
),
CompatibilityQueryCallSite::new(
"rest sources markdown file create",
"source_write",
"nmem-server::rest_sources::create_markdown_file_source",
)
.with_cypher(
"CREATE (s:Source { id: $id, source_type: 'file', original_name: $original_name, mime_type: 'text/markdown', file_path: $file_path, parsed_path: $parsed_path, source_url: '', sha256: $sha256, size_bytes: $size_bytes, version: $version, space_id: $space_id, lifecycle_state: 'parsed', chunk_count: 0, memory_count: 0, section_tree: '', summary: $summary, error_message: '', created_at: timestamp($created_at), updated_at: timestamp($updated_at), metadata: $metadata })",
),
CompatibilityQueryCallSite::new(
"rest sources url create",
"source_write",
"nmem-server::rest_sources::create_url_source",
)
.with_cypher(
"CREATE (s:Source { id: $id, source_type: 'url', original_name: $original_name, mime_type: 'text/html', file_path: '', parsed_path: $parsed_path, source_url: $source_url, sha256: $sha256, size_bytes: $size_bytes, version: 1, space_id: $space_id, lifecycle_state: 'parsed', chunk_count: 0, memory_count: 0, section_tree: $section_tree, summary: $summary, error_message: '', created_at: timestamp($created_at), updated_at: timestamp($updated_at), metadata: $metadata })",
),
CompatibilityQueryCallSite::new(
"rest sources pdf create",
"source_write",
"nmem-server::rest_sources::create_pdf_source",
)
.with_cypher(
"CREATE (s:Source { id: $id, source_type: 'file', original_name: $original_name, mime_type: 'application/pdf', file_path: $file_path, parsed_path: $parsed_path, source_url: $source_url, sha256: $sha256, size_bytes: $size_bytes, version: $version, space_id: $space_id, lifecycle_state: 'parsed', chunk_count: 0, memory_count: 0, section_tree: '', summary: $summary, error_message: '', created_at: timestamp($created_at), updated_at: timestamp($updated_at), metadata: $metadata })",
),
CompatibilityQueryCallSite::new(
"rest sources generic file create",
"source_write",
"nmem-server::rest_sources::create_generic_file_source",
)
.with_cypher(
"CREATE (s:Source { id: $id, source_type: 'file', original_name: $original_name, mime_type: $mime_type, file_path: $file_path, parsed_path: $parsed_path, source_url: '', sha256: $sha256, size_bytes: $size_bytes, version: $version, space_id: $space_id, lifecycle_state: 'parsed', chunk_count: 0, memory_count: 0, section_tree: '', summary: $summary, error_message: '', created_at: timestamp($created_at), updated_at: timestamp($updated_at), metadata: $metadata })",
),
CompatibilityQueryCallSite::new(
"rest sources markdown import create",
"source_write",
"nmem-server::rest_sources::import_markdown_source",
)
.with_cypher(
"CREATE (s:Source { id: $id, source_type: 'file', original_name: $original_name, mime_type: 'text/markdown', file_path: $file_path, parsed_path: $parsed_path, source_url: '', sha256: $sha256, size_bytes: $size_bytes, version: 1, space_id: $space_id, lifecycle_state: 'parsed', chunk_count: 0, memory_count: 0, section_tree: '', summary: $summary, error_message: '', created_at: timestamp($created_at), updated_at: timestamp($updated_at), metadata: $metadata })",
),
CompatibilityQueryCallSite::new(
"rest sources parsed path summary update",
"source_write",
"nmem-server::rest_sources::mark_source_parsed_with_path",
)
.with_cypher(
"MATCH (s:Source {id: $id}) SET s.lifecycle_state = 'parsed', s.parsed_path = $parsed_path, s.summary = $summary, s.sha256 = $sha256, s.size_bytes = $size_bytes, s.updated_at = timestamp($updated_at)",
),
CompatibilityQueryCallSite::new(
"rest sources summary update",
"source_write",
"nmem-server::rest_sources::mark_source_parsed_summary",
)
.with_cypher(
"MATCH (s:Source {id: $id}) SET s.lifecycle_state = 'parsed', s.summary = $summary, s.sha256 = $sha256, s.size_bytes = $size_bytes, s.updated_at = timestamp($updated_at)",
),
CompatibilityQueryCallSite::new(
"rest sources whole node read",
"source_read",
"nmem-server::rest_sources::get_source_node",
)
.with_cypher("MATCH (s:Source {id: $source_id}) RETURN s"),
CompatibilityQueryCallSite::new(
"rest sources sha version read",
"source_read",
"nmem-server::rest_sources::find_source_by_sha",
)
.with_cypher(
"MATCH (s:Source) WHERE s.sha256 = $sha256 AND s.space_id = $space_id RETURN s ORDER BY s.version DESC LIMIT 1",
),
CompatibilityQueryCallSite::new(
"rest sources label name read",
"source_label_read",
"nmem-server::rest_sources::label_name_for_source",
)
.with_cypher("MATCH (l:Label {id: $label_id}) RETURN l.name LIMIT 1"),
CompatibilityQueryCallSite::new(
"memory relation multi property update",
"memory_relation_write",
"nmem-server::mcp_server::update_memory_relation",
)
.with_cypher(
"MATCH (source:Memory)-[r:MEMORY_RELATES_TO]->(target:Memory) WHERE r.id = $relation_id SET r.relation_type = $relation_type, r.strength = $strength, r.confidence = $confidence, r.status = $status, r.reason = $reason, r.updated_at = timestamp($updated_at)",
),
CompatibilityQueryCallSite::new(
"mcp memory relation full update",
"mcp_write",
"nmem-server::mcp_server::memory_relation_create_or_update.existing",
)
.with_cypher(
"MATCH (source:Memory)-[r:MEMORY_RELATES_TO]->(target:Memory) WHERE r.id = $relation_id SET r.relation_type = $relation_type, r.strength = $strength, r.confidence = $confidence, r.bidirectional = $bidirectional, r.status = $status, r.reviewed = $reviewed, r.source = $source, r.agent_id = $agent_id, r.source_app = $source_app, r.reason = $reason, r.updated_at = timestamp($updated_at)",
),
CompatibilityQueryCallSite::new(
"rest memory relation full update write",
"memory_relation_write",
"nmem-server::rest_memory_relations::update_memory_relation",
)
.with_cypher(
"MATCH (source:Memory)-[r:MEMORY_RELATES_TO]->(target:Memory) WHERE r.id = $relation_id SET r.relation_type = $relation_type, r.strength = $strength, r.confidence = $confidence, r.bidirectional = $bidirectional, r.status = $status, r.reviewed = $reviewed, r.source = $source, r.author_id = $author_id, r.agent_id = $agent_id, r.source_app = $source_app, r.reason = $reason, r.properties = $properties, r.updated_at = timestamp($updated_at)",
),
CompatibilityQueryCallSite::new(
"mcp memory relation create",
"mcp_write",
"nmem-server::mcp_server::memory_relation_create_or_update.create",
)
.with_cypher(
"MATCH (source:Memory), (target:Memory) WHERE source.id = $source_memory_id AND target.id = $target_memory_id CREATE (source)-[:MEMORY_RELATES_TO { id: $relation_id, relation_type: $relation_type, strength: $strength, confidence: $confidence, bidirectional: $bidirectional, status: $status, reviewed: $reviewed, source: $source, author_id: $author_id, agent_id: $agent_id, source_app: $source_app, reason: $reason, properties: $properties, created_at: timestamp($created_at), updated_at: timestamp($updated_at) }]->(target)",
),
CompatibilityQueryCallSite::new(
"rest memory relation create write",
"memory_relation_write",
"nmem-server::rest_memory_relations::create_memory_relation",
)
.with_cypher(
"MATCH (source:Memory {id: $source_memory_id}), (target:Memory {id: $target_memory_id}) CREATE (source)-[r:MEMORY_RELATES_TO { id: $relation_id, relation_type: $relation_type, strength: $strength, confidence: $confidence, bidirectional: $bidirectional, status: $status, reviewed: $reviewed, source: $source, author_id: $author_id, agent_id: $agent_id, source_app: $source_app, reason: $reason, properties: $properties, created_at: timestamp($created_at), updated_at: timestamp($updated_at) }]->(target)",
),
CompatibilityQueryCallSite::new(
"mcp memory relation identity read",
"mcp_read",
"nmem-server::mcp_server::memory_relation_identity",
)
.with_cypher(
"MATCH (m:Memory {id: $memory_id}) RETURN m.id, CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END",
),
CompatibilityQueryCallSite::new(
"mcp memory relation endpoint spaces read",
"mcp_read",
"nmem-server::mcp_server::memory_relation_validate_spaces",
)
.with_cypher(
"MATCH (m:Memory {id: $memory_id}), (s:Source {id: $source_id}) RETURN m.space_id, s.space_id",
),
CompatibilityQueryCallSite::new(
"rest memory relation identity detail read",
"memory_relation_read",
"nmem-server::rest_memory_relations::memory_identity",
)
.with_cypher(
"MATCH (m:Memory {id: $memory_id}) RETURN m.id, CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END, m.metadata, m.is_latest, m.lifecycle_state",
),
CompatibilityQueryCallSite::new(
"mcp memory relation existing id lookup",
"mcp_read",
"nmem-server::mcp_server::find_existing_memory_relation",
)
.with_cypher(
"MATCH (source:Memory)-[r:MEMORY_RELATES_TO]->(target:Memory) WHERE source.id = $source_memory_id AND target.id = $target_memory_id AND COALESCE(r.status, 'active') <> 'deleted' RETURN r.id ORDER BY r.updated_at DESC LIMIT 1",
),
CompatibilityQueryCallSite::new(
"rest memory relation existing bidirectional lookup",
"memory_relation_read",
"nmem-server::rest_memory_relations::find_existing_relation",
)
.with_cypher(
"MATCH (source:Memory)-[r:MEMORY_RELATES_TO]->(target:Memory) WHERE r.status <> 'deleted' AND ( (source.id = $source_memory_id AND target.id = $target_memory_id) OR ( source.id = $target_memory_id AND target.id = $source_memory_id AND r.bidirectional = true ) ) RETURN r.id LIMIT 1",
),
CompatibilityQueryCallSite::new(
"mcp memory relation outgoing read",
"mcp_read",
"nmem-server::mcp_server::memory_relations.outgoing",
)
.with_cypher(
"MATCH (a:Memory)-[r:MEMORY_RELATES_TO]->(b:Memory) WHERE a.id = $id AND r.status = 'active' RETURN r.id, b.id, b.title, r.relation_type, r.strength, r.confidence, r.bidirectional, r.reason, r.source, r.source_app, b.metadata, b.is_latest, b.lifecycle_state",
),
CompatibilityQueryCallSite::new(
"mcp memory relation incoming read",
"mcp_read",
"nmem-server::mcp_server::memory_relations.incoming",
)
.with_cypher(
"MATCH (a:Memory)-[r:MEMORY_RELATES_TO]->(b:Memory) WHERE b.id = $id AND r.status = 'active' RETURN r.id, a.id, a.title, r.relation_type, r.strength, r.confidence, r.bidirectional, r.reason, r.source, r.source_app, a.metadata, a.is_latest, a.lifecycle_state",
),
CompatibilityQueryCallSite::new(
"mcp memory mentions read",
"mcp_read",
"nmem-server::mcp_server::memory_mentions",
)
.with_cypher(
"MATCH (m:Memory)-[r:MENTIONS]->(e:Entity) WHERE m.id = $id RETURN e.id, e.name, e.entity_type, r.confidence",
),
CompatibilityQueryCallSite::new(
"mcp source synthesized crystal read",
"mcp_read",
"nmem-server::mcp_server::source_crystals",
)
.with_cypher(
"MATCH (c:Memory)-[r:SYNTHESIZED_FROM]->(s:Memory) WHERE s.id = $id RETURN c.id, c.crystal_title, r.weight",
),
CompatibilityQueryCallSite::new(
"mcp memory evolves outgoing read",
"mcp_read",
"nmem-server::mcp_server::memory_evolves.outgoing",
)
.with_cypher(
"MATCH (a:Memory)-[e:EVOLVES]->(b:Memory) WHERE a.id = $id RETURN b.id, b.title, e.content_relation, e.confidence, e.reviewed, b.is_latest",
),
CompatibilityQueryCallSite::new(
"mcp memory evolves incoming read",
"mcp_read",
"nmem-server::mcp_server::memory_evolves.incoming",
)
.with_cypher(
"MATCH (a:Memory)-[e:EVOLVES]->(b:Memory) WHERE b.id = $id RETURN a.id, a.title, e.content_relation, e.confidence, e.reviewed, a.is_latest",
),
CompatibilityQueryCallSite::new(
"mcp evolves chain backward read",
"mcp_read",
"nmem-server::mcp_server::walk_evolves_chain.backward",
)
.with_cypher(
"MATCH (a:Memory)-[e:EVOLVES]->(b:Memory) WHERE b.id = $id RETURN a.id, a.title, a.content, e.content_relation, e.confidence, a.is_latest, a.unit_type LIMIT 1",
),
CompatibilityQueryCallSite::new(
"mcp evolves chain forward read",
"mcp_read",
"nmem-server::mcp_server::walk_evolves_chain.forward",
)
.with_cypher(
"MATCH (a:Memory)-[e:EVOLVES]->(b:Memory) WHERE a.id = $id RETURN b.id, b.title, b.content, e.content_relation, e.confidence, b.is_latest, b.unit_type LIMIT 1",
),
CompatibilityQueryCallSite::new(
"mcp memory summary read",
"mcp_read",
"nmem-server::mcp_server::memory_summary",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id = $id RETURN m.id, m.title, m.content, m.is_latest, m.unit_type, m.is_crystal, m.importance, m.metadata, m.lifecycle_state",
),
CompatibilityQueryCallSite::new(
"mcp graph node memory detail read",
"mcp_read",
"nmem-server::mcp_server::lookup_graph_node.memory",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id = $id OPTIONAL MATCH (m)-[r]-() RETURN m.id, m.title, m.created_at, COUNT(r), m.content, m.is_crystal, m.is_latest, m.unit_type, m.importance, m.community_id",
),
CompatibilityQueryCallSite::new(
"mcp graph node entity detail read",
"mcp_read",
"nmem-server::mcp_server::lookup_graph_node.entity",
)
.with_cypher(
"MATCH (e:Entity) WHERE e.id = $id OPTIONAL MATCH (m:Memory)-[:MENTIONS]->(e) RETURN e.id, e.name, e.entity_type, COUNT(m), e.description, e.community_id, e.pagerank_score",
),
CompatibilityQueryCallSite::new(
"mcp graph node thread detail read",
"mcp_read",
"nmem-server::mcp_server::lookup_graph_node.thread",
)
.with_cypher("MATCH (t:Thread) WHERE t.id = $id RETURN t.id, t.title, t.source, t.message_count"),
CompatibilityQueryCallSite::new(
"mcp graph node thread message count read",
"mcp_read",
"nmem-server::mcp_server::lookup_graph_node.thread_legacy_count",
)
.with_cypher(
"MATCH (t:Thread) WHERE t.id = $id OPTIONAL MATCH (t)-[:CONTAINS]->(msg:Message) RETURN COUNT(msg)",
),
CompatibilityQueryCallSite::new(
"source revision history path read",
"source_revision_read",
"nmem-server::rest_sources::source_revision_history",
)
.with_cypher(
"MATCH p = (s:Source {id: $source_id})-[:REVISED_AS*1..10]->(older:Source) RETURN older.id as id, older.original_name as name, older.version as version, older.sha256 as sha256, older.created_at as created_at ORDER BY older.version DESC",
),
CompatibilityQueryCallSite::new(
"evolves progression list read",
"memory_evolution_read",
"nmem-server::context_wiring::evolves_progression_list",
)
.with_cypher(
"MATCH (older:Memory)-[e:EVOLVES]->(newer:Memory) WHERE (older.unit_type IN $types OR newer.unit_type IN $types) RETURN older.id, newer.id, e.content_relation, e.is_progression, older.unit_type, newer.unit_type, older.title, newer.title, older.created_at, newer.created_at, older.is_latest, newer.is_latest, older.space_id, newer.space_id ORDER BY newer.created_at DESC LIMIT 500",
),
CompatibilityQueryCallSite::new(
"context memory title preview read",
"context_wiring_read",
"nmem-server::context_wiring::semantic_unit_rows",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.unit_type IN $types AND (m.is_latest IS NULL OR m.is_latest = true) AND (m.is_crystal IS NULL OR m.is_crystal = false) RETURN m.id, m.title ORDER BY m.created_at DESC LIMIT 400",
),
CompatibilityQueryCallSite::new(
"context memory label preview read",
"context_wiring_read",
"nmem-server::context_wiring::semantic_unit_label_rows",
)
.with_cypher(
"MATCH (m:Memory)-[:HAS_LABEL]->(l:Label) WHERE m.unit_type IN $types AND m.is_latest = true AND (m.is_crystal IS NULL OR m.is_crystal = false) RETURN l.id, l.canonical_name, l.name, m.id, m.title ORDER BY m.created_at DESC LIMIT 2000",
),
CompatibilityQueryCallSite::new(
"context memory typed preview read",
"context_wiring_read",
"nmem-server::context_wiring::semantic_unit_typed_rows",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.unit_type IN $types AND (m.is_latest IS NULL OR m.is_latest = true) AND (m.is_crystal IS NULL OR m.is_crystal = false) RETURN m.id, m.title, m.unit_type ORDER BY m.created_at DESC LIMIT 800",
),
CompatibilityQueryCallSite::new(
"mcp entity wiki lookup read",
"mcp_read",
"nmem-server::mcp_server::render_entity_wiki_markdown.entity",
)
.with_cypher(
"MATCH (e:Entity) WHERE e.id = $id OR LOWER(COALESCE(e.name, '')) = $needle RETURN e.id, e.name, e.entity_type, e.description, e.community_id LIMIT 1",
),
CompatibilityQueryCallSite::new(
"mcp entity wiki memory read",
"mcp_read",
"nmem-server::mcp_server::render_entity_wiki_markdown.memories",
)
.with_cypher(
"MATCH (m:Memory)-[r:MENTIONS]->(e:Entity {id: $entity_id}) RETURN m.id, COALESCE(m.title, ''), COALESCE(m.content, ''), COALESCE(r.confidence, 0.5) ORDER BY COALESCE(r.confidence, 0.5) DESC, COALESCE(m.importance, 0.5) DESC LIMIT 10",
),
CompatibilityQueryCallSite::new(
"mcp crystal wiki detail read",
"mcp_read",
"nmem-server::mcp_server::render_crystal_wiki_markdown.detail",
)
.with_cypher(
"MATCH (c:Memory) WHERE c.id = $id AND COALESCE(c.is_crystal, false) = true RETURN c.id, c.crystal_title, c.title, c.content, c.source_unit_count, c.importance, c.created_at LIMIT 1",
),
CompatibilityQueryCallSite::new(
"mcp crystal wiki source read",
"mcp_read",
"nmem-server::mcp_server::render_crystal_wiki_markdown.sources",
)
.with_cypher(
"MATCH (c:Memory {id: $id})-[r:SYNTHESIZED_FROM]->(s:Memory) RETURN s.id, COALESCE(s.title, ''), COALESCE(s.content, ''), COALESCE(r.weight, 0.0) ORDER BY COALESCE(r.weight, 0.0) DESC LIMIT 10",
),
CompatibilityQueryCallSite::new(
"mcp topic wiki community read",
"mcp_read",
"nmem-server::mcp_server::render_topic_wiki_markdown.community",
)
.with_cypher(
"MATCH (c:Community) WHERE c.community_id = $community_id RETURN c.id, c.community_id, c.name, c.description, c.ai_summary, c.member_count LIMIT 1",
),
CompatibilityQueryCallSite::new(
"mcp explore seed memory read",
"mcp_read",
"nmem-server::mcp_server::insert_explore_seed",
)
.with_cypher(
"MATCH (m:Memory {id: $id}) RETURN m.id, COALESCE(m.title, LEFT(COALESCE(m.content, ''), 60)), COALESCE(m.importance, 0.5), COALESCE(m.is_crystal, false), COALESCE(m.content, ''), m.created_at, m.community_id LIMIT 1",
),
CompatibilityQueryCallSite::new(
"mcp explore mentions read",
"mcp_read",
"nmem-server::mcp_server::expand_memory_graph_once.mentions",
)
.with_cypher(
"MATCH (m:Memory {id: $id})-[r:MENTIONS]->(e:Entity) RETURN e.id, COALESCE(e.name, e.id), e.entity_type, e.community_id, COALESCE(r.confidence, 0.5), m.id ORDER BY COALESCE(r.confidence, 0.5) DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"mcp explore memory relation read",
"mcp_read",
"nmem-server::mcp_server::expand_memory_graph_once.memory_relations",
)
.with_cypher(
"MATCH (a:Memory)-[r:MEMORY_RELATES_TO]-(b:Memory) WHERE (a.id = $id OR b.id = $id) AND COALESCE(r.status, 'active') = 'active' RETURN a.id, COALESCE(a.title, LEFT(COALESCE(a.content, ''), 60)), COALESCE(a.importance, 0.5), COALESCE(a.is_crystal, false), COALESCE(a.content, ''), a.created_at, a.community_id, b.id, COALESCE(b.title, LEFT(COALESCE(b.content, ''), 60)), COALESCE(b.importance, 0.5), COALESCE(b.is_crystal, false), COALESCE(b.content, ''), b.created_at, b.community_id, r.id, r.relation_type, r.reason, r.strength, r.confidence LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"mcp explore evolves read",
"mcp_read",
"nmem-server::mcp_server::expand_memory_graph_once.evolves",
)
.with_cypher(
"MATCH (a:Memory)-[r:EVOLVES]-(b:Memory) WHERE a.id = $id OR b.id = $id RETURN a.id, COALESCE(a.title, LEFT(COALESCE(a.content, ''), 60)), COALESCE(a.importance, 0.5), COALESCE(a.is_crystal, false), COALESCE(a.content, ''), a.created_at, a.community_id, b.id, COALESCE(b.title, LEFT(COALESCE(b.content, ''), 60)), COALESCE(b.importance, 0.5), COALESCE(b.is_crystal, false), COALESCE(b.content, ''), b.created_at, b.community_id, r.content_relation, r.confidence LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"mcp explore synthesized read",
"mcp_read",
"nmem-server::mcp_server::expand_memory_graph_once.synthesized",
)
.with_cypher(
"MATCH (c:Memory)-[r:SYNTHESIZED_FROM]-(s:Memory) WHERE c.id = $id OR s.id = $id RETURN c.id, COALESCE(c.crystal_title, c.title, LEFT(COALESCE(c.content, ''), 60)), COALESCE(c.importance, 0.5), true, COALESCE(c.content, ''), c.created_at, c.community_id, s.id, COALESCE(s.title, LEFT(COALESCE(s.content, ''), 60)), COALESCE(s.importance, 0.5), COALESCE(s.is_crystal, false), COALESCE(s.content, ''), s.created_at, s.community_id, r.weight LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"mcp graph all shortest path read",
"graph_path_read",
"nmem-server::mcp_server::find_shortest_path",
)
.with_cypher(
"MATCH p = (a)-[e* ALL SHORTEST 1..3]-(b) WHERE a.id = $from_id AND b.id = $to_id RETURN properties(nodes(p), 'id') AS node_ids, properties(nodes(p), 'name') AS names, length(p) AS hops",
),
CompatibilityQueryCallSite::new(
"rest graph all shortest path read",
"graph_path_read",
"nmem-server::rest_graph::find_shortest_path",
)
.with_cypher(
"MATCH p = (a)-[e* ALL SHORTEST 1..3]-(b) WHERE a.id = $from_id AND b.id = $to_id RETURN properties(nodes(p), 'id') AS node_ids, properties(nodes(p), 'name') AS node_names, length(p) AS hops",
),
CompatibilityQueryCallSite::new(
"source detach delete cascade",
"source_delete_write",
"nmem-server::rest_sources::delete_source_node",
)
.with_cypher("MATCH (s:Source {id: $id}) DETACH DELETE s"),
CompatibilityQueryCallSite::new(
"thread optional message count",
"thread_cleanup_read",
"nmem-graph::repo::delete_thread_graph",
)
.with_cypher(
"MATCH (t:Thread {id: $thread_uuid}) OPTIONAL MATCH (t)-[:CONTAINS]->(m:Message) RETURN COUNT(m)",
),
CompatibilityQueryCallSite::new(
"thread message ordered read",
"thread_read",
"nmem-server::thread_repo::ordered_messages",
)
.with_cypher(
"MATCH (t:Thread {id: $thread_uuid})-[c:CONTAINS]->(m:Message) RETURN m.id, m.content, m.role, COALESCE(c.order_index, m.order_index), m.timestamp ORDER BY COALESCE(c.order_index, m.order_index)",
),
CompatibilityQueryCallSite::new(
"thread distill legacy message read",
"thread_distill_read",
"nmem-server::rest_distill::legacy_thread_messages",
)
.with_cypher(
"MATCH (t:Thread {id: $thread_uuid})-[c:CONTAINS]->(m:Message) RETURN COALESCE(c.order_index, m.order_index), m.role, m.content, m.metadata ORDER BY COALESCE(c.order_index, m.order_index)",
),
CompatibilityQueryCallSite::new(
"thread distill total message count read",
"thread_distill_read",
"nmem-server::rest_distill::total_message_count",
)
.with_cypher(
"MATCH (t:Thread {id: $thread_uuid}) OPTIONAL MATCH (t)-[:CONTAINS]->(m:Message) WITH t, COUNT(m) AS counted RETURN COALESCE(t.message_count, counted)",
),
CompatibilityQueryCallSite::new(
"thread message detach delete",
"thread_cleanup_write",
"nmem-graph::repo::delete_thread_graph",
)
.with_cypher(
"MATCH (t:Thread {id: $thread_uuid})-[:CONTAINS]->(m:Message) DETACH DELETE m",
),
CompatibilityQueryCallSite::new(
"legacy tail extracted refs count",
"thread_cleanup_read",
"nmem-graph::repo::count_legacy_tail_memory_refs",
)
.with_cypher(
"MATCH (t:Thread {id: $thread_uuid})-[:CONTAINS]->(m:Message) WHERE m.order_index >= $start_index OPTIONAL MATCH (:Memory)-[r:EXTRACTED_FROM]->(m) RETURN COUNT(r)",
),
CompatibilityQueryCallSite::new(
"top entities by degree",
"graph_analysis_read",
"nmem-server::rest_graph::graph_analysis",
)
.with_cypher(
"MATCH (e:Entity) OPTIONAL MATCH (e)-[r]-() WITH e, COUNT(r) as degree RETURN e.id, e.name, degree ORDER BY degree DESC LIMIT 10",
),
CompatibilityQueryCallSite::new(
"rest graph entity overview ranking read",
"graph_overview_read",
"nmem-server::rest_graph::overview_entities",
)
.with_cypher(
"MATCH (e:Entity) RETURN e.id, COALESCE(e.name, e.id), e.entity_type, e.description, COALESCE(e.pagerank_score, e.confidence, 0.5), e.community_id, e.confidence ORDER BY COALESCE(e.pagerank_score, e.confidence, 0.5) DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest graph thread overview ranking read",
"graph_overview_read",
"nmem-server::rest_graph::overview_threads",
)
.with_cypher(
"MATCH (t:Thread) RETURN t.id, COALESCE(t.title, t.source, 'Thread'), t.source, COALESCE(t.message_count, 0), t.space_id, t.summary, t.created_at, t.updated_at ORDER BY t.message_count DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest graph skill overview ranking read",
"graph_overview_read",
"nmem-server::rest_graph::overview_skills",
)
.with_cypher(
"MATCH (s:Skill) WHERE s.stage IS NULL OR (s.stage <> 'archived' AND s.stage <> 'rejected' AND s.stage <> 'deprecated') WITH s, CASE WHEN s.stage = 'active' THEN 4 WHEN s.stage = 'promotable' THEN 3 WHEN s.stage = 'candidate' THEN 2 WHEN s.stage = 'draft' THEN 1 ELSE 0 END AS stage_rank, COALESCE(s.evidence_count, 0) AS evidence_score ORDER BY stage_rank DESC, evidence_score DESC, s.updated_at DESC LIMIT $limit RETURN s.id, COALESCE(s.name, s.title, 'Skill'), s.stage, s.kind, COALESCE(s.evidence_count, 0), s.confidence, COALESCE(s.use_count, 0), s.space_id, s.description, s.bundle_path, s.updated_at",
),
CompatibilityQueryCallSite::new(
"rest graph overview edge list read",
"graph_overview_read",
"nmem-server::rest_graph::overview_edges",
)
.with_cypher(
"MATCH (a)-[r]->(b) WHERE a.id IN $ids AND b.id IN $ids RETURN a.id, b.id, label(r), COALESCE(r.strength, r.confidence, 0.5)",
),
CompatibilityQueryCallSite::new(
"rest graph overview edge limited list read",
"graph_overview_read",
"nmem-server::rest_graph::overview_edges_limited",
)
.with_cypher(
"MATCH (a)-[r]->(b) WHERE a.id IN $ids AND b.id IN $ids RETURN a.id, b.id, label(r), COALESCE(r.strength, r.confidence, 0.5) LIMIT 200",
),
CompatibilityQueryCallSite::new(
"rest graph active memory relation overview read",
"graph_overview_read",
"nmem-server::rest_graph::overview_memory_relations",
)
.with_cypher(
"MATCH (source:Memory)-[r:MEMORY_RELATES_TO]->(target:Memory) WHERE r.status = 'active' RETURN source.id, COALESCE(source.title, LEFT(source.content, 60)), COALESCE(source.importance, 0.5), source.community_id, source.title, LEFT(COALESCE(source.content, ''), 200), source.space_id, target.id, COALESCE(target.title, LEFT(target.content, 60)), COALESCE(target.importance, 0.5), target.community_id, target.title, LEFT(COALESCE(target.content, ''), 200), target.space_id, r.id, r.relation_type, r.strength, r.confidence, r.reason, r.status, r.source ORDER BY r.updated_at DESC, r.created_at DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest graph augmentation state graph meta read",
"graph_state_read",
"nmem-server::rest_graph::augmentation_state",
)
.with_cypher(
"MATCH (m:GraphMeta {meta_id: 'main'}) RETURN m.community_detection_applied, m.pagerank_applied, m.community_algorithm, m.community_resolution, m.community_count, m.pagerank_algorithm, m.pagerank_damping, m.pagerank_iterations, m.last_augmentation_at, m.schema_version, m.community_detection_computed_at, m.pagerank_computed_at",
),
CompatibilityQueryCallSite::new(
"rest graph stats non-crystal memory count",
"graph_stats_read",
"nmem-server::rest_graph::graph_statistics",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.is_crystal IS NULL OR m.is_crystal = false RETURN COUNT(m)",
),
CompatibilityQueryCallSite::new(
"rest graph stats thread count",
"graph_stats_read",
"nmem-server::rest_graph::graph_statistics",
)
.with_cypher("MATCH (t:Thread) RETURN COUNT(t)"),
CompatibilityQueryCallSite::new(
"rest graph stats community count",
"graph_stats_read",
"nmem-server::rest_graph::graph_statistics",
)
.with_cypher("MATCH (c:Community) RETURN COUNT(c)"),
CompatibilityQueryCallSite::new(
"rest read batch community count",
"read_batch_stats",
"nmem-server::rest_read_batch::community_count",
)
.with_cypher("MATCH (c:Community) RETURN count(c)"),
CompatibilityQueryCallSite::new(
"rest graph stats label count",
"graph_stats_read",
"nmem-server::rest_graph::graph_statistics",
)
.with_cypher("MATCH (l:Label) RETURN COUNT(l)"),
CompatibilityQueryCallSite::new(
"rest read batch label count",
"read_batch_stats",
"nmem-server::rest_read_batch::label_count",
)
.with_cypher("MATCH (l:Label) RETURN count(l)"),
CompatibilityQueryCallSite::new(
"rest graph stats mentions relationship count",
"graph_stats_read",
"nmem-server::rest_graph::graph_statistics",
)
.with_cypher("MATCH ()-[r:MENTIONS]->() RETURN COUNT(r)"),
CompatibilityQueryCallSite::new(
"rest graph stats relates relationship count",
"graph_stats_read",
"nmem-server::rest_graph::graph_statistics",
)
.with_cypher("MATCH ()-[r:RELATES_TO]->() RETURN COUNT(r)"),
CompatibilityQueryCallSite::new(
"rest read batch relates relationship count",
"read_batch_stats",
"nmem-server::rest_read_batch::relates_count",
)
.with_cypher("MATCH ()-[r:RELATES_TO]->() RETURN count(r)"),
CompatibilityQueryCallSite::new(
"rest graph stats memory relation count",
"graph_stats_read",
"nmem-server::rest_graph::graph_statistics",
)
.with_cypher("MATCH ()-[r:MEMORY_RELATES_TO]->() RETURN COUNT(r)"),
CompatibilityQueryCallSite::new(
"rest read batch memory relation count",
"read_batch_stats",
"nmem-server::rest_read_batch::memory_relation_count",
)
.with_cypher("MATCH ()-[r:MEMORY_RELATES_TO]->() RETURN count(r)"),
CompatibilityQueryCallSite::new(
"rest graph stats contains relationship count",
"graph_stats_read",
"nmem-server::rest_graph::graph_statistics",
)
.with_cypher("MATCH ()-[r:CONTAINS]->() RETURN COUNT(r)"),
CompatibilityQueryCallSite::new(
"rest graph stats compacts relationship count",
"graph_stats_read",
"nmem-server::rest_graph::graph_statistics",
)
.with_cypher("MATCH ()-[r:COMPACTS_TO]->() RETURN COUNT(r)"),
CompatibilityQueryCallSite::new(
"rest graph community analysis list read",
"graph_analysis_read",
"nmem-server::rest_graph::graph_analysis_payload",
)
.with_cypher(
"MATCH (c:Community) RETURN c.community_id, c.name, c.description, c.member_count, c.algorithm, c.resolution ORDER BY c.member_count DESC",
),
CompatibilityQueryCallSite::new(
"rest read batch community member count ranking",
"read_batch_stats",
"nmem-server::rest_read_batch::top_communities",
)
.with_cypher(
"MATCH (c:Community) WHERE c.member_count > 0 RETURN c.name, c.member_count, c.description ORDER BY c.member_count DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest read batch entity relation pair count",
"read_batch_stats",
"nmem-server::rest_read_batch::top_entity_relations",
)
.with_cypher(
"MATCH (e1:Entity)-[r:RELATES_TO]->(e2:Entity) RETURN e1.name, e2.name, COUNT(r) as count ORDER BY count DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest read batch entity detail",
"read_batch_detail",
"nmem-server::rest_read_batch::entity_detail",
)
.with_cypher("MATCH (e:Entity {id: $entity_id}) RETURN e"),
CompatibilityQueryCallSite::new(
"rest read batch entity related detail",
"read_batch_detail",
"nmem-server::rest_read_batch::entity_related_detail",
)
.with_cypher(
"MATCH (e:Entity {id: $entity_id})-[r:RELATES_TO]-(related:Entity) RETURN e.id, e.name, e.entity_type, related.id, related.name, related.entity_type, related.description, COALESCE(r.relation_type, 'RELATES_TO'), COALESCE(r.confidence, 0.5), COALESCE(r.strength, 0.5) ORDER BY COALESCE(r.confidence, 0.5) DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest read batch entity memory mentions",
"read_batch_detail",
"nmem-server::rest_read_batch::entity_memory_mentions",
)
.with_cypher(
"MATCH (m:Memory)-[r:MENTIONS]->(e:Entity {id: $entity_id}) RETURN m.id, COALESCE(m.title, ''), LEFT(COALESCE(m.content, ''), 200), COALESCE(r.confidence, 0.5), COALESCE(r.mention_count, 1) ORDER BY COALESCE(r.confidence, 0.5) DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest read batch community detail by cid",
"read_batch_detail",
"nmem-server::rest_read_batch::community_detail",
)
.with_cypher(
"MATCH (c:Community) WHERE c.community_id = $cid RETURN c.name, c.ai_summary, c.description, c.member_count LIMIT 1",
),
CompatibilityQueryCallSite::new(
"rest search memory bulk projection",
"search_projection",
"nmem-server::rest_search::memory_bulk_projection",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, m.unit_type, m.metadata, COALESCE(m.importance, 0.5), COALESCE(m.confidence, 0.5), m.event_start, m.created_at, m.temporal_context",
),
CompatibilityQueryCallSite::new(
"rest search entity bulk projection",
"search_projection",
"nmem-server::rest_search::entity_bulk_projection",
)
.with_cypher(
"MATCH (e:Entity) WHERE e.id IN $ids RETURN e.id, COALESCE(e.name, e.id), e.entity_type, e.description, COALESCE(e.pagerank_score, e.confidence, 0.5), e.community_id, e.confidence",
),
CompatibilityQueryCallSite::new(
"rest search entity memory edge projection",
"search_projection",
"nmem-server::rest_search::entity_memory_edges",
)
.with_cypher(
"MATCH (a:Entity)-[r]-(m:Memory) WHERE a.id IN $ids RETURN a.id, m.id, COALESCE(m.title, LEFT(COALESCE(m.content, ''), 60)), m.title, LEFT(COALESCE(m.content, ''), 200), COALESCE(m.pagerank_score, m.importance, 0.5), m.community_id, m.space_id, m.created_at, m.updated_at, m.source, m.event_start, m.event_end, m.importance, label(r), COALESCE(r.strength, r.confidence, 0.5) LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest search entity entity edge projection",
"search_projection",
"nmem-server::rest_search::entity_entity_edges",
)
.with_cypher(
"MATCH (a:Entity)-[r]-(b:Entity) WHERE a.id IN $ids RETURN a.id, b.id, COALESCE(b.name, b.id), b.entity_type, b.description, COALESCE(b.pagerank_score, b.confidence, 0.5), b.community_id, b.confidence, label(r), COALESCE(r.strength, r.confidence, 0.5) LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest search source memory edge projection",
"search_projection",
"nmem-server::rest_search::source_memory_edges",
)
.with_cypher(
"MATCH (m:Memory)-[r:SOURCED_FROM]->(s:Source) WHERE s.id IN $ids RETURN s.id, m.id, COALESCE(m.title, LEFT(COALESCE(m.content, ''), 60)), m.title, LEFT(COALESCE(m.content, ''), 200), COALESCE(m.pagerank_score, m.importance, 0.5), m.community_id, m.space_id, m.created_at, m.updated_at, m.source, m.event_start, m.event_end, m.importance LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest search thread bulk projection",
"search_projection",
"nmem-server::rest_search::thread_bulk_projection",
)
.with_cypher(
"MATCH (t:Thread) WHERE t.id IN $ids RETURN t.id, COALESCE(t.title, t.source, 'Thread'), t.source, t.summary, t.message_count, t.project, t.workspace",
),
CompatibilityQueryCallSite::new(
"rest search thread compacts memory projection",
"search_projection",
"nmem-server::rest_search::thread_memory_edges",
)
.with_cypher(
"MATCH (t:Thread)-[r:COMPACTS_TO]->(m:Memory) WHERE t.id IN $ids RETURN t.id, m.id, COALESCE(m.title, LEFT(COALESCE(m.content, ''), 60)), m.title, LEFT(COALESCE(m.content, ''), 200), COALESCE(m.pagerank_score, m.importance, 0.5), m.community_id, m.space_id, m.created_at, m.updated_at, m.source, m.event_start, m.event_end, m.importance LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest graph node detail memory lookup",
"graph_node_detail_read",
"nmem-server::rest_graph::node_details_payload",
)
.with_cypher("MATCH (n:Memory {id: $node_id}) RETURN n"),
CompatibilityQueryCallSite::new(
"rest graph node detail entity lookup",
"graph_node_detail_read",
"nmem-server::rest_graph::node_details_payload",
)
.with_cypher("MATCH (n:Entity {id: $node_id}) RETURN n"),
CompatibilityQueryCallSite::new(
"rest graph node detail source lookup",
"graph_node_detail_read",
"nmem-server::rest_graph::node_details_payload",
)
.with_cypher("MATCH (n:Source {id: $node_id}) RETURN n"),
CompatibilityQueryCallSite::new(
"rest graph node detail thread lookup",
"graph_node_detail_read",
"nmem-server::rest_graph::node_details_payload",
)
.with_cypher("MATCH (n:Thread {id: $node_id}) RETURN n"),
CompatibilityQueryCallSite::new(
"rest graph seed memory nodes read",
"graph_node_detail_read",
"nmem-server::rest_graph::query_seed_memory_nodes",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, COALESCE(m.title, LEFT(COALESCE(m.content, ''), 60)), m.title, LEFT(COALESCE(m.content, ''), 200), COALESCE(m.pagerank_score, m.importance, 0.5), m.community_id, m.space_id, m.created_at, m.updated_at, m.source, m.event_start, m.event_end, m.importance",
),
CompatibilityQueryCallSite::new(
"rest graph seed memory neighbor read",
"graph_node_detail_read",
"nmem-server::rest_graph::query_seed_neighbors",
)
.with_cypher(
"MATCH (a:Memory)-[r]-(b:Memory) WHERE a.id IN $ids RETURN a.id, b.id, COALESCE(b.title, LEFT(COALESCE(b.content, ''), 60)), b.title, LEFT(COALESCE(b.content, ''), 200), COALESCE(b.pagerank_score, b.importance, 0.5), b.community_id, b.space_id, b.created_at, b.updated_at, b.source, b.event_start, b.event_end, b.importance, label(r), COALESCE(r.strength, r.confidence, 0.5) LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest graph seed entity neighbor read",
"graph_node_detail_read",
"nmem-server::rest_graph::query_seed_neighbors",
)
.with_cypher(
"MATCH (a:Memory)-[r]-(e:Entity) WHERE a.id IN $ids RETURN a.id, e.id, COALESCE(e.name, e.id), e.entity_type, e.description, COALESCE(e.pagerank_score, e.confidence, 0.5), e.community_id, e.confidence, label(r), COALESCE(r.strength, r.confidence, 0.5) LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest graph space-scoped overview seed read",
"graph_overview_read",
"nmem-server::rest_graph::graph_overview_handler",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.space_id = $space_id OR ($space_id = $default_space_id AND (m.space_id IS NULL OR m.space_id = '')) RETURN m.id ORDER BY COALESCE(m.pagerank_score, m.importance, 0.5) DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest graph scoped search seed read",
"graph_search_read",
"nmem-server::rest_graph::graph_search_handler",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.space_id = $space_id AND (contains(LOWER(COALESCE(m.title, '')), LOWER($q)) OR contains(LOWER(COALESCE(m.content, '')), LOWER($q))) RETURN m.id ORDER BY COALESCE(m.pagerank_score, m.importance, 0.5) DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest graph global search seed read",
"graph_search_read",
"nmem-server::rest_graph::graph_search_handler",
)
.with_cypher(
"MATCH (m:Memory) WHERE contains(LOWER(COALESCE(m.title, '')), LOWER($q)) OR contains(LOWER(COALESCE(m.content, '')), LOWER($q)) RETURN m.id ORDER BY COALESCE(m.pagerank_score, m.importance, 0.5) DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest graph community member entity read",
"graph_community_read",
"nmem-server::rest_graph::community_members_handler",
)
.with_cypher(
"MATCH (e:Entity) WHERE e.community_id = $cid RETURN e.id, COALESCE(e.name, e.id), COALESCE(e.pagerank_score, e.confidence, 0.5)",
),
CompatibilityQueryCallSite::new(
"rest graph community member memory read",
"graph_community_read",
"nmem-server::rest_graph::community_members_handler",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.community_id = $cid RETURN m.id, COALESCE(m.title, LEFT(m.content, 60)), COALESCE(m.pagerank_score, m.importance, 0.5)",
),
CompatibilityQueryCallSite::new(
"rest graph community subgraph entity ranking read",
"graph_community_read",
"nmem-server::rest_graph::community_subgraph_handler",
)
.with_cypher(
"MATCH (e:Entity) WHERE e.community_id = $cid OPTIONAL MATCH (:Memory)-[r:MENTIONS]->(e) RETURN e.id, e.name, e.entity_type, e.confidence, COUNT(r) AS mention_count ORDER BY mention_count DESC, e.name ASC LIMIT $max_entities",
),
CompatibilityQueryCallSite::new(
"rest graph community subgraph relation edge read",
"graph_community_read",
"nmem-server::rest_graph::community_subgraph_handler",
)
.with_cypher(
"MATCH (e1:Entity)-[r:RELATES_TO]-(e2:Entity) WHERE e1.id IN $ids AND e2.id IN $ids AND e1.id < e2.id RETURN e1.id, e2.id, r.confidence, r.relation_type",
),
CompatibilityQueryCallSite::new(
"rest graph community recent memories read",
"graph_community_read",
"nmem-server::rest_graph::community_recent_memories_handler",
)
.with_cypher(
"MATCH (m:Memory)-[:MENTIONS]->(e:Entity) WHERE e.community_id = $cid WITH m, COUNT(DISTINCT e) AS mention_breadth ORDER BY m.created_at DESC LIMIT $limit RETURN m.id, m.title, m.content, m.importance, m.created_at, m.updated_at, m.is_crystal, mention_breadth",
),
CompatibilityQueryCallSite::new(
"rest graph cleanup orphan entity delete",
"graph_cleanup_write",
"nmem-server::rest_graph::cleanup_graph_orphans_handler",
)
.with_cypher("MATCH (e:Entity {id: $entity_id}) DETACH DELETE e"),
CompatibilityQueryCallSite::new(
"rest graph kg existing entities context read",
"graph_kg_read",
"nmem-server::rest_graph::kg_existing_entities_context",
)
.with_cypher(
"MATCH (e:Entity) RETURN e.name, e.entity_type, e.description ORDER BY e.created_at DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest graph kg memory detail read",
"graph_kg_read",
"nmem-server::rest_graph::load_memory_kg_row",
)
.with_cypher(
"MATCH (m:Memory {id: $id}) RETURN m.title, m.content, m.metadata, m.is_latest, m.lifecycle_state",
),
CompatibilityQueryCallSite::new(
"rest label action label name read",
"label_action_read",
"nmem-server::rest_labels_write::label_name",
)
.with_cypher("MATCH (l:Label {id: $id}) RETURN l.name"),
CompatibilityQueryCallSite::new(
"rest library crystal source memories read",
"library_crystal_read",
"nmem-server::rest_library::crystal_source_memories_handler",
)
.with_cypher(
"MATCH (c:Memory {id: $crystal_id})-[r:SYNTHESIZED_FROM]->(s:Memory) WHERE c.is_crystal = true RETURN s.id, s.title, s.content, s.importance, s.created_at, r.weight ORDER BY r.weight DESC, s.importance DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"node detail neighbor counts",
"graph_node_detail_read",
"nmem-server::rest_graph::query_node_detail",
)
.with_cypher(
"MATCH (n)-[r]-(neighbor) WHERE n.id = $node_id RETURN COUNT(DISTINCT neighbor), COUNT(r)",
),
CompatibilityQueryCallSite::new(
"undo community delete nodes",
"community_undo_write",
"nmem-server::rest_graph::run_undo_community_detection_inline",
)
.with_cypher("MATCH (c:Community) DETACH DELETE c"),
CompatibilityQueryCallSite::new(
"undo community clear node assignments",
"community_undo_write",
"nmem-server::rest_graph::run_undo_community_detection_inline",
)
.with_cypher("MATCH (n) WHERE n.community_id IS NOT NULL SET n.community_id = NULL"),
CompatibilityQueryCallSite::new(
"undo community reset graph meta",
"community_undo_write",
"nmem-server::rest_graph::run_undo_community_detection_inline",
)
.with_cypher(
"MATCH (m:GraphMeta {meta_id: 'main'}) SET m.community_detection_applied = false, m.community_algorithm = '', m.community_resolution = 1.0, m.community_count = 0, m.community_detection_computed_at = NULL, m.updated_at = CURRENT_TIMESTAMP()",
),
CompatibilityQueryCallSite::new(
"community scheduler graph meta read",
"community_plan_read",
"nmem-server::scheduler_service::run_community_detection",
)
.with_cypher(
"MATCH (m:GraphMeta {meta_id: 'main'}) RETURN m.community_detection_computed_at, m.community_count, m.last_augmentation_at",
),
CompatibilityQueryCallSite::new(
"community scheduler candidate scan",
"community_plan_read",
"nmem-server::scheduler_service::run_community_detection",
)
.with_cypher(
"MATCH (c:Community) WHERE c.community_id IS NOT NULL AND c.community_id >= 0 RETURN c.id, c.community_id, c.name, c.description, c.ai_summary, c.member_count ORDER BY c.member_count DESC, c.community_id ASC LIMIT $row_limit",
),
CompatibilityQueryCallSite::new(
"community scheduler member entity ids",
"community_plan_read",
"nmem-server::scheduler_service::run_community_detection",
)
.with_cypher("MATCH (e:Entity) WHERE e.community_id = $cid RETURN e.id"),
CompatibilityQueryCallSite::new(
"community scheduler summary write",
"community_plan_write",
"nmem-server::scheduler_service::run_community_detection",
)
.with_cypher(
"MATCH (c:Community {id: $id}) SET c.name = $name, c.description = $description, c.ai_summary = $ai_summary, c.updated_at = CURRENT_TIMESTAMP()",
),
CompatibilityQueryCallSite::new(
"cleanup compaction seed scan",
"cleanup_scheduler_read",
"nmem-server::scheduler_service::compaction_seed_ids_from_graph",
)
.with_cypher(
"MATCH (m:Memory) WHERE COALESCE(m.is_crystal, false) = false AND {visible} AND (COALESCE(m.decay_score_cached, 1.0) < 0.55 OR COALESCE(m.created_at, m.last_accessed_at) <= $stale_cutoff){space_clause} RETURN m.id ORDER BY COALESCE(m.clicks, 0) ASC, COALESCE(m.total_dwell_time_ms, 0) ASC, {active_consumption} ASC, COALESCE(m.created_at, m.last_accessed_at) ASC, COALESCE(m.decay_score_cached, 1.0) ASC, COALESCE(m.importance, 0.5) ASC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"cleanup hot duplicate seed scan",
"cleanup_scheduler_read",
"nmem-server::scheduler_service::compaction_hot_dup_seed_ids_from_graph",
)
.with_cypher(
"MATCH (m:Memory) WHERE COALESCE(m.is_crystal, false) = false AND {visible} AND COALESCE(m.created_at, m.last_accessed_at) >= $recent_cutoff{space_clause} RETURN m.id ORDER BY COALESCE(m.created_at, m.last_accessed_at) DESC, COALESCE(m.importance, 0.5) DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"cleanup existing evolves pairs",
"cleanup_scheduler_read",
"nmem-server::scheduler_service::compaction_existing_evolves_pairs",
)
.with_cypher(
"MATCH (a:Memory)-[:EVOLVES]-(b:Memory) WHERE a.id IN $ids AND b.id IN $ids RETURN a.id, b.id",
),
CompatibilityQueryCallSite::new(
"cleanup fingerprint row fetch",
"cleanup_scheduler_read",
"nmem-server::scheduler_service::fetch_compaction_cleanup_rows",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, m.title, m.metadata, m.is_latest, m.decay_score_cached, m.created_at, m.last_accessed_at, m.last_clicked_at, m.access_count, m.appearances, m.clicks, m.total_dwell_time_ms, m.importance, m.unit_type, m.semantic_field",
),
CompatibilityQueryCallSite::new(
"crystallized provenance backfill merge",
"schema_migration_write",
"nmem-graph::schema::m_backfill_crystallized_from",
)
.with_cypher(
"MATCH (c:Memory)-[r:CRYSTALLIZED_FROM]->(s:Memory) MERGE (c)-[n:SYNTHESIZED_FROM]->(s) ON CREATE SET n.weight = r.contribution_weight, n.occasion_key = '', n.created_at = r.created_at",
),
CompatibilityQueryCallSite::new(
"crystallized provenance backfill idempotent",
"schema_migration_write",
"nmem-graph::schema::m_backfill_crystallized_from",
)
.with_cypher(
"MATCH (c:Memory)-[r:CRYSTALLIZED_FROM]->(s:Memory) MERGE (c)-[n:SYNTHESIZED_FROM]->(s) ON CREATE SET n.weight = r.contribution_weight, n.occasion_key = '', n.created_at = r.created_at",
),
CompatibilityQueryCallSite::new(
"synthesized provenance edge count",
"schema_migration_verify",
"nmem-graph::schema::converge_data::synthesized_edge_count",
)
.with_cypher("MATCH (:Memory)-[:SYNTHESIZED_FROM]->(:Memory) RETURN count(*)"),
CompatibilityQueryCallSite::new(
"crystallized provenance edge count",
"schema_migration_verify",
"nmem-graph::schema::converge_data::crystallized_edge_count",
)
.with_cypher("MATCH (:Memory)-[:CRYSTALLIZED_FROM]->(:Memory) RETURN count(*)"),
CompatibilityQueryCallSite::new(
"crystallized provenance unmirrored verification",
"schema_migration_verify",
"nmem-server::bin::mig_verify",
)
.with_cypher(
"MATCH (c:Memory)-[:CRYSTALLIZED_FROM]->(s:Memory) WHERE NOT EXISTS { MATCH (c)-[:SYNTHESIZED_FROM]->(s) } RETURN count(*)",
),
CompatibilityQueryCallSite::new(
"crystallized provenance distinct pair count",
"schema_migration_verify",
"nmem-server::bin::mig_verify",
)
.with_cypher(
"MATCH (c:Memory)-[:CRYSTALLIZED_FROM]->(s:Memory) WITH DISTINCT c.id AS a, s.id AS b RETURN count(*)",
),
CompatibilityQueryCallSite::new(
"synthesized source ids collect read",
"feed_read",
"nmem-server::rest_feed.rs:306",
)
.with_cypher(
"MATCH (c:Memory)-[:SYNTHESIZED_FROM]->(s:Memory) WHERE c.id IN $ids WITH c, COLLECT(DISTINCT s.id) AS source_ids RETURN c.id, source_ids",
),
CompatibilityQueryCallSite::new(
"skill synthesized memory id read",
"skill_read",
"nmem-server::context_wiring::skill_evidence_ids",
)
.with_cypher(
"MATCH (sk:Skill)-[:SYNTHESIZED_FROM]->(m:Memory) WHERE sk.stage IN $stages RETURN m.id",
),
CompatibilityQueryCallSite::new(
"skill stage list read",
"skill_read",
"nmem-server::context_wiring::skill_stage_list",
)
.with_cypher(
"MATCH (sk:Skill) WHERE sk.stage IN $stages RETURN sk.id, sk.title, sk.name, sk.description, sk.stage, sk.evidence_count LIMIT 50",
),
CompatibilityQueryCallSite::new(
"rest skills public detail read",
"skill_read",
"nmem-server::rest_skills::public_detail",
)
.with_cypher("MATCH (s:Skill {id: $id}) RETURN s.id, s.title, s.name, s.metadata"),
CompatibilityQueryCallSite::new(
"rest skills stale memory ids read",
"skill_read",
"nmem-server::rest_skills::stale_memory_ids",
)
.with_cypher("MATCH (m:Memory) WHERE m.id IN $ids AND m.is_latest = false RETURN m.id"),
CompatibilityQueryCallSite::new(
"rest skills evolves latest read",
"skill_read",
"nmem-server::rest_skills::evolves_latest",
)
.with_cypher(
"MATCH (old:Memory)-[:EVOLVES]->(new:Memory) WHERE old.id IN $ids RETURN DISTINCT new.id, new.is_latest",
),
CompatibilityQueryCallSite::new(
"rest skills id read",
"skill_read",
"nmem-server::rest_skills::id_exists",
)
.with_cypher("MATCH (s:Skill {id: $id}) RETURN s.id"),
CompatibilityQueryCallSite::new(
"rest skills id version read",
"skill_read",
"nmem-server::rest_skills::id_version",
)
.with_cypher("MATCH (s:Skill {id: $id}) RETURN s.id, s.version"),
CompatibilityQueryCallSite::new(
"rest skills source memory title content read",
"skill_read",
"nmem-server::rest_skills::source_memory_title_content",
)
.with_cypher(
"MATCH (s:Skill {id: $id})-[:SYNTHESIZED_FROM]->(m:Memory) RETURN m.title, m.content ORDER BY m.created_at LIMIT 8",
),
CompatibilityQueryCallSite::new(
"rest skills metadata read",
"skill_read",
"nmem-server::rest_skills::metadata; nmem-server::rest_skills_write::metadata",
)
.with_cypher("MATCH (s:Skill {id: $id}) RETURN s.metadata"),
CompatibilityQueryCallSite::new(
"rest skills version read",
"skill_read",
"nmem-server::rest_skills::version",
)
.with_cypher("MATCH (s:Skill {id: $id}) RETURN s.version"),
CompatibilityQueryCallSite::new(
"rest skills title read",
"skill_read",
"nmem-server::rest_skills::title",
)
.with_cypher("MATCH (s:Skill {id: $id}) RETURN s.title"),
CompatibilityQueryCallSite::new(
"rest skills imported draft create",
"skill_write",
"nmem-server::rest_skills_write::imported_draft_create",
)
.with_cypher(
"CREATE (s:Skill { id: $id, stage: 'draft', title: $title, kind: 'procedure', rationale: $null_str, evidence_count: 0, confidence: 0.0, demand_signal: 0.0, rejected_at: $null_ts, name: $name, description: $description, triggers: $empty_strs, tools: $empty_strs, bundle_path: $bundle_path, content_hash: $content_hash, version: 1, invalidation_reason: $null_str, write_origin: 'imported', scope: 'personal', freshness: 1.0, pinned: false, use_count: 0, success_rate: 0.0, last_activity_at: $null_ts, space_id: $space_id, created_at: $now, updated_at: $now, last_evidence_at: $null_ts, metadata: $metadata })",
),
CompatibilityQueryCallSite::new(
"rest skills promotable create",
"skill_write",
"nmem-server::rest_skills_write::promotable_create",
)
.with_cypher(
"CREATE (s:Skill { id: $id, stage: 'promotable', title: $title, kind: 'procedure', rationale: $rationale, evidence_count: $evidence_count, confidence: 0.0, demand_signal: 0.0, rejected_at: $null_ts, name: $null_str, description: $null_str, triggers: $empty_strs, tools: $empty_strs, bundle_path: $null_str, content_hash: $null_str, version: 1, invalidation_reason: $null_str, write_origin: 'user', scope: 'personal', freshness: 1.0, pinned: false, use_count: 0, success_rate: 0.0, last_activity_at: $null_ts, space_id: $space_id, created_at: $now, updated_at: $now, last_evidence_at: $null_ts, metadata: $metadata })",
),
CompatibilityQueryCallSite::new(
"rest skills thread compact memory ids read",
"skill_read",
"nmem-server::rest_skills_write::thread_compacts_memory_ids",
)
.with_cypher(
"MATCH (t:Thread {thread_id: $tid})-[:COMPACTS_TO]->(m:Memory) RETURN m.id",
),
CompatibilityQueryCallSite::new(
"rest skills reject mutation",
"skill_write",
"nmem-server::rest_skills_write::reject_skill",
)
.with_cypher(
"MATCH (s:Skill {id: $id}) SET s.stage = 'rejected', s.rejected_at = $rejected_at, s.updated_at = $updated_at",
),
CompatibilityQueryCallSite::new(
"rest skills stage metadata read",
"skill_read",
"nmem-server::rest_skills_write::stage_metadata_read",
)
.with_cypher("MATCH (s:Skill {id: $id}) RETURN s.stage, s.metadata"),
CompatibilityQueryCallSite::new(
"rest skills full write state read",
"skill_read",
"nmem-server::rest_skills_write::full_write_state_read",
)
.with_cypher(
"MATCH (s:Skill {id: $id}) RETURN s.stage, s.metadata, s.version, s.use_count, s.bundle_path, s.content_hash, s.name, s.description, s.title",
),
CompatibilityQueryCallSite::new(
"rest skills stage update",
"skill_write",
"nmem-server::rest_skills_write::stage_update",
)
.with_cypher("MATCH (s:Skill {id: $id}) SET s.stage = $stage, s.updated_at = $updated_at"),
CompatibilityQueryCallSite::new(
"rest skills compiled update",
"skill_write",
"nmem-server::rest_skills_write::compiled_update",
)
.with_cypher(
"MATCH (s:Skill {id: $id}) SET s.version = $version, s.title = $name, s.name = $name, s.description = $description, s.content_hash = $content_hash, s.bundle_path = $bundle_path, s.metadata = $metadata, s.updated_at = $updated_at",
),
CompatibilityQueryCallSite::new(
"rest skills stage rejection update",
"skill_write",
"nmem-server::rest_skills_write::stage_rejection_update",
)
.with_cypher(
"MATCH (s:Skill {id: $id}) SET s.stage = $stage, s.rejected_at = $rejected_at, s.updated_at = $updated_at",
),
CompatibilityQueryCallSite::new(
"rest skills source merge",
"skill_write",
"nmem-server::rest_skills_write::source_merge",
)
.with_cypher(
"MATCH (s:Skill {id: $skill_id}), (m:Memory {id: $memory_id}) MERGE (s)-[r:SYNTHESIZED_FROM]->(m) ON CREATE SET r.weight = 1.0, r.occasion_key = '', r.created_at = $now",
),
CompatibilityQueryCallSite::new(
"rest skills memory title content read",
"skill_read",
"nmem-server::rest_skills_write::memory_title_content_read",
)
.with_cypher("MATCH (m:Memory) WHERE m.id IN $ids RETURN m.title, m.content ORDER BY m.created_at"),
CompatibilityQueryCallSite::new(
"rest skills metadata version read",
"skill_read",
"nmem-server::rest_skills_write::metadata_version_read",
)
.with_cypher("MATCH (s:Skill {id: $id}) RETURN s.metadata, s.version"),
CompatibilityQueryCallSite::new(
"rest skills content hash metadata update",
"skill_write",
"nmem-server::rest_skills_write::content_hash_metadata_update",
)
.with_cypher(
"MATCH (s:Skill {id: $id}) SET s.content_hash = $content_hash, s.metadata = $metadata, s.updated_at = $updated_at",
),
CompatibilityQueryCallSite::new(
"skill builder list read",
"skill_read",
"nmem-server::skill_builder::list_skills",
)
.with_cypher("MATCH (s:Skill) RETURN s ORDER BY s.updated_at DESC LIMIT 60"),
CompatibilityQueryCallSite::new(
"skill active whole-record list read",
"skill_read",
"nmem-server::rest_skills_write::active_skill_list; nmem-server::scheduler_service::active_skill_list",
)
.with_cypher(
"MATCH (s:Skill) WHERE s.stage = 'active' RETURN s ORDER BY s.updated_at DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest fs active skill listing read",
"skill_read",
"nmem-server::rest_fs::ls_skills",
)
.with_cypher(
"MATCH (s:Skill) WHERE s.stage = 'active' AND s.id > $after RETURN s.id, s.name, s.title, s.updated_at, s.version ORDER BY s.id ASC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest fs active skill detail lookup read",
"skill_read",
"nmem-server::rest_fs::fetch_active_skill",
)
.with_cypher(
"MATCH (s:Skill) WHERE s.id = $key OR s.id STARTS WITH $key OR s.id CONTAINS $key RETURN s.id, s.name, s.title, s.stage, s.version, s.created_at, s.updated_at LIMIT 1",
),
CompatibilityQueryCallSite::new(
"mcp skill prefix lookup read",
"mcp_read",
"nmem-server::mcp_server::resolve_skill.prefix",
)
.with_cypher(
"MATCH (s:Skill) WHERE s.id STARTS WITH $key OR s.id CONTAINS $key RETURN s.id, s.version, s.use_count, s.metadata, s.name, s.title, s.bundle_path ORDER BY s.updated_at DESC LIMIT 1",
),
CompatibilityQueryCallSite::new(
"mcp skill exact lookup read",
"mcp_read",
"nmem-server::mcp_server::resolve_skill.exact",
)
.with_cypher(
"MATCH (s:Skill {id: $key}) RETURN s.id, s.version, s.use_count, s.metadata, s.name, s.title, s.bundle_path",
),
CompatibilityQueryCallSite::new(
"mcp skill catalog read",
"mcp_read",
"nmem-server::mcp_server::list_skills.catalog",
)
.with_cypher(
"MATCH (s:Skill) WHERE s.stage IN ['active','draft','stale','candidate','promotable','rejected'] RETURN s.id, s.stage, s.name, s.title, s.description, s.triggers, s.content_hash, s.metadata, s.space_id ORDER BY s.updated_at DESC LIMIT 1500",
),
CompatibilityQueryCallSite::new(
"mcp active skill list read",
"mcp_read",
"nmem-server::mcp_server::list_active_skills",
)
.with_cypher(
"MATCH (s:Skill) WHERE s.stage = 'active' RETURN s.id, s.title, s.name, s.description, s.triggers, s.stage ORDER BY s.updated_at DESC LIMIT 200",
),
CompatibilityQueryCallSite::new(
"mcp memory prefix ownership read",
"mcp_read",
"nmem-server::mcp_server::skill_memory_prefix_ownership",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id STARTS WITH $p RETURN m.id, m.space_id LIMIT 2",
),
CompatibilityQueryCallSite::new(
"skill stage projection list read",
"skill_read",
"nmem-server::rest_skills::stage_projection_list",
)
.with_cypher(
"MATCH (s:Skill) WHERE s.stage = $stage RETURN s.id, s.title, s.name, s.version, s.success_rate, s.metadata, s.description, s.triggers ORDER BY s.updated_at DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"skill detail read",
"skill_read",
"nmem-server::context_wiring::skill_detail",
)
.with_cypher(
"MATCH (sk:Skill {id: $id}) RETURN sk.title, sk.name, sk.stage, sk.scope, sk.rationale, sk.evidence_count, sk.metadata",
),
CompatibilityQueryCallSite::new(
"skill synthesized memory detail read",
"skill_read",
"nmem-server::context_wiring::skill_evidence_detail",
)
.with_cypher(
"MATCH (sk:Skill {id: $id})-[:SYNTHESIZED_FROM]->(m:Memory) RETURN m.id, m.title, m.content, m.unit_type ORDER BY m.created_at",
),
CompatibilityQueryCallSite::new(
"skill synthesized memory direct id read",
"skill_read",
"nmem-server::rest_skills::skill_memory_ids; nmem-server::rest_lists::skill_memory_ids; nmem-server::mcp_server::skill_memory_ids; nmem-server::scheduler_service::skill_memory_ids",
)
.with_cypher(
"MATCH (s:Skill {id: $id})-[:SYNTHESIZED_FROM]->(m:Memory) RETURN m.id",
),
CompatibilityQueryCallSite::new(
"skill metadata read",
"skill_read",
"nmem-server::context_wiring::skill_metadata",
)
.with_cypher("MATCH (sk:Skill {id: $id}) RETURN sk.stage, sk.metadata"),
CompatibilityQueryCallSite::new(
"skill metadata version read",
"skill_read",
"nmem-server::rest_skills_write::metadata_version_read",
)
.with_cypher(
"MATCH (s:Skill {id: $id}) RETURN s.metadata, s.version, s.content_hash, s.title",
),
CompatibilityQueryCallSite::new(
"mcp skill candidate create",
"mcp_write",
"nmem-server::mcp_server::suggest_skill_candidate.create",
)
.with_cypher(
"CREATE (s:Skill { id: $id, stage: 'candidate', title: $title, kind: $kind, rationale: $rationale, evidence_count: $evidence_count, confidence: 0.0, demand_signal: 0.0, rejected_at: $null_ts, name: $null_str, description: $null_str, triggers: $empty_strs, tools: $empty_strs, bundle_path: $null_str, content_hash: $null_str, version: 1, invalidation_reason: $null_str, write_origin: 'compiler', scope: $scope, freshness: 1.0, pinned: false, use_count: 0, success_rate: 0.0, last_activity_at: $null_ts, space_id: $space_id, created_at: $now, updated_at: $now, last_evidence_at: $now, metadata: $metadata })",
),
CompatibilityQueryCallSite::new(
"mcp skill rollback delete",
"mcp_write",
"nmem-server::mcp_server::suggest_skill_candidate.rollback",
)
.with_cypher("MATCH (s:Skill {id: $id}) DETACH DELETE s"),
CompatibilityQueryCallSite::new(
"mcp skill evidence memory id read",
"mcp_read",
"nmem-server::mcp_server::skill_link_synthesized_from_keyed.existing",
)
.with_cypher("MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id"),
CompatibilityQueryCallSite::new(
"mcp skill synthesized keyed merge",
"mcp_write",
"nmem-server::mcp_server::skill_link_synthesized_from_keyed.merge",
)
.with_cypher(
"MATCH (s:Skill {id: $skill_id}), (m:Memory {id: $memory_id}) MERGE (s)-[r:SYNTHESIZED_FROM]->(m) ON CREATE SET r.weight = 1.0, r.occasion_key = $occasion_key, r.created_at = $now",
),
CompatibilityQueryCallSite::new(
"mcp skill stage metadata space read",
"mcp_read",
"nmem-server::mcp_server::skill_stage_meta_space",
)
.with_cypher("MATCH (s:Skill {id: $id}) RETURN s.stage, s.metadata, s.space_id"),
CompatibilityQueryCallSite::new(
"mcp skill promotion update",
"mcp_write",
"nmem-server::mcp_server::suggest_skill_promotion",
)
.with_cypher(
"MATCH (s:Skill {id: $id}) SET s.rationale = $rationale, s.stage = 'promotable', s.updated_at = $updated_at",
),
CompatibilityQueryCallSite::new(
"mcp skill write draft update",
"mcp_write",
"nmem-server::mcp_server::write_skill",
)
.with_cypher(
"MATCH (s:Skill {id: $id}) SET s.name = $name, s.description = $description, s.triggers = $triggers, s.tools = $tools, s.bundle_path = $bundle_path, s.content_hash = $content_hash, s.write_origin = 'compiler', s.stage = 'draft', s.updated_at = $updated_at",
),
CompatibilityQueryCallSite::new(
"mcp skill compiled metadata read",
"mcp_read",
"nmem-server::mcp_server::published_skill_metadata",
)
.with_cypher(
"MATCH (s:Skill {id: $id}) RETURN s.version, s.content_hash, s.bundle_path, s.metadata",
),
CompatibilityQueryCallSite::new(
"skill metadata update",
"skill_write",
"nmem-server::rest_skills_write::metadata_update; nmem-server::mcp_server::skill_metadata_update; nmem-server::scheduler_service::skill_metadata_update",
)
.with_cypher(
"MATCH (s:Skill {id: $id}) SET s.metadata = $metadata, s.updated_at = $updated_at",
),
CompatibilityQueryCallSite::new(
"skill usage stats update",
"skill_write",
"nmem-server::rest_skills_write::usage_stats_update; nmem-server::mcp_server::usage_stats_update",
)
.with_cypher(
"MATCH (s:Skill {id: $id}) SET s.use_count = $use_count, s.success_rate = $success_rate, s.last_activity_at = $last_activity_at, s.updated_at = $updated_at, s.metadata = $metadata",
),
CompatibilityQueryCallSite::new(
"memory metadata update",
"memory_write",
"nmem-server::rest_graph::memory_metadata_update; nmem-server::rest_write::memory_metadata_update; nmem-server::scheduler_service::memory_metadata_update",
)
.with_cypher(
"MATCH (m:Memory {id: $memory_id}) SET m.metadata = $metadata, m.updated_at = $updated_at",
),
CompatibilityQueryCallSite::new(
"memory metadata replace update",
"memory_write",
"nmem-graph::repo::update_memory_metadata",
)
.with_cypher("MATCH (m:Memory {id: $id}) SET m.metadata = $metadata"),
CompatibilityQueryCallSite::new(
"thread metadata update",
"thread_write",
"nmem-server::rest_threads_write::thread_metadata_update",
)
.with_cypher(
"MATCH (t:Thread {id: $thread_uuid}) SET t.metadata = $metadata, t.updated_at = $updated_at",
),
CompatibilityQueryCallSite::new(
"thread metadata read",
"thread_read",
"nmem-server::rest_threads_write::thread_metadata_read",
)
.with_cypher(
"MATCH (t:Thread {id: $thread_uuid}) RETURN t.metadata as metadata",
),
CompatibilityQueryCallSite::new(
"thread distill identity metadata read",
"thread_distill_read",
"nmem-server::rest_distill::thread_identity_attribution",
)
.with_cypher("MATCH (t:Thread {id: $thread_uuid}) RETURN t.metadata"),
CompatibilityQueryCallSite::new(
"rest thread repair identities read",
"thread_repair_read",
"nmem-server::rest_thread_repair::thread_identities",
)
.with_cypher(
"MATCH (ti:ThreadIdentity) RETURN ti.id, ti.thread_node_id, CASE WHEN ti.space_id IS NULL OR ti.space_id = '' THEN 'default' ELSE ti.space_id END",
),
CompatibilityQueryCallSite::new(
"rest thread repair summary read",
"thread_repair_read",
"nmem-server::rest_thread_repair::thread_repair_summary",
)
.with_cypher(
"MATCH (t:Thread) OPTIONAL MATCH (ti:ThreadIdentity) WHERE ti.thread_node_id = t.id WITH t, COUNT(ti) AS identity_refs OPTIONAL MATCH (t)-[:CONTAINS]->(msg:Message) WITH t, identity_refs, COUNT(msg) AS legacy_messages OPTIONAL MATCH (t)-[:COMPACTS_TO]->(m:Memory) RETURN t.id, t.thread_id, CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END, COALESCE(t.message_count, 0), identity_refs, legacy_messages, COUNT(m) ORDER BY t.id ASC",
),
CompatibilityQueryCallSite::new(
"rest thread repair storage delete",
"thread_repair_write",
"nmem-server::rest_thread_repair::delete_storage_thread",
)
.with_cypher("MATCH (t:Thread {id: $storage_id}) DETACH DELETE t"),
CompatibilityQueryCallSite::new(
"rest thread message transcript read",
"thread_read",
"nmem-server::rest_threads::thread_transcript",
)
.with_cypher(
"MATCH (t:Thread {id: $thread_uuid})-[c:CONTAINS]->(m:Message) RETURN m.role, m.content, m.timestamp, m.created_at, COALESCE(c.order_index, m.order_index) ORDER BY COALESCE(c.order_index, m.order_index)",
),
CompatibilityQueryCallSite::new(
"rest thread skill stages read",
"thread_skill_usage_read",
"nmem-server::rest_threads_write::skill_usage_detection.stage_candidates",
)
.with_cypher("MATCH (s:Skill) WHERE s.stage IN $stages RETURN s.id, s.name LIMIT 500"),
CompatibilityQueryCallSite::new(
"rest thread metadata uuid read",
"thread_skill_usage_read",
"nmem-server::rest_threads_write::skill_usage_detection.thread_metadata",
)
.with_cypher("MATCH (t:Thread {id: $uuid}) RETURN t.metadata"),
CompatibilityQueryCallSite::new(
"rest thread skill usage read",
"thread_skill_usage_read",
"nmem-server::rest_threads_write::skill_usage_detection.skill_metadata",
)
.with_cypher("MATCH (s:Skill {id: $id}) RETURN s.metadata, s.use_count"),
CompatibilityQueryCallSite::new(
"rest thread skill usage update",
"thread_skill_usage_write",
"nmem-server::rest_threads_write::skill_usage_detection.update_skill_usage",
)
.with_cypher(
"MATCH (s:Skill {id: $id}) SET s.use_count = $use_count, s.last_activity_at = $now, s.updated_at = $now, s.metadata = $metadata",
),
CompatibilityQueryCallSite::new(
"rest thread metadata now update",
"thread_skill_usage_write",
"nmem-server::rest_threads_write::skill_usage_detection.update_thread_metadata",
)
.with_cypher("MATCH (t:Thread {id: $uuid}) SET t.metadata = $metadata, t.updated_at = $now"),
CompatibilityQueryCallSite::new(
"rest thread candidate source read",
"thread_bulk_move_read",
"nmem-server::rest_threads_write::candidate_ids_in_source_space",
)
.with_cypher(
"MATCH (t:Thread) WHERE t.thread_id IN $candidate_ids AND CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END = $source_space_id RETURN t.thread_id",
),
CompatibilityQueryCallSite::new(
"rest thread candidate target exclusion read",
"thread_bulk_move_read",
"nmem-server::rest_threads_write::candidate_ids_not_in_target_space",
)
.with_cypher(
"MATCH (t:Thread) WHERE t.thread_id IN $candidate_ids AND CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END <> $target_space_id RETURN t.thread_id",
),
CompatibilityQueryCallSite::new(
"rest thread source space count read",
"thread_bulk_move_read",
"nmem-server::rest_threads_write::source_space_count",
)
.with_cypher(
"MATCH (t:Thread) WHERE CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END = $source_space_id RETURN count(t)",
),
CompatibilityQueryCallSite::new(
"rest thread source space limit read",
"thread_bulk_move_read",
"nmem-server::rest_threads_write::source_space_limited_thread_ids",
)
.with_cypher(
"MATCH (t:Thread) WHERE CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END = $source_space_id RETURN t.thread_id LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest thread duplicate source-space read",
"thread_bulk_move_read",
"nmem-server::rest_threads_write::duplicate_thread_ids_in_source_space",
)
.with_cypher(
"MATCH (t:Thread) WHERE t.thread_id IN $thread_ids AND CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END = $source_space_id WITH t.thread_id AS thread_id, count(t) AS row_count WHERE row_count > 1 RETURN thread_id, row_count",
),
CompatibilityQueryCallSite::new(
"rest thread duplicate global read",
"thread_bulk_move_read",
"nmem-server::rest_threads_write::duplicate_thread_ids_global",
)
.with_cypher(
"MATCH (t:Thread) WHERE t.thread_id IN $thread_ids WITH t.thread_id AS thread_id, count(t) AS row_count WHERE row_count > 1 RETURN thread_id, row_count",
),
CompatibilityQueryCallSite::new(
"rest thread source-space rows read",
"thread_bulk_move_read",
"nmem-server::rest_threads_write::source_space_thread_rows",
)
.with_cypher(
"MATCH (t:Thread) WHERE t.thread_id IN $thread_ids AND CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END = $source_space_id RETURN t.id, t.thread_id, t.space_id",
),
CompatibilityQueryCallSite::new(
"rest thread rows read",
"thread_bulk_move_read",
"nmem-server::rest_threads_write::thread_rows",
)
.with_cypher(
"MATCH (t:Thread) WHERE t.thread_id IN $thread_ids RETURN t.id, t.thread_id, t.space_id",
),
CompatibilityQueryCallSite::new(
"rest thread move target update returning ids",
"thread_bulk_move_write_return",
"nmem-server::rest_threads_write::move_non_target_threads",
)
.with_cypher(
"MATCH (t:Thread) WHERE t.thread_id IN $thread_ids AND CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END <> $target_space_id SET t.space_id = $target_space_id, t.updated_at = $updated_at RETURN t.thread_id",
),
CompatibilityQueryCallSite::new(
"rest thread identity source-space update",
"thread_bulk_move_write",
"nmem-server::rest_threads_write::move_thread_identities_from_source",
)
.with_cypher(
"MATCH (ti:ThreadIdentity) WHERE ti.thread_id IN $thread_ids AND CASE WHEN ti.space_id IS NULL OR ti.space_id = '' THEN 'default' ELSE ti.space_id END = $source_space_id SET ti.space_id = $target_space_id, ti.updated_at = $updated_at",
),
CompatibilityQueryCallSite::new(
"rest thread identity target-space update",
"thread_bulk_move_write",
"nmem-server::rest_threads_write::move_thread_identities_not_target",
)
.with_cypher(
"MATCH (ti:ThreadIdentity) WHERE ti.thread_id IN $thread_ids AND CASE WHEN ti.space_id IS NULL OR ti.space_id = '' THEN 'default' ELSE ti.space_id END <> $target_space_id SET ti.space_id = $target_space_id, ti.updated_at = $updated_at",
),
CompatibilityQueryCallSite::new(
"rest write compaction link create",
"rest_write",
"nmem-server::rest_write::link_distilled_memory_to_thread",
)
.with_cypher(
"MATCH (t:Thread {id: $thread_uuid}), (m:Memory {id: $memory_id}) CREATE (t)-[:COMPACTS_TO {compaction_method: $method, created_at: $created_at, properties: '{}'}]->(m)",
),
CompatibilityQueryCallSite::new(
"rest write message indices read",
"rest_write_read",
"nmem-server::rest_write::message_ids_by_indices",
)
.with_cypher(
"MATCH (t:Thread {id: $thread_uuid})-[:CONTAINS]->(m:Message) WHERE m.order_index IN $indices RETURN m.id ORDER BY m.order_index",
),
CompatibilityQueryCallSite::new(
"rest write crystal source count read",
"rest_write_read",
"nmem-server::rest_write::crystal_source_unit_count",
)
.with_cypher(
"MATCH (c:Memory)-[:SYNTHESIZED_FROM]->(m:Memory {id: $id}) RETURN c.id, COALESCE(c.source_unit_count, 0)",
),
CompatibilityQueryCallSite::new(
"rest write crystal source count decrement",
"rest_write",
"nmem-server::rest_write::decrement_crystal_source_unit_count",
)
.with_cypher(
"MATCH (c:Memory {id: $cid}) SET c.source_unit_count = CASE WHEN c.source_unit_count > 0 THEN c.source_unit_count - 1 ELSE 0 END, c.updated_at = CURRENT_TIMESTAMP()",
),
CompatibilityQueryCallSite::new(
"rest write memory mentions read",
"rest_write_read",
"nmem-server::rest_write::memory_mentions_for_delete",
)
.with_cypher("MATCH (m:Memory {id: $id})-[:MENTIONS]->(e:Entity) RETURN e.id"),
CompatibilityQueryCallSite::new(
"rest write entity source reference read",
"rest_write_read",
"nmem-server::rest_write::source_reference_entities_for_delete",
)
.with_cypher(
"MATCH (e:Entity)-[r:RELATES_TO]-() WHERE r.source_reference = $id RETURN DISTINCT e.id",
),
CompatibilityQueryCallSite::new(
"rest write entity mention count read",
"rest_write_read",
"nmem-server::rest_write::other_memory_mentions_for_entity",
)
.with_cypher(
"MATCH (e:Entity {id: $eid})<-[:MENTIONS]-(other:Memory) WHERE other.id <> $mid RETURN count(*)",
),
CompatibilityQueryCallSite::new(
"rest write entity label count read",
"rest_write_read",
"nmem-server::rest_write::entity_label_count_for_delete",
)
.with_cypher("MATCH (e:Entity {id: $eid})-[:HAS_LABEL]-() RETURN count(*)"),
CompatibilityQueryCallSite::new(
"rest write entity source reference relationship count sum",
"rest_write_read",
"nmem-server::rest_write::source_reference_relationship_count_for_delete",
)
.with_cypher(
"MATCH (e:Entity {id: $eid}) OPTIONAL MATCH (e)-[r1:RELATES_TO]-() WHERE r1.source_reference <> $mid OR r1.source_reference IS NULL OR r1.source_reference = '' OPTIONAL MATCH ()-[r2:RELATES_TO]->(e) WHERE r2.source_reference <> $mid OR r2.source_reference IS NULL OR r2.source_reference = '' RETURN (count(r1) + count(r2))",
),
CompatibilityQueryCallSite::new(
"rest write entity distinct relationship count sum",
"rest_write_read",
"nmem-server::rest_write::relationship_count_for_orphan_entity",
)
.with_cypher(
"MATCH (e:Entity {id: $eid}) OPTIONAL MATCH (e)-[r1]-() OPTIONAL MATCH ()-[r2]->(e) RETURN (count(DISTINCT r1) + count(DISTINCT r2))",
),
CompatibilityQueryCallSite::new(
"rest write entity delete",
"rest_write",
"nmem-server::rest_write::delete_orphan_entity",
)
.with_cypher("MATCH (e:Entity {id: $eid}) DETACH DELETE e"),
CompatibilityQueryCallSite::new(
"rest write compact thread metadata read",
"rest_write_read",
"nmem-server::rest_write::thread_metadata_for_memory",
)
.with_cypher(
"MATCH (t:Thread)-[:COMPACTS_TO]->(m:Memory {id: $id}) RETURN t.id, t.metadata",
),
CompatibilityQueryCallSite::new(
"rest write compact memory count read",
"rest_write_read",
"nmem-server::rest_write::thread_compacted_memory_count",
)
.with_cypher("MATCH (t:Thread {id: $uuid})-[:COMPACTS_TO]->(m:Memory) RETURN count(m)"),
CompatibilityQueryCallSite::new(
"rest write thread metadata replace",
"rest_write",
"nmem-server::rest_write::replace_thread_metadata",
)
.with_cypher("MATCH (t:Thread {id: $uuid}) SET t.metadata = $metadata"),
CompatibilityQueryCallSite::new(
"scheduler dedup reviewed update",
"scheduler_write",
"nmem-server::scheduler_service::mark_dedup_reviewed",
)
.with_cypher("MATCH (m:Memory) WHERE m.id IN $ids SET m.dedup_reviewed_at = $reviewed_at"),
CompatibilityQueryCallSite::new(
"scheduler skill stage node read",
"scheduler_read",
"nmem-server::scheduler_service::skills_by_stage",
)
.with_cypher(
"MATCH (s:Skill) WHERE s.stage = $stage RETURN s ORDER BY s.updated_at DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"scheduler memory prefix read",
"scheduler_read",
"nmem-server::scheduler_service::memory_prefix_lookup",
)
.with_cypher("MATCH (m:Memory) WHERE m.id STARTS WITH $prefix RETURN m.id, m.space_id LIMIT 2"),
CompatibilityQueryCallSite::new(
"scheduler memory compact detail read",
"scheduler_read",
"nmem-server::scheduler_service::memory_compact_details",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, m.title, m.content, m.unit_type",
),
CompatibilityQueryCallSite::new(
"scheduler memory import detail read",
"scheduler_read",
"nmem-server::scheduler_service::memory_import_details",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, m.title, m.content, m.unit_type, m.importance, m.created_at, m.space_id, m.is_crystal",
),
CompatibilityQueryCallSite::new(
"scheduler community snapshot read",
"scheduler_read",
"nmem-server::scheduler_service::community_snapshot",
)
.with_cypher(
"MATCH (c:Community) RETURN c.id, c.community_id, COALESCE(c.name, ''), COALESCE(c.description, ''), COALESCE(c.ai_summary, ''), COALESCE(c.member_count, 0)",
),
CompatibilityQueryCallSite::new(
"scheduler memory metadata read",
"scheduler_read",
"nmem-server::scheduler_service::memory_metadata",
)
.with_cypher("MATCH (m:Memory {id: $id}) RETURN m.metadata"),
CompatibilityQueryCallSite::new(
"scheduler entity ids read",
"scheduler_read",
"nmem-server::scheduler_service::entities_by_ids",
)
.with_cypher(
"MATCH (e:Entity) WHERE e.id IN $entity_ids RETURN e.id, e.name, e.entity_type, e.description",
),
CompatibilityQueryCallSite::new(
"scheduler thread transcript read",
"scheduler_read",
"nmem-server::scheduler_service::thread_transcript",
)
.with_cypher(
"MATCH (t:Thread {id: $thread_uuid})-[c:CONTAINS]->(m:Message) RETURN COALESCE(c.order_index, m.order_index), m.role, m.content, m.timestamp ORDER BY COALESCE(c.order_index, m.order_index)",
),
CompatibilityQueryCallSite::new(
"scheduler thread message count read",
"scheduler_read",
"nmem-server::scheduler_service::thread_message_count",
)
.with_cypher("MATCH (t:Thread {id: $thread_uuid})-[:CONTAINS]->(m:Message) RETURN count(m)"),
CompatibilityQueryCallSite::new(
"scheduler compact metadata bulk read",
"scheduler_read",
"nmem-server::scheduler_service::thread_metadata_for_memories",
)
.with_cypher(
"MATCH (t:Thread)-[:COMPACTS_TO]->(m:Memory) WHERE m.id IN $ids RETURN m.id, t.metadata",
),
CompatibilityQueryCallSite::new(
"scheduler thread summary read",
"scheduler_read",
"nmem-server::scheduler_service::thread_summary",
)
.with_cypher("MATCH (t:Thread {id: $thread_uuid}) RETURN t.title, t.summary, t.source LIMIT 1"),
CompatibilityQueryCallSite::new(
"scheduler memory full detail read",
"scheduler_read",
"nmem-server::scheduler_service::memory_full_detail",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id = $id RETURN m.id, m.title, m.content, m.unit_type, m.created_at, m.importance, m.metadata, m.lifecycle_state LIMIT 1",
),
CompatibilityQueryCallSite::new(
"scheduler memory source detail read",
"scheduler_read",
"nmem-server::scheduler_service::memory_source_detail",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id = $id RETURN m.id, m.title, m.content, m.unit_type, m.source, m.space_id, m.created_at LIMIT 1",
),
CompatibilityQueryCallSite::new(
"scheduler memory decay detail read",
"scheduler_read",
"nmem-server::scheduler_service::memory_decay_detail",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id = $id RETURN m.id, m.title, m.content, m.unit_type, m.source, m.space_id, m.created_at, m.decay_score_cached, m.metadata, m.is_latest, m.lifecycle_state LIMIT 1",
),
CompatibilityQueryCallSite::new(
"scheduler memory bulk detail read",
"scheduler_read",
"nmem-server::scheduler_service::memory_bulk_detail",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id IN $ids RETURN m.id, m.title, m.content, m.unit_type, m.source, m.importance, m.created_at, m.metadata, m.is_latest, m.lifecycle_state",
),
CompatibilityQueryCallSite::new(
"scheduler evolves neighbor read",
"scheduler_read",
"nmem-server::scheduler_service::memory_evolves_neighbors",
)
.with_cypher(
"MATCH (m:Memory)-[r:EVOLVES]-(n:Memory) WHERE m.id = $id RETURN n.id, n.title, n.unit_type, 'EVOLVES' as edge_type, r.content_relation as relation, n.created_at LIMIT 20",
),
CompatibilityQueryCallSite::new(
"scheduler community ai summary read",
"scheduler_read",
"nmem-server::scheduler_service::community_ai_summary_rows",
)
.with_cypher(
"MATCH (c:Community) WHERE c.community_id IS NOT NULL AND c.community_id >= 0 AND c.ai_summary IS NOT NULL AND c.ai_summary <> '' RETURN c.community_id, c.name, c.description, c.ai_summary, c.member_count",
),
CompatibilityQueryCallSite::new(
"scheduler entity community ids read",
"scheduler_read",
"nmem-server::scheduler_service::entity_ids_by_community",
)
.with_cypher("MATCH (e:Entity) WHERE e.community_id IN $cids RETURN e.community_id, e.id"),
CompatibilityQueryCallSite::new(
"skill routing stage projection read",
"skill_routing_read",
"nmem-server::skill_routing::skills_by_stage",
)
.with_cypher(
"MATCH (s:Skill) WHERE s.stage = $stage RETURN s.id, s.name, s.title, s.description, s.triggers, s.metadata, s.content_hash, s.version ORDER BY s.updated_at DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"learning memory latest read",
"memory_retrieval_read",
"nmem-server::context_wiring::learning_memory_latest",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.unit_type = 'learning' AND m.is_crystal = false AND m.is_latest = true RETURN m.id, m.title, m.content ORDER BY m.created_at DESC LIMIT 40",
),
CompatibilityQueryCallSite::new(
"source parsed path list read",
"source_read",
"nmem-server::context_wiring::parsed_source_list",
)
.with_cypher(
"MATCH (src:Source) WHERE src.parsed_path IS NOT NULL RETURN src.id, src.original_name, src.parsed_path ORDER BY src.created_at DESC LIMIT 12",
),
CompatibilityQueryCallSite::new(
"community summarized list read",
"community_read",
"nmem-server::context_wiring::community_summary_list",
)
.with_cypher(
"MATCH (c:Community) WHERE c.ai_summary IS NOT NULL AND c.ai_summary <> '' RETURN c.community_id, c.name, c.ai_summary ORDER BY c.member_count DESC LIMIT 40",
),
CompatibilityQueryCallSite::new(
"community memory type-filter read",
"community_read",
"nmem-server::context_wiring::community_memory_type_filter",
)
.with_cypher(
"MATCH (e:Entity {community_id: $cid})<-[:MENTIONS]-(m:Memory) WHERE m.is_crystal = false AND m.unit_type IN $types RETURN m.id, m.title LIMIT 200",
),
CompatibilityQueryCallSite::new(
"search projection entity candidate read",
"search_projection_read",
"nmem-graph::search_projection::search_entity_candidates",
)
.with_cypher(
"MATCH (e:Entity) WHERE lower(e.name) CONTAINS $raw_query OR lower(e.name) CONTAINS $normalized_query OR list_contains(e.aliases, $raw_input) OPTIONAL MATCH (m:Memory)-[:MENTIONS]->(e) RETURN e.id, e.name, e.entity_type, e.aliases, e.description, e.confidence, e.community_id, e.pagerank_score, COUNT(m) AS memory_count ORDER BY CASE WHEN lower(e.name) = $raw_query THEN 0 WHEN lower(e.name) = $normalized_query THEN 0 WHEN list_contains(e.aliases, $raw_input) THEN 1 ELSE 2 END ASC, memory_count DESC, e.pagerank_score DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"search projection source candidate read",
"search_projection_read",
"nmem-graph::search_projection::search_source_candidate_rows",
)
.with_cypher(
"MATCH (s:Source) WITH s, CASE WHEN s.original_name IS NOT NULL THEN lower(s.original_name) ELSE '' END AS s_name, CASE WHEN s.summary IS NOT NULL THEN lower(s.summary) ELSE '' END AS s_summary, CASE WHEN s.file_path IS NOT NULL THEN lower(s.file_path) ELSE '' END AS s_path, CASE WHEN s.source_type IS NOT NULL THEN lower(s.source_type) ELSE '' END AS s_type WHERE s_name CONTAINS $raw_query OR s_name CONTAINS $normalized_query OR s_summary CONTAINS $raw_query OR s_summary CONTAINS $normalized_query OR s_path CONTAINS $raw_query OR s_path CONTAINS $normalized_query OR s_type CONTAINS $raw_query OR s_type CONTAINS $normalized_query RETURN s.id, COALESCE(s.original_name, s.file_path, s.source_type, 'Source'), s.source_type, s.summary, s.file_path, s.memory_count, s.chunk_count, CASE WHEN s_name = $raw_query THEN 3 WHEN s_name = $normalized_query THEN 3 WHEN s_name CONTAINS $raw_query THEN 2 WHEN s_name CONTAINS $normalized_query THEN 2 ELSE 1 END AS match_level ORDER BY match_level DESC, COALESCE(s.memory_count, 0) DESC, COALESCE(s.chunk_count, 0) DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"search projection thread candidate read",
"search_projection_read",
"nmem-graph::search_projection::search_thread_candidate_rows",
)
.with_cypher(
"MATCH (t:Thread) WITH t, CASE WHEN t.title IS NOT NULL THEN lower(t.title) ELSE '' END AS t_title, CASE WHEN t.summary IS NOT NULL THEN lower(t.summary) ELSE '' END AS t_summary, CASE WHEN t.source IS NOT NULL THEN lower(t.source) ELSE '' END AS t_source, CASE WHEN t.project IS NOT NULL THEN lower(t.project) ELSE '' END AS t_project, CASE WHEN t.workspace IS NOT NULL THEN lower(t.workspace) ELSE '' END AS t_workspace WHERE t_title CONTAINS $raw_query OR t_title CONTAINS $normalized_query OR t_summary CONTAINS $raw_query OR t_summary CONTAINS $normalized_query OR t_source CONTAINS $raw_query OR t_source CONTAINS $normalized_query OR t_project CONTAINS $raw_query OR t_project CONTAINS $normalized_query OR t_workspace CONTAINS $raw_query OR t_workspace CONTAINS $normalized_query RETURN t.id, COALESCE(t.title, t.source, 'Thread'), t.source, t.summary, t.message_count, t.project, t.workspace, CASE WHEN t_title = $raw_query THEN 3 WHEN t_title = $normalized_query THEN 3 WHEN t_title CONTAINS $raw_query THEN 2 WHEN t_title CONTAINS $normalized_query THEN 2 ELSE 1 END AS match_level ORDER BY match_level DESC, COALESCE(t.message_count, 0) DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"search projection community seed entity read",
"search_projection_read",
"nmem-graph::search_projection::community_seed_entities",
)
.with_cypher(
"MATCH (e:Entity) WHERE e.community_id = $community_id OPTIONAL MATCH (m:Memory)-[:MENTIONS]->(e) RETURN e.id, e.name, e.entity_type, e.confidence, e.community_id, e.pagerank_score, COUNT(m) AS memory_count ORDER BY memory_count DESC, e.pagerank_score DESC, e.confidence DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"community entity memory-count read",
"community_read",
"nmem-server::context_wiring::community_entity_memory_count",
)
.with_cypher(
"MATCH (e:Entity) WHERE e.community_id = $community_id OPTIONAL MATCH (m:Memory)-[:MENTIONS]->(e) RETURN e.id, e.name, e.entity_type, COUNT(m) AS memory_count ORDER BY memory_count DESC LIMIT 10",
),
CompatibilityQueryCallSite::new(
"entity mention-count list read",
"entity_read",
"nmem-server::entity_repo::list_with_mention_counts",
)
.with_cypher(
"MATCH (e:Entity) OPTIONAL MATCH (:Memory)-[r:MENTIONS]->(e) RETURN e.id, e.name, e.entity_type, e.description, e.aliases, e.confidence, e.community_id, e.created_at, COUNT(r) AS mention_count ORDER BY mention_count DESC, e.name ASC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"synthesized source coverage lookup",
"schema_migration_read",
"nmem-graph::schema::find_existing_crystal_for_sources",
)
.with_cypher(
"MATCH (c:Memory)-[:SYNTHESIZED_FROM]->(s:Memory) WHERE c.is_crystal = true AND s.id IN $source_ids WITH c.id AS cid, count(DISTINCT s.id) AS covered WHERE covered = $n RETURN cid LIMIT 1",
),
CompatibilityQueryCallSite::new(
"synthesized source coverage title lookup",
"memory_crystal_read",
"nmem-server::mcp_server.rs:7363",
)
.with_cypher(
"MATCH (c:Memory)-[:SYNTHESIZED_FROM]->(s:Memory) WHERE c.is_crystal = true AND s.id IN $source_ids WITH c.id AS cid, c.crystal_title AS ct, count(DISTINCT s.id) AS covered WHERE covered = $n RETURN cid, ct LIMIT 1",
),
CompatibilityQueryCallSite::new(
"label usage count read",
"label_list_read",
"nmem-server::rest_lists::list_labels_handler",
)
.with_cypher(
"MATCH (l:Label) OPTIONAL MATCH (l)<-[:HAS_LABEL]-(n) WITH l, COUNT(n) as usage_count RETURN l.id, l.name, l.color, l.description, l.created_at, l.updated_at, usage_count",
),
CompatibilityQueryCallSite::new(
"label usage context summary read",
"context_wiring_read",
"nmem-server::context_wiring::node_counts",
)
.with_cypher(
"MATCH (l:Label) OPTIONAL MATCH (l)<-[:HAS_LABEL]-(n) WITH l, COUNT(n) as usage_count RETURN l.name as name, usage_count ORDER BY usage_count DESC SKIP 0 LIMIT 200",
),
CompatibilityQueryCallSite::new(
"label total count read",
"label_read",
"nmem-graph::repo::memories_by_label_pattern",
)
.with_cypher("MATCH (l:Label) RETURN count(*) as label_count"),
CompatibilityQueryCallSite::new(
"label usage direct optional count read",
"label_list_read",
"nmem-server::mcp_server.rs:1813",
)
.with_cypher(
"MATCH (l:Label) OPTIONAL MATCH (m:Memory)-[:HAS_LABEL]->(l) RETURN l.id, l.name, COUNT(m) AS usage_count ORDER BY l.name ASC SKIP $offset LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"entity mention fan-in count",
"entity_lifecycle_read",
"nmem-graph::entity_lifecycle::impact_counts",
)
.with_cypher("MATCH (:Memory)-[r:MENTIONS]->(e:Entity {id: $id}) RETURN COUNT(r)"),
CompatibilityQueryCallSite::new(
"entity lifecycle detail projection",
"entity_lifecycle_read",
"nmem-graph::entity_lifecycle::delete_preview",
)
.with_cypher(
"MATCH (e:Entity {id: $id}) RETURN e.id, e.name, e.entity_type, e.description, e.aliases",
),
CompatibilityQueryCallSite::new(
"entity outgoing relates count",
"entity_lifecycle_read",
"nmem-graph::entity_lifecycle::impact_counts",
)
.with_cypher(
"MATCH (e:Entity {id: $id})-[r:RELATES_TO]->(:Entity) RETURN COUNT(r)",
),
CompatibilityQueryCallSite::new(
"entity incoming relates count",
"entity_lifecycle_read",
"nmem-graph::entity_lifecycle::impact_counts",
)
.with_cypher(
"MATCH (:Entity)-[r:RELATES_TO]->(e:Entity {id: $id}) RETURN COUNT(r)",
),
CompatibilityQueryCallSite::new(
"entity outgoing relation preview",
"entity_lifecycle_read",
"nmem-graph::entity_lifecycle::relation_preview_rows",
)
.with_cypher(
"MATCH (e:Entity {id: $id})-[r:RELATES_TO]->(other:Entity) RETURN other.id, r",
),
CompatibilityQueryCallSite::new(
"entity incoming relation preview",
"entity_lifecycle_read",
"nmem-graph::entity_lifecycle::relation_preview_rows",
)
.with_cypher(
"MATCH (other:Entity)-[r:RELATES_TO]->(e:Entity {id: $id}) RETURN other.id, r",
),
CompatibilityQueryCallSite::new(
"entity has label count",
"entity_lifecycle_read",
"nmem-graph::entity_lifecycle::impact_counts",
)
.with_cypher(
"MATCH (e:Entity {id: $id})-[r:HAS_LABEL]->(:Label) RETURN COUNT(r)",
),
CompatibilityQueryCallSite::new(
"entity has label preview",
"entity_lifecycle_read",
"nmem-graph::entity_lifecycle::label_preview_rows",
)
.with_cypher(
"MATCH (e:Entity {id: $id})-[r:HAS_LABEL]->(n:Label) RETURN n.id, r",
),
CompatibilityQueryCallSite::new(
"entity belongs community count",
"entity_lifecycle_read",
"nmem-graph::entity_lifecycle::impact_counts",
)
.with_cypher(
"MATCH (e:Entity {id: $id})-[r:BELONGS_TO]->(:Community) RETURN COUNT(r)",
),
CompatibilityQueryCallSite::new(
"entity belongs community preview",
"entity_lifecycle_read",
"nmem-graph::entity_lifecycle::community_preview_rows",
)
.with_cypher(
"MATCH (e:Entity {id: $id})-[r:BELONGS_TO]->(n:Community) RETURN n.id, r",
),
CompatibilityQueryCallSite::new(
"entity detach delete cascade",
"entity_lifecycle_write",
"nmem-graph::entity_lifecycle::delete_entity",
)
.with_cypher("MATCH (e:Entity {id: $id}) DETACH DELETE e"),
CompatibilityQueryCallSite::new(
"graph orphan entity read",
"graph_orphan_read",
"nmem-server::rest_graph::graph_orphans_handler",
)
.with_cypher(
"MATCH (e:Entity) WHERE NOT (e)<-[:MENTIONS]-(:Memory) AND NOT (e)-[:RELATES_TO]-() AND NOT (e)-[:HAS_LABEL]-() RETURN e.id, e.name, e.entity_type",
),
CompatibilityQueryCallSite::new(
"graph orphan cleanup candidate read",
"graph_orphan_cleanup_read",
"nmem-server::rest_graph::cleanup_graph_orphans_handler",
)
.with_cypher(
"MATCH (e:Entity) WHERE NOT (e)<-[:MENTIONS]-(:Memory) AND NOT (e)-[:RELATES_TO]-() AND NOT (e)-[:HAS_LABEL]-() RETURN e.id",
),
CompatibilityQueryCallSite::new(
"thread move source space selection",
"thread_bulk_move_read",
"nmem-server::rest_threads_write::select_thread_move_records",
)
.with_cypher(
"MATCH (t:Thread) WHERE t.thread_id IN $thread_ids AND CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END = $source_space_id RETURN t.id, t.thread_id, t.space_id",
),
CompatibilityQueryCallSite::new(
"thread move target space exclusion",
"thread_bulk_move_read",
"nmem-server::rest_threads_write::select_bulk_thread_ids",
)
.with_cypher(
"MATCH (t:Thread) WHERE t.thread_id IN $candidate_ids AND CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END <> $target_space_id RETURN t.thread_id",
),
CompatibilityQueryCallSite::new(
"thread move source space update returning ids",
"thread_bulk_move_write_return",
"nmem-server::rest_threads_write::move_threads_to_space",
)
.with_cypher(
"MATCH (t:Thread) WHERE t.thread_id IN $thread_ids AND CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END = $source_space_id SET t.space_id = $target_space_id, t.updated_at = $updated_at RETURN t.thread_id",
),
CompatibilityQueryCallSite::new(
"thread distill optional source count all",
"thread_distill_read",
"nmem-server::rest_distill::list_threads_for_distill",
)
.with_cypher(
"MATCH (t:Thread) WHERE t.thread_id IS NOT NULL AND (CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END) = $space_id AND ($source IS NULL OR t.source = $source) RETURN COUNT(t)",
),
CompatibilityQueryCallSite::new(
"thread distill optional source count filtered",
"thread_distill_read",
"nmem-server::rest_distill::list_threads_for_distill",
)
.with_cypher(
"MATCH (t:Thread) WHERE t.thread_id IS NOT NULL AND (CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END) = $space_id AND ($source IS NULL OR t.source = $source) RETURN COUNT(t)",
),
CompatibilityQueryCallSite::new(
"thread distill candidate page read",
"thread_distill_read",
"nmem-server::rest_distill::select_thread_candidates",
)
.with_cypher(
"MATCH (t:Thread) WHERE t.thread_id IS NOT NULL AND (CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END) = $space_id AND ($source IS NULL OR t.source = $source) RETURN t.thread_id ORDER BY COALESCE(t.updated_at, t.import_date, t.created_at) DESC, t.thread_id ASC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"memory access counter touch",
"memory_access_write",
"nmem-graph::repo::mark_memories_accessed",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id = $id SET m.access_count = COALESCE(m.access_count, 0) + 1, m.last_accessed_at = $now",
),
CompatibilityQueryCallSite::new(
"memory click dwell access touch",
"memory_access_write",
"nmem-server::memory_access::record_click_dwell",
)
.with_cypher(
"MATCH (m:Memory {id: $memory_id}) SET m.clicks = COALESCE(m.clicks, 0) + 1, m.last_clicked_at = $now, m.total_dwell_time_ms = COALESCE(m.total_dwell_time_ms, 0) + $dwell, m.access_count = COALESCE(m.access_count, 0) + 1, m.last_accessed_at = $now",
),
CompatibilityQueryCallSite::new(
"memory full content update",
"memory_write",
"nmem-graph::repo::update_memory_content",
)
.with_cypher(
"MATCH (m:Memory {id: $id}) SET m.content = $content, m.title = $title, m.semantic_field = $semantic_field, m.importance = $importance, m.confidence = $confidence, m.unit_type = $unit_type, m.source = $source, m.source_range = $source_range, m.space_id = $space_id, m.updated_at = $updated_at, m.reindex_needed = $reindex_needed, m.review_status = $review_status, m.extraction_method = $extraction_method",
),
CompatibilityQueryCallSite::new(
"null predicate",
"predicate_read",
"nowledge-memory-core::metadata-filter",
)
.with_cypher("MATCH (m:Memory) WHERE m.status IS NULL RETURN m.id AS id"),
CompatibilityQueryCallSite::new(
"entity alias list lookup",
"entity_write_lookup",
"nmem-graph::entity_write::find_entity_id",
)
.with_cypher(
"MATCH (e:Entity) WHERE e.entity_type = $entity_type AND list_contains(e.aliases, $name)",
),
CompatibilityQueryCallSite::new(
"entity reusable exact lookup",
"entity_write_lookup",
"nmem-graph::entity_write::find_reusable_entity",
)
.with_cypher(
"MATCH (e:Entity {name: $name, entity_type: $entity_type}) RETURN e.id, e.name, e.aliases, e.entity_created, e.entity_ended, e.temporal_precision, e.temporal_confidence, e.temporal_context, e.description LIMIT 1",
),
CompatibilityQueryCallSite::new(
"entity reusable lowercase lookup",
"entity_write_lookup",
"nmem-graph::entity_write::find_reusable_entity",
)
.with_cypher(
"MATCH (e:Entity) WHERE e.entity_type = $entity_type AND LOWER(e.name) = LOWER($name) RETURN e.id, e.name, e.aliases, e.entity_created, e.entity_ended, e.temporal_precision, e.temporal_confidence, e.temporal_context, e.description LIMIT 1",
),
CompatibilityQueryCallSite::new(
"entity reusable alias lookup",
"entity_write_lookup",
"nmem-graph::entity_write::find_reusable_entity",
)
.with_cypher(
"MATCH (e:Entity) WHERE e.entity_type = $entity_type AND list_contains(e.aliases, $name) RETURN e.id, e.name, e.aliases, e.entity_created, e.entity_ended, e.temporal_precision, e.temporal_confidence, e.temporal_context, e.description LIMIT 1",
),
CompatibilityQueryCallSite::new(
"entity reusable same-type bounded scan",
"entity_write_lookup",
"nmem-graph::entity_write::find_reusable_entity",
)
.with_cypher(
"MATCH (e:Entity) WHERE e.entity_type = $entity_type RETURN e.id, e.name, e.aliases, e.entity_created, e.entity_ended, e.temporal_precision, e.temporal_confidence, e.temporal_context, e.description ORDER BY e.updated_at DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"entity temporal metadata update write",
"entity_write",
"nmem-graph::entity_write::store_entity",
)
.with_cypher(
"MATCH (e:Entity {id: $id}) SET e.aliases = $aliases, e.entity_created = $entity_created, e.entity_ended = $entity_ended, e.temporal_precision = $temporal_precision, e.temporal_confidence = $temporal_confidence, e.temporal_context = $temporal_context, e.updated_at = $updated_at",
),
CompatibilityQueryCallSite::new(
"entity temporal create write",
"entity_write",
"nmem-graph::entity_write::store_entity",
)
.with_cypher(
"CREATE (e:Entity { id: $id, name: $name, entity_type: $entity_type, description: $description, aliases: $aliases, confidence: $confidence, entity_created: $entity_created, entity_ended: $entity_ended, temporal_precision: $temporal_precision, temporal_confidence: $temporal_confidence, temporal_context: $temporal_context, created_at: $created_at, updated_at: $updated_at, metadata: $metadata })",
),
CompatibilityQueryCallSite::new(
"entity mention relationship create",
"entity_write",
"nmem-graph::entity_write::create_entity_mention",
)
.with_cypher(
"MATCH (m:Memory {id: $memory_id}), (e:Entity {id: $entity_id}) CREATE (m)-[:MENTIONS { confidence: $confidence, mention_count: 1, created_at: $created_at, properties: $properties }]->(e)",
),
CompatibilityQueryCallSite::new(
"entity temporal relationship create",
"entity_relationship_write",
"nmem-graph::entity_write::create_entity_relationship",
)
.with_cypher(
"MATCH (source:Entity {id: $source_entity_id}), (target:Entity {id: $target_entity_id}) CREATE (source)-[:RELATES_TO { relation_type: $relation_type, strength: $confidence, confidence: $confidence, context: $context, conditions: $conditions, temporal_info: $temporal_info, source_reference: $source_reference, bidirectional: false, created_at: $created_at, properties: $properties, temporal_type: $temporal_type, rel_start: $rel_start, rel_end: $rel_end, temporal_precision: $temporal_precision, is_ongoing: $is_ongoing, temporal_confidence: $temporal_confidence }]->(target)",
),
CompatibilityQueryCallSite::new(
"entity total count read",
"entity_write_read",
"nmem-graph::entity_write::entity_count",
)
.with_cypher("MATCH (e:Entity) RETURN count(e)"),
CompatibilityQueryCallSite::new(
"current timestamp write",
"augmentation_write",
"nmem-graph::augmentation::create_job",
)
.with_cypher(
"CREATE (j:AugmentationJob {job_id: $job_id, status: $status, job_type: $job_type, progress: 0.0, created_at: CURRENT_TIMESTAMP()})",
),
CompatibilityQueryCallSite::new(
"augmentation job create",
"augmentation_job_write",
"nmem-graph::augmentation::create_job",
)
.with_cypher(
"CREATE (j:AugmentationJob { job_id: $job_id, job_type: $job_type, status: 'pending', progress: 0.0, message: 'Job created', parameters: $parameters, result: '{}', error_message: '', started_at: NULL, completed_at: NULL, created_at: CURRENT_TIMESTAMP() })",
),
CompatibilityQueryCallSite::new(
"augmentation job mark running",
"augmentation_job_write",
"nmem-graph::augmentation::mark_running",
)
.with_cypher(
"MATCH (j:AugmentationJob {job_id: $job_id}) WHERE j.status = 'pending' SET j.status = 'running', j.started_at = CURRENT_TIMESTAMP(), j.message = 'Job started' RETURN j.job_id",
),
CompatibilityQueryCallSite::new(
"augmentation job progress update",
"augmentation_job_write",
"nmem-graph::augmentation::update_progress",
)
.with_cypher(
"MATCH (j:AugmentationJob {job_id: $job_id}) WHERE j.status = 'running' SET j.progress = $progress, j.message = $message RETURN j.job_id",
),
CompatibilityQueryCallSite::new(
"augmentation job mark completed",
"augmentation_job_write",
"nmem-graph::augmentation::mark_completed",
)
.with_cypher(
"MATCH (j:AugmentationJob {job_id: $job_id}) WHERE j.status = 'running' SET j.status = 'completed', j.progress = 100.0, j.message = 'Job completed successfully', j.result = $result, j.completed_at = CURRENT_TIMESTAMP() RETURN j.job_id",
),
CompatibilityQueryCallSite::new(
"augmentation job mark failed",
"augmentation_job_write",
"nmem-graph::augmentation::mark_failed",
)
.with_cypher(
"MATCH (j:AugmentationJob {job_id: $job_id}) WHERE j.status = 'pending' OR j.status = 'running' SET j.status = 'failed', j.message = 'Job failed', j.error_message = $error_message, j.completed_at = CURRENT_TIMESTAMP() RETURN j.job_id",
),
CompatibilityQueryCallSite::new(
"augmentation job status read",
"augmentation_job_read",
"nmem-graph::augmentation::get_job",
)
.with_cypher(
"MATCH (j:AugmentationJob {job_id: $job_id}) RETURN j.job_type, j.status, j.progress, j.message, j.result, j.error_message, j.started_at, j.completed_at",
),
CompatibilityQueryCallSite::new(
"rest graph augmentation job status read",
"augmentation_job_read",
"nmem-server::rest_graph::augmentation_job_status",
)
.with_cypher(
"MATCH (j:AugmentationJob {job_id: $job_id}) RETURN j.job_type, j.status, j.progress, j.message, j.result, j.error_message, j.started_at, j.completed_at, j.created_at",
),
CompatibilityQueryCallSite::new(
"augmentation job filtered list read",
"augmentation_job_read",
"nmem-graph::augmentation::list_jobs::filtered",
)
.with_cypher(
"MATCH (j:AugmentationJob) WHERE j.status = $status RETURN j.job_id, j.job_type, j.status, j.progress, j.message, j.started_at, j.completed_at ORDER BY j.started_at DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest graph augmentation jobs filtered list read",
"augmentation_job_read",
"nmem-server::rest_graph::augmentation_jobs_filtered",
)
.with_cypher(
"MATCH (j:AugmentationJob) WHERE j.status = $status_filter RETURN j.job_id, j.job_type, j.status, j.progress, j.message, j.created_at ORDER BY j.created_at DESC LIMIT $job_limit",
),
CompatibilityQueryCallSite::new(
"augmentation job list read",
"augmentation_job_read",
"nmem-graph::augmentation::list_jobs::all",
)
.with_cypher(
"MATCH (j:AugmentationJob) RETURN j.job_id, j.job_type, j.status, j.progress, j.message, j.started_at, j.completed_at ORDER BY j.started_at DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest graph augmentation jobs list read",
"augmentation_job_read",
"nmem-server::rest_graph::augmentation_jobs_all",
)
.with_cypher(
"MATCH (j:AugmentationJob) RETURN j.job_id, j.job_type, j.status, j.progress, j.message, j.created_at ORDER BY j.created_at DESC LIMIT $job_limit",
),
CompatibilityQueryCallSite::new(
"augmentation stale interrupt write",
"augmentation_job_write",
"nmem-graph::augmentation::interrupt_orphaned_jobs",
)
.with_cypher(
"MATCH (j:AugmentationJob) WHERE j.status = 'pending' OR j.status = 'running' SET j.status = 'failed', j.message = 'Interrupted before completion', j.error_message = $reason, j.completed_at = CURRENT_TIMESTAMP() RETURN count(j)",
),
CompatibilityQueryCallSite::new(
"merge node on create set",
"schema_migration_write",
"nmem-graph::schema::run_migrations",
)
.with_cypher(
"MERGE (m:SchemaMigrationLog {id: $id}) ON CREATE SET m.applied_at = CURRENT_TIMESTAMP()",
),
CompatibilityQueryCallSite::new(
"schema migration log ids read",
"schema_migration_read",
"nmem-graph::schema::run_migrations::applied_ids",
)
.with_cypher("MATCH (m:SchemaMigrationLog) RETURN m.id"),
CompatibilityQueryCallSite::new(
"graph meta merge post set",
"pagerank_write",
"nmem-graph::pagerank::persist_pagerank_scores",
)
.with_cypher(
"MERGE (m:GraphMeta {meta_id: 'main'}) SET m.pagerank_applied = true, m.pagerank_algorithm = 'pagerank', m.pagerank_damping = 0.85, m.pagerank_iterations = 20, m.pagerank_computed_at = CURRENT_TIMESTAMP(), m.updated_at = CURRENT_TIMESTAMP()",
),
CompatibilityQueryCallSite::new(
"rest graph pagerank plan graph meta read",
"graph_state_read",
"nmem-server::rest_graph::pagerank_plan",
)
.with_cypher(
"MATCH (m:GraphMeta {meta_id: 'main'}) RETURN m.pagerank_applied, m.pagerank_computed_at",
),
CompatibilityQueryCallSite::new(
"pagerank entity membership read",
"pagerank_read",
"nmem-graph::pagerank::split_unified_scores",
)
.with_cypher("MATCH (e:Entity) WHERE e.id IN $node_ids RETURN e.id"),
CompatibilityQueryCallSite::new(
"pagerank memory membership read",
"pagerank_read",
"nmem-graph::pagerank::split_unified_scores",
)
.with_cypher("MATCH (m:Memory) WHERE m.id IN $node_ids RETURN m.id"),
CompatibilityQueryCallSite::new(
"pagerank memory visibility read",
"pagerank_read",
"nmem-graph::pagerank::filter_default_visible_memory",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id IN $memory_ids RETURN m.id, m.metadata, COALESCE(m.is_latest, true)",
),
CompatibilityQueryCallSite::new(
"pagerank entity score write",
"pagerank_write",
"nmem-graph::pagerank::persist_pagerank",
)
.with_cypher("MATCH (e:Entity) WHERE e.id = $id SET e.pagerank_score = $score"),
CompatibilityQueryCallSite::new(
"pagerank memory score write",
"pagerank_write",
"nmem-graph::pagerank::persist_pagerank",
)
.with_cypher("MATCH (m:Memory) WHERE m.id = $id SET m.pagerank_score = $score"),
CompatibilityQueryCallSite::new(
"pagerank central entity name read",
"pagerank_read",
"nmem-graph::pagerank::most_central_entity",
)
.with_cypher("MATCH (e:Entity {id: $entity_id}) RETURN e.name"),
CompatibilityQueryCallSite::new(
"pagerank clear entity scores",
"pagerank_write",
"nmem-graph::pagerank::clear_pagerank",
)
.with_cypher(
"MATCH (e:Entity) WHERE e.pagerank_score IS NOT NULL SET e.pagerank_score = NULL",
),
CompatibilityQueryCallSite::new(
"pagerank clear memory scores",
"pagerank_write",
"nmem-graph::pagerank::clear_pagerank",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.pagerank_score IS NOT NULL SET m.pagerank_score = NULL",
),
CompatibilityQueryCallSite::new(
"graph meta pagerank clear stamp",
"pagerank_write",
"nmem-graph::pagerank::clear_pagerank",
)
.with_cypher(
"MERGE (m:GraphMeta {meta_id: 'main'}) SET m.pagerank_applied = false, m.pagerank_computed_at = NULL, m.updated_at = CURRENT_TIMESTAMP()",
),
CompatibilityQueryCallSite::new(
"pagerank memory node count",
"pagerank_plan_read",
"nmem-graph::pagerank_plan::graph_counts",
)
.with_cypher("MATCH (m:Memory) RETURN COUNT(m)"),
CompatibilityQueryCallSite::new(
"pagerank entity node count",
"pagerank_plan_read",
"nmem-graph::pagerank_plan::graph_counts",
)
.with_cypher("MATCH (e:Entity) RETURN COUNT(e)"),
CompatibilityQueryCallSite::new(
"pagerank entity relation count",
"pagerank_plan_read",
"nmem-graph::pagerank_plan::graph_counts",
)
.with_cypher("MATCH (:Entity)-[r:RELATES_TO]->(:Entity) RETURN COUNT(r)"),
CompatibilityQueryCallSite::new(
"pagerank mention edge count",
"pagerank_plan_read",
"nmem-graph::pagerank_plan::graph_counts",
)
.with_cypher("MATCH (:Memory)-[r:MENTIONS]->(:Entity) RETURN COUNT(r)"),
CompatibilityQueryCallSite::new(
"pagerank changed memory count",
"pagerank_plan_read",
"nmem-graph::pagerank_plan::changed_counts",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.created_at > timestamp($cutoff) OR m.updated_at > timestamp($cutoff) RETURN COUNT(m)",
),
CompatibilityQueryCallSite::new(
"pagerank changed entity count",
"pagerank_plan_read",
"nmem-graph::pagerank_plan::changed_counts",
)
.with_cypher(
"MATCH (e:Entity) WHERE e.created_at > timestamp($cutoff) OR e.updated_at > timestamp($cutoff) RETURN COUNT(e)",
),
CompatibilityQueryCallSite::new(
"pagerank changed mentions count",
"pagerank_plan_read",
"nmem-graph::pagerank_plan::changed_counts",
)
.with_cypher(
"MATCH (:Memory)-[r:MENTIONS]->(:Entity) WHERE r.created_at > timestamp($cutoff) RETURN COUNT(r)",
),
CompatibilityQueryCallSite::new(
"pagerank changed entity relation count",
"pagerank_plan_read",
"nmem-graph::pagerank_plan::changed_counts",
)
.with_cypher(
"MATCH (:Entity)-[r:RELATES_TO]->(:Entity) WHERE r.created_at > timestamp($cutoff) RETURN COUNT(r)",
),
CompatibilityQueryCallSite::new(
"pagerank active memory relation count",
"pagerank_plan_read",
"nmem-graph::pagerank_plan::graph_counts",
)
.with_cypher(
"MATCH (:Memory)-[r:MEMORY_RELATES_TO]->(:Memory) WHERE r.status = 'active' RETURN COUNT(r)",
),
CompatibilityQueryCallSite::new(
"pagerank changed memory relation count",
"pagerank_plan_read",
"nmem-graph::pagerank_plan::changed_counts",
)
.with_cypher(
"MATCH (:Memory)-[r:MEMORY_RELATES_TO]->(:Memory) WHERE r.status = 'active' AND (r.created_at > timestamp($cutoff) OR r.updated_at > timestamp($cutoff)) RETURN COUNT(r)",
),
CompatibilityQueryCallSite::new(
"decay evolves relation counts",
"decay_scheduler_read",
"nmem-server::scheduler_service::Q_DECAY_EVOLVES_COUNTS",
)
.with_cypher(
"MATCH (m:Memory)-[e:EVOLVES]->(:Memory) WHERE m.id IN $memory_ids AND e.content_relation IN ['confirms', 'enriches'] RETURN m.id, COUNT(e)",
),
CompatibilityQueryCallSite::new(
"decay crystal synthesis counts",
"decay_scheduler_read",
"nmem-server::scheduler_service::Q_DECAY_CRYSTAL_COUNTS",
)
.with_cypher(
"MATCH (c:Memory)-[:SYNTHESIZED_FROM]->(m:Memory) WHERE m.id IN $memory_ids AND c.is_crystal = true RETURN m.id, COUNT(c)",
),
CompatibilityQueryCallSite::new(
"label merge node on create seed",
"label_write",
"nmem-graph::label_write::upsert_label",
)
.with_cypher(
"MERGE (l:Label {id: $label_id}) ON CREATE SET l.name = $label_name, l.canonical_name = $canonical, l.color = $color, l.description = $description, l.created_at = $now, l.updated_at = $now, l.metadata = $metadata",
),
CompatibilityQueryCallSite::new(
"label merge node on create and match set",
"label_write",
"nmem-graph::label_write::upsert_label",
)
.with_cypher(
"MERGE (l:Label {id: $label_id}) ON CREATE SET l.name = $label_name, l.canonical_name = $canonical, l.color = $color, l.description = $description, l.created_at = $now, l.updated_at = $now, l.metadata = $metadata ON MATCH SET l.updated_at = $now, l.canonical_name = COALESCE(l.canonical_name, $canonical)",
),
CompatibilityQueryCallSite::new(
"matched relationship merge on create set",
"label_write",
"nmem-graph::repo::assign_label_to_memory",
)
.with_cypher(
"MATCH (m:Memory {id: $memory_id}), (l:Label {id: $label_id}) MERGE (m)-[r:HAS_LABEL]->(l) ON CREATE SET r.assigned_by = $assigned_by, r.created_at = $created_at, r.properties = $properties",
),
CompatibilityQueryCallSite::new(
"label merge transfer retarget relationship",
"label_write",
"nmem-graph::label_write::merge_labels",
)
.with_cypher(
"MATCH (n:Memory)-[:HAS_LABEL]->(src:Label {id: $src}) MATCH (tgt:Label {id: $tgt}) MERGE (n)-[r:HAS_LABEL]->(tgt) ON CREATE SET r.assigned_by = 'label_merge', r.created_at = $now, r.properties = '{}'",
),
CompatibilityQueryCallSite::new(
"label canonical lookup",
"label_write",
"nmem-graph::label_write::resolve_or_create_label",
)
.with_cypher("MATCH (l:Label) WHERE l.canonical_name = $c RETURN l.id LIMIT 1"),
CompatibilityQueryCallSite::new(
"label canonical backfill read",
"schema_migration_read",
"nmem-graph::schema::backfill_label_canonical_name",
)
.with_cypher(
"MATCH (l:Label) WHERE l.canonical_name IS NULL RETURN l.id, l.name",
),
CompatibilityQueryCallSite::new(
"label null-canonical bounded scan",
"label_write",
"nmem-graph::label_write::resolve_or_create_label",
)
.with_cypher(
"MATCH (l:Label) WHERE l.canonical_name IS NULL RETURN l.id, l.name LIMIT $cap",
),
CompatibilityQueryCallSite::new(
"label null-canonical backfill write",
"label_write",
"nmem-graph::label_write::resolve_or_create_label",
)
.with_cypher("MATCH (l:Label {id: $id}) SET l.canonical_name = $c"),
CompatibilityQueryCallSite::new(
"label rename collision lookup",
"label_write",
"nmem-graph::label_write::update_label",
)
.with_cypher(
"MATCH (l:Label) WHERE l.canonical_name = $c AND l.id <> $label_id RETURN l.id LIMIT 1",
),
CompatibilityQueryCallSite::new(
"label rename null-canonical collision scan",
"label_write",
"nmem-graph::label_write::update_label",
)
.with_cypher(
"MATCH (l:Label) WHERE l.canonical_name IS NULL AND l.id <> $label_id RETURN l.id, l.name LIMIT 500",
),
CompatibilityQueryCallSite::new(
"label existence lookup",
"label_write",
"nmem-graph::label_write::update_label",
)
.with_cypher("MATCH (l:Label {id: $label_id}) RETURN l.id LIMIT 1"),
CompatibilityQueryCallSite::new(
"label dynamic update set",
"label_write",
"nmem-graph::label_write::update_label",
)
.with_cypher(
"MATCH (l:Label {id: $label_id}) SET l.updated_at = $updated_at, l.name = $name, l.canonical_name = $canonical",
),
CompatibilityQueryCallSite::new(
"label relationship remove from memory",
"label_write",
"nmem-graph::label_write::remove_label_from_memory",
)
.with_cypher(
"MATCH (m:Memory {id: $memory_id})-[r:HAS_LABEL]->(l:Label {id: $label_id}) DELETE r",
),
CompatibilityQueryCallSite::new(
"label remove all from memory count",
"label_write",
"nmem-graph::label_write::remove_all_labels_from_memory",
)
.with_cypher("MATCH (m:Memory {id: $id})-[r:HAS_LABEL]->(:Label) RETURN COUNT(r)"),
CompatibilityQueryCallSite::new(
"label remove all from memory delete",
"label_write",
"nmem-graph::label_write::remove_all_labels_from_memory",
)
.with_cypher("MATCH (m:Memory {id: $id})-[r:HAS_LABEL]->(:Label) DELETE r"),
CompatibilityQueryCallSite::new(
"label detach delete",
"label_write",
"nmem-graph::label_write::delete_label",
)
.with_cypher("MATCH (l:Label {id: $label_id}) DETACH DELETE l"),
CompatibilityQueryCallSite::new(
"mention relationship target-filter multi property update",
"entity_lifecycle_write",
"nmem-graph::entity_lifecycle::update_entity_mention",
)
.with_cypher(
"MATCH (m:Memory {id: $memory_id})-[r:MENTIONS]->(e:Entity {id: $target_id}) SET r.confidence = $confidence, r.mention_count = $mention_count, r.created_at = $created_at",
),
CompatibilityQueryCallSite::new(
"timestamp cutoff predicate",
"graph_freshness_read",
"nmem-graph::pagerank_plan::changed_counts",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.created_at > timestamp($cutoff) OR m.updated_at > timestamp($cutoff) RETURN COUNT(m)",
),
CompatibilityQueryCallSite::new(
"cast timestamp cleanup coverage predicate",
"cleanup_coverage_read",
"nmem-server::cleanup_plan::fetch_dedup_coverage",
)
.with_cypher(
"MATCH (m:Memory) WHERE (m.is_crystal IS NULL OR m.is_crystal = false) AND (m.is_latest IS NULL OR m.is_latest = true) AND (m.lifecycle_state IS NULL OR m.lifecycle_state = 'active') AND m.created_at IS NOT NULL AND m.created_at >= CAST($recent_7d AS TIMESTAMP) RETURN count(m)",
),
CompatibilityQueryCallSite::new(
"memory monthly date part aggregate read",
"memory_stats_read",
"nmem-server::rest_read_batch::memory_monthly_stats",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.created_at IS NOT NULL AND ({filter}){space_and} WITH date_part('year', m.created_at) as year, date_part('month', m.created_at) as month, COUNT(m) as memory_count RETURN year, month, memory_count ORDER BY year DESC, month DESC LIMIT $months",
),
CompatibilityQueryCallSite::new(
"relationship count aggregate order read",
"graph_analysis_read",
"nmem-graph::community::topic_graph_candidates",
)
.with_cypher(
"MATCH (e:Entity)-[r:RELATES_TO]-(:Entity) WHERE r.confidence >= {conf} AND r.strength >= {strength} RETURN e.id, COUNT(r) ORDER BY COUNT(r) DESC LIMIT {limit}",
),
CompatibilityQueryCallSite::new(
"memory mention entity count aggregate read",
"community_memory_read",
"nmem-server::mcp_server::community_memories",
)
.with_cypher(
"MATCH (e:Entity {community_id: $louvain_id})<-[:MENTIONS]-(m:Memory) WHERE m.is_crystal = false WITH m, COUNT(e) AS entity_count RETURN m.id, m.title, m.content, m.unit_type, m.metadata, COALESCE(m.is_latest, true) ORDER BY entity_count DESC, m.importance DESC",
),
CompatibilityQueryCallSite::new(
"mcp community memory ranking read",
"mcp_read",
"nmem-server::mcp_server::community_memories.exact",
)
.with_cypher(
"MATCH (e:Entity {community_id: $louvain_id})<-[:MENTIONS]-(m:Memory) WHERE m.is_crystal = false WITH m, COUNT(e) AS entity_count RETURN m.id, m.title, m.content, m.unit_type, m.metadata, COALESCE(m.is_latest, true) ORDER BY entity_count DESC, m.importance DESC",
),
CompatibilityQueryCallSite::new(
"community top memory collect entity ids read",
"community_memory_read",
"nmem-graph::repo::community_top_memory",
)
.with_cypher(
"MATCH (e:Entity {community_id: $community_id})<-[:MENTIONS]-(m:Memory) WITH m, COUNT(e) as entity_count, COLLECT(DISTINCT e.id) as entity_ids RETURN m, entity_count, entity_ids ORDER BY entity_count DESC, m.importance DESC, COALESCE(m.pagerank_score, 0.0) DESC LIMIT 1",
),
CompatibilityQueryCallSite::new(
"community memories collect entity ids read",
"community_memory_read",
"nmem-graph::repo::memories_in_community",
)
.with_cypher(
"MATCH (e:Entity {community_id: $community_id})<-[:MENTIONS]-(m:Memory) WITH m, COUNT(e) as entity_count, COLLECT(DISTINCT e.id) as entity_ids RETURN m, entity_count, entity_ids ORDER BY entity_count DESC, m.importance DESC, COALESCE(m.pagerank_score, 0.0) DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"entity strategy collect entity nodes read",
"community_memory_read",
"nmem-graph::repo::memories_mentioning_entities",
)
.with_cypher(
"MATCH (m:Memory)-[:MENTIONS]->(e:Entity) WHERE e.id IN $entity_ids WITH m, COLLECT(DISTINCT e) as entity_nodes, COUNT(DISTINCT e) as entity_count RETURN m, entity_nodes, entity_count ORDER BY entity_count DESC, m.importance DESC, COALESCE(m.pagerank_score, 0.0) DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"community memory coalesced summary read",
"community_memory_read",
"nmem-server::rest_community::community_memory_summaries",
)
.with_cypher(
"MATCH (e:Entity {community_id: $community_id})<-[:MENTIONS]-(m:Memory) WHERE COALESCE(m.is_crystal, false) = false WITH m, COUNT(e) AS entity_count RETURN m.id, COALESCE(m.title, ''), COALESCE(m.content, ''), entity_count ORDER BY entity_count DESC, COALESCE(m.importance, 0.5) DESC LIMIT 10",
),
CompatibilityQueryCallSite::new(
"rest favorite memories paged metadata read",
"rest_list_read",
"nmem-server::rest_lists::favorite_memories_handler",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.metadata CONTAINS 'is_favorite' RETURN m ORDER BY m.updated_at DESC SKIP $offset LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest favorite threads paged metadata read",
"rest_list_read",
"nmem-server::rest_lists::favorite_threads_handler",
)
.with_cypher(
"MATCH (t:Thread) WHERE t.metadata CONTAINS 'is_favorite' RETURN t.thread_id, t.title, t.summary, COALESCE(t.message_count, 0), t.source, t.id, t.created_at, t.updated_at, t.metadata, CASE WHEN t.space_id IS NULL OR t.space_id = '' THEN 'default' ELSE t.space_id END ORDER BY t.updated_at DESC SKIP $offset LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest thread metadata lookup read",
"rest_list_read",
"nmem-server::rest_lists::thread_metadata_lookup",
)
.with_cypher(
"MATCH (t:Thread) WHERE t.thread_id = $thread_id OR t.id = $thread_id RETURN t.id, t.thread_id, COALESCE(t.message_count, 0), t.metadata LIMIT 1",
),
CompatibilityQueryCallSite::new(
"rest list thread legacy message detail read",
"rest_list_read",
"nmem-server::rest_lists::fetch_legacy_kuzu_messages",
)
.with_cypher(
"MATCH (t:Thread {id: $thread_uuid})-[c:CONTAINS]->(m:Message) RETURN m.id, m.content, m.role, COALESCE(c.order_index, m.order_index), m.timestamp, m.token_count, m.created_at, m.updated_at, m.metadata ORDER BY COALESCE(c.order_index, m.order_index)",
),
CompatibilityQueryCallSite::new(
"rest list thread compacted memory detail read",
"rest_list_read",
"nmem-server::rest_lists::fetch_thread_related_memories",
)
.with_cypher(
"MATCH (t:Thread {id: $thread_uuid})-[:COMPACTS_TO]->(m:Memory) RETURN m.id, m.content, m.title, m.importance, m.pagerank_score, m.confidence, m.source_range, m.source, m.created_at, m.updated_at, m.metadata, CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END, m.last_reindexed_at, m.reindex_needed, COALESCE(m.unit_type, 'fact'), COALESCE(m.is_latest, true), COALESCE(m.version, 1), COALESCE(m.is_crystal, false), m.crystal_title, m.source_unit_count, COALESCE(m.extraction_method, 'manual'), COALESCE(m.access_count, 0), COALESCE(m.appearances, 0), COALESCE(m.clicks, 0), COALESCE(m.decay_score_cached, 0.0), m.event_end, m.event_start, m.last_accessed_at, m.last_clicked_at, m.last_evaluated_at, COALESCE(m.review_status, ''), m.temporal_confidence, m.temporal_context, m.temporal_precision, m.temporal_type, COALESCE(m.total_dwell_time_ms, 0) ORDER BY m.importance DESC, m.created_at DESC LIMIT 10",
),
CompatibilityQueryCallSite::new(
"rest list thread metadata related memory read",
"rest_list_read",
"nmem-server::rest_lists::fetch_metadata_related_memories",
)
.with_cypher(
"MATCH (m:Memory) WHERE ( m.space_id = $space_id OR ($space_id = 'default' AND (m.space_id IS NULL OR m.space_id = '')) ) AND ( m.metadata CONTAINS $source_id_spaced OR m.metadata CONTAINS $source_id_compact OR m.metadata CONTAINS $source_thread_id_spaced OR m.metadata CONTAINS $source_thread_id_compact ) RETURN m.id, m.content, m.title, m.importance, m.pagerank_score, m.confidence, m.source_range, m.source, m.created_at, m.updated_at, m.metadata, CASE WHEN m.space_id IS NULL OR m.space_id = '' THEN 'default' ELSE m.space_id END, m.last_reindexed_at, m.reindex_needed, COALESCE(m.unit_type, 'fact'), COALESCE(m.is_latest, true), COALESCE(m.version, 1), COALESCE(m.is_crystal, false), m.crystal_title, m.source_unit_count, COALESCE(m.extraction_method, 'manual'), COALESCE(m.access_count, 0), COALESCE(m.appearances, 0), COALESCE(m.clicks, 0), COALESCE(m.decay_score_cached, 0.0), m.event_end, m.event_start, m.last_accessed_at, m.last_clicked_at, m.last_evaluated_at, COALESCE(m.review_status, ''), m.temporal_confidence, m.temporal_context, m.temporal_precision, m.temporal_type, COALESCE(m.total_dwell_time_ms, 0) ORDER BY m.created_at DESC LIMIT 25",
),
CompatibilityQueryCallSite::new(
"rest list related entity names by memory ids read",
"rest_list_read",
"nmem-server::rest_lists::fetch_thread_entities.memory_ids",
)
.with_cypher(
"MATCH (m:Memory)-[:MENTIONS]->(e:Entity) WHERE m.id IN $memory_ids RETURN DISTINCT e.name ORDER BY e.name LIMIT 20",
),
CompatibilityQueryCallSite::new(
"rest list related entity names by thread read",
"rest_list_read",
"nmem-server::rest_lists::fetch_thread_entities.thread",
)
.with_cypher(
"MATCH (t:Thread {id: $thread_uuid})-[:COMPACTS_TO]->(m:Memory)-[:MENTIONS]->(e:Entity) RETURN DISTINCT e.name ORDER BY e.name LIMIT 20",
),
CompatibilityQueryCallSite::new(
"rest list community summary ranked read",
"rest_list_read",
"nmem-server::rest_lists::list_communities_handler",
)
.with_cypher(
"MATCH (c:Community) WHERE c.ai_summary IS NOT NULL AND c.ai_summary <> '' RETURN c.id, c.community_id, c.name, c.description, c.ai_summary, c.member_count ORDER BY c.member_count DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest list skill node detail read",
"rest_list_read",
"nmem-server::rest_lists::get_skill_handler.skill",
)
.with_cypher("MATCH (s:Skill {id: $id}) RETURN s"),
CompatibilityQueryCallSite::new(
"rest list skill evidence detail read",
"rest_list_read",
"nmem-server::rest_lists::get_skill_handler.evidence",
)
.with_cypher(
"MATCH (s:Skill {id: $id})-[:SYNTHESIZED_FROM]->(m:Memory) RETURN m.id, m.title, m.content, m.created_at ORDER BY m.created_at DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest list label row aliased usage read",
"rest_list_read",
"nmem-server::rest_lists::get_label_handler",
)
.with_cypher(
"MATCH (l:Label {id: $label_id}) OPTIONAL MATCH (l)<-[:HAS_LABEL]-(n) WITH l, COUNT(n) as usage_count RETURN l.id as id, l.name as name, l.color as color, l.description as description, l.created_at as created_at, l.updated_at as updated_at, usage_count",
),
CompatibilityQueryCallSite::new(
"rest list label health usage read",
"rest_list_read",
"nmem-server::rest_lists::label_health_handler.usage_rows",
)
.with_cypher(
"MATCH (l:Label) OPTIONAL MATCH (l)<-[:HAS_LABEL]-(n) WITH l, COUNT(n) AS u RETURN u",
),
CompatibilityQueryCallSite::new(
"rest list memory label health count read",
"rest_list_read",
"nmem-server::rest_lists::label_health_handler.per_memory_rows",
)
.with_cypher(
"MATCH (m:Memory) OPTIONAL MATCH (m)-[:HAS_LABEL]->(l:Label) WITH m, COUNT(l) AS k RETURN k",
),
CompatibilityQueryCallSite::new(
"label distinct memory count aggregate read",
"label_stats_read",
"nmem-server::rest_fs::label_distribution",
)
.with_cypher(
"MATCH (m:Memory)-[:HAS_LABEL]->(l:Label) WITH l, COUNT(DISTINCT m) AS memory_count RETURN l.name, memory_count ORDER BY memory_count DESC, l.name ASC SKIP $offset LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"label regex memory connection aggregate read",
"label_stats_read",
"nmem-graph::repo::memories_by_label_pattern",
)
.with_cypher(
"MATCH (m:Memory)-[hl:HAS_LABEL]->(l:Label) WHERE l.name =~ $pattern RETURN DISTINCT m, l.name as label_name, COUNT(*) as label_connections ORDER BY label_connections DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"okf export label rows read",
"okf_export_read",
"nmem-server::okf_export::fetch_label_rows",
)
.with_cypher(
"MATCH (m:Memory)-[:HAS_LABEL]->(l:Label) WITH l, COUNT(DISTINCT m) AS member_count RETURN l.name, member_count ORDER BY member_count DESC, l.name ASC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"mention breadth aggregate pre-return order read",
"graph_memory_read",
"nmem-server::rest_graph::top_memories_by_mentions",
)
.with_cypher(
"MATCH (m:Memory)-[men:MENTIONS]->(e:Entity) WHERE e.id IN $ids WITH m, COUNT(DISTINCT e) AS mention_breadth ORDER BY mention_breadth DESC, COALESCE(m.importance, 0.5) DESC LIMIT $top_n RETURN m.id, m.title, m.content, m.importance, m.is_crystal, mention_breadth",
),
CompatibilityQueryCallSite::new(
"entity bridge span aggregate read",
"graph_bridge_read",
"nmem-server::mcp_server::bridge_entities",
)
.with_cypher(
"MATCH (e1:Entity)-[:RELATES_TO]-(e2:Entity) WHERE e1.community_id IN $cids AND e2.community_id IN $cids AND e1.community_id <> e2.community_id WITH e1, COUNT(DISTINCT e2.community_id) AS community_span, COUNT(*) AS bridge_strength RETURN e1.id, e1.name, e1.community_id, community_span, bridge_strength ORDER BY community_span DESC, bridge_strength DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"entity bridge span aggregate filter read",
"graph_bridge_read",
"nmem-server::mcp_server::bridge_entities_filtered",
)
.with_cypher(
"MATCH (e1:Entity)-[:RELATES_TO]-(e2:Entity) WHERE e1.community_id IS NOT NULL AND e2.community_id IS NOT NULL AND e1.community_id <> e2.community_id WITH e1, COUNT(DISTINCT e2.community_id) AS community_span, COUNT(*) AS bridge_strength WHERE community_span >= 2 RETURN e1.id, e1.name, e1.community_id, community_span, bridge_strength ORDER BY community_span DESC, bridge_strength DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"community bridge lookup after aggregate read",
"graph_bridge_read",
"nmem-server::rest_graph::community_bridge_lookup",
)
.with_cypher(
"MATCH (e1:Entity)-[:RELATES_TO]-(e2:Entity) WHERE e1.community_id = $cid AND e2.community_id IS NOT NULL AND e2.community_id <> $cid WITH e2.community_id AS other_cid, COUNT(*) AS shared_edge_count ORDER BY shared_edge_count DESC LIMIT $limit MATCH (c:Community) WHERE c.community_id = other_cid RETURN c.community_id, c.name, c.ai_summary, c.description, c.member_count, shared_edge_count",
),
CompatibilityQueryCallSite::new(
"search projection community candidate read",
"search_projection_read",
"nmem-graph::search_projection::search_community_candidates",
)
.with_cypher(
"MATCH (c:Community) WITH c, CASE WHEN c.name IS NOT NULL THEN lower(c.name) ELSE '' END AS c_name, CASE WHEN c.description IS NOT NULL THEN lower(c.description) ELSE '' END AS c_description, CASE WHEN c.ai_summary IS NOT NULL THEN lower(c.ai_summary) ELSE '' END AS c_summary WHERE c_name CONTAINS $raw_query OR c_name CONTAINS $normalized_query OR c_description CONTAINS $raw_query OR c_description CONTAINS $normalized_query OR c_summary CONTAINS $raw_query OR c_summary CONTAINS $normalized_query RETURN c.community_id, c.name, c.description, c.ai_summary, c.member_count, CASE WHEN c_name = $raw_query THEN 3 WHEN c_name = $normalized_query THEN 3 WHEN c_name CONTAINS $raw_query THEN 2 WHEN c_name CONTAINS $normalized_query THEN 2 ELSE 1 END AS match_level ORDER BY match_level DESC, c.member_count DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"community memory count optional lookup read",
"community_memory_read",
"nmem-server::rest_read_batch::community_memory_counts",
)
.with_cypher(
"MATCH (m:Memory)-[:MENTIONS]->(e:Entity) WHERE {space_expr} IN $space_ids AND e.community_id IS NOT NULL WITH e.community_id AS community_id, COUNT(DISTINCT m) AS memory_count OPTIONAL MATCH (c:Community) WHERE c.community_id = community_id RETURN c.name, memory_count, c.description ORDER BY memory_count DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"community summary presence ranked read",
"community_read",
"nmem-server::rest_library::community_summary_ranked",
)
.with_cypher(
"MATCH (c:Community) WHERE c.community_id IS NOT NULL AND c.community_id >= 0 RETURN c.community_id, c.name, c.description, c.ai_summary, c.member_count, c.updated_at ORDER BY CASE WHEN c.ai_summary IS NOT NULL AND c.ai_summary <> '' THEN 0 ELSE 1 END, c.member_count DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"wiki community entity anchor visibility read",
"wiki_export_read",
"nmem-server::rest_fs::entity_anchors_by_community; nmem-server::rest_library::community_entities",
)
.with_cypher(
"MATCH (e:Entity) WHERE e.community_id IN $cids OPTIONAL MATCH (m:Memory)-[r:MENTIONS]->(e) RETURN e.community_id, e.id, e.name, e.entity_type, m.id, m.metadata, COALESCE(m.is_latest, true), m.lifecycle_state ORDER BY e.community_id, e.name ASC",
),
CompatibilityQueryCallSite::new(
"wiki community crystal source visibility read",
"wiki_export_read",
"nmem-server::rest_library::community_crystals",
)
.with_cypher(
"MATCH (m:Memory)-[:SYNTHESIZED_FROM]->(src:Memory)-[:MENTIONS]->(e:Entity) WHERE m.is_crystal = true AND e.community_id IN $cids RETURN m.id, m.crystal_title, m.title, m.content, m.importance, e.community_id, m.metadata, COALESCE(m.is_latest, true), m.lifecycle_state, src.metadata, COALESCE(src.is_latest, true), src.lifecycle_state",
),
CompatibilityQueryCallSite::new(
"wiki entity listing mention-count read",
"wiki_export_read",
"nmem-server::rest_fs::ls_wiki_entities",
)
.with_cypher(
"MATCH (e:Entity) WHERE e.name IS NOT NULL AND e.id IS NOT NULL OPTIONAL MATCH (:Memory)-[r:MENTIONS]->(e) WITH e, COUNT(r) AS mention_count RETURN e.id, e.name, e.updated_at, mention_count ORDER BY mention_count DESC, e.name ASC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"wiki entity listing mention-count cursor read",
"wiki_export_read",
"nmem-server::rest_fs::ls_wiki_entities.cursor_count",
)
.with_cypher(
"MATCH (e:Entity) WHERE e.name IS NOT NULL AND e.id IS NOT NULL OPTIONAL MATCH (:Memory)-[r:MENTIONS]->(e) WITH e, COUNT(r) AS mention_count WHERE mention_count < $after_count OR (mention_count = $after_count AND e.name > $after_name) RETURN e.id, e.name, e.updated_at, mention_count ORDER BY mention_count DESC, e.name ASC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"wiki export summary entity count",
"wiki_export_read",
"nmem-server::wiki_export::wiki_export_summary.entity_count",
)
.with_cypher("MATCH (e:Entity) RETURN COUNT(e)"),
CompatibilityQueryCallSite::new(
"wiki export summary crystal count",
"wiki_export_read",
"nmem-server::wiki_export::wiki_export_summary.crystal_count",
)
.with_cypher("MATCH (m:Memory) WHERE m.is_crystal = true RETURN COUNT(m)"),
CompatibilityQueryCallSite::new(
"wiki export summary community count",
"wiki_export_read",
"nmem-server::wiki_export::wiki_export_summary.community_count",
)
.with_cypher(
"MATCH (c:Community) WHERE c.community_id IS NOT NULL AND c.community_id >= 0 AND c.ai_summary IS NOT NULL AND c.ai_summary <> '' AND c.name <> 'Knowledge Network' AND c.name <> 'Concept Cluster' AND c.name <> 'Small Group' RETURN COUNT(c)",
),
CompatibilityQueryCallSite::new(
"wiki export community mention memory ranking read",
"wiki_export_read",
"nmem-server::wiki_export::list_top_memories_by_community.mention_rows",
)
.with_cypher(
"MATCH (m:Memory)-[:MENTIONS]->(e:Entity) WHERE e.community_id IN $cids RETURN e.community_id, m.id, m.title, m.content, m.importance, m.created_at, m.is_crystal, COUNT(DISTINCT e.id) AS mention_breadth, m.metadata, COALESCE(m.is_latest, true), m.lifecycle_state ORDER BY e.community_id ASC, mention_breadth DESC, CASE WHEN m.importance IS NOT NULL THEN m.importance ELSE 0.5 END DESC, m.created_at DESC",
),
CompatibilityQueryCallSite::new(
"wiki export community direct memory ranking read",
"wiki_export_read",
"nmem-server::wiki_export::list_top_memories_by_community.direct_rows",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.community_id IN $cids AND (m.is_crystal IS NULL OR m.is_crystal = false) RETURN m.community_id, m.id, m.title, m.content, m.importance, m.created_at, m.is_crystal, 0 AS mention_breadth, m.metadata, COALESCE(m.is_latest, true), m.lifecycle_state ORDER BY m.community_id ASC, CASE WHEN m.importance IS NOT NULL THEN m.importance ELSE 0.5 END DESC, m.created_at DESC",
),
CompatibilityQueryCallSite::new(
"wiki topic entity mention-count read",
"wiki_export_read",
"nmem-server::rest_fs::render_single_topic_page.entities",
)
.with_cypher(
"MATCH (e:Entity) WHERE e.community_id = $cid OPTIONAL MATCH (:Memory)-[r:MENTIONS]->(e) RETURN e.id, e.name, e.entity_type, COUNT(r) AS mention_count ORDER BY mention_count DESC, e.name ASC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"rest fs community topic detail read",
"wiki_export_read",
"nmem-server::rest_fs::render_single_topic_page.community",
)
.with_cypher(
"MATCH (c:Community) WHERE c.community_id = $cid RETURN c.community_id, c.name, c.ai_summary, c.description, c.member_count LIMIT 1",
),
CompatibilityQueryCallSite::new(
"rest fs crystal wiki detail read",
"wiki_export_read",
"nmem-server::rest_fs::render_single_crystal_page",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.is_crystal = true AND (m.id = $key OR m.id STARTS WITH $key OR m.id CONTAINS $key) RETURN m.id, m.crystal_title, m.title, m.content, m.importance, m.unit_type, m.created_at LIMIT 1",
),
CompatibilityQueryCallSite::new(
"rest fs crystal page read",
"wiki_export_read",
"nmem-server::rest_fs::fetch_visible_crystal_rows_page",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.is_crystal = true AND m.id > $after RETURN m.id, m.title, m.crystal_title, m.is_crystal, m.updated_at, m.metadata, m.is_latest ORDER BY m.id ASC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"wiki topic crystal ranking read",
"wiki_export_read",
"nmem-server::rest_fs::render_single_topic_page.crystals",
)
.with_cypher(
"MATCH (m:Memory)-[:SYNTHESIZED_FROM]->(src:Memory)-[:MENTIONS]->(e:Entity) WHERE m.is_crystal = true AND e.community_id = $cid RETURN m.id, m.crystal_title, m.title, m.content, m.importance, COUNT(e) AS hits ORDER BY hits DESC, m.importance DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"wiki entity id-or-name lookup read",
"wiki_export_read",
"nmem-server::rest_fs::render_single_entity_page.lookup",
)
.with_cypher(
"MATCH (e:Entity) WHERE e.id = $key OR LOWER(e.name) = LOWER($key) RETURN e.id, e.name, e.entity_type, e.description, e.aliases, e.confidence, e.community_id, e.created_at LIMIT 1",
),
CompatibilityQueryCallSite::new(
"wiki entity community context read",
"wiki_export_read",
"nmem-server::rest_fs::render_single_entity_page.community",
)
.with_cypher(
"MATCH (c:Community) WHERE c.community_id = $cid RETURN c.name, c.ai_summary, c.description LIMIT 1",
),
CompatibilityQueryCallSite::new(
"mcp community detail read",
"mcp_read",
"nmem-server::mcp_server::community_detail",
)
.with_cypher(
"MATCH (c:Community) WHERE c.id = $cid RETURN c.id, c.community_id, c.name, c.description, c.ai_summary, c.member_count",
),
CompatibilityQueryCallSite::new(
"mcp community entity mention read",
"mcp_read",
"nmem-server::mcp_server::community_entities",
)
.with_cypher(
"MATCH (e:Entity) WHERE e.community_id = $louvain_id OPTIONAL MATCH (m:Memory)-[:MENTIONS]->(e) RETURN e.id, e.name, e.entity_type, m.id, m.metadata, COALESCE(m.is_latest, true) ORDER BY e.name ASC",
),
CompatibilityQueryCallSite::new(
"mcp community summary list read",
"mcp_read",
"nmem-server::mcp_server::community_summary_list",
)
.with_cypher(
"MATCH (c:Community) WHERE c.ai_summary IS NOT NULL AND c.ai_summary <> '' RETURN c.id, c.community_id, c.name, c.ai_summary, c.member_count ORDER BY c.member_count DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"okf export community list read",
"okf_export_read",
"nmem-server::okf_export::list_communities",
)
.with_cypher(
"MATCH (c:Community) WHERE c.ai_summary IS NOT NULL AND c.ai_summary <> '' AND c.name <> 'Knowledge Network' AND c.name <> 'Concept Cluster' AND c.name <> 'Small Group' RETURN c.community_id, c.name, c.ai_summary, c.description, c.member_count ORDER BY c.member_count DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"okf export entity list read",
"okf_export_read",
"nmem-server::okf_export::list_entities",
)
.with_cypher(
"MATCH (e:Entity) OPTIONAL MATCH (:Memory)-[r:MENTIONS]->(e) RETURN e.id, e.name, e.entity_type, e.description, e.aliases, e.confidence, e.community_id, e.created_at, COUNT(r) AS mention_count ORDER BY mention_count DESC, e.name ASC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"okf export crystal list read",
"okf_export_read",
"nmem-server::okf_export::list_crystals",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.is_crystal = true RETURN m.id, m.crystal_title, m.title, m.content, m.importance, m.unit_type, m.created_at ORDER BY m.importance DESC, m.created_at DESC",
),
CompatibilityQueryCallSite::new(
"okf export crystal entity community read",
"okf_export_read",
"nmem-server::okf_export::crystal_entity_communities",
)
.with_cypher(
"MATCH (m:Memory)-[:SYNTHESIZED_FROM]->(src:Memory)-[:MENTIONS]->(e:Entity) WHERE m.is_crystal = true AND e.community_id IS NOT NULL RETURN m.id, e.community_id",
),
CompatibilityQueryCallSite::new(
"export entity mention detail read",
"export_entity_read",
"nmem-server::okf_export::entity_mentions_and_related; nmem-server::wiki_export::entity_mentions_and_related_rows; nmem-server::rest_fs::render_single_entity_page.mentions",
)
.with_cypher(
"MATCH (m:Memory)-[:MENTIONS]->(e:Entity {id: $id}) RETURN m.id, m.title, m.content, m.is_crystal, COALESCE(m.crystal_title, m.title) AS display_title, m.importance ORDER BY m.is_crystal DESC, m.importance DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"export related entity read",
"export_entity_read",
"nmem-server::okf_export::entity_mentions_and_related; nmem-server::wiki_export::entity_mentions_and_related_rows; nmem-server::rest_fs::render_single_entity_page.related",
)
.with_cypher(
"MATCH (e:Entity {id: $id})-[:RELATES_TO]-(other:Entity) WHERE other.id <> $id RETURN DISTINCT other.id, other.name, other.entity_type LIMIT 30",
),
CompatibilityQueryCallSite::new(
"okf export memory rows with labels read",
"okf_export_read",
"nmem-server::okf_export::fetch_memory_rows",
)
.with_cypher(
"MATCH (m:Memory) WHERE (m.is_crystal IS NULL OR m.is_crystal = false) OPTIONAL MATCH (m)-[:HAS_LABEL]->(l:Label) RETURN m.id, m.title, m.content, m.unit_type, m.importance, m.confidence, m.created_at, m.source, m.metadata, m.is_latest, m.lifecycle_state, COLLECT(DISTINCT l.name) AS labels ORDER BY m.created_at DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"analyzable corpus max updated fingerprint",
"scheduler_fingerprint_read",
"nmem-server::scheduler_service::analyzable_corpus_fingerprint",
)
.with_cypher(
"MATCH (m:Memory) WHERE (m.is_crystal IS NULL OR m.is_crystal = false) AND (m.is_latest IS NULL OR m.is_latest = true) AND (m.lifecycle_state IS NULL OR m.lifecycle_state = 'active') RETURN count(m), max(m.updated_at)",
),
CompatibilityQueryCallSite::new(
"list predicate and pagination",
"predicate_pagination_read",
"nowledge-memory-core::candidate-window",
)
.with_cypher("MATCH (m:Memory) WHERE m.id IN $ids RETURN m.title AS title"),
CompatibilityQueryCallSite::new(
"grouped aggregation",
"aggregation_read",
"nowledge-memory-core::summary",
)
.with_cypher("MATCH (m:Memory) RETURN m.kind AS kind, count(*) AS total"),
CompatibilityQueryCallSite::new(
"health average read",
"agent_context_read",
"nmem-graph::agent_context::Q_HEALTH_AGG",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.is_crystal = false RETURN count(m), avg(m.decay_score_cached)",
),
CompatibilityQueryCallSite::new(
"graph totals memory count read",
"context_wiring_read",
"nmem-server::context_wiring::graph_totals",
)
.with_cypher("MATCH (m:Memory) RETURN count(m)"),
CompatibilityQueryCallSite::new(
"graph totals evolves count read",
"context_wiring_read",
"nmem-server::context_wiring::graph_totals",
)
.with_cypher("MATCH ()-[e:EVOLVES]->() RETURN count(e)"),
CompatibilityQueryCallSite::new(
"graph totals crystal count read",
"context_wiring_read",
"nmem-server::context_wiring::graph_totals",
)
.with_cypher("MATCH (m:Memory) WHERE m.is_crystal = true RETURN count(m)"),
CompatibilityQueryCallSite::new(
"mcp crystal count read",
"mcp_read",
"nmem-server::mcp_server::list_crystals.count",
)
.with_cypher("MATCH (c:Memory) WHERE c.is_crystal = true RETURN count(c)"),
CompatibilityQueryCallSite::new(
"mcp crystal list read",
"mcp_read",
"nmem-server::mcp_server::list_crystals.rows",
)
.with_cypher(
"MATCH (c:Memory) WHERE c.is_crystal = true RETURN c.id, c.crystal_title, c.content, c.unit_type, c.importance, c.source_unit_count, c.created_at ORDER BY c.created_at DESC SKIP $offset LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"mcp crystal source read",
"mcp_read",
"nmem-server::mcp_server::list_crystal_sources",
)
.with_cypher(
"MATCH (c:Memory)-[r:SYNTHESIZED_FROM]->(s:Memory) WHERE c.id = $id RETURN s.id, s.title, r.weight",
),
CompatibilityQueryCallSite::new(
"mcp memory duplicate candidate read",
"mcp_write_guard_read",
"nmem-server::mcp_server::create_crystal.duplicate_candidate",
)
.with_cypher(
"MATCH (memory:Memory) WHERE memory.space_id = $space_id AND memory.content = $content AND (memory.is_latest IS NULL OR memory.is_latest = true) AND (memory.is_crystal IS NULL OR memory.is_crystal = false) RETURN memory.id, memory.title, memory.content LIMIT 3",
),
CompatibilityQueryCallSite::new(
"mcp source metadata read",
"mcp_write_guard_read",
"nmem-server::mcp_server::create_crystal.source_metadata",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id IN $source_ids RETURN m.id, m.space_id, m.unit_type",
),
CompatibilityQueryCallSite::new(
"mcp crystal create write",
"mcp_write",
"nmem-server::mcp_server::create_crystal.node",
)
.with_cypher(
"CREATE (m:Memory { id: $id, title: $title, content: $content, unit_type: $unit_type, is_crystal: true, is_latest: true, importance: 0.8, created_at: $now, updated_at: $now, last_evaluated_at: $now, source: 'agent', review_status: '', space_id: $space_id, crystal_title: $title, source_unit_count: $source_count, extraction_method: 'agent', version: 1, confidence: 0.5, access_count: 0, appearances: 0, clicks: 0, total_dwell_time_ms: 0, reindex_needed: false, temporal_context: 'timeless' })",
),
CompatibilityQueryCallSite::new(
"mcp crystal source link merge",
"mcp_write",
"nmem-server::mcp_server::create_crystal.source_link",
)
.with_cypher(
"MATCH (c:Memory), (s:Memory) WHERE c.id = $crystal_id AND s.id = $src_id MERGE (c)-[r:SYNTHESIZED_FROM]->(s) ON CREATE SET r.weight = $weight, r.occasion_key = '', r.created_at = $now",
),
CompatibilityQueryCallSite::new(
"mcp crystal delete write",
"mcp_write",
"nmem-server::mcp_server::delete_crystal",
)
.with_cypher("MATCH (m:Memory {id: $id}) DETACH DELETE m"),
CompatibilityQueryCallSite::new(
"decay refresh score and confidence update",
"decay_refresh_write",
"nmem-search::decay_refresh::Q_DECAY_CONF",
)
.with_cypher(
"MATCH (m:Memory {id: $id}) SET m.decay_score_cached = $decay, m.confidence = $conf",
),
CompatibilityQueryCallSite::new(
"decay refresh score update",
"decay_refresh_write",
"nmem-search::decay_refresh::Q_DECAY_ONLY",
)
.with_cypher("MATCH (m:Memory {id: $id}) SET m.decay_score_cached = $decay"),
CompatibilityQueryCallSite::new(
"health stale count read",
"agent_context_read",
"nmem-graph::agent_context::Q_HEALTH_STALE",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.is_crystal = false AND m.decay_score_cached < 0.5 RETURN count(m)",
),
CompatibilityQueryCallSite::new(
"activity digest recent memory read",
"agent_context_read",
"nmem-graph::agent_context::Q_DIGEST_MEMORIES",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.created_at >= $cutoff AND (m.is_crystal IS NULL OR m.is_crystal = false) RETURN m.id, m.title, m.unit_type, m.importance, m.created_at ORDER BY m.created_at DESC LIMIT 20",
),
CompatibilityQueryCallSite::new(
"activity digest recent evolves read",
"agent_context_read",
"nmem-graph::agent_context::Q_DIGEST_EVOLVES",
)
.with_cypher(
"MATCH (newer:Memory)-[e:EVOLVES]->(older:Memory) WHERE e.created_at >= $cutoff RETURN newer.id, newer.title, older.id, older.title, e.content_relation, e.created_at ORDER BY e.created_at DESC LIMIT 10",
),
CompatibilityQueryCallSite::new(
"activity digest recent crystal read",
"agent_context_read",
"nmem-graph::agent_context::Q_DIGEST_CRYSTALS",
)
.with_cypher(
"MATCH (c:Memory) WHERE c.is_crystal = true AND c.created_at >= $cutoff RETURN c.id, c.title, c.created_at ORDER BY c.created_at DESC LIMIT 5",
),
CompatibilityQueryCallSite::new(
"activity digest recent source read",
"agent_context_read",
"nmem-graph::agent_context::Q_DIGEST_SOURCES",
)
.with_cypher(
"MATCH (s:Source) WHERE s.created_at >= $cutoff RETURN s.id, s.original_name, s.source_type, s.lifecycle_state, s.memory_count ORDER BY s.created_at DESC LIMIT 10",
),
CompatibilityQueryCallSite::new(
"activity task crystal memory read",
"agent_context_read",
"nmem-graph::agent_context_tasks::Q_CRYSTAL_MEMORIES",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.created_at >= $cutoff AND (m.is_crystal IS NULL OR m.is_crystal = false) RETURN m.id, m.title, m.unit_type, m.importance, m.created_at ORDER BY m.created_at DESC LIMIT 30",
),
CompatibilityQueryCallSite::new(
"activity task crystallized source id read",
"agent_context_read",
"nmem-graph::agent_context_tasks::Q_CRYSTALLIZED_IDS",
)
.with_cypher(
"MATCH (c:Memory {is_crystal: true})-[:SYNTHESIZED_FROM]->(s:Memory) RETURN DISTINCT s.id",
),
CompatibilityQueryCallSite::new(
"activity task challenge edge read",
"agent_context_read",
"nmem-graph::agent_context_tasks::Q_CHALLENGE_EDGES",
)
.with_cypher(
"MATCH (newer:Memory)-[e:EVOLVES {content_relation: 'challenges'}]->(older:Memory) RETURN newer.id, newer.title, older.id, older.title, e.created_at ORDER BY e.created_at DESC LIMIT 10",
),
CompatibilityQueryCallSite::new(
"activity task decision memory read",
"agent_context_read",
"nmem-graph::agent_context_tasks::Q_DECISION_MEMORIES",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.unit_type = 'decision' RETURN m.id, m.title, m.created_at, m.importance ORDER BY m.created_at DESC LIMIT 20",
),
CompatibilityQueryCallSite::new(
"activity task source attention read",
"agent_context_read",
"nmem-graph::agent_context_tasks::Q_SOURCE_ATTENTION",
)
.with_cypher(
"MATCH (s:Source) WHERE s.lifecycle_state = 'ingested' OR s.lifecycle_state = 'parsed' OR s.lifecycle_state = 'chunked' OR s.lifecycle_state = 'error' RETURN s.id, s.original_name, s.lifecycle_state, s.memory_count, s.created_at ORDER BY s.created_at ASC LIMIT 15",
),
CompatibilityQueryCallSite::new(
"agent context summarized community task read",
"agent_context_read",
"nmem-graph::agent_context_tasks::Q_SUMMARIZED_COMMUNITIES",
)
.with_cypher(
"MATCH (c:Community) WHERE c.ai_summary IS NOT NULL AND c.ai_summary <> '' RETURN c.id, c.name, c.ai_summary, c.member_count ORDER BY c.member_count DESC LIMIT 10",
),
CompatibilityQueryCallSite::new(
"activity task evolves cluster read",
"agent_context_read",
"nmem-graph::agent_context_tasks::Q_EVOLVES_CLUSTERS",
)
.with_cypher(
"MATCH (m:Memory)-[:EVOLVES]-(other:Memory) WHERE (m.is_crystal IS NULL OR m.is_crystal = false) AND (other.is_crystal IS NULL OR other.is_crystal = false) RETURN m.id, m.title, m.unit_type, count(DISTINCT other) as neighbor_count ORDER BY neighbor_count DESC LIMIT 30",
),
CompatibilityQueryCallSite::new(
"memory evolves relation lookup",
"evolves_read",
"nmem-graph::repo::existing_evolves_relation",
)
.with_cypher(
"MATCH (a:Memory)-[r:EVOLVES]->(b:Memory) WHERE a.id = $older_id AND b.id = $newer_id RETURN r.content_relation",
),
CompatibilityQueryCallSite::new(
"activity task compaction evolves read",
"agent_context_read",
"nmem-graph::agent_context_tasks::Q_COMPACTION_EVOLVES",
)
.with_cypher(
"MATCH (a:Memory)-[e:EVOLVES]-(b:Memory) WHERE a.id IN $ids AND b.id IN $ids RETURN a.id, b.id, e.content_relation",
),
CompatibilityQueryCallSite::new(
"memory evolves outgoing context read",
"evolves_read",
"nmem-graph::repo::list_evolves_contexts_for_memories::outgoing",
)
.with_cypher(
"MATCH (a:Memory)-[e:EVOLVES]->(b:Memory) WHERE a.id IN $ids RETURN a.id, b.id, b.title, e.content_relation ORDER BY b.updated_at DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"memory evolves incoming context read",
"evolves_read",
"nmem-graph::repo::list_evolves_contexts_for_memories::incoming",
)
.with_cypher(
"MATCH (a:Memory)-[e:EVOLVES]->(b:Memory) WHERE b.id IN $ids RETURN b.id, a.id, a.title, e.content_relation ORDER BY a.updated_at DESC LIMIT $limit",
),
CompatibilityQueryCallSite::new(
"activity task oldest crystal read",
"agent_context_read",
"nmem-graph::agent_context_tasks::Q_OLDEST_CRYSTALS",
)
.with_cypher(
"MATCH (c:Memory) WHERE c.is_crystal = true RETURN c.id, c.title, c.created_at, c.last_evaluated_at, c.review_status ORDER BY c.created_at ASC LIMIT 10",
),
CompatibilityQueryCallSite::new(
"activity task stale crystal source read",
"agent_context_read",
"nmem-graph::agent_context_tasks::Q_STALE_CRYSTAL_SOURCES",
)
.with_cypher(
"MATCH (c:Memory {is_crystal: true})-[:SYNTHESIZED_FROM]->(src:Memory) MATCH (src)-[:EVOLVES]-(newer:Memory) WHERE newer.created_at > c.created_at AND c.review_status <> 'dismissed' RETURN c.id, c.title, newer.id, newer.title, newer.created_at, c.review_status ORDER BY newer.created_at DESC LIMIT 10",
),
CompatibilityQueryCallSite::new(
"relationship min aggregation",
"schema_verification_read",
"nmem-graph::schema::backfill_synthesized_from",
)
.with_cypher(
"MATCH (:Memory)-[r:SYNTHESIZED_FROM]->(:Memory) RETURN count(*), min(r.weight)",
),
CompatibilityQueryCallSite::new(
"where matched evolves relationship create",
"memory_evolution_write",
"nmem-graph::repo::add_evolves_edge",
)
.with_cypher(
"MATCH (a:Memory), (b:Memory) WHERE a.id = $older_id AND b.id = $newer_id CREATE (a)-[:EVOLVES {content_relation: $content_relation, created_at: timestamp($now)}]->(b)",
),
CompatibilityQueryCallSite::new(
"memory evolves parameterized relationship create",
"memory_evolution_write",
"nmem-graph::repo::add_evolves_edge::create_replacement_relation",
)
.with_cypher(
"MATCH (a:Memory), (b:Memory) WHERE a.id = $older_id AND b.id = $newer_id CREATE (a)-[:EVOLVES { content_relation: $relation, is_progression: $is_progression, confidence: $confidence, detected_by: $detected_by, reviewed: $reviewed, reason: $reason, created_at: timestamp($now) }]->(b)",
),
CompatibilityQueryCallSite::new(
"memory evolves relation update",
"memory_evolution_write",
"nmem-graph::repo::add_evolves_edge::update_existing_relation",
)
.with_cypher(
"MATCH (a:Memory)-[r:EVOLVES]->(b:Memory) WHERE a.id = $older_id AND b.id = $newer_id SET r.content_relation = 'replaces', r.is_progression = true, r.confidence = $confidence, r.detected_by = $detected_by, r.reviewed = $reviewed, r.reason = $reason",
),
CompatibilityQueryCallSite::new(
"memory latest demotion update",
"memory_evolution_write",
"nmem-graph::repo::add_evolves_edge::demote_replaced_memory",
)
.with_cypher(
"MATCH (m:Memory) WHERE m.id = $older_id SET m.is_latest = false",
),
CompatibilityQueryCallSite::new(
"memory latest promotion update",
"memory_evolution_write",
"nmem-graph::repo::add_evolves_edge::promote_replacement_memory",
)
.with_cypher("MATCH (m:Memory) WHERE m.id = $newer_id SET m.is_latest = true"),
CompatibilityQueryCallSite::new(
"memory latest demotion in space update",
"memory_evolution_write",
"nmem-graph::repo::add_evolves_edge_batch::demote_replaced_memory",
)
.with_cypher(
"MATCH (older:Memory {id: $older_id}) WHERE older.space_id = $space_id SET older.is_latest = false",
),
CompatibilityQueryCallSite::new(
"memory label transfer retarget relationship",
"memory_evolution_write",
"nmem-graph::repo::add_evolves_edge::copy_replaced_memory_labels",
)
.with_cypher(
"MATCH (older:Memory {id: $older_id})-[:HAS_LABEL]->(label:Label), (newer:Memory {id: $newer_id}) WHERE older.space_id = $space_id AND newer.space_id = $space_id MERGE (newer)-[edge:HAS_LABEL]->(label) ON CREATE SET edge.assigned_by = 'system', edge.created_at = $created_at, edge.properties = '{}'",
),
CompatibilityQueryCallSite::new(
"distinct relationship aggregation",
"aggregation_read",
"nowledge-memory-core::distinct-summary",
)
.with_cypher(
"MATCH (m:Memory)-[:MENTIONS]->(e:Entity) RETURN count(DISTINCT m) AS memories, count(DISTINCT e.id) AS entities",
),
CompatibilityQueryCallSite::new(
"node property pattern read",
"predicate_read",
"nowledge-memory-core::crystal-source-filter",
)
.with_cypher(
"MATCH (m:Memory {kind: 'note'})-[:MENTIONS]->(e:Entity {name: 'Rust'}) RETURN DISTINCT m.id AS id",
),
CompatibilityQueryCallSite::new(
"undirected evolves read",
"relationship_read",
"nowledge-memory-core::evolves-neighbors",
)
.with_cypher(
"MATCH (m:Memory {id: 3})-[:EVOLVES]-(other:Memory) RETURN DISTINCT other.id AS id",
),
CompatibilityQueryCallSite::new(
"incoming mentions read",
"relationship_read",
"nowledge-memory-core::incoming-mentions",
)
.with_cypher(
"MATCH (e:Entity {community_id: $community_id})<-[:MENTIONS]-(m:Memory) RETURN DISTINCT m.id AS id",
),
CompatibilityQueryCallSite::new(
"untyped relationship label read",
"relationship_read",
"nowledge-memory-core::overview-edges",
)
.with_cypher("MATCH (a)-[r]->(b) RETURN a.id, b.id, label(r)"),
CompatibilityQueryCallSite::new(
"mcp subgraph edge list read",
"mcp_read",
"nmem-server::mcp_server::subgraph_edges",
)
.with_cypher(
"MATCH (a)-[r]->(b) WHERE a.id IN $ids AND b.id IN $ids RETURN a.id, b.id",
),
CompatibilityQueryCallSite::new(
"mcp subgraph node title fallback read",
"mcp_read",
"nmem-server::mcp_server::subgraph_nodes",
)
.with_cypher("MATCH (n) WHERE n.id IN $ids RETURN n.id, COALESCE(n.title, n.name, n.id)"),
CompatibilityQueryCallSite::new(
"multi label overview read",
"relationship_read",
"nowledge-memory-core::graph-overview-neighbors",
)
.with_cypher(
"MATCH (start)-[r]-(neighbor:Entity:Memory) WHERE start.id = $node_id RETURN neighbor.id AS id",
),
CompatibilityQueryCallSite::new(
"projection fallback read",
"projection_read",
"nowledge-memory-core::fallback-labels",
)
.with_cypher(
"MATCH (m:Memory)-[r:MENTIONS]->(e:Entity) RETURN COALESCE(m.title, LEFT(COALESCE(m.content, ''), 60)), COALESCE(r.strength, r.confidence, 0.5)",
),
CompatibilityQueryCallSite::new(
"projection fallback ordering",
"projection_ordering",
"nowledge-memory-core::rank-fallback-order",
)
.with_cypher(
"MATCH (m:Memory) RETURN m.id AS id ORDER BY COALESCE(m.pagerank_score, m.importance, 0.5) DESC",
),
CompatibilityQueryCallSite::new(
"predicate fallback read",
"predicate_read",
"nowledge-memory-core::crystal-filter",
)
.with_cypher(
"MATCH (m:Memory) WHERE COALESCE(m.is_crystal, false) = false RETURN m.id AS id",
),
CompatibilityQueryCallSite::new(
"case insensitive fallback grep",
"predicate_read",
"nowledge-memory-core::kfs-grep",
)
.with_cypher(
"MATCH (m:Memory) WHERE LOWER(COALESCE(m.content, '')) CONTAINS LOWER($needle) OR LOWER(COALESCE(m.title, '')) CONTAINS LOWER($needle) RETURN m.id AS id",
),
CompatibilityQueryCallSite::new(
"unlabeled node mutation",
"node_mutation",
"nowledge-memory-core::community-assignment",
)
.with_cypher("MATCH (n) WHERE n.id = $node_id SET n.community_id = $community_id"),
CompatibilityQueryCallSite::new(
"anonymous relationship count",
"relationship_count",
"nowledge-memory-core::graph-stats",
)
.with_cypher("MATCH (:Memory)-[r:MENTIONS]->(:Entity) RETURN count(r) AS total"),
CompatibilityQueryCallSite::new(
"relationship property read",
"relationship_read",
"nowledge-memory-core::relationship-properties",
)
.with_cypher(
"MATCH (m:Memory)-[r:MENTIONS {weight: 4}]->(e:Entity) RETURN e.name AS entity, r.weight AS weight",
),
CompatibilityQueryCallSite::new(
"relationship property mutation",
"relationship_mutation",
"nowledge-memory-core::relationship-property-set",
)
.with_cypher(
"MATCH (m:Memory)-[r:MENTIONS {weight: 3}]->(e:Entity) WHERE m.id = 1 AND r.weight = 3 SET r.weight = 7",
),
CompatibilityQueryCallSite::new(
"cypher projected graph definition",
"projected_graph_definition",
"nowledge-memory-core::projection",
)
.with_cypher(
"CALL project_graph('MemoryMentions', ['Memory', 'Entity'], ['MENTIONS'])",
),
CompatibilityQueryCallSite::new(
"unified projected graph map definition",
"projected_graph_definition",
"nmem-graph::pagerank::run_pagerank_unified",
)
.with_cypher(
"CALL PROJECT_GRAPH('UnifiedGraph', ['Entity', 'Memory'], { 'RELATES_TO': '', 'MENTIONS': '', 'MEMORY_RELATES_TO': \"r.status = 'active'\" })",
),
CompatibilityQueryCallSite::new(
"page rank procedure",
"graph_algorithm",
"nowledge-memory-core::pagerank",
)
.with_cypher(
"CALL page_rank('MemoryMentions', dampingFactor := 0.85, maxIterations := 20)",
),
CompatibilityQueryCallSite::new(
"unified page rank procedure",
"graph_algorithm",
"nmem-graph::pagerank::run_pagerank_unified",
)
.with_cypher(
"CALL page_rank('UnifiedGraph', dampingFactor := 0.85, maxIterations := 20, tolerance := 0.0000001, normalizeInitial := true) RETURN node, rank",
),
CompatibilityQueryCallSite::new(
"hierarchical louvain procedure",
"graph_algorithm",
"nowledge-memory-core::louvain",
)
.with_cypher("CALL louvain('MemoryMentions', maxLevels := 2)"),
CompatibilityQueryCallSite::new(
"mentions projection",
"projected_graph_shadow",
"nowledge-memory-core::projected-graph-shadow",
),
],
)
.expect("built-in Nowledge core compatibility inventory is valid")
}
fn compatibility_row(items: impl IntoIterator<Item = (&'static str, Value)>) -> Row {
items
.into_iter()
.map(|(key, value)| (key.to_string(), value))
.collect()
}