Skip to content

Commit 6f3faa0

Browse files
bokelleyclaude
andcommitted
fix(decisioning): handle Specialism|str union in create_media_buy_store
Post-rebase fix. ``create_media_buy_store`` (added in adcontextprotocol#474, landed after this branch was originally cut) intersects ``capabilities.specialisms`` against a string set to gate ``targeting_overlay`` echo on the seller's ``property-lists`` / ``collection-lists`` claim. Per adcontextprotocol#479, ``capabilities.specialisms`` is now ``list[Specialism | str]`` — spec-known slugs are coerced to ``Specialism`` enum members at construction. The naive ``set(capabilities.specialisms) & _OVERLAY_ECHO_SPECIALISMS`` was an empty intersection because ``Specialism.property_lists != "property-lists"``, silently routing every adopter to the no-op wrapper regardless of their declaration. Fix: extract slug uniformly via ``.value`` (with the same hasattr pattern other readers use) before intersecting. The wrapper now correctly activates when the seller declares either spec slug, whether passed as enum or string. 10 ``test_media_buy_store.py`` tests pass; 3,469 unit tests overall. Refs adcontextprotocol#479 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b72b744 commit 6f3faa0

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/adcp/decisioning/media_buy_store.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,14 @@ def create_media_buy_store(
188188
assignment site (``platform.media_buy_store = ...``) without
189189
aliasing the underlying persistence layer.
190190
"""
191-
claimed = set(capabilities.specialisms) & _OVERLAY_ECHO_SPECIALISMS
191+
# ``capabilities.specialisms`` is ``list[Specialism | str]`` per #479
192+
# — spec-known slugs are coerced to ``Specialism`` enum members at
193+
# construction; novel/typo slugs pass through as strings. Extract the
194+
# slug uniformly before set intersection.
195+
declared_slugs = {
196+
entry.value if hasattr(entry, "value") else entry for entry in capabilities.specialisms
197+
}
198+
claimed = declared_slugs & _OVERLAY_ECHO_SPECIALISMS
192199
if claimed:
193200
return _ActiveMediaBuyStore(adopter_store)
194201
return _NoopMediaBuyStore(adopter_store)

0 commit comments

Comments
 (0)