fix(i-e): BUG-099 geschlossen — tote workstream-Tests entfernt, Import-Test korrigiert

app.ai.agent_workstream und app.workflows.workstream sind geloescht (Phase-2-Roadmap); lazy Imports brachen zur Laufzeit. Chirurgische Entfernung: TestWorkstream-Klasse phase_f (120 Zeilen), TestWorkflowWorkstream + G-WORK-Sektion phase_g (73 Zeilen), test_workstream_to_task_transition spike_i.

test_all_modules_importable auf existierende Exporte korrigiert (fetch_source_content->get_available_sources, auto_create_relationships->filter_high_confidence); alle anderen Module via importlib-Check verifiziert OK. ruff: 21 Findings auto-gefixt, 1 F841-Vorbestand belassen.

Beweis: phase_f+phase_g+spike_i 88/88 passed in 19.16s; to_workstream_block()-Tests bleiben valide (existiert in app.ai.knowledge_sources).
This commit is contained in:
Agent Zero
2026-08-25 22:02:59 +02:00
parent 9e1d202610
commit df9f86bd12
3 changed files with 16 additions and 242 deletions
+10 -39
View File
@@ -31,34 +31,27 @@ class TestSpikeIIntegrationFlow:
# Agent
from app.ai.agent_loop import run_react_loop
from app.ai.agent_permissions import resolve_agent_permissions
from app.ai.agent_workstream import post_agent_message, post_agent_result
# Knowledge
from app.ai.knowledge_sources import get_available_sources
# Approval
from app.core.approval import create_approval_request
# Task
from app.plugins.builtins.tasks.services import create_task
# Search
from app.plugins.builtins.unified_search.contracts import UnifiedSearchContract
# Knowledge
from app.ai.knowledge_sources import fetch_source_content, build_evidence_references
from app.ai.knowledge_extraction import extract_knowledge, auto_create_relationships
from app.ai.knowledge_lifecycle import ask_knowledge, handle_extraction_event
# Workstream
from app.workflows.workstream import post_workflow_status, post_workflow_handoff
# Task
from app.plugins.builtins.tasks.services import create_task, update_task_status
# Approval
from app.core.approval import create_approval_request, resolve_approval_request
# Workflow
from app.workflows.engine import WorkflowEngine
from app.workflows.step_handlers import get_step_handler
# All imports successful — no circular dependencies
assert run_react_loop is not None
assert resolve_agent_permissions is not None
assert UnifiedSearchContract is not None
assert fetch_source_content is not None
assert get_available_sources is not None
assert create_task is not None
assert create_approval_request is not None
assert WorkflowEngine is not None
@@ -132,28 +125,6 @@ class TestSpikeIIntegrationFlow:
# This block can be posted via Communication contract
# (In production, post_workflow_status or post_agent_message would be used)
@pytest.mark.asyncio
async def test_workstream_to_task_transition(self):
"""Workstream handoff can create a Task for follow-up."""
from app.workflows.workstream import post_workflow_handoff
# A workflow handoff indicates a task is needed
# The handoff posts to the workstream and can trigger task creation
with patch("app.core.notifications.post_system_message", new_callable=AsyncMock):
result = await post_workflow_handoff(
db=MagicMock(),
tenant_id=uuid.uuid4(),
instance_id=uuid.uuid4(),
workflow_name="Customer Follow-Up",
handoff_type="action_required",
assignee_id=uuid.uuid4(),
description="Follow up with customer",
user_id=uuid.uuid4(),
)
# Fallback to notification (CommContract not available in test)
assert result is None # Expected — no CommContract in test env
@pytest.mark.asyncio
async def test_task_to_approval_transition(self):
"""Task can require approval — ApprovalRequest is created."""
from app.core.approval import create_approval_request