============================= test session starts ==============================
platform darwin -- Python 3.9.6, pytest-8.3.5, pluggy-1.5.0
rootdir: /Volumes/Alpha SSD/Coding/bot
configfile: pyproject.toml
plugins: asyncio-0.23.5, cov-7.1.0, anyio-3.7.1, mock-3.14.0, xdist-3.6.1
asyncio: mode=strict
collected 152 items

tests/anomalies/test_bot_flow_edge_cases.py ...                          [  1%]
tests/anomalies/test_cognitive_edge_cases.py ...                         [  3%]
tests/anomalies/test_fsd_recovery.py F                                   [  4%]
tests/anomalies/test_hardware_anomalies.py EEEE.                         [  7%]
tests/anomalies/test_hardware_edge_cases.py ..                           [  9%]
tests/anomalies/test_human_hesitation.py ..                              [ 10%]
tests/anomalies/test_llm_hallucination_recovery.py ..                    [ 11%]
tests/anomalies/test_nav_failure_tdd.py .                                [ 12%]
tests/anomalies/test_nav_graph_edge_cases.py ...                         [ 14%]
tests/anomalies/test_xml_dumps_fuzz.py s                                 [ 15%]
tests/integration/test_ad_detection.py FFF                               [ 17%]
tests/integration/test_bot_flow_interaction.py ..........F..             [ 25%]
tests/integration/test_bot_flow_start.py F                               [ 26%]
tests/integration/test_cognitive_integration.py FF.F                     [ 28%]
tests/integration/test_cognitive_stack_audit.py .......                  [ 33%]
tests/integration/test_darwin_engine.py ....                             [ 36%]
tests/integration/test_deep_engagement.py s..                            [ 38%]
tests/integration/test_device_facade_full.py ...........                 [ 45%]
tests/integration/test_dm_loop.py ..                                     [ 46%]
tests/integration/test_false_positive.py F                               [ 47%]
tests/integration/test_llm_provider_full.py .......                      [ 51%]
tests/integration/test_q_nav_graph.py ...                                [ 53%]
tests/integration/test_qdrant_memory_full.py ............                [ 61%]
tests/integration/test_resonance_engine.py .......                       [ 66%]
tests/integration/test_scenarios_fsd.py EE                               [ 67%]
tests/integration/test_swarm_protocol.py F...                            [ 70%]
tests/integration/test_telepathic_edge_cases.py ......                   [ 74%]
tests/integration/test_telepathic_engine_extraction.py FFFFFEEFFFFFF     [ 82%]
tests/integration/test_telepathic_engine_vlm.py ......................   [ 97%]
tests/integration/test_telepathic_keyword.py .                           [ 98%]
tests/integration/test_unfollow_loop.py ...                              [100%]

==================================== ERRORS ====================================
______________ ERROR at setup of test_slow_loading_post_recovery _______________

    @pytest.fixture
    def test_dumps():
        dumps = {}
>       with open(DUMPS["organic"], "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/tests/fixtures/organic_post.xml'

tests/anomalies/test_hardware_anomalies.py:39: FileNotFoundError
____________ ERROR at setup of test_wait_timeout_aborts_gracefully _____________

    @pytest.fixture
    def test_dumps():
        dumps = {}
>       with open(DUMPS["organic"], "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/tests/fixtures/organic_post.xml'

tests/anomalies/test_hardware_anomalies.py:39: FileNotFoundError
____________ ERROR at setup of test_empty_content_extraction_guard _____________

    @pytest.fixture
    def test_dumps():
        dumps = {}
>       with open(DUMPS["organic"], "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/tests/fixtures/organic_post.xml'

tests/anomalies/test_hardware_anomalies.py:39: FileNotFoundError
______________ ERROR at setup of test_missing_feed_markers_guard _______________

    @pytest.fixture
    def test_dumps():
        dumps = {}
>       with open(DUMPS["organic"], "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/tests/fixtures/organic_post.xml'

tests/anomalies/test_hardware_anomalies.py:39: FileNotFoundError
____________ ERROR at setup of test_full_mission_autopilot_sequence ____________

    @pytest.fixture
    def fsd_fixtures():
        def _load(name):
            with open(os.path.join(FIX_DIR, name), "r") as f:
                return f.read()
        return {
>           "organic": _load("organic_post.xml"),
            "ad": _load("sponsored_reel.xml"),
            "modal": _load("survey_modal.xml")
        }

tests/integration/test_scenarios_fsd.py:64: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'organic_post.xml'

    def _load(name):
>       with open(os.path.join(FIX_DIR, name), "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/tests/fixtures/organic_post.xml'

tests/integration/test_scenarios_fsd.py:61: FileNotFoundError
_________________ ERROR at setup of test_feed_loop_chaos_mode __________________

    @pytest.fixture
    def fsd_fixtures():
        def _load(name):
            with open(os.path.join(FIX_DIR, name), "r") as f:
                return f.read()
        return {
>           "organic": _load("organic_post.xml"),
            "ad": _load("sponsored_reel.xml"),
            "modal": _load("survey_modal.xml")
        }

tests/integration/test_scenarios_fsd.py:64: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'organic_post.xml'

    def _load(name):
>       with open(os.path.join(FIX_DIR, name), "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/tests/fixtures/organic_post.xml'

tests/integration/test_scenarios_fsd.py:61: FileNotFoundError
_ ERROR at setup of TestSafetyGuard.test_real_explore_fullscreen_container_rejected _

self = <test_telepathic_engine_extraction.TestSafetyGuard object at 0x108e59eb0>

    @pytest.fixture(autouse=True)
    def setup_real_nodes(self):
        """Pre-parse real XML nodes BEFORE any mocking happens."""
        engine = TelepathicEngine()
>       explore_xml = load_fixture("explore_feed.xml")

tests/integration/test_telepathic_engine_extraction.py:140: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'explore_feed.xml'

    def load_fixture(name: str) -> str:
        """Load a real XML capture from tests/mock_data/"""
        path = os.path.join(FIXTURE_DIR, name)
>       with open(path, "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/integration/mock_data/explore_feed.xml'

tests/integration/test_telepathic_engine_extraction.py:27: FileNotFoundError
------------------------------ Captured log setup ------------------------------
WARNING  GramAddict.core.qdrant_memory:qdrant_memory.py:35 Qdrant dimension mismatch for 'telepathic_engine_cache': collection has <MagicMock name='mock.QdrantClient().get_collection().config.params.vectors.size' id='4446345248'>, expected 768. Recreating collection...
___ ERROR at setup of TestSafetyGuard.test_real_explore_like_button_accepted ___

self = <test_telepathic_engine_extraction.TestSafetyGuard object at 0x108e6c100>

    @pytest.fixture(autouse=True)
    def setup_real_nodes(self):
        """Pre-parse real XML nodes BEFORE any mocking happens."""
        engine = TelepathicEngine()
>       explore_xml = load_fixture("explore_feed.xml")

tests/integration/test_telepathic_engine_extraction.py:140: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'explore_feed.xml'

    def load_fixture(name: str) -> str:
        """Load a real XML capture from tests/mock_data/"""
        path = os.path.join(FIXTURE_DIR, name)
>       with open(path, "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/integration/mock_data/explore_feed.xml'

tests/integration/test_telepathic_engine_extraction.py:27: FileNotFoundError
------------------------------ Captured log setup ------------------------------
WARNING  GramAddict.core.qdrant_memory:qdrant_memory.py:35 Qdrant dimension mismatch for 'telepathic_engine_cache': collection has <MagicMock name='mock.QdrantClient().get_collection().config.params.vectors.size' id='4446345248'>, expected 768. Recreating collection...
=================================== FAILURES ===================================
___________________ test_fsd_handles_persistent_survey_modal ___________________

    def test_fsd_handles_persistent_survey_modal():
        """
        Simulates a case where the bot gets stuck on a survey modal.
        The FSD (Full Self Driving) anomaly handler should trigger,
        detect that 'Back' didn't work, and engage TelepathicEngine
        to find and tap the 'Not Now' or 'Dismiss' button.
        """
        from GramAddict.core.bot_flow import _run_zero_latency_feed_loop
        from GramAddict.core.telepathic_engine import TelepathicEngine
    
        device = MagicMock()
        device.app_id = "com.instagram.android"
        device._get_current_app.return_value = "com.instagram.android"
        configs = ConfigMock()
    
        # Mock the TelepathicEngine singleton behavior entirely
        mock_telepathic = MagicMock()
        mock_telepathic.find_best_node.return_value = {"x": 500, "y": 1400, "semantic": "Not Now"}
        mock_telepathic._extract_semantic_nodes.return_value = [{"x": 10}]
    
        dopamine = MagicMock()
        dopamine.is_app_session_over.side_effect = [False, False, True] # Run twice, then exit
        dopamine.wants_to_change_feed.return_value = False
        dopamine.wants_to_doomscroll.return_value = False
    
        ai = MagicMock()
        ai.get_sleep_modifier.return_value = 1.0
        cognitive_stack = {"dopamine": dopamine, "growth_brain": None, "active_inference": ai, "telepathic": mock_telepathic}
    
        # Load the mock survey modal UI
        xml_path = os.path.join(FIXTURE_DIR, "survey_modal.xml")
>       with open(xml_path, "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/tests/fixtures/survey_modal.xml'

tests/anomalies/test_fsd_recovery.py:46: FileNotFoundError
________________ test_real_sponsored_reel_flexcode_is_detected _________________

    def test_real_sponsored_reel_flexcode_is_detected():
        """
        Test: The manual_interrupt dump is a sponsored Reel (flexcode_systems).
        _detect_ad_structural MUST return True.
        """
        xml_path = os.path.join(FIX_DIR, "sponsored_reel.xml")
>       with open(xml_path, "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/tests/fixtures/sponsored_reel.xml'

tests/integration/test_ad_detection.py:13: FileNotFoundError
___________________________ test_normal_post_not_ad ____________________________

    def test_normal_post_not_ad():
        """
        Test: The manual_interrupt dump is a normal post.
        _detect_ad_structural MUST return False to avoid false positives.
        """
        xml_path = os.path.join(FIX_DIR, "organic_post.xml")
>       with open(xml_path, "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/tests/fixtures/organic_post.xml'

tests/integration/test_ad_detection.py:24: FileNotFoundError
_____________________ test_peugeot_carousel_ad_is_detected _____________________

    def test_peugeot_carousel_ad_is_detected():
        """
        Test: The 'peugeot.deutschland' carousel ad from manual_interrupt dump.
        _detect_ad_structural MUST return True.
        """
        xml_path = os.path.join(FIX_DIR, "peugeot_ad.xml")
>       with open(xml_path, "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/tests/fixtures/peugeot_ad.xml'

tests/integration/test_ad_detection.py:36: FileNotFoundError
___________________________ test_start_bot_interrupt ___________________________

    def test_start_bot_interrupt():
        from GramAddict.core.bot_flow import start_bot
    
        # Mock all the heavy initialization
        with patch('GramAddict.core.bot_flow.Config') as MockConfig, \
             patch('GramAddict.core.bot_flow.configure_logger'), \
             patch('GramAddict.core.bot_flow.check_if_updated'), \
             patch('GramAddict.core.benchmark_guard.check_model_benchmarks'), \
             patch('GramAddict.core.llm_provider.log_openrouter_burn'), \
             patch('GramAddict.core.bot_flow.create_device') as mock_create_device, \
             patch('GramAddict.core.bot_flow.set_time_delta') as mock_time_delta, \
             patch('GramAddict.core.bot_flow.SessionState') as MockSession, \
             patch('GramAddict.core.bot_flow.open_instagram', side_effect=KeyboardInterrupt()), \
             patch('GramAddict.core.bot_flow.dump_ui_state') as mock_dump:
    
            MockConfig.return_value.args.feed = True
            MockConfig.return_value.args.explore = False
            MockConfig.return_value.args.reels = False
            MockConfig.return_value.args.stories = False
            MockConfig.return_value.args.working_hours = [10, 20]
            MockConfig.return_value.args.time_delta_session = 30
    
            MockSession.inside_working_hours.return_value = (True, 0)
    
            with pytest.raises(KeyboardInterrupt):
>               start_bot(username="test", device_id="123")
E               Failed: DID NOT RAISE <class 'KeyboardInterrupt'>

tests/integration/test_bot_flow_interaction.py:190: Failed
----------------------------- Captured stdout call -----------------------------

==================================================
🤖 MANUAL E2E DUMP CAPTURE SEQUENCE
==================================================
Please follow the instructions below to capture the required fixtures.
If an IG update changed the layout, you can navigate there naturally.
==================================================


👉 1. COMMENT SHEET:
Open Instagram, scroll to any post on the HomeFeed, and open the comment section.
When the comment sheet is fully visible, press ENTER to capture...
------------------------------ Captured log call -------------------------------
ERROR    GramAddict.core.dump_capturer:dump_capturer.py:105 💥 Capture Sequence crashed: pytest: reading from stdin while output is captured!  Consider using `-s`.
Traceback (most recent call last):
  File "/Volumes/Alpha SSD/Coding/bot/GramAddict/core/dump_capturer.py", line 43, in capture_all
    input("\n👉 1. COMMENT SHEET:\nOpen Instagram, scroll to any post on the HomeFeed, and open the comment section.\nWhen the comment sheet is fully visible, press ENTER to capture...")
  File "/Users/marcmintel/Library/Python/3.9/lib/python/site-packages/_pytest/capture.py", line 227, in read
    raise OSError(
OSError: pytest: reading from stdin while output is captured!  Consider using `-s`.
__________________________ test_start_bot_normal_flow __________________________

MockConfig = <MagicMock name='Config' id='4457320064'>
mock_logger = <MagicMock name='configure_logger' id='4458406768'>
mock_update = <MagicMock name='check_if_updated' id='4458427008'>
mock_benchmark = <MagicMock name='check_model_benchmarks' id='4458439056'>
mock_burn = <MagicMock name='log_openrouter_burn' id='4458455248'>
mock_create_device = <MagicMock name='create_device' id='4458463184'>
mock_time_delta = <MagicMock name='set_time_delta' id='4458479376'>
MockSession = <MagicMock name='SessionState' id='4458491472'>
mock_open_ig = <MagicMock name='open_instagram' id='4458511760'>
mock_ig_version = <MagicMock name='get_instagram_version' id='4458523808'>
mock_close_ig = <MagicMock name='close_instagram' id='4458535808'>
mock_sleep = <MagicMock name='random_sleep' id='4458552144'>
mock_dump = <MagicMock name='dump_ui_state' id='4458568336'>
mock_telepathic = <MagicMock name='TelepathicEngine' id='4458588624'>
mock_nav = <MagicMock name='QNavGraph' id='4458604816'>
mock_zero = <MagicMock name='ZeroLatencyEngine' id='4458621008'>
mock_dopamine_class = <MagicMock name='DopamineEngine' id='4458637200'>
mock_resonance = <MagicMock name='ResonanceEngine' id='4458653392'>
mock_growth = <MagicMock name='GrowthBrain' id='4458669584'>
mock_crm = <MagicMock name='ParasocialCRMDB' id='4458681680'>
mock_radome = <MagicMock name='HoneypotRadome' id='4458693776'>
mock_dojo = <MagicMock name='DojoEngine' id='4458709968'>
mock_run_feed = <MagicMock name='_run_zero_latency_feed_loop' id='4458726160'>

    @patch('GramAddict.core.bot_flow._run_zero_latency_feed_loop', return_value="SESSION_OVER")
    @patch('GramAddict.core.bot_flow.DojoEngine')
    @patch('GramAddict.core.bot_flow.HoneypotRadome')
    @patch('GramAddict.core.bot_flow.ParasocialCRMDB')
    @patch('GramAddict.core.bot_flow.GrowthBrain')
    @patch('GramAddict.core.bot_flow.ResonanceEngine')
    @patch('GramAddict.core.bot_flow.DopamineEngine')
    @patch('GramAddict.core.bot_flow.ZeroLatencyEngine')
    @patch('GramAddict.core.bot_flow.QNavGraph')
    @patch('GramAddict.core.bot_flow.TelepathicEngine')
    @patch('GramAddict.core.bot_flow.dump_ui_state')
    @patch('GramAddict.core.bot_flow.random_sleep')
    @patch('GramAddict.core.bot_flow.close_instagram')
    @patch('GramAddict.core.bot_flow.get_instagram_version', return_value="1.0")
    @patch('GramAddict.core.bot_flow.open_instagram', return_value=True)
    @patch('GramAddict.core.bot_flow.SessionState')
    @patch('GramAddict.core.bot_flow.set_time_delta')
    @patch('GramAddict.core.bot_flow.create_device')
    @patch('GramAddict.core.llm_provider.log_openrouter_burn')
    @patch('GramAddict.core.benchmark_guard.check_model_benchmarks')
    @patch('GramAddict.core.bot_flow.check_if_updated')
    @patch('GramAddict.core.bot_flow.configure_logger')
    @patch('GramAddict.core.bot_flow.Config')
    def test_start_bot_normal_flow(MockConfig, mock_logger, mock_update, mock_benchmark, mock_burn,
                                   mock_create_device, mock_time_delta, MockSession, mock_open_ig, mock_ig_version,
                                   mock_close_ig, mock_sleep, mock_dump, mock_telepathic, mock_nav, mock_zero,
                                   mock_dopamine_class, mock_resonance, mock_growth, mock_crm, mock_radome, mock_dojo, mock_run_feed):
    
        MockConfig.return_value.args.feed = True
        MockConfig.return_value.args.explore = False
        MockConfig.return_value.args.reels = True
        MockConfig.return_value.args.stories = False
        MockConfig.return_value.args.working_hours = [10, 20]
        MockConfig.return_value.args.time_delta_session = 30
    
        MockSession.inside_working_hours.return_value = (True, 0)
    
        # Simulate dopamine session over after one loop
        mock_dopamine = mock_dopamine_class.return_value
        mock_dopamine.is_app_session_over.side_effect = [False, True]
        mock_dopamine.boredom = 10.0
    
        # We need to intentionally throw an exception to break the "while True" loop
        MockSession.side_effect = [MagicMock(), Exception("Break infinite loop")]
    
        try:
            start_bot(username="test", device_id="123")
        except Exception as e:
            if str(e) != "Break infinite loop":
                raise e
    
>       assert mock_run_feed.called
E       AssertionError: assert False
E        +  where False = <MagicMock name='_run_zero_latency_feed_loop' id='4458726160'>.called

tests/integration/test_bot_flow_start.py:56: AssertionError
----------------------------- Captured stdout call -----------------------------

==================================================
🤖 MANUAL E2E DUMP CAPTURE SEQUENCE
==================================================
Please follow the instructions below to capture the required fixtures.
If an IG update changed the layout, you can navigate there naturally.
==================================================


👉 1. COMMENT SHEET:
Open Instagram, scroll to any post on the HomeFeed, and open the comment section.
When the comment sheet is fully visible, press ENTER to capture...
------------------------------ Captured log call -------------------------------
ERROR    GramAddict.core.dump_capturer:dump_capturer.py:105 💥 Capture Sequence crashed: pytest: reading from stdin while output is captured!  Consider using `-s`.
Traceback (most recent call last):
  File "/Volumes/Alpha SSD/Coding/bot/GramAddict/core/dump_capturer.py", line 43, in capture_all
    input("\n👉 1. COMMENT SHEET:\nOpen Instagram, scroll to any post on the HomeFeed, and open the comment section.\nWhen the comment sheet is fully visible, press ENTER to capture...")
  File "/Users/marcmintel/Library/Python/3.9/lib/python/site-packages/_pytest/capture.py", line 227, in read
    raise OSError(
OSError: pytest: reading from stdin while output is captured!  Consider using `-s`.
_____________________ test_full_content_to_resonance_flow ______________________

mock_engines = (<GramAddict.core.resonance_engine.ResonanceEngine object at 0x1093e2be0>, <GramAddict.core.growth_brain.GrowthBrain object at 0x108f3f040>)

    def test_full_content_to_resonance_flow(mock_engines):
        """
        REALITY CHECK: Tests the flow from RAW XML -> EXTRACED CONTENT -> RESONANCE SCORE.
        Using 'dump.xml' which contains an organic post and an ad.
        """
        resonance, _ = mock_engines
    
>       with open(DUMPS["organic"], "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/tests/fixtures/organic_post.xml'

tests/integration/test_cognitive_integration.py:51: FileNotFoundError
________________________ test_ad_detection_integration _________________________

    def test_ad_detection_integration():
        """Verify that _detect_ad_structural works on the actual ad_dump.xml."""
        from GramAddict.core.bot_flow import _detect_ad_structural
    
>       with open(DUMPS["ad"], "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/tests/fixtures/peugeot_ad.xml'

tests/integration/test_cognitive_integration.py:73: FileNotFoundError
__________________________ test_extract_explore_reel ___________________________

    def test_extract_explore_reel():
        """Verify extraction logic works on the Explore Grid/Reels dump."""
>       with open(DUMPS["explore"], "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/tests/mock_data/explore_feed.xml'

tests/integration/test_cognitive_integration.py:98: FileNotFoundError
_______________________ test_real_normal_post_is_not_ad ________________________

    def test_real_normal_post_is_not_ad():
        """
        Test: Ensures the ad detector correctly ignores a standard organic post.
        """
        xml_path = os.path.join(FIX_DIR, "organic_post.xml")
>       with open(xml_path, "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/tests/fixtures/organic_post.xml'

tests/integration/test_false_positive.py:12: FileNotFoundError
_____________________________ test_emit_pheromone ______________________________

swarm = <GramAddict.core.swarm_protocol.SwarmProtocol object at 0x1093cde50>

    def test_emit_pheromone(swarm):
        """Verify that emitting a pheromone calls Qdrant upsert with correct payload."""
        with patch("GramAddict.core.qdrant_memory.QdrantBase.is_connected", new_callable=PropertyMock, return_value=True):
            path_hash = "some_ui_path_hash"
            outcome = "success"
    
            swarm.emit_pheromone(path_hash, outcome)
    
            # Check if upsert was called with the expected payload
            swarm.client.upsert.assert_called_once()
            args, kwargs = swarm.client.upsert.call_args
            points = kwargs.get('points')
>           assert points[0].payload['path_hash'] == path_hash
E           AssertionError: assert <MagicMock name='mock.PointStruct().payload.__getitem__()' id='4444684496'> == 'some_ui_path_hash'

tests/integration/test_swarm_protocol.py:22: AssertionError
------------------------------ Captured log setup ------------------------------
WARNING  GramAddict.core.qdrant_memory:qdrant_memory.py:35 Qdrant dimension mismatch for 'gramaddict_swarm_pheromones': collection has <MagicMock name='QdrantClient().get_collection().config.params.vectors.size' id='4444982096'>, expected 4. Recreating collection...
____________ TestNodeExtraction.test_home_feed_extracts_like_button ____________

self = <test_telepathic_engine_extraction.TestNodeExtraction object at 0x108d91fd0>

    def test_home_feed_extracts_like_button(self):
        """
        In a real Home Feed dump, the parser MUST find the Like button node
        with resource-id 'row_feed_button_like'.
        """
        engine = TelepathicEngine()
>       xml = load_fixture("home_feed_with_ad.xml")

tests/integration/test_telepathic_engine_extraction.py:43: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'home_feed_with_ad.xml'

    def load_fixture(name: str) -> str:
        """Load a real XML capture from tests/mock_data/"""
        path = os.path.join(FIXTURE_DIR, name)
>       with open(path, "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/integration/mock_data/home_feed_with_ad.xml'

tests/integration/test_telepathic_engine_extraction.py:27: FileNotFoundError
------------------------------ Captured log call -------------------------------
WARNING  GramAddict.core.qdrant_memory:qdrant_memory.py:35 Qdrant dimension mismatch for 'telepathic_engine_cache': collection has <MagicMock name='mock.QdrantClient().get_collection().config.params.vectors.size' id='4446345248'>, expected 768. Recreating collection...
______________ TestNodeExtraction.test_home_feed_extracts_tab_bar ______________

self = <test_telepathic_engine_extraction.TestNodeExtraction object at 0x108e59430>

    def test_home_feed_extracts_tab_bar(self):
        """
        The parser must find the bottom tab bar items (Home, Reels, Search, Profile).
        These are critical for navigation.
        """
        engine = TelepathicEngine()
>       xml = load_fixture("home_feed_with_ad.xml")

tests/integration/test_telepathic_engine_extraction.py:66: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'home_feed_with_ad.xml'

    def load_fixture(name: str) -> str:
        """Load a real XML capture from tests/mock_data/"""
        path = os.path.join(FIXTURE_DIR, name)
>       with open(path, "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/integration/mock_data/home_feed_with_ad.xml'

tests/integration/test_telepathic_engine_extraction.py:27: FileNotFoundError
------------------------------ Captured log call -------------------------------
WARNING  GramAddict.core.qdrant_memory:qdrant_memory.py:35 Qdrant dimension mismatch for 'telepathic_engine_cache': collection has <MagicMock name='mock.QdrantClient().get_collection().config.params.vectors.size' id='4446345248'>, expected 768. Recreating collection...
__________ TestNodeExtraction.test_home_feed_node_count_is_realistic ___________

self = <test_telepathic_engine_extraction.TestNodeExtraction object at 0x108e59610>

    def test_home_feed_node_count_is_realistic(self):
        """
        A real Instagram home feed XML produces 20-40 interactive nodes.
        If we get <10 or >100, the parser is broken.
        """
        engine = TelepathicEngine()
>       xml = load_fixture("home_feed_with_ad.xml")

tests/integration/test_telepathic_engine_extraction.py:80: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'home_feed_with_ad.xml'

    def load_fixture(name: str) -> str:
        """Load a real XML capture from tests/mock_data/"""
        path = os.path.join(FIXTURE_DIR, name)
>       with open(path, "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/integration/mock_data/home_feed_with_ad.xml'

tests/integration/test_telepathic_engine_extraction.py:27: FileNotFoundError
------------------------------ Captured log call -------------------------------
WARNING  GramAddict.core.qdrant_memory:qdrant_memory.py:35 Qdrant dimension mismatch for 'telepathic_engine_cache': collection has <MagicMock name='mock.QdrantClient().get_collection().config.params.vectors.size' id='4446345248'>, expected 768. Recreating collection...
__________ TestNodeExtraction.test_explore_feed_extracts_like_button ___________

self = <test_telepathic_engine_extraction.TestNodeExtraction object at 0x108e59820>

    def test_explore_feed_extracts_like_button(self):
        """
        In the real Explore/Reels feed, the Like button has id 'like_button'
        and description 'Like'. The parser must find it.
        """
        engine = TelepathicEngine()
>       xml = load_fixture("explore_feed.xml")

tests/integration/test_telepathic_engine_extraction.py:94: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'explore_feed.xml'

    def load_fixture(name: str) -> str:
        """Load a real XML capture from tests/mock_data/"""
        path = os.path.join(FIXTURE_DIR, name)
>       with open(path, "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/integration/mock_data/explore_feed.xml'

tests/integration/test_telepathic_engine_extraction.py:27: FileNotFoundError
------------------------------ Captured log call -------------------------------
WARNING  GramAddict.core.qdrant_memory:qdrant_memory.py:35 Qdrant dimension mismatch for 'telepathic_engine_cache': collection has <MagicMock name='mock.QdrantClient().get_collection().config.params.vectors.size' id='4446345248'>, expected 768. Recreating collection...
________ TestNodeExtraction.test_explore_feed_has_fullscreen_containers ________

self = <test_telepathic_engine_extraction.TestNodeExtraction object at 0x108e59a30>

    def test_explore_feed_has_fullscreen_containers(self):
        """
        Verify that the parser extracts the fullscreen containers
        (swipeable_nav_view_pager_inner_recycler_view, clips_viewer_view_pager)
        so that the Safety Guard has something to reject.
        """
        engine = TelepathicEngine()
>       xml = load_fixture("explore_feed.xml")

tests/integration/test_telepathic_engine_extraction.py:112: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'explore_feed.xml'

    def load_fixture(name: str) -> str:
        """Load a real XML capture from tests/mock_data/"""
        path = os.path.join(FIXTURE_DIR, name)
>       with open(path, "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/integration/mock_data/explore_feed.xml'

tests/integration/test_telepathic_engine_extraction.py:27: FileNotFoundError
------------------------------ Captured log call -------------------------------
WARNING  GramAddict.core.qdrant_memory:qdrant_memory.py:35 Qdrant dimension mismatch for 'telepathic_engine_cache': collection has <MagicMock name='mock.QdrantClient().get_collection().config.params.vectors.size' id='4446345248'>, expected 768. Recreating collection...
_______________ TestAdDetection.test_real_explore_feed_is_not_ad _______________

self = <test_telepathic_engine_extraction.TestAdDetection object at 0x108e6c520>

    def test_real_explore_feed_is_not_ad(self):
        """
        The explore_feed.xml is a real Reel without any ad markers.
        It should NOT be flagged.
        """
        from GramAddict.core.bot_flow import _detect_ad_structural
    
>       xml = load_fixture("explore_feed.xml")

tests/integration/test_telepathic_engine_extraction.py:241: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'explore_feed.xml'

    def load_fixture(name: str) -> str:
        """Load a real XML capture from tests/mock_data/"""
        path = os.path.join(FIXTURE_DIR, name)
>       with open(path, "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/integration/mock_data/explore_feed.xml'

tests/integration/test_telepathic_engine_extraction.py:27: FileNotFoundError
_______________ TestFeedMarkers.test_real_home_feed_has_markers ________________

self = <test_telepathic_engine_extraction.TestFeedMarkers object at 0x108e6c8e0>

    def test_real_home_feed_has_markers(self):
        """The real home feed XML must match our feed markers."""
        from GramAddict.core.bot_flow import FEED_MARKERS
    
>       xml = load_fixture("home_feed_with_ad.xml")

tests/integration/test_telepathic_engine_extraction.py:256: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'home_feed_with_ad.xml'

    def load_fixture(name: str) -> str:
        """Load a real XML capture from tests/mock_data/"""
        path = os.path.join(FIXTURE_DIR, name)
>       with open(path, "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/integration/mock_data/home_feed_with_ad.xml'

tests/integration/test_telepathic_engine_extraction.py:27: FileNotFoundError
______________ TestFeedMarkers.test_real_explore_feed_has_markers ______________

self = <test_telepathic_engine_extraction.TestFeedMarkers object at 0x108e6caf0>

    def test_real_explore_feed_has_markers(self):
        """The real explore feed XML must match our feed markers."""
        from GramAddict.core.bot_flow import FEED_MARKERS
    
>       xml = load_fixture("explore_feed.xml")

tests/integration/test_telepathic_engine_extraction.py:267: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'explore_feed.xml'

    def load_fixture(name: str) -> str:
        """Load a real XML capture from tests/mock_data/"""
        path = os.path.join(FIXTURE_DIR, name)
>       with open(path, "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/integration/mock_data/explore_feed.xml'

tests/integration/test_telepathic_engine_extraction.py:27: FileNotFoundError
______ TestTelepathicResolutionCascade.test_keyword_fast_path_bypasses_ai ______

self = <test_telepathic_engine_extraction.TestTelepathicResolutionCascade object at 0x108e6ceb0>
mock_get_embedding = <MagicMock name='_get_embedding' id='4449038736'>
mock_vlm = <MagicMock name='query_telepathic_llm' id='4447908240'>

    @patch('GramAddict.core.telepathic_engine.query_telepathic_llm')
    @patch('GramAddict.core.qdrant_memory.QdrantBase._get_embedding')
    def test_keyword_fast_path_bypasses_ai(self, mock_get_embedding, mock_vlm):
        """
        A direct keyword match (like 'tap like button') MUST be resolved by Stage 1.5.
        It must never reach the Embedding (Stage 2) or VLM (Stage 3).
        """
        from GramAddict.core.telepathic_engine import TelepathicEngine
        engine = TelepathicEngine()
        engine._embedding_cache.clear()
        engine._intent_cache.clear()
    
        # home_feed_with_ad.xml contains standard UI elements
>       xml_content = load_fixture("home_feed_with_ad.xml")

tests/integration/test_telepathic_engine_extraction.py:294: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'home_feed_with_ad.xml'

    def load_fixture(name: str) -> str:
        """Load a real XML capture from tests/mock_data/"""
        path = os.path.join(FIXTURE_DIR, name)
>       with open(path, "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/integration/mock_data/home_feed_with_ad.xml'

tests/integration/test_telepathic_engine_extraction.py:27: FileNotFoundError
------------------------------ Captured log call -------------------------------
WARNING  GramAddict.core.qdrant_memory:qdrant_memory.py:35 Qdrant dimension mismatch for 'telepathic_engine_cache': collection has <MagicMock name='mock.QdrantClient().get_collection().config.params.vectors.size' id='4446345248'>, expected 768. Recreating collection...
_ TestTelepathicResolutionCascade.test_embedding_fallback_bypasses_vlm_if_confident _

self = <test_telepathic_engine_extraction.TestTelepathicResolutionCascade object at 0x108e6cdf0>
mock_get_embedding = <MagicMock name='_get_embedding' id='4457325136'>
mock_vlm = <MagicMock name='query_telepathic_llm' id='4449935808'>

    @patch('GramAddict.core.telepathic_engine.query_telepathic_llm')
    @patch('GramAddict.core.qdrant_memory.QdrantBase._get_embedding')
    def test_embedding_fallback_bypasses_vlm_if_confident(self, mock_get_embedding, mock_vlm):
        """
        If we ask something without an exact keyword match, it should fail Stage 1.5,
        hit Stage 2 (Embeddings), and if confident enough, avoid Stage 3 (VLM).
        """
        from GramAddict.core.telepathic_engine import TelepathicEngine
        engine = TelepathicEngine()
        engine._embedding_cache.clear()
        engine._intent_cache.clear()
    
>       xml_content = load_fixture("home_feed_with_ad.xml")

tests/integration/test_telepathic_engine_extraction.py:318: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'home_feed_with_ad.xml'

    def load_fixture(name: str) -> str:
        """Load a real XML capture from tests/mock_data/"""
        path = os.path.join(FIXTURE_DIR, name)
>       with open(path, "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/integration/mock_data/home_feed_with_ad.xml'

tests/integration/test_telepathic_engine_extraction.py:27: FileNotFoundError
------------------------------ Captured log call -------------------------------
WARNING  GramAddict.core.qdrant_memory:qdrant_memory.py:35 Qdrant dimension mismatch for 'telepathic_engine_cache': collection has <MagicMock name='mock.QdrantClient().get_collection().config.params.vectors.size' id='4446345248'>, expected 768. Recreating collection...
_ TestTelepathicResolutionCascade.test_vlm_fallback_triggered_on_low_confidence _

self = <test_telepathic_engine_extraction.TestTelepathicResolutionCascade object at 0x108e6c430>
mock_get_embedding = <MagicMock name='_get_embedding' id='4457118352'>
mock_vlm = <MagicMock name='query_telepathic_llm' id='4444565312'>

    @patch('GramAddict.core.telepathic_engine.query_telepathic_llm')
    @patch('GramAddict.core.qdrant_memory.QdrantBase._get_embedding')
    def test_vlm_fallback_triggered_on_low_confidence(self, mock_get_embedding, mock_vlm):
        """
        If Embeddings fail to find a confident match (< 0.82), it must trigger
        the Stage 3 VLM fallback.
        """
        from GramAddict.core.telepathic_engine import TelepathicEngine
        engine = TelepathicEngine()
        engine._embedding_cache.clear()
        engine._intent_cache.clear()
    
>       xml_content = load_fixture("home_feed_with_ad.xml")

tests/integration/test_telepathic_engine_extraction.py:353: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'home_feed_with_ad.xml'

    def load_fixture(name: str) -> str:
        """Load a real XML capture from tests/mock_data/"""
        path = os.path.join(FIXTURE_DIR, name)
>       with open(path, "r") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Alpha SSD/Coding/bot/tests/integration/mock_data/home_feed_with_ad.xml'

tests/integration/test_telepathic_engine_extraction.py:27: FileNotFoundError
------------------------------ Captured log call -------------------------------
WARNING  GramAddict.core.qdrant_memory:qdrant_memory.py:35 Qdrant dimension mismatch for 'telepathic_engine_cache': collection has <MagicMock name='mock.QdrantClient().get_collection().config.params.vectors.size' id='4446345248'>, expected 768. Recreating collection...
=============================== warnings summary ===============================
../../../../Users/marcmintel/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py:35
  /Users/marcmintel/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/anomalies/test_fsd_recovery.py::test_fsd_handles_persistent_survey_modal
FAILED tests/integration/test_ad_detection.py::test_real_sponsored_reel_flexcode_is_detected
FAILED tests/integration/test_ad_detection.py::test_normal_post_not_ad - File...
FAILED tests/integration/test_ad_detection.py::test_peugeot_carousel_ad_is_detected
FAILED tests/integration/test_bot_flow_interaction.py::test_start_bot_interrupt
FAILED tests/integration/test_bot_flow_start.py::test_start_bot_normal_flow
FAILED tests/integration/test_cognitive_integration.py::test_full_content_to_resonance_flow
FAILED tests/integration/test_cognitive_integration.py::test_ad_detection_integration
FAILED tests/integration/test_cognitive_integration.py::test_extract_explore_reel
FAILED tests/integration/test_false_positive.py::test_real_normal_post_is_not_ad
FAILED tests/integration/test_swarm_protocol.py::test_emit_pheromone - Assert...
FAILED tests/integration/test_telepathic_engine_extraction.py::TestNodeExtraction::test_home_feed_extracts_like_button
FAILED tests/integration/test_telepathic_engine_extraction.py::TestNodeExtraction::test_home_feed_extracts_tab_bar
FAILED tests/integration/test_telepathic_engine_extraction.py::TestNodeExtraction::test_home_feed_node_count_is_realistic
FAILED tests/integration/test_telepathic_engine_extraction.py::TestNodeExtraction::test_explore_feed_extracts_like_button
FAILED tests/integration/test_telepathic_engine_extraction.py::TestNodeExtraction::test_explore_feed_has_fullscreen_containers
FAILED tests/integration/test_telepathic_engine_extraction.py::TestAdDetection::test_real_explore_feed_is_not_ad
FAILED tests/integration/test_telepathic_engine_extraction.py::TestFeedMarkers::test_real_home_feed_has_markers
FAILED tests/integration/test_telepathic_engine_extraction.py::TestFeedMarkers::test_real_explore_feed_has_markers
FAILED tests/integration/test_telepathic_engine_extraction.py::TestTelepathicResolutionCascade::test_keyword_fast_path_bypasses_ai
FAILED tests/integration/test_telepathic_engine_extraction.py::TestTelepathicResolutionCascade::test_embedding_fallback_bypasses_vlm_if_confident
FAILED tests/integration/test_telepathic_engine_extraction.py::TestTelepathicResolutionCascade::test_vlm_fallback_triggered_on_low_confidence
ERROR tests/anomalies/test_hardware_anomalies.py::test_slow_loading_post_recovery
ERROR tests/anomalies/test_hardware_anomalies.py::test_wait_timeout_aborts_gracefully
ERROR tests/anomalies/test_hardware_anomalies.py::test_empty_content_extraction_guard
ERROR tests/anomalies/test_hardware_anomalies.py::test_missing_feed_markers_guard
ERROR tests/integration/test_scenarios_fsd.py::test_full_mission_autopilot_sequence
ERROR tests/integration/test_scenarios_fsd.py::test_feed_loop_chaos_mode - Fi...
ERROR tests/integration/test_telepathic_engine_extraction.py::TestSafetyGuard::test_real_explore_fullscreen_container_rejected
ERROR tests/integration/test_telepathic_engine_extraction.py::TestSafetyGuard::test_real_explore_like_button_accepted
== 22 failed, 120 passed, 2 skipped, 1 warning, 8 errors in 76.34s (0:01:16) ===
