Skip to content

Commit a229459

Browse files
committed
fix(ci): restore storyboard fixture coverage
1 parent 98aebf5 commit a229459

5 files changed

Lines changed: 81 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,7 @@ jobs:
658658
adcp storyboard run \
659659
http://acme.localhost:3001/mcp media_buy_seller \
660660
--auth dev-bearer-token-acme-1 \
661+
--test-kit ../../tests/fixtures/storyboard-test-kit.yaml \
661662
--json --allow-http \
662663
> v3-storyboard-result.json
663664

examples/v3_reference_seller/src/platform.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2019,7 +2019,7 @@ async def list_creative_formats_legacy(
20192019
format-list endpoint (formats are publisher-defined, baked
20202020
into the upstream's product catalog). Real adopters drive this
20212021
from a creative-format registry."""
2022-
del req, ctx
2022+
del ctx
20232023
agent_url = "https://reference.adcp.org"
20242024
formats = [
20252025
LegacyFormat.model_validate(
@@ -2036,6 +2036,13 @@ async def list_creative_formats_legacy(
20362036
"description": "IAB standard 728x90 display banner.",
20372037
}
20382038
),
2039+
LegacyFormat.model_validate(
2040+
{
2041+
"format_id": {"agent_url": agent_url, "id": "video_30s"},
2042+
"name": "Video 30s",
2043+
"description": "Standard 30-second video creative.",
2044+
}
2045+
),
20392046
LegacyFormat.model_validate(
20402047
{
20412048
"format_id": {"agent_url": agent_url, "id": "video_16x9_30s"},
@@ -2044,7 +2051,20 @@ async def list_creative_formats_legacy(
20442051
}
20452052
),
20462053
]
2047-
self._record("creatives.formats", {})
2054+
if req.format_ids:
2055+
requested = {
2056+
(str(format_id.agent_url).rstrip("/"), format_id.id) for format_id in req.format_ids
2057+
}
2058+
formats = [
2059+
format_
2060+
for format_ in formats
2061+
if (
2062+
str(format_.format_id.agent_url).rstrip("/"),
2063+
format_.format_id.id,
2064+
)
2065+
in requested
2066+
]
2067+
self._record("creatives.formats", {"format_ids": len(req.format_ids or [])})
20482068
return ListCreativeFormatsResponse(formats=formats)
20492069

20502070
# ----- list_creatives --------------------------------------------------

examples/v3_reference_seller/tests/test_smoke_broadening.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,6 +1719,30 @@ async def test_list_creative_formats_is_static_no_upstream_call() -> None:
17191719
assert respx_mock.calls.call_count == 0
17201720

17211721

1722+
@pytest.mark.asyncio
1723+
async def test_list_creative_formats_filters_requested_ids() -> None:
1724+
"""The static catalog honors the exact IDs returned by get_products."""
1725+
from adcp.types import LegacyListCreativeFormatsRequest
1726+
1727+
platform = _platform_with_upstream()
1728+
ctx = _build_ctx()
1729+
resp = await platform.list_creative_formats_legacy(
1730+
LegacyListCreativeFormatsRequest.model_validate(
1731+
{
1732+
"format_ids": [
1733+
{
1734+
"agent_url": "https://reference.adcp.org/",
1735+
"id": "video_30s",
1736+
}
1737+
]
1738+
}
1739+
),
1740+
ctx,
1741+
)
1742+
1743+
assert [format_.format_id.id for format_ in resp.formats] == ["video_30s"]
1744+
1745+
17221746
@pytest.mark.asyncio
17231747
@respx.mock(base_url=_RESPX_BASE_URL)
17241748
async def test_update_media_buy_rejects_foreign_advertiser_order(respx_mock: Any) -> None:

scripts/ci/run_storyboard_reference_seller.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# PYTHON=python3
1313
# ADCP_PYTHON_VENV=.context/storyboard-reference-seller-venv
1414
# ADCP_SDK_ROOT=/path/to/@adcp/sdk
15+
# ADCP_TEST_KIT=tests/fixtures/storyboard-test-kit.yaml
1516
#
1617
# The script assumes it is running from an adcp-client-python checkout,
1718
# installs the Python dependencies needed by examples/seller_agent.py,
@@ -32,6 +33,7 @@ ADCP_RUNNER_BIN="${ADCP_RUNNER_BIN:-}"
3233
ADCP_SDK_VERSION="${ADCP_SDK_VERSION:-}"
3334
ADCP_SDK_TARBALL="${ADCP_SDK_TARBALL:-}"
3435
ADCP_SDK_ROOT="${ADCP_SDK_ROOT:-}"
36+
ADCP_TEST_KIT="${ADCP_TEST_KIT:-$ROOT/tests/fixtures/storyboard-test-kit.yaml}"
3537

3638
fail() {
3739
echo "ERROR: $*" >&2
@@ -194,6 +196,16 @@ trap cleanup EXIT
194196
install_or_select_runner
195197
install_python_dependencies
196198

199+
STORYBOARD_ARGS=(
200+
storyboard run
201+
"http://127.0.0.1:${ADCP_PORT}/mcp" media_buy_seller
202+
--json --allow-http
203+
)
204+
if "$ADCP_RUNNER_BIN" storyboard run --help | grep -q -- '--test-kit'; then
205+
[[ -f "$ADCP_TEST_KIT" ]] || fail "ADCP_TEST_KIT not found: $ADCP_TEST_KIT"
206+
STORYBOARD_ARGS+=(--test-kit "$ADCP_TEST_KIT")
207+
fi
208+
197209
mkdir -p "$(dirname "$STORYBOARD_RESULT_PATH")"
198210
echo "Starting examples/seller_agent.py on port $ADCP_PORT"
199211
ADCP_PORT="$ADCP_PORT" "$PYTHON" examples/seller_agent.py >"$SELLER_LOG_PATH" 2>&1 &
@@ -202,10 +214,7 @@ wait_for_seller "$SELLER_PID"
202214

203215
echo "Running media_buy_seller storyboard"
204216
set +e
205-
"$ADCP_RUNNER_BIN" storyboard run \
206-
"http://127.0.0.1:${ADCP_PORT}/mcp" media_buy_seller \
207-
--json --allow-http \
208-
>"$STORYBOARD_RESULT_PATH"
217+
"$ADCP_RUNNER_BIN" "${STORYBOARD_ARGS[@]}" >"$STORYBOARD_RESULT_PATH"
209218
RUNNER_STATUS=$?
210219
set -e
211220

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Deterministic creative inputs for @adcp/sdk storyboard runs. The runner
2+
# selects the first fixture satisfying the seller-declared slot constraints;
3+
# these URLs are opaque test values and are never fetched by the examples.
4+
assets:
5+
images:
6+
- url: https://fixtures.example.com/display-300x250.png
7+
width: 300
8+
height: 250
9+
mime_type: image/png
10+
- url: https://fixtures.example.com/display-970x250.png
11+
width: 970
12+
height: 250
13+
mime_type: image/png
14+
text:
15+
headlines:
16+
- Test campaign headline
17+
descriptions:
18+
- Deterministic storyboard creative description.
19+
cta:
20+
- Learn more
21+
click_url: https://fixtures.example.com/landing-page

0 commit comments

Comments
 (0)