Skip to content

Commit af94df2

Browse files
Merge pull request #607 from adcontextprotocol/EmmaLouise2018/fix-gam-package-id
Fix all adapters to return packages with package_id
2 parents 007d830 + e3817a7 commit af94df2

File tree

98 files changed

+1490
-644
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+1490
-644
lines changed

alembic/versions/e38f2f6f395a_add_mock_manual_approval_required.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,33 @@
55
Create Date: 2025-10-23 20:06:20.766732
66
77
"""
8-
from typing import Sequence, Union
98

10-
from alembic import op
9+
from collections.abc import Sequence
10+
1111
import sqlalchemy as sa
1212

13+
from alembic import op
1314

1415
# revision identifiers, used by Alembic.
15-
revision: str = 'e38f2f6f395a'
16-
down_revision: Union[str, Sequence[str], None] = 'faaed3b71428'
17-
branch_labels: Union[str, Sequence[str], None] = None
18-
depends_on: Union[str, Sequence[str], None] = None
16+
revision: str = "e38f2f6f395a"
17+
down_revision: str | Sequence[str] | None = "faaed3b71428"
18+
branch_labels: str | Sequence[str] | None = None
19+
depends_on: str | Sequence[str] | None = None
1920

2021

2122
def upgrade() -> None:
2223
"""Upgrade schema."""
2324
# Add mock_manual_approval_required column to adapter_config table
24-
op.add_column('adapter_config', sa.Column('mock_manual_approval_required', sa.Boolean(), nullable=True))
25+
op.add_column("adapter_config", sa.Column("mock_manual_approval_required", sa.Boolean(), nullable=True))
2526

2627
# Set default value to False for ALL existing rows (not just mock adapters)
2728
op.execute("UPDATE adapter_config SET mock_manual_approval_required = false")
2829

2930
# Make the column non-nullable after setting defaults
30-
op.alter_column('adapter_config', 'mock_manual_approval_required', nullable=False, server_default=sa.false())
31+
op.alter_column("adapter_config", "mock_manual_approval_required", nullable=False, server_default=sa.false())
3132

3233

3334
def downgrade() -> None:
3435
"""Downgrade schema."""
3536
# Remove mock_manual_approval_required column
36-
op.drop_column('adapter_config', 'mock_manual_approval_required')
37+
op.drop_column("adapter_config", "mock_manual_approval_required")

examples/upstream_product_catalog_server.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,23 @@ async def match_products(self, brief: str, all_products: list[dict[str, Any]]) -
164164
prompt = f"""Given this advertising brief: "{brief}"
165165
166166
And these available products:
167-
{json.dumps([{
168-
'id': p['product_id'],
169-
'name': p['name'],
170-
'description': p['description'],
171-
'formats': [f['type'] for f in p['formats']],
172-
'targeting': p.get('targeting_template', {}),
173-
'price': p.get('cpm') or p.get('price_guidance', {}).get('p50', 'variable'),
174-
'special_features': p.get('availability', {})
175-
} for p in all_products], indent=2)}
167+
{
168+
json.dumps(
169+
[
170+
{
171+
"id": p["product_id"],
172+
"name": p["name"],
173+
"description": p["description"],
174+
"formats": [f["type"] for f in p["formats"]],
175+
"targeting": p.get("targeting_template", {}),
176+
"price": p.get("cpm") or p.get("price_guidance", {}).get("p50", "variable"),
177+
"special_features": p.get("availability", {}),
178+
}
179+
for p in all_products
180+
],
181+
indent=2,
182+
)
183+
}
176184
177185
Select the most relevant products (up to 3) and return as JSON:
178186
{{

scripts/audit_e2e_tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
3. Redundant tests
77
4. Tests with excessive tool calls
88
"""
9+
910
import re
1011
import sys
1112
from collections import defaultdict

scripts/deploy/fly-proxy.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Simple HTTP proxy for Fly.io deployment to route between MCP server and Admin UI
44
"""
5+
56
import asyncio
67
import logging
78

scripts/maintenance/audit_all_production_products.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@ def audit_all_products():
4545
if not data["pricing_options"]:
4646
missing_pricing.append(data["product"])
4747

48-
print(f"\n{'='*80}")
48+
print(f"\n{'=' * 80}")
4949
print("PRODUCTION PRODUCT PRICING AUDIT")
50-
print(f"{'='*80}\n")
50+
print(f"{'=' * 80}\n")
5151

5252
print(f"Total products in database: {len(products_by_id)}")
5353
print(f"Products WITH pricing_options: {len(products_by_id) - len(missing_pricing)}")
5454
print(f"Products MISSING pricing_options: {len(missing_pricing)}")
5555

5656
if missing_pricing:
57-
print(f"\n{'='*80}")
57+
print(f"\n{'=' * 80}")
5858
print("⚠️ PRODUCTS MISSING PRICING_OPTIONS (BLOCKING MIGRATION)")
59-
print(f"{'='*80}\n")
59+
print(f"{'=' * 80}\n")
6060

6161
for product in missing_pricing:
6262
print(f"❌ {product.product_id}")
@@ -65,9 +65,9 @@ def audit_all_products():
6565
print(f" Delivery Type: {product.delivery_type}")
6666
print()
6767

68-
print(f"{'='*80}")
68+
print(f"{'=' * 80}")
6969
print("⚠️ ACTION REQUIRED")
70-
print(f"{'='*80}\n")
70+
print(f"{'=' * 80}\n")
7171
print("These products MUST have pricing_options added before migration can proceed.")
7272
print("\nRecommended fix (run in Fly.io SSH console):")
7373
print("\n```python")

scripts/ops/aggregate_format_metrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def main():
5151
args = parser.parse_args()
5252

5353
logger.info(
54-
f"Starting format metrics aggregation (period_days={args.period_days}, " f"tenant_id={args.tenant_id or 'all'})"
54+
f"Starting format metrics aggregation (period_days={args.period_days}, tenant_id={args.tenant_id or 'all'})"
5555
)
5656

5757
try:

scripts/ops/gam_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def test_gam_connection(tenant_id: str) -> dict:
122122

123123
return {
124124
"success": True,
125-
"message": f'Successfully connected to GAM network: {network["displayName"]} (ID: {network["id"]})',
125+
"message": f"Successfully connected to GAM network: {network['displayName']} (ID: {network['id']})",
126126
}
127127

128128
except Exception as e:

scripts/ops/get_tokens.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env python3
22
"""Quick script to get tokens from the database."""
33

4-
54
from src.core.database.database_session import get_db_session
65
from src.core.database.models import Principal, Tenant
76

scripts/ops/show_principal_mappings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python3
22
"""Show detailed platform mappings for all principals in a tenant."""
3+
34
import json
45
import sys
56

@@ -19,7 +20,7 @@ def show_mappings(tenant_name=None):
1920
principals = session.query(Principal).all()
2021

2122
for principal in principals:
22-
print(f"\n{'='*80}")
23+
print(f"\n{'=' * 80}")
2324
print(f"Name: {principal.name}")
2425
print(f"Principal ID: {principal.principal_id}")
2526
print(f"Tenant ID: {principal.tenant_id}")

scripts/ops/sync_all_tenants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def sync_all_gam_tenants():
5656
try:
5757
# Call sync API
5858
response = requests.post(
59-
f'http://localhost:{os.environ.get("ADMIN_UI_PORT", 8001)}/api/v1/sync/trigger/{tenant_id}',
59+
f"http://localhost:{os.environ.get('ADMIN_UI_PORT', 8001)}/api/v1/sync/trigger/{tenant_id}",
6060
headers={"X-API-Key": api_key},
6161
json={"sync_type": "full"},
6262
timeout=300, # 5 minute timeout per tenant

0 commit comments

Comments
 (0)