From 535a57e8d0b1a654c3c72c195e7b72a8449b3d65 Mon Sep 17 00:00:00 2001 From: garvitkaushik-123 Date: Thu, 20 Aug 2026 00:34:55 +0530 Subject: [PATCH] test: stop stubbing discovery_inquiry_flow, restore real coverage (issue #60 part 1) The "pre-existing @listen() bugs with CrewAI version mismatch" stub that every ad_seller.flows-touching test file carried for discovery_inquiry_flow dates to when crewai was pinned at >=0.86.0 (commit 530df34, March 2026). crewai is >=1.14.4 now (resolves to 1.15.2) -- a major version bump, and the flow runs cleanly end to end on it: verified DiscoveryInquiryFlow.kickoff_async() across all four routing branches, both standalone and under pytest, and confirmed the production call path (the sync flow.query() wrapper -- which calls self.kickoff(), not kickoff_async() -- invoked from inside an async FastAPI handler) also works correctly. atc964 confirmed on the issue that the rationale was real at the time and just never got revisited as crewai moved forward. This wasn't just stale test hygiene: DiscoveryInquiryFlow backs a live endpoint (POST /discovery, products.py:201), so the blanket stub meant that endpoint had been running in production with zero real test coverage for as long as the stub existed. jaanijuk caught that on the issue -- grep for "DiscoveryInquiryFlow" in tests/ before this change returns nothing. execution_activation_flow stays stubbed. It has a separate, real bug (a cancel-scope leak in an MCP client cleanup path on ad-server connection failure, landing outside the code's own try/except) that's being tracked and fixed independently as issue #60 part 2 -- it just isn't the @listen() bug the old comment claimed either. Changes: - Removed the discovery_inquiry_flow entry from the _broken_flows stub list in all 33 test files that had it (execution_activation_flow entries are untouched). - Simplified test_deal_flow_e2e.py: its _get_deal_request_flow_class() helper existed solely to bypass flows/__init__.py via manual sys.modules surgery so importing DealRequestFlow wouldn't also trigger discovery_inquiry_flow. With the stub gone that's unnecessary -- replaced with a plain module import. - Fixed the stale docstring in test_linear_tv.py making the same claim. - Added tests/unit/test_discovery_inquiry_flow.py: the flow's own routing logic across all four response types run for real (no stub), plus POST /discovery exercised through the actual FastAPI app with the real flow (not mocked) -- closing the exact coverage gap this issue found. Full suite: 1491 passed, 28 skipped (pre-existing, unrelated), no regressions. ruff check / format clean. Part of #60. --- tests/integration/test_deal_flow_e2e.py | 47 +------ .../test_packages_audience_filter.py | 5 +- tests/unit/test_agentic_audience_match.py | 1 - tests/unit/test_approval_gates.py | 5 +- tests/unit/test_audience_plan_validation.py | 1 - tests/unit/test_auth_header_binding.py | 5 +- tests/unit/test_avails_contract_adoption.py | 5 +- tests/unit/test_avails_endpoint.py | 5 +- tests/unit/test_avails_spec_dialect.py | 5 +- tests/unit/test_capability_audience_block.py | 5 +- tests/unit/test_change_request.py | 1 - tests/unit/test_csv_catalog_coherence.py | 5 +- tests/unit/test_deal_booking_endpoints.py | 4 +- tests/unit/test_deal_booking_snapshot.py | 5 +- tests/unit/test_deal_performance_gam.py | 12 +- tests/unit/test_default_catalog_enrichment.py | 5 +- tests/unit/test_discovery_inquiry_flow.py | 122 ++++++++++++++++++ tests/unit/test_endpoint_no_flow_kickoff.py | 5 +- tests/unit/test_issue34_catalog_fixes.py | 5 +- tests/unit/test_linear_tv.py | 3 +- tests/unit/test_negotiation_cold_start.py | 5 +- .../unit/test_negotiation_lowball_counter.py | 5 +- .../unit/test_negotiation_message_endpoint.py | 4 +- tests/unit/test_operator_auth.py | 5 +- tests/unit/test_optional_startup_key.py | 5 +- tests/unit/test_order_audit.py | 1 - tests/unit/test_order_endpoints.py | 1 - tests/unit/test_proposal_avails_grounding.py | 5 +- tests/unit/test_proposal_error_taxonomy.py | 5 +- tests/unit/test_proposal_flow_time_budget.py | 5 +- .../unit/test_quote_availability_grounding.py | 5 +- tests/unit/test_quote_endpoints.py | 5 +- tests/unit/test_route_shadowing.py | 5 +- tests/unit/test_service_layer.py | 5 +- tests/unit/test_trust_tier_verification.py | 5 +- 35 files changed, 182 insertions(+), 135 deletions(-) create mode 100644 tests/unit/test_discovery_inquiry_flow.py diff --git a/tests/integration/test_deal_flow_e2e.py b/tests/integration/test_deal_flow_e2e.py index 4bd069de..e9f1128f 100644 --- a/tests/integration/test_deal_flow_e2e.py +++ b/tests/integration/test_deal_flow_e2e.py @@ -7,9 +7,7 @@ - Approval gate integration """ -import importlib -import sys - +import ad_seller.flows.deal_request_flow as deal_request_flow_module from ad_seller.models.buyer_identity import BuyerContext, BuyerIdentity from ad_seller.models.core import DealType, PricingModel from ad_seller.models.flow_state import ( @@ -18,46 +16,6 @@ from .conftest import InMemoryStorage, make_settings - -def _get_deal_request_flow_class(): - """Import DealRequestFlow directly from its module, bypassing flows/__init__.py - which triggers discovery_inquiry_flow (broken with current crewai version).""" - mod_name = "ad_seller.flows.deal_request_flow" - if mod_name in sys.modules: - return sys.modules[mod_name].DealRequestFlow - - # Ensure the parent package 'ad_seller.flows' exists in sys.modules - # as a stub so that find_spec / relative imports work, without - # executing the __init__.py that pulls in the broken module. - parent_name = "ad_seller.flows" - original_parent = sys.modules.get(parent_name) - installed_stub = False - if original_parent is None: - import types - - import ad_seller # noqa: F401 - - stub = types.ModuleType(parent_name) - stub.__path__ = [str(importlib.resources.files("ad_seller").joinpath("flows"))] - stub.__package__ = parent_name - sys.modules[parent_name] = stub - installed_stub = True - - spec = importlib.util.find_spec(mod_name) - if spec is None: - raise ImportError(f"Cannot find {mod_name}") - mod = importlib.util.module_from_spec(spec) - sys.modules[mod_name] = mod - spec.loader.exec_module(mod) - - # Remove the stub so other tests that import ad_seller.flows get the real - # module (with ProductSetupFlow etc.) instead of a bare stub. - if installed_stub: - del sys.modules[parent_name] - - return mod.DealRequestFlow - - # ============================================================================ # Pricing Engine # ============================================================================ @@ -139,7 +97,7 @@ class TestDealRequestFlowE2E: def _make_state(self, request_text, buyer_context=None, seller_org="INTEG"): """Create a DealRequestState manually and return (module, state).""" - mod = sys.modules["ad_seller.flows.deal_request_flow"] + mod = deal_request_flow_module state = mod.DealRequestState( flow_id="test-flow-001", flow_type="deal_request", @@ -152,7 +110,6 @@ def _make_state(self, request_text, buyer_context=None, seller_org="INTEG"): async def _run_steps(self, request_text, buyer_context=None, seller_org="INTEG"): """Run the flow steps manually in sequence on a DealRequestState.""" - _get_deal_request_flow_class() # ensure module is loaded mod, state = self._make_state(request_text, buyer_context, seller_org) settings = make_settings(seller_organization_id=seller_org) diff --git a/tests/integration/test_packages_audience_filter.py b/tests/integration/test_packages_audience_filter.py index d03c3fdb..5ade20b9 100644 --- a/tests/integration/test_packages_audience_filter.py +++ b/tests/integration/test_packages_audience_filter.py @@ -31,10 +31,9 @@ import sys from types import ModuleType -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI version -# mismatch) before importing main, mirroring test_quote_endpoints.py. +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_agentic_audience_match.py b/tests/unit/test_agentic_audience_match.py index f77eec72..55e8101e 100644 --- a/tests/unit/test_agentic_audience_match.py +++ b/tests/unit/test_agentic_audience_match.py @@ -22,7 +22,6 @@ # Stub broken flow modules before importing main, mirroring sibling tests. _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_approval_gates.py b/tests/unit/test_approval_gates.py index 77a3c570..3649810c 100644 --- a/tests/unit/test_approval_gates.py +++ b/tests/unit/test_approval_gates.py @@ -21,10 +21,9 @@ import pytest -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI version -# mismatch) before any import of ad_seller.flows triggers __init__.py. +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_audience_plan_validation.py b/tests/unit/test_audience_plan_validation.py index 60f8405d..3a2312b2 100644 --- a/tests/unit/test_audience_plan_validation.py +++ b/tests/unit/test_audience_plan_validation.py @@ -24,7 +24,6 @@ # Stub broken flow modules before importing other ad_seller bits. _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_auth_header_binding.py b/tests/unit/test_auth_header_binding.py index a4a69dec..a272c498 100644 --- a/tests/unit/test_auth_header_binding.py +++ b/tests/unit/test_auth_header_binding.py @@ -24,10 +24,9 @@ import pytest -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI version mismatch) -# before any import of ad_seller.flows triggers __init__.py. +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_avails_contract_adoption.py b/tests/unit/test_avails_contract_adoption.py index d72f85eb..c1519c61 100644 --- a/tests/unit/test_avails_contract_adoption.py +++ b/tests/unit/test_avails_contract_adoption.py @@ -27,10 +27,9 @@ import pytest -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI version -# mismatch) before any import of ad_seller.flows triggers __init__.py. +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_avails_endpoint.py b/tests/unit/test_avails_endpoint.py index 83f7a63c..0e3144b5 100644 --- a/tests/unit/test_avails_endpoint.py +++ b/tests/unit/test_avails_endpoint.py @@ -20,10 +20,9 @@ import pytest -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI version -# mismatch) before any import of ad_seller.flows triggers __init__.py. +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_avails_spec_dialect.py b/tests/unit/test_avails_spec_dialect.py index c0fcda7b..0e2d323c 100644 --- a/tests/unit/test_avails_spec_dialect.py +++ b/tests/unit/test_avails_spec_dialect.py @@ -32,10 +32,9 @@ import pytest -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI version -# mismatch) before any import of ad_seller.flows triggers __init__.py. +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_capability_audience_block.py b/tests/unit/test_capability_audience_block.py index 34ca8c43..020f5b10 100644 --- a/tests/unit/test_capability_audience_block.py +++ b/tests/unit/test_capability_audience_block.py @@ -32,11 +32,10 @@ import pytest -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI version -# mismatch) before importing main, mirroring the pattern in +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). # test_quote_endpoints.py. _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_change_request.py b/tests/unit/test_change_request.py index ce0a147d..5f0a8f54 100644 --- a/tests/unit/test_change_request.py +++ b/tests/unit/test_change_request.py @@ -11,7 +11,6 @@ # Stub broken flow modules _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_csv_catalog_coherence.py b/tests/unit/test_csv_catalog_coherence.py index 3677579e..bdabc4c0 100644 --- a/tests/unit/test_csv_catalog_coherence.py +++ b/tests/unit/test_csv_catalog_coherence.py @@ -31,10 +31,9 @@ import pytest -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI version -# mismatch). Same pattern used in test_issue34_catalog_fixes.py. +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_deal_booking_endpoints.py b/tests/unit/test_deal_booking_endpoints.py index c56aa16b..664b635d 100644 --- a/tests/unit/test_deal_booking_endpoints.py +++ b/tests/unit/test_deal_booking_endpoints.py @@ -12,9 +12,9 @@ import pytest -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI version mismatch) +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_deal_booking_snapshot.py b/tests/unit/test_deal_booking_snapshot.py index 2da2b40a..263cb3f9 100644 --- a/tests/unit/test_deal_booking_snapshot.py +++ b/tests/unit/test_deal_booking_snapshot.py @@ -28,10 +28,9 @@ import pytest -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI version -# mismatch). Mirrors the pattern in tests/unit/test_deal_booking_endpoints.py. +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_deal_performance_gam.py b/tests/unit/test_deal_performance_gam.py index c4e6a921..fa509e54 100644 --- a/tests/unit/test_deal_performance_gam.py +++ b/tests/unit/test_deal_performance_gam.py @@ -301,13 +301,11 @@ async def test_rest_performance_endpoint_returns_real_gam_numbers(self): import sys from types import ModuleType - # Stub broken flow modules (pre-existing @listen() bugs with CrewAI - # version mismatch) before ad_seller.flows import — same pattern as - # test_avails_endpoint.py. - for _mod_name in ( - "ad_seller.flows.discovery_inquiry_flow", - "ad_seller.flows.execution_activation_flow", - ): + # Stub execution_activation_flow (cancel-scope leak on ad-server + # connection failure — issue #60 part 2, unresolved) before + # ad_seller.flows import — same pattern as test_avails_endpoint.py. + # discovery_inquiry_flow no longer needs stubbing (issue #60 part 1). + for _mod_name in ("ad_seller.flows.execution_activation_flow",): if _mod_name not in sys.modules: _stub = ModuleType(_mod_name) _cls = _mod_name.rsplit(".", 1)[-1].replace("_", " ").title().replace(" ", "") diff --git a/tests/unit/test_default_catalog_enrichment.py b/tests/unit/test_default_catalog_enrichment.py index 345d2b13..fb99ed44 100644 --- a/tests/unit/test_default_catalog_enrichment.py +++ b/tests/unit/test_default_catalog_enrichment.py @@ -24,10 +24,9 @@ import pytest from fastapi import HTTPException -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI version -# mismatch). Same pattern used across the unit test suite. +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_discovery_inquiry_flow.py b/tests/unit/test_discovery_inquiry_flow.py new file mode 100644 index 00000000..44f6716f --- /dev/null +++ b/tests/unit/test_discovery_inquiry_flow.py @@ -0,0 +1,122 @@ +# Author: Green Mountain Systems AI Inc. +# Donated to IAB Tech Lab + +"""Real coverage for DiscoveryInquiryFlow and POST /discovery (issue #60 part 1). + +Every test file that touched ad_seller.flows used to stub this module out +before import, citing a "pre-existing @listen() bug with CrewAI version +mismatch" that dated to when crewai was pinned at >=0.86.0. crewai is +>=1.14.4 now, the flow runs cleanly end to end, and DiscoveryInquiryFlow +backs a live endpoint (POST /discovery, products.py:201) -- so the stub +wasn't just hiding dead code, it was hiding a served API path. See issue +#60 for the full investigation. + +These tests run the real flow, not a stub. +""" + +import httpx +import pytest +from httpx import ASGITransport + +from ad_seller.flows.discovery_inquiry_flow import DiscoveryInquiryFlow +from ad_seller.interfaces.api.main import _get_optional_api_key_record, app +from ad_seller.models.buyer_identity import BuyerContext, BuyerIdentity +from ad_seller.models.core import DealType, PricingModel +from ad_seller.models.flow_state import ProductDefinition + + +def _make_product(product_id="ctv-premium-sports", inventory_type="ctv"): + return ProductDefinition( + product_id=product_id, + name="Premium CTV - Sports", + inventory_type=inventory_type, + supported_deal_types=[DealType.PREFERRED_DEAL], + supported_pricing_models=[PricingModel.CPM], + base_cpm=35.0, + floor_cpm=28.0, + minimum_impressions=100000, + ) + + +def _products(): + return {"ctv-premium-sports": _make_product()} + + +class TestDiscoveryInquiryFlowRouting: + """The flow's own routing logic, run for real -- no stub in the way.""" + + @pytest.mark.parametrize( + "query, expected_type", + [ + ("show me what you have", "catalog"), + ("how much does this cost?", "pricing"), + ("what CPM for CTV?", "pricing"), + ("what inventory is available?", "availability"), + ("how many impressions do you have?", "availability"), + ("what audience targeting do you support?", "targeting"), + ], + ) + def test_query_routes_to_expected_response_type(self, query, expected_type): + flow = DiscoveryInquiryFlow() + response = flow.query(query=query, buyer_context=None, products=_products()) + assert flow.state.response_type == expected_type + assert response is not None + + def test_public_buyer_gets_price_range_not_exact_price(self): + flow = DiscoveryInquiryFlow() + response = flow.query( + query="how much does CTV cost?", buyer_context=None, products=_products() + ) + assert flow.state.response_type == "pricing" + assert response is not None + + def test_authenticated_buyer_context_is_accepted(self): + ctx = BuyerContext( + identity=BuyerIdentity(agency_id="agency-1", agency_name="Test Agency"), + is_authenticated=True, + ) + flow = DiscoveryInquiryFlow() + response = flow.query(query="what's available?", buyer_context=ctx, products=_products()) + assert flow.state.response_type == "availability" + assert response is not None + + def test_empty_catalog_does_not_crash(self): + flow = DiscoveryInquiryFlow() + response = flow.query(query="show me your catalog", buyer_context=None, products={}) + assert response is not None + + +class TestDiscoveryEndpointRealFlow: + """POST /discovery through the real FastAPI app -- the real + DiscoveryInquiryFlow runs, nothing mocked.""" + + @pytest.fixture + def client(self): + app.dependency_overrides[_get_optional_api_key_record] = lambda: None + transport = ASGITransport(app=app) + c = httpx.AsyncClient(transport=transport, base_url="http://test") + yield c + app.dependency_overrides.clear() + + async def test_discovery_query_returns_200(self, client): + async with client as c: + resp = await c.post("/discovery", json={"query": "what inventory do you have?"}) + assert resp.status_code == 200, resp.text + + async def test_discovery_pricing_query_returns_200(self, client): + async with client as c: + resp = await c.post("/discovery", json={"query": "how much does CTV cost?"}) + assert resp.status_code == 200, resp.text + + async def test_discovery_query_with_buyer_tier_returns_200(self, client): + async with client as c: + resp = await c.post( + "/discovery", + json={"query": "what's available?", "buyer_tier": "agency", "agency_id": "ag-1"}, + ) + assert resp.status_code == 200, resp.text + + async def test_discovery_missing_query_is_422(self, client): + async with client as c: + resp = await c.post("/discovery", json={}) + assert resp.status_code == 422 diff --git a/tests/unit/test_endpoint_no_flow_kickoff.py b/tests/unit/test_endpoint_no_flow_kickoff.py index e3b3edec..628629d3 100644 --- a/tests/unit/test_endpoint_no_flow_kickoff.py +++ b/tests/unit/test_endpoint_no_flow_kickoff.py @@ -25,10 +25,9 @@ import pytest -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI version mismatch). -# Same pattern used in test_deal_booking_endpoints.py. +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_issue34_catalog_fixes.py b/tests/unit/test_issue34_catalog_fixes.py index 57f197e2..eab74b58 100644 --- a/tests/unit/test_issue34_catalog_fixes.py +++ b/tests/unit/test_issue34_catalog_fixes.py @@ -34,10 +34,9 @@ import pytest -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI version -# mismatch). Same pattern used in test_endpoint_no_flow_kickoff.py. +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_linear_tv.py b/tests/unit/test_linear_tv.py index 0d148983..399823fc 100644 --- a/tests/unit/test_linear_tv.py +++ b/tests/unit/test_linear_tv.py @@ -738,8 +738,7 @@ def test_billing_reconciliation_tool(self): class TestClassificationHelpers: """Tests for linear TV classification in product setup flow. - These test the static methods directly without importing the flow module - (which has a pre-existing broken import in discovery_inquiry_flow.py). + These test the static methods directly without importing the flow module. """ def test_classify_ad_formats(self): diff --git a/tests/unit/test_negotiation_cold_start.py b/tests/unit/test_negotiation_cold_start.py index 12950429..8825c94d 100644 --- a/tests/unit/test_negotiation_cold_start.py +++ b/tests/unit/test_negotiation_cold_start.py @@ -35,10 +35,9 @@ # as test_modern_agentic_capabilities.py (no LLM call is ever made here). os.environ.setdefault("ANTHROPIC_API_KEY", "test-key-for-unit-tests") -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI version -# mismatch). Same pattern used in test_deal_booking_endpoints.py. +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_negotiation_lowball_counter.py b/tests/unit/test_negotiation_lowball_counter.py index 3781f279..63ee945f 100644 --- a/tests/unit/test_negotiation_lowball_counter.py +++ b/tests/unit/test_negotiation_lowball_counter.py @@ -38,10 +38,9 @@ # as test_negotiation_cold_start.py (no LLM call is ever made here). os.environ.setdefault("ANTHROPIC_API_KEY", "test-key-for-unit-tests") -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI version -# mismatch). Same pattern used in test_negotiation_cold_start.py. +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_negotiation_message_endpoint.py b/tests/unit/test_negotiation_message_endpoint.py index ae92aa73..08e7cea5 100644 --- a/tests/unit/test_negotiation_message_endpoint.py +++ b/tests/unit/test_negotiation_message_endpoint.py @@ -15,9 +15,9 @@ from types import ModuleType from unittest.mock import AsyncMock, patch -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI mismatch). +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_operator_auth.py b/tests/unit/test_operator_auth.py index 36a363cc..42ef839d 100644 --- a/tests/unit/test_operator_auth.py +++ b/tests/unit/test_operator_auth.py @@ -30,10 +30,9 @@ import pytest -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI version -# mismatch) before any import of ad_seller.flows triggers __init__.py. +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_optional_startup_key.py b/tests/unit/test_optional_startup_key.py index 748b4fef..a362174a 100644 --- a/tests/unit/test_optional_startup_key.py +++ b/tests/unit/test_optional_startup_key.py @@ -27,10 +27,9 @@ import pytest -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI version -# mismatch). Same pattern used in test_proposal_flow_time_budget.py. +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_order_audit.py b/tests/unit/test_order_audit.py index 24569019..b41eb96c 100644 --- a/tests/unit/test_order_audit.py +++ b/tests/unit/test_order_audit.py @@ -11,7 +11,6 @@ # Stub broken flow modules _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_order_endpoints.py b/tests/unit/test_order_endpoints.py index a9cd90e1..5815697d 100644 --- a/tests/unit/test_order_endpoints.py +++ b/tests/unit/test_order_endpoints.py @@ -11,7 +11,6 @@ # Stub broken flow modules _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_proposal_avails_grounding.py b/tests/unit/test_proposal_avails_grounding.py index bc9de5af..57372387 100644 --- a/tests/unit/test_proposal_avails_grounding.py +++ b/tests/unit/test_proposal_avails_grounding.py @@ -38,10 +38,9 @@ # as test_negotiation_lowball_counter.py (no LLM call is ever made here). os.environ.setdefault("ANTHROPIC_API_KEY", "test-key-for-unit-tests") -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI version -# mismatch). Same pattern used in test_negotiation_lowball_counter.py. +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_proposal_error_taxonomy.py b/tests/unit/test_proposal_error_taxonomy.py index 477c181a..b4d64333 100644 --- a/tests/unit/test_proposal_error_taxonomy.py +++ b/tests/unit/test_proposal_error_taxonomy.py @@ -35,10 +35,9 @@ # as test_proposal_flow_time_budget.py (no LLM call is ever made here). os.environ.setdefault("ANTHROPIC_API_KEY", "test-key-for-unit-tests") -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI version -# mismatch). Same pattern used in test_negotiation_cold_start.py. +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_proposal_flow_time_budget.py b/tests/unit/test_proposal_flow_time_budget.py index a25a0bea..83b62067 100644 --- a/tests/unit/test_proposal_flow_time_budget.py +++ b/tests/unit/test_proposal_flow_time_budget.py @@ -32,10 +32,9 @@ # as test_negotiation_cold_start.py (no LLM call is ever made here). os.environ.setdefault("ANTHROPIC_API_KEY", "test-key-for-unit-tests") -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI version -# mismatch). Same pattern used in test_negotiation_cold_start.py. +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_quote_availability_grounding.py b/tests/unit/test_quote_availability_grounding.py index 7f61ba99..35c273e8 100644 --- a/tests/unit/test_quote_availability_grounding.py +++ b/tests/unit/test_quote_availability_grounding.py @@ -26,10 +26,9 @@ import pytest from fastapi import HTTPException -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI version -# mismatch). Same pattern used across the unit test suite. +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_quote_endpoints.py b/tests/unit/test_quote_endpoints.py index 94ab86f2..a8c60af5 100644 --- a/tests/unit/test_quote_endpoints.py +++ b/tests/unit/test_quote_endpoints.py @@ -18,10 +18,9 @@ import pytest -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI version mismatch) -# before any import of ad_seller.flows triggers __init__.py. +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_route_shadowing.py b/tests/unit/test_route_shadowing.py index 76b31d8b..c6712525 100644 --- a/tests/unit/test_route_shadowing.py +++ b/tests/unit/test_route_shadowing.py @@ -24,10 +24,9 @@ import pytest -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI version -# mismatch) — mirrors tests/unit/test_deal_booking_endpoints.py. +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_service_layer.py b/tests/unit/test_service_layer.py index a61dcad0..3dad23ed 100644 --- a/tests/unit/test_service_layer.py +++ b/tests/unit/test_service_layer.py @@ -20,10 +20,9 @@ import pytest from fastapi import HTTPException -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI version -# mismatch). Same pattern used in test_deal_booking_endpoints.py. +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: diff --git a/tests/unit/test_trust_tier_verification.py b/tests/unit/test_trust_tier_verification.py index 083e2b47..aa68b67d 100644 --- a/tests/unit/test_trust_tier_verification.py +++ b/tests/unit/test_trust_tier_verification.py @@ -29,10 +29,9 @@ from types import ModuleType from unittest.mock import AsyncMock, patch -# Stub broken flow modules (pre-existing @listen() bugs with CrewAI version -# mismatch) before any import of ad_seller.flows triggers __init__.py. +# Stub execution_activation_flow (cancel-scope leak on ad-server +# connection failure, unresolved -- issue #60 part 2). _broken_flows = [ - "ad_seller.flows.discovery_inquiry_flow", "ad_seller.flows.execution_activation_flow", ] for _mod_name in _broken_flows: