fix: update remaining tests and session_to_tree for title field rename

- test_tree_validation.py: replace "action"/"solution" content fields with "title"
- test_procedural_flows.py: update solution node fixtures to use "title"
- test_save_session_as_tree.py: update fixtures and assertions for "title" field
- session_to_tree.py: generate "title" instead of "action"/"solution" on converted nodes;
  fall back to legacy field names when reading from old tree snapshots for compatibility

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-02-22 23:55:37 -05:00
parent 5acf94b6c2
commit 8475f780d1
4 changed files with 47 additions and 47 deletions

View File

@@ -20,7 +20,7 @@ class TestSessionToTreeConversion:
"""Test converting a session with no path."""
tree_structure = convert_session_to_tree([], {}, [], [])
assert tree_structure["type"] == "solution"
assert "no recorded path" in tree_structure["solution"].lower()
assert "no recorded path" in tree_structure["title"].lower()
def test_convert_simple_linear_path(self):
"""Test converting a simple linear path."""
@@ -29,8 +29,8 @@ class TestSessionToTreeConversion:
"type": "decision",
"question": "Is it working?",
"children": [
{"id": "yes", "type": "solution", "solution": "Great!"},
{"id": "no", "type": "action", "action": "Fix it"}
{"id": "yes", "type": "solution", "title": "Great!"},
{"id": "no", "type": "action", "title": "Fix it"}
]
}
path_taken = ["root", "no"]
@@ -51,7 +51,7 @@ class TestSessionToTreeConversion:
tree_snapshot = {
"id": "root",
"type": "solution",
"solution": "Done"
"title": "Done"
}
custom_step_id = "custom-123"
path_taken = ["root", custom_step_id]
@@ -70,7 +70,7 @@ class TestSessionToTreeConversion:
assert len(result["children"]) == 1
custom_node = result["children"][0]
assert custom_node["type"] == "action"
assert "Custom troubleshooting step" in custom_node["action"]
assert "Custom troubleshooting step" in custom_node["title"]
def test_find_node_in_tree(self):
"""Test finding a node in nested tree structure."""
@@ -142,7 +142,7 @@ class TestSaveSessionAsTreeAPI:
tree = Tree(
name="Test Tree",
description="Test",
tree_structure={"id": "root", "type": "solution", "solution": "Fix"},
tree_structure={"id": "root", "type": "solution", "title": "Fix"},
author_id=UUID(test_user["user_data"]["id"]),
account_id=UUID(test_user["user_data"]["account_id"]),
status='published'
@@ -187,7 +187,7 @@ class TestSaveSessionAsTreeAPI:
tree = Tree(
name="Original Tree",
tree_structure={"id": "root", "type": "solution", "solution": "Fix"},
tree_structure={"id": "root", "type": "solution", "title": "Fix"},
author_id=UUID(test_user["user_data"]["id"]),
account_id=UUID(test_user["user_data"]["account_id"]),
status='published'
@@ -227,7 +227,7 @@ class TestSaveSessionAsTreeAPI:
# Create a simple tree with just a solution (will convert to valid linear tree)
tree = Tree(
name="Test Tree",
tree_structure={"id": "root", "type": "solution", "solution": "Fixed"},
tree_structure={"id": "root", "type": "solution", "title": "Fixed"},
author_id=UUID(test_user["user_data"]["id"]),
account_id=UUID(test_user["user_data"]["account_id"]),
status='published'
@@ -267,7 +267,7 @@ class TestSaveSessionAsTreeAPI:
tree = Tree(
name="Original Tree",
tree_structure={"id": "root", "type": "solution", "solution": "Fix"},
tree_structure={"id": "root", "type": "solution", "title": "Fix"},
author_id=UUID(test_user["user_data"]["id"]),
account_id=UUID(test_user["user_data"]["account_id"]),
status='published'
@@ -326,7 +326,7 @@ class TestSaveSessionAsTreeAPI:
# Create a tree
tree = Tree(
name="Test Tree",
tree_structure={"id": "root", "type": "solution", "solution": "Fix"},
tree_structure={"id": "root", "type": "solution", "title": "Fix"},
author_id=UUID(test_user["user_data"]["id"]),
account_id=UUID(test_user["user_data"]["account_id"]),
status='published'