feat(examples): add 4 spec-required sales-* methods to v3 reference seller#394
Draft
feat(examples): add 4 spec-required sales-* methods to v3 reference seller#394
Conversation
…eller Closes #376 Implements the four optional-but-required-in-v6.0-rc.1 methods for the sales-non-guaranteed specialism in examples/v3_reference_seller: - get_media_buys: queries existing MediaBuy table (tenant+account scoped) - provide_performance_feedback: persists to new PerformanceFeedback ORM table - list_creative_formats: static stub (empty catalog; extend for production) - list_creatives: stub (defers sync_creatives persistence wiring) Adds PerformanceFeedback SQLAlchemy model with idempotency-key unique constraint (perf_feedback_idem_uk), mirroring MediaBuy replay-safety pattern. Smoke tests updated to cover all nine methods and the new table. https://claude.ai/code/session_01R5JrFxdiswxFhwvEr3SWAd
Pre-PR review (dx-expert) flagged that silently dropping media buys missing total_budget/currency made debugging impossible for adopters. Add logger.warning with the media_buy_id so the skip is visible in logs. https://claude.ai/code/session_01R5JrFxdiswxFhwvEr3SWAd
PerformanceFeedback is now the sixth model used by the platform; update the "All five" reference to "All six". https://claude.ai/code/session_01R5JrFxdiswxFhwvEr3SWAd
5 tasks
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
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.
Closes #376
Adds the four
sales-non-guaranteedspecialism methods thatvalidate_platform()will require in v6.0 rc.1. The v3 reference seller previously declared the specialism but only implemented the five core methods; this PR completes the surface so adopters forking it won't fail the boot check.What changed
examples/v3_reference_seller/src/models.py— newPerformanceFeedbackSQLAlchemy model (mirrors theMediaBuyidempotency-key pattern):tenant_id/account_idFKs,media_buy_id,idempotency_key(unique per tenant viaperf_feedback_idem_uk), perf fields (performance_index,measurement_periodJSON,metric_type,package_id,creative_id,feedback_source),received_at/created_attimestamps.examples/v3_reference_seller/src/platform.py— four new async methods onV3ReferenceSeller:get_media_buys— queries existingMediaBuytable (tenant + account scoped), supports optionalmedia_buy_ids/status_filternarrowing. Rows missing wire-requiredtotal_budgetorcurrencyare skipped with alogger.warning(production adopters should enforce budget at creation time).provide_performance_feedback— inserts aPerformanceFeedbackRow; DB-level idempotency viaperf_feedback_idem_uk. ReturnsProvidePerformanceFeedbackSuccessResponse(success=True).list_creative_formats— stub returning empty catalog. Extend for production by querying aCreativeFormattable or fetching from a creative management platform.list_creatives— stub returning empty list. Full persistence (wiringsync_creatives→Creativetable) is deferred to a follow-up.examples/v3_reference_seller/tests/test_smoke.py— four new tests: all-nine-methods presence check,list_creative_formatsresponse validity,list_creativesresponse validity, andperf_feedback_idem_ukconstraint assertion.Nits (not fixed — noted for reviewers)
list_creativesreturning empty is intentional; wiringsync_creativespersistence is a separate concern.PerformanceFeedback.performance_indexis nullable in the ORM (defensive for schema evolution) but always populated on insert from the required wire field.CREATE TABLEflow per README.What tested
ruff check examples/v3_reference_seller/— cleanpytest examples/v3_reference_seller/tests/ -v— 11 passed (7 pre-existing + 4 new)pytest tests/ -q --ignore=tests/conformance— 2715 passed, 18 skipped (no regressions)Pre-PR review
get_media_buysSession: https://claude.ai/code/session_01R5JrFxdiswxFhwvEr3SWAd
Generated by Claude Code