Skip to content

feat(examples): add 4 spec-required sales-* methods to v3 reference seller#394

Draft
bokelley wants to merge 3 commits intomainfrom
claude/issue-376-v3-ref-seller-sales-methods
Draft

feat(examples): add 4 spec-required sales-* methods to v3 reference seller#394
bokelley wants to merge 3 commits intomainfrom
claude/issue-376-v3-ref-seller-sales-methods

Conversation

@bokelley
Copy link
Copy Markdown
Contributor

@bokelley bokelley commented May 3, 2026

Closes #376

Adds the four sales-non-guaranteed specialism methods that validate_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 — new PerformanceFeedback SQLAlchemy model (mirrors the MediaBuy idempotency-key pattern): tenant_id / account_id FKs, media_buy_id, idempotency_key (unique per tenant via perf_feedback_idem_uk), perf fields (performance_index, measurement_period JSON, metric_type, package_id, creative_id, feedback_source), received_at / created_at timestamps.

examples/v3_reference_seller/src/platform.py — four new async methods on V3ReferenceSeller:

  • get_media_buys — queries existing MediaBuy table (tenant + account scoped), supports optional media_buy_ids / status_filter narrowing. Rows missing wire-required total_budget or currency are skipped with a logger.warning (production adopters should enforce budget at creation time).
  • provide_performance_feedback — inserts a PerformanceFeedbackRow; DB-level idempotency via perf_feedback_idem_uk. Returns ProvidePerformanceFeedbackSuccessResponse(success=True).
  • list_creative_formats — stub returning empty catalog. Extend for production by querying a CreativeFormat table or fetching from a creative management platform.
  • list_creatives — stub returning empty list. Full persistence (wiring sync_creativesCreative table) is deferred to a follow-up.

examples/v3_reference_seller/tests/test_smoke.py — four new tests: all-nine-methods presence check, list_creative_formats response validity, list_creatives response validity, and perf_feedback_idem_uk constraint assertion.

Nits (not fixed — noted for reviewers)

  • list_creatives returning empty is intentional; wiring sync_creatives persistence is a separate concern.
  • PerformanceFeedback.performance_index is nullable in the ORM (defensive for schema evolution) but always populated on insert from the required wire field.
  • No Alembic migration included — reference seller uses docker-compose CREATE TABLE flow per README.

What tested

  • ruff check examples/v3_reference_seller/ — clean
  • pytest 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

  • code-reviewer: approved — no blockers; stale "five"→"six" docstring nit fixed before opening
  • dx-expert: approved after logger.warning fix for silent-skip path in get_media_buys

Triage-managed PR. This bot does not currently iterate on
review comments or PR conversation threads (only on the source
issue). To unblock:

  • Push fixup commits directly: gh pr checkout <num>
    fix → push.
  • Or re-trigger: comment /triage execute on the source
    issue.

See adcp#3121
for context.

Session: https://claude.ai/code/session_01R5JrFxdiswxFhwvEr3SWAd


Generated by Claude Code

claude added 3 commits May 3, 2026 00:44
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(v3-ref-seller): implement 4 spec-required sales-* methods (get_media_buys, provide_performance_feedback, list_creative_formats, list_creatives)

2 participants