Initial commit: Agentic OS troubleshooting platform
Self-hosted, Docker-based agentic troubleshooting platform: FastAPI backend + LangGraph agent, Next.js UI, tiered LLM routing (local Ollama -> Gemini -> DeepSeek -> OpenRouter), MCP server manager, encrypted device credentials, RBAC, audit log, project-memory + Obsidian integrations, and editable troubleshooting decision rules tuned for the GeneseasX vessel stack. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
45
backend/tests/test_investigation_context.py
Normal file
45
backend/tests/test_investigation_context.py
Normal file
@@ -0,0 +1,45 @@
|
||||
"""Tests for investigation context gathering."""
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
os.environ.setdefault("SECRET_KEY", "test-secret-key-for-unit-tests-only")
|
||||
|
||||
from app.services.investigation_context import ( # noqa: E402
|
||||
_score_obsidian_file,
|
||||
extract_search_keywords,
|
||||
_obsidian_title,
|
||||
)
|
||||
|
||||
|
||||
def test_extract_search_keywords_from_issue():
|
||||
terms = extract_search_keywords("Asterisk health status on GeneseasX voip container")
|
||||
assert "asterisk" in terms
|
||||
assert "geneseasx" in terms
|
||||
assert "voip" in terms
|
||||
assert "health" not in terms # stopword
|
||||
|
||||
|
||||
def test_obsidian_title_from_markdown():
|
||||
text = "# Asterisk health status\n\nSome body"
|
||||
assert _obsidian_title(text, "2026-06-13-asterisk.md") == "Asterisk health status"
|
||||
|
||||
|
||||
def test_memory_vessel_from_tags():
|
||||
from app.services.investigation_context import _memory_vessel_from_hit, _obsidian_vessel_from_text
|
||||
|
||||
hit = {"tags": ["agentic-os", "vessel:geneseasx-test"], "content": "", "title": "[Task] foo"}
|
||||
assert _memory_vessel_from_hit(hit) == "geneseasx test"
|
||||
|
||||
text = "---\ntags: [agentic-os]\nvessel: test\nstatus: unresolved\n---\n# Title"
|
||||
assert _obsidian_vessel_from_text(text) == "test"
|
||||
|
||||
|
||||
def test_score_obsidian_file_matches_keywords():
|
||||
score = _score_obsidian_file(
|
||||
"/vault/agentic-os-tasks/2026-06-13-asterisk-health.md",
|
||||
"Asterisk pjsip registration failed on voip container",
|
||||
["asterisk", "voip"],
|
||||
)
|
||||
assert score >= 3
|
||||
Reference in New Issue
Block a user