{
  "title": "From an agent request to recorded delivery",
  "kind": "inspected-fixture replay backed by a focused test run",
  "environment": "Local integration test with synthetic CTV inventory",
  "literalApiCapture": false,
  "test": "adcp_buy_over_mcp_wins_an_auction",
  "result": "1 passed; 0 failed; 2 filtered out",
  "runStartedAt": "2026-10-27T20:50:33.410399+00:00",
  "sourceFile": "crates/mdsp-server/tests/e2e.rs",
  "sourceSha256": "95352ca1f0117c3cfa499829009e6d47644148b7c0816e91069ee12a60b83059",
  "testBinarySha256": "c9c3fa1196d34aad66d34891a4a7476618fa6eca8876d33e65ad206c82170e1a",
  "buildNote": "Ran an existing test binary directly. No cargo build or source edit. The engine working tree contains concurrent uncommitted work. This records the exact binary hash and inspected test source, not a reproducible pristine release built from the observed HEAD.",
  "policy": {
    "principal": {
      "id": "prn_agency",
      "name": "Agency buyer agent",
      "scopes": [
        "read",
        "write"
      ],
      "sandbox": false,
      "max_budget_per_buy": null,
      "max_active_budget": null,
      "approval_threshold": null
    },
    "auto_provision_accounts": true,
    "auto_approve_creatives": true,
    "media_buy_activation": "automatic",
    "operator_approval_exercised": false,
    "explanation": "The fixture uses default principal limits with no approval threshold. The buy becomes active automatically. Operator approval is a separate configurable engine path and is not demonstrated by this test.",
    "environment": "In-process application router, in-memory store, temporary event spool, one-second event flush interval. Supply refresh is disabled and documentation IP addresses are allowed."
  },
  "steps": [
    {
      "id": "creative",
      "title": "The agent supplies a creative",
      "operation": "sync_creatives over MCP",
      "input": {
        "brand_domain": "acme.example",
        "creative_id": "acme-spot-30",
        "format_id": "ctv_vast_30s",
        "vast_tag_url": "https://ads.acme.example/vast/spot30.xml",
        "vast_version": "4.2",
        "duration_ms": 30000
      },
      "verified_result": {
        "creatives[0].action": "created"
      },
      "proof": "The focused test asserts that the creative sync returns action created. This is a synthetic buyer VAST URL, not a captured production creative or video playback."
    },
    {
      "id": "buy",
      "title": "The media buy becomes active",
      "operation": "create_media_buy over MCP",
      "input": {
        "product_id": "prd_ctv_premium",
        "pricing_option_id": "ctv_fixed_cpm",
        "budget": 6000,
        "currency": "USD",
        "start_time": "asap",
        "end_time_rule": "Test run time plus seven days",
        "pacing": "asap",
        "creative_id": "acme-spot-30"
      },
      "verified_result": {
        "media_buy_status": "active"
      },
      "proof": "The test asserts active status. The fixture's USD product has a fixed CPM of 30. No operator approval action is sent. Generated media buy and package IDs are not printed by the test, so this replay does not invent them."
    },
    {
      "id": "bid",
      "title": "The engine answers the auction",
      "operation": "POST /openrtb2/bid",
      "input": {
        "auction_id": "e2e-auction-1",
        "inventory": "Synthetic CTV app",
        "currency": "USD",
        "bidfloor_cpm": 20,
        "video_max_duration_seconds": 30,
        "video_size": [
          1920,
          1080
        ]
      },
      "verified_result": {
        "http_status": 200,
        "bid_price_cpm": 30,
        "adomain": [
          "acme.example"
        ],
        "ad_markup_type": "VAST Wrapper",
        "wrapped_tag_url": "https://ads.acme.example/vast/spot30.xml",
        "campaign_reference": "Matches the generated media_buy_id",
        "signed_tracking_reference": "Matches the generated package_id"
      },
      "proof": "The test polls while the catalog watcher rebuilds the targeting index. It decodes the successful bid response and asserts price, advertiser domain, campaign reference, Wrapper markup and signed package reference. A bid response alone is not proof of a real exchange win."
    },
    {
      "id": "billing",
      "title": "A synthetic billing event records the price",
      "operation": "GET the returned billing URL",
      "input": {
        "auction_price_macro_value": 25.5,
        "currency": "USD",
        "price_unit": "CPM"
      },
      "verified_result": {
        "http_status_class": "success"
      },
      "proof": "The test client replaces the AUCTION_PRICE macro in the returned billing URL with 25.5 and calls the in-process event endpoint. This simulates the exchange billing callback. There is no live exchange or publisher in this run."
    },
    {
      "id": "delivery",
      "title": "The agent reads delivery back",
      "operation": "get_media_buy_delivery over MCP",
      "input": {
        "media_buy_reference": "The buy created in step two"
      },
      "verified_result": {
        "impressions": 1,
        "spend": 0.0255,
        "currency": "USD"
      },
      "proof": "After the event flush, the test asserts one impression and 0.0255 spend. That equals one impression at a 25.50 USD clearing CPM. This is synthetic test delivery, not a production customer result."
    }
  ]
}
