Architecture: - Graph engine (engine.py) loads graph definitions, instantiates nodes - Versioned nodes: input_v1, thinker_v1, output_v1, memorizer_v1, director_v1 - NODE_REGISTRY for dynamic node lookup by name - Graph API: /api/graph/active, /api/graph/list, /api/graph/switch - Graph definition: graphs/v1_current.py (7 nodes, 13 edges, 3 edge types) S3* Audit system: - Workspace mismatch detection (server vs browser controls) - Code-without-tools retry (Thinker wrote code but no tool calls) - Intent-without-action retry (request intent but Thinker only produced text) - Dashboard feedback: browser sends workspace state on every message - Sensor continuous comparison on 5s tick State machines: - create_machine / add_state / reset_machine / destroy_machine via function calling - Local transitions (go:) resolve without LLM round-trip - Button persistence across turns Database tools: - query_db tool via pymysql to MariaDB K3s pod (eras2_production) - Table rendering in workspace (tab-separated parsing) - Director pre-planning with Opus for complex data requests - Error retry with corrected SQL Frontend: - Cytoscape.js pipeline graph with real-time node animations - Overlay scrollbars (CSS-only, no reflow) - Tool call/result trace events - S3* audit events in trace Testing: - 167 integration tests (11 test suites) - 22 node-level unit tests (test_nodes/) - Three test levels: node unit, graph integration, scenario Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
68 lines
2.7 KiB
Python
68 lines
2.7 KiB
Python
"""Run all node-level unit tests."""
|
|
|
|
import sys
|
|
import time
|
|
from pathlib import Path
|
|
|
|
# Ensure we can import from parent
|
|
sys.path.insert(0, str(Path(__file__).parent.parent))
|
|
sys.path.insert(0, str(Path(__file__).parent))
|
|
|
|
from harness import NodeTestRunner
|
|
|
|
# Import all test modules
|
|
import test_input_v1
|
|
import test_thinker_v1
|
|
import test_memorizer_v1
|
|
import test_director_v1
|
|
|
|
runner = NodeTestRunner()
|
|
t0 = time.time()
|
|
|
|
print("\n" + "=" * 60)
|
|
print(" Node-Level Unit Tests")
|
|
print("=" * 60)
|
|
|
|
# Input v1
|
|
print("\n--- InputNode v1 ---")
|
|
runner.test("greeting is social+trivial", test_input_v1.test_greeting_is_social_trivial())
|
|
runner.test("german detected", test_input_v1.test_german_detected())
|
|
runner.test("request classified", test_input_v1.test_request_classified())
|
|
runner.test("frustrated tone", test_input_v1.test_frustrated_tone())
|
|
runner.test("emits perceived HUD", test_input_v1.test_emits_perceived_hud())
|
|
runner.test("source text preserved", test_input_v1.test_source_text_preserved())
|
|
|
|
# Thinker v1
|
|
print("\n--- ThinkerNode v1 ---")
|
|
runner.test("simple response", test_thinker_v1.test_simple_response())
|
|
runner.test("no code in response", test_thinker_v1.test_no_code_in_response())
|
|
runner.test("emits tool calls for buttons", test_thinker_v1.test_emits_tool_calls_for_buttons())
|
|
runner.test("query_db called for DB question", test_thinker_v1.test_query_db_called())
|
|
runner.test("S3* audit mechanism", test_thinker_v1.test_s3_audit_code_without_tools())
|
|
runner.test("decided HUD emitted", test_thinker_v1.test_decided_hud_emitted())
|
|
|
|
# Memorizer v1
|
|
print("\n--- MemorizerNode v1 ---")
|
|
runner.test("extracts mood", test_memorizer_v1.test_extracts_mood())
|
|
runner.test("extracts language", test_memorizer_v1.test_extracts_language())
|
|
runner.test("facts preserved across updates", test_memorizer_v1.test_facts_preserved_across_updates())
|
|
runner.test("topic tracked", test_memorizer_v1.test_topic_tracked())
|
|
runner.test("emits updated HUD", test_memorizer_v1.test_emits_updated_hud())
|
|
|
|
# Director v1
|
|
print("\n--- DirectorNode v1 ---")
|
|
runner.test("detects casual mode", test_director_v1.test_detects_casual_mode())
|
|
runner.test("detects frustrated style", test_director_v1.test_detects_frustrated_style())
|
|
runner.test("produces plan for complex request", test_director_v1.test_produces_plan_for_complex_request())
|
|
runner.test("directive has required fields", test_director_v1.test_directive_has_required_fields())
|
|
runner.test("context line includes plan", test_director_v1.test_context_line_includes_plan())
|
|
|
|
# Summary
|
|
elapsed = time.time() - t0
|
|
p, f = runner.summary()
|
|
print(f"\n{'=' * 60}")
|
|
print(f" TOTAL: {p} passed, {f} failed ({elapsed:.1f}s)")
|
|
print(f"{'=' * 60}")
|
|
|
|
sys.exit(0 if f == 0 else 1)
|