|
42 | 42 | from adcp.decisioning.webhook_emit import maybe_emit_sync_completion |
43 | 43 | from adcp.server.base import ADCPHandler, ToolContext |
44 | 44 |
|
| 45 | +# Pydantic Request/Response types are imported at module scope (NOT |
| 46 | +# under TYPE_CHECKING) so that ``typing.get_type_hints(method)`` can |
| 47 | +# resolve every shim's ``params`` annotation at runtime. The dispatcher |
| 48 | +# at ``adcp.server.mcp_tools._resolve_params_pydantic_model`` walks |
| 49 | +# these hints to deserialise wire-shape dicts into the typed Pydantic |
| 50 | +# models the shims expect; without runtime visibility, ``get_type_hints`` |
| 51 | +# raises ``NameError`` on the forward refs (the file uses |
| 52 | +# ``from __future__ import annotations``), the resolver swallows the |
| 53 | +# exception, and the dispatcher falls back to the dict path — which |
| 54 | +# crashes inside the shim with ``'dict' object has no attribute |
| 55 | +# 'account'`` (Emma sales-direct backend test, verdict 2/10). |
| 56 | +from adcp.types import ( |
| 57 | + AccountReference, |
| 58 | + AcquireRightsRequest, |
| 59 | + AcquireRightsResponse, |
| 60 | + ActivateSignalRequest, |
| 61 | + ActivateSignalSuccessResponse, |
| 62 | + BuildCreativeRequest, |
| 63 | + BuildCreativeResponse, |
| 64 | + CalibrateContentRequest, |
| 65 | + CalibrateContentResponse, |
| 66 | + CheckGovernanceRequest, |
| 67 | + CheckGovernanceResponse, |
| 68 | + CreateCollectionListRequest, |
| 69 | + CreateCollectionListResponse, |
| 70 | + CreateContentStandardsRequest, |
| 71 | + CreateContentStandardsResponse, |
| 72 | + CreateMediaBuyRequest, |
| 73 | + CreateMediaBuySuccessResponse, |
| 74 | + CreatePropertyListRequest, |
| 75 | + CreatePropertyListResponse, |
| 76 | + DeleteCollectionListRequest, |
| 77 | + DeleteCollectionListResponse, |
| 78 | + DeletePropertyListRequest, |
| 79 | + DeletePropertyListResponse, |
| 80 | + GetBrandIdentityRequest, |
| 81 | + GetBrandIdentitySuccessResponse, |
| 82 | + GetCollectionListRequest, |
| 83 | + GetCollectionListResponse, |
| 84 | + GetContentStandardsRequest, |
| 85 | + GetContentStandardsResponse, |
| 86 | + GetCreativeDeliveryRequest, |
| 87 | + GetCreativeDeliveryResponse, |
| 88 | + GetCreativeFeaturesRequest, |
| 89 | + GetCreativeFeaturesResponse, |
| 90 | + GetMediaBuyArtifactsRequest, |
| 91 | + GetMediaBuyArtifactsResponse, |
| 92 | + GetMediaBuyDeliveryRequest, |
| 93 | + GetMediaBuyDeliveryResponse, |
| 94 | + GetMediaBuysRequest, |
| 95 | + GetMediaBuysResponse, |
| 96 | + GetPlanAuditLogsRequest, |
| 97 | + GetPlanAuditLogsResponse, |
| 98 | + GetProductsRequest, |
| 99 | + GetProductsResponse, |
| 100 | + GetPropertyListRequest, |
| 101 | + GetPropertyListResponse, |
| 102 | + GetRightsRequest, |
| 103 | + GetRightsSuccessResponse, |
| 104 | + GetSignalsRequest, |
| 105 | + GetSignalsResponse, |
| 106 | + ListCollectionListsRequest, |
| 107 | + ListCollectionListsResponse, |
| 108 | + ListContentStandardsRequest, |
| 109 | + ListContentStandardsResponse, |
| 110 | + ListCreativeFormatsRequest, |
| 111 | + ListCreativeFormatsResponse, |
| 112 | + ListCreativesRequest, |
| 113 | + ListCreativesResponse, |
| 114 | + ListPropertyListsRequest, |
| 115 | + ListPropertyListsResponse, |
| 116 | + PreviewCreativeRequest, |
| 117 | + PreviewCreativeResponse, |
| 118 | + ProvidePerformanceFeedbackRequest, |
| 119 | + ProvidePerformanceFeedbackResponse, |
| 120 | + ReportPlanOutcomeRequest, |
| 121 | + ReportPlanOutcomeResponse, |
| 122 | + SyncAudiencesRequest, |
| 123 | + SyncAudiencesSuccessResponse, |
| 124 | + SyncCreativesRequest, |
| 125 | + SyncCreativesSuccessResponse, |
| 126 | + SyncPlansRequest, |
| 127 | + SyncPlansResponse, |
| 128 | + UpdateCollectionListRequest, |
| 129 | + UpdateCollectionListResponse, |
| 130 | + UpdateContentStandardsRequest, |
| 131 | + UpdateContentStandardsResponse, |
| 132 | + UpdateMediaBuyRequest, |
| 133 | + UpdateMediaBuySuccessResponse, |
| 134 | + UpdatePropertyListRequest, |
| 135 | + UpdatePropertyListResponse, |
| 136 | + UpdateRightsRequest, |
| 137 | + UpdateRightsResponse, |
| 138 | + ValidateContentDeliveryRequest, |
| 139 | + ValidateContentDeliveryResponse, |
| 140 | +) |
| 141 | + |
45 | 142 | if TYPE_CHECKING: |
46 | 143 | from concurrent.futures import ThreadPoolExecutor |
47 | 144 |
|
|
50 | 147 | from adcp.decisioning.state import StateReader |
51 | 148 | from adcp.decisioning.task_registry import TaskRegistry |
52 | 149 | from adcp.decisioning.types import Account |
53 | | - from adcp.types import ( |
54 | | - AccountReference, |
55 | | - AcquireRightsRequest, |
56 | | - AcquireRightsResponse, |
57 | | - ActivateSignalRequest, |
58 | | - ActivateSignalSuccessResponse, |
59 | | - BuildCreativeRequest, |
60 | | - BuildCreativeResponse, |
61 | | - CalibrateContentRequest, |
62 | | - CalibrateContentResponse, |
63 | | - CheckGovernanceRequest, |
64 | | - CheckGovernanceResponse, |
65 | | - CreateCollectionListRequest, |
66 | | - CreateCollectionListResponse, |
67 | | - CreateContentStandardsRequest, |
68 | | - CreateContentStandardsResponse, |
69 | | - CreateMediaBuyRequest, |
70 | | - CreateMediaBuySuccessResponse, |
71 | | - CreatePropertyListRequest, |
72 | | - CreatePropertyListResponse, |
73 | | - DeleteCollectionListRequest, |
74 | | - DeleteCollectionListResponse, |
75 | | - DeletePropertyListRequest, |
76 | | - DeletePropertyListResponse, |
77 | | - GetBrandIdentityRequest, |
78 | | - GetBrandIdentitySuccessResponse, |
79 | | - GetCollectionListRequest, |
80 | | - GetCollectionListResponse, |
81 | | - GetContentStandardsRequest, |
82 | | - GetContentStandardsResponse, |
83 | | - GetCreativeDeliveryRequest, |
84 | | - GetCreativeDeliveryResponse, |
85 | | - GetCreativeFeaturesRequest, |
86 | | - GetCreativeFeaturesResponse, |
87 | | - GetMediaBuyArtifactsRequest, |
88 | | - GetMediaBuyArtifactsResponse, |
89 | | - GetMediaBuyDeliveryRequest, |
90 | | - GetMediaBuyDeliveryResponse, |
91 | | - GetMediaBuysRequest, |
92 | | - GetMediaBuysResponse, |
93 | | - GetPlanAuditLogsRequest, |
94 | | - GetPlanAuditLogsResponse, |
95 | | - GetProductsRequest, |
96 | | - GetProductsResponse, |
97 | | - GetPropertyListRequest, |
98 | | - GetPropertyListResponse, |
99 | | - GetRightsRequest, |
100 | | - GetRightsSuccessResponse, |
101 | | - GetSignalsRequest, |
102 | | - GetSignalsResponse, |
103 | | - ListCollectionListsRequest, |
104 | | - ListCollectionListsResponse, |
105 | | - ListContentStandardsRequest, |
106 | | - ListContentStandardsResponse, |
107 | | - ListCreativeFormatsRequest, |
108 | | - ListCreativeFormatsResponse, |
109 | | - ListCreativesRequest, |
110 | | - ListCreativesResponse, |
111 | | - ListPropertyListsRequest, |
112 | | - ListPropertyListsResponse, |
113 | | - PreviewCreativeRequest, |
114 | | - PreviewCreativeResponse, |
115 | | - ProvidePerformanceFeedbackRequest, |
116 | | - ProvidePerformanceFeedbackResponse, |
117 | | - ReportPlanOutcomeRequest, |
118 | | - ReportPlanOutcomeResponse, |
119 | | - SyncAudiencesRequest, |
120 | | - SyncAudiencesSuccessResponse, |
121 | | - SyncCreativesRequest, |
122 | | - SyncCreativesSuccessResponse, |
123 | | - SyncPlansRequest, |
124 | | - SyncPlansResponse, |
125 | | - UpdateCollectionListRequest, |
126 | | - UpdateCollectionListResponse, |
127 | | - UpdateContentStandardsRequest, |
128 | | - UpdateContentStandardsResponse, |
129 | | - UpdateMediaBuyRequest, |
130 | | - UpdateMediaBuySuccessResponse, |
131 | | - UpdatePropertyListRequest, |
132 | | - UpdatePropertyListResponse, |
133 | | - UpdateRightsRequest, |
134 | | - UpdateRightsResponse, |
135 | | - ValidateContentDeliveryRequest, |
136 | | - ValidateContentDeliveryResponse, |
137 | | - ) |
138 | 150 | from adcp.webhook_sender import WebhookSender |
139 | 151 |
|
140 | 152 |
|
|
0 commit comments