def test_bot_flow_uses_goal_decomposer_not_abstract_goals():
    """
    Test that bot_flow.py uses GoalDecomposer for task-based navigation
    instead of the abstract goals string system.

    The old system passed abstract strings like "Nurture my community"
    to GoalExecutor.achieve() — which caused endless scrolling because
    the LLM had no semantic bridge to concrete plugin actions.

    The new system:
    1. GoalDecomposer reads mission + plugins → generates concrete Tasks
    2. GrowthBrain.select_task() picks a Task with weighted random
    3. The Task's target_screen routes through nav_graph to feed loops
    """
    with open("GramAddict/core/bot_flow.py", "r") as f:
        content = f.read()

    # New system MUST be present
    assert "GoalDecomposer" in content, "bot_flow.py must use GoalDecomposer"
    assert "select_task" in content, "bot_flow.py must use GrowthBrain.select_task()"
    assert "available_tasks" in content, "bot_flow.py must generate available_tasks"

    # Old abstract goals path MUST be gone
    assert "goal_executor.achieve(current_goal)" not in content, (
        "bot_flow.py still uses old abstract goal_executor.achieve()! "
        "This causes endless scrolling."
    )
    assert 'getattr(configs.args, "goals"' not in content, (
        "bot_flow.py still reads abstract goals from config!"
    )
