-
Notifications
You must be signed in to change notification settings - Fork 13
fix: remove inventory sync requirement for mock adapter #719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Problem: - Mock adapter has built-in mock inventory (via get_available_inventory) - Inventory browser/sync UI was accessible to ALL tenants - Mock adapter users got confusing GAM-specific error messages Solution: - Add adapter type check to inventory_browser route - Non-GAM tenants redirected with clear message - "Inventory browser is only available for Google Ad Manager" - Add adapter type check to sync_inventory endpoint - Non-GAM tenants get 400 error with clear message - Explains their adapter doesn't require inventory sync - Add comprehensive unit tests - Verify mock adapter has built-in inventory - Verify adapter type checks work correctly - All tests pass (4/4) Key points: - Mock adapter DOES have inventory (built-in, not synced) - Mock adapter explicitly skips inventory validation - Inventory sync UI now properly GAM-specific - Clear, helpful error messages for non-GAM adapters 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Problem: - Setup checklist validation was blocking create_media_buy for mock adapter - Error: "Setup incomplete. Please complete the following required tasks: - Inventory Sync: Sync ad units and placements from ad server" - Mock adapter has built-in inventory and should not require sync - Inventory sync check was applied to ALL adapters, not just GAM Root Cause: - setup_checklist_service.py:187-206 checked GAMInventory table for all adapters - Mock adapter doesn't populate GAMInventory (has built-in mock inventory) - This caused critical task to be marked incomplete, blocking media buy creation Solution: - Add adapter type check: only require inventory sync for GAM adapter - Mock adapter: auto-complete inventory sync task with clear description - GAM adapter: continue requiring GAMInventory records (unchanged behavior) Changes: - src/services/setup_checklist_service.py: - Check tenant.ad_server before requiring inventory sync - Mock adapter: task always complete, no action needed - GAM adapter: task requires GAMInventory records (existing behavior) - tests/unit/test_setup_checklist_mock_adapter.py: - Verify mock adapter inventory sync always complete - Verify GAM adapter still requires sync - Verify validate_setup_complete() allows mock without inventory - All 4 tests pass Impact: - Mock adapter users can now create media buys without syncing inventory - GAM adapter behavior unchanged (still requires inventory sync) - Setup checklist correctly shows adapter-specific requirements - Clearer error messages for users 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Address code review feedback - handle all adapter types properly Changes: - Fix adapter name inconsistency: "gam" → "google_ad_manager" (line 113) - Add explicit handling for Kevel and Triton adapters - Add default case for unknown/future adapters - Improve comments to clarify adapter-specific behavior Adapter-specific inventory behavior: - google_ad_manager: Requires GAMInventory sync (unchanged) - mock: Built-in inventory, auto-complete (unchanged) - kevel/triton: Inventory configured per product, auto-complete (new) - unknown: Shows warning but doesn't block, auto-complete (new) Impact: - All adapter types now handled explicitly - No silent failures for Kevel/Triton users - Future adapters won't cause unexpected behavior - Consistent adapter type string usage throughout Tests: All 8 tests still pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Update tests to use 'google_ad_manager' instead of 'gam' This aligns with the adapter type fix in setup checklist service Tests now pass with corrected adapter type string
When tenant.ad_server is None (no adapter selected), inventory sync should be marked incomplete, not auto-complete. Issue: Integration test was failing because tenant with ad_server=None fell through to the 'else' clause which marked inventory as complete. Fix: - Add explicit check for None/empty adapter at start of inventory logic - Mark as incomplete with message to configure ad server first - Add test case for None adapter scenario Tests: - Added test_no_adapter_selected_inventory_incomplete - All 9 tests pass (8 existing + 1 new) - Fixes CI failure in test_minimal_tenant_incomplete_setup
Contributor
Author
CI Fix AppliedFixed the failing integration test test_minimal_tenant_incomplete_setup. Issue: When tenant.ad_server = None (no adapter selected), the code was marking inventory sync as complete via the else clause. Fix: Added explicit check for None/empty adapter at the start of inventory sync logic to mark it as incomplete with clear messaging. Changes:
Tests:
Commit: f005e93 |
bokelley
added a commit
that referenced
this pull request
Nov 7, 2025
Resolved conflicts in schema metadata files: - schemas/v1/_schemas_v1_core_format_json.json.meta - schemas/v1/_schemas_v1_core_product_json.json.meta - schemas/v1/index.json.meta Conflicts were only in download timestamps and etags. Content hashes are identical, confirming schema content is the same. Accepted newer timestamps from main branch. Merged changes from PR #719 (remove inventory sync requirement for mock adapter). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
bokelley
added a commit
that referenced
this pull request
Nov 8, 2025
Resolved conflicts in schema metadata files: - schemas/v1/_schemas_v1_core_format_json.json.meta - schemas/v1/_schemas_v1_core_product_json.json.meta - schemas/v1/index.json.meta All conflicts were timestamp/etag updates from schema downloads. Used main's versions (more recent timestamps). Merged changes from main: - fix: require authentication for sync_creatives and update_media_buy (#721) - fix: signals agent test endpoint async handling (#718) - fix: remove inventory sync requirement for mock adapter (#719) - fix: remove /a2a suffix from A2A endpoint URLs and add name field to configs - Migrate agent registries to adcp v1.0.1 library (#712)
danf-newton
pushed a commit
to Newton-Research-Inc/salesagent
that referenced
this pull request
Nov 24, 2025
…tocol#719) * fix: restrict inventory sync UI to GAM adapter only Problem: - Mock adapter has built-in mock inventory (via get_available_inventory) - Inventory browser/sync UI was accessible to ALL tenants - Mock adapter users got confusing GAM-specific error messages Solution: - Add adapter type check to inventory_browser route - Non-GAM tenants redirected with clear message - "Inventory browser is only available for Google Ad Manager" - Add adapter type check to sync_inventory endpoint - Non-GAM tenants get 400 error with clear message - Explains their adapter doesn't require inventory sync - Add comprehensive unit tests - Verify mock adapter has built-in inventory - Verify adapter type checks work correctly - All tests pass (4/4) Key points: - Mock adapter DOES have inventory (built-in, not synced) - Mock adapter explicitly skips inventory validation - Inventory sync UI now properly GAM-specific - Clear, helpful error messages for non-GAM adapters 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: skip inventory sync requirement for mock adapter in setup checklist Problem: - Setup checklist validation was blocking create_media_buy for mock adapter - Error: "Setup incomplete. Please complete the following required tasks: - Inventory Sync: Sync ad units and placements from ad server" - Mock adapter has built-in inventory and should not require sync - Inventory sync check was applied to ALL adapters, not just GAM Root Cause: - setup_checklist_service.py:187-206 checked GAMInventory table for all adapters - Mock adapter doesn't populate GAMInventory (has built-in mock inventory) - This caused critical task to be marked incomplete, blocking media buy creation Solution: - Add adapter type check: only require inventory sync for GAM adapter - Mock adapter: auto-complete inventory sync task with clear description - GAM adapter: continue requiring GAMInventory records (unchanged behavior) Changes: - src/services/setup_checklist_service.py: - Check tenant.ad_server before requiring inventory sync - Mock adapter: task always complete, no action needed - GAM adapter: task requires GAMInventory records (existing behavior) - tests/unit/test_setup_checklist_mock_adapter.py: - Verify mock adapter inventory sync always complete - Verify GAM adapter still requires sync - Verify validate_setup_complete() allows mock without inventory - All 4 tests pass Impact: - Mock adapter users can now create media buys without syncing inventory - GAM adapter behavior unchanged (still requires inventory sync) - Setup checklist correctly shows adapter-specific requirements - Clearer error messages for users 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: improve adapter handling in setup checklist Address code review feedback - handle all adapter types properly Changes: - Fix adapter name inconsistency: "gam" → "google_ad_manager" (line 113) - Add explicit handling for Kevel and Triton adapters - Add default case for unknown/future adapters - Improve comments to clarify adapter-specific behavior Adapter-specific inventory behavior: - google_ad_manager: Requires GAMInventory sync (unchanged) - mock: Built-in inventory, auto-complete (unchanged) - kevel/triton: Inventory configured per product, auto-complete (new) - unknown: Shows warning but doesn't block, auto-complete (new) Impact: - All adapter types now handled explicitly - No silent failures for Kevel/Triton users - Future adapters won't cause unexpected behavior - Consistent adapter type string usage throughout Tests: All 8 tests still pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * test: fix inventory sync status tests to use correct adapter type Update tests to use 'google_ad_manager' instead of 'gam' This aligns with the adapter type fix in setup checklist service Tests now pass with corrected adapter type string * fix: handle None adapter in setup checklist inventory validation When tenant.ad_server is None (no adapter selected), inventory sync should be marked incomplete, not auto-complete. Issue: Integration test was failing because tenant with ad_server=None fell through to the 'else' clause which marked inventory as complete. Fix: - Add explicit check for None/empty adapter at start of inventory logic - Mark as incomplete with message to configure ad server first - Add test case for None adapter scenario Tests: - Added test_no_adapter_selected_inventory_incomplete - All 9 tests pass (8 existing + 1 new) - Fixes CI failure in test_minimal_tenant_incomplete_setup --------- Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Mock adapter users were blocked from creating media buys with error:
Root Cause: Setup checklist validation checked
GAMInventorytable for ALL adapters. Mock adapter has built-in inventory and doesn't populate this table, causing the critical task to be marked incomplete.Solution
1. Setup Checklist (
src/services/setup_checklist_service.py)2. UI Restrictions (
src/admin/blueprints/inventory.py)Changes
Core Logic:
src/services/setup_checklist_service.py- Adapter-aware inventory validationsrc/admin/blueprints/inventory.py- Restrict UI to GAM onlyTests (10 total, all passing):
tests/unit/test_setup_checklist_mock_adapter.py(4 tests)tests/unit/test_inventory_adapter_restrictions.py(4 tests)tests/unit/test_inventory_sync_status.py(2 tests, updated)Impact
✅ Mock adapter: Can now create media buys without inventory sync
✅ GAM adapter: Unchanged behavior (requires inventory sync)
✅ Kevel/Triton: Properly handled (inventory per product)
✅ UI/UX: Clear, adapter-specific messaging throughout
Testing
Code Review Feedback Addressed
✅ Fixed adapter name inconsistency ("gam" vs "google_ad_manager")
✅ Added explicit handling for Kevel and Triton adapters
✅ Added default case for unknown/future adapters
✅ Updated existing tests to use correct adapter types
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com