Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Adapter: Smoot #4148

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

New Adapter: Smoot #4148

wants to merge 4 commits into from

Conversation

leamarty
Copy link

Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 7c0f3cf

smoot

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/smoot/smoot.go:29:	Builder		100.0%
github.com/prebid/prebid-server/v3/adapters/smoot/smoot.go:36:	MakeRequests	74.2%
github.com/prebid/prebid-server/v3/adapters/smoot/smoot.go:86:	makeRequest	85.7%
github.com/prebid/prebid-server/v3/adapters/smoot/smoot.go:104:	MakeBids	100.0%
github.com/prebid/prebid-server/v3/adapters/smoot/smoot.go:141:	getBidType	100.0%
total:								(statements)	85.9%

@bsardo bsardo added the adapter label Jan 14, 2025
@ccorbo
Copy link
Contributor

ccorbo commented Jan 17, 2025

Confirmed endpoint:
image

@leamarty
Copy link
Author

Thank you @ccorbo ! I imagine we'll need a couple approvals here, right?

Docs were already approved btw: prebid/prebid.github.io#5811

@ccorbo
Copy link
Contributor

ccorbo commented Jan 22, 2025

Validated user sync endpoint and cookie being set
image

Cookie set:
image

Email sent to maintainer email adress for verification

@ccorbo
Copy link
Contributor

ccorbo commented Jan 22, 2025

Thank you @ccorbo ! I imagine we'll need a couple approvals here, right?

Docs were already approved btw: prebid/prebid.github.io#5811

Hello! - Yes you will need other approvals as well, it is in the queue.

@leamarty
Copy link
Author

Thank you @ccorbo ! I'll stay tuned then. By the way:

Email sent to maintainer email adress for verification

Did you send the email to [email protected]? We didn't receive anything yet

@@ -0,0 +1,136 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: rename to simple-app-banner.json to easily differentiate between the simple-web-banner.json

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done ✅

var bidderExt adapters.ExtImpBidder
var smootExt openrtb_ext.ImpExtSmoot

if err := jsonutil.Unmarshal(imp.Ext, &bidderExt); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add test coverage on these unmarshal errors

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, sorry for that. Done ✅

headers.Add("Content-Type", "application/json;charset=utf-8")
headers.Add("Accept", "application/json")
return &adapters.RequestData{
Method: "POST",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: use http.MethodPost

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks! Done ✅

@ccorbo
Copy link
Contributor

ccorbo commented Jan 22, 2025

Thank you @ccorbo ! I'll stay tuned then. By the way:

Email sent to maintainer email adress for verification

Did you send the email to [email protected]? We didn't receive anything yet

Sorry about that - missed hitting the send button before I posted that. Just sent it over

@ccorbo
Copy link
Contributor

ccorbo commented Jan 22, 2025

Verified maintainer email address

@bsardo bsardo self-assigned this Jan 22, 2025
Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 4fefda1

smoot

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/smoot/smoot.go:29:	Builder		100.0%
github.com/prebid/prebid-server/v3/adapters/smoot/smoot.go:36:	MakeRequests	87.1%
github.com/prebid/prebid-server/v3/adapters/smoot/smoot.go:86:	makeRequest	85.7%
github.com/prebid/prebid-server/v3/adapters/smoot/smoot.go:104:	MakeBids	100.0%
github.com/prebid/prebid-server/v3/adapters/smoot/smoot.go:141:	getBidType	100.0%
total:								(statements)	92.2%

@leamarty leamarty requested a review from ccorbo January 23, 2025 08:35
@leamarty
Copy link
Author

Hi @ccorbo @bsardo

Just wanted to know if there's any update on this. I'll appreciate a review & merge since we are waiting on it 🙏🏻

Thanks!

Copy link
Contributor

@ccorbo ccorbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM from my POV - will need another approval from another reviewer however

@leamarty
Copy link
Author

Awesome, thank you @ccorbo . Who should I reach to get the final approval?

@bsardo
Copy link
Collaborator

bsardo commented Jan 29, 2025

Hi @leamarty, I'll review tomorrow and get back to you. Thanks for your patience.

@leamarty
Copy link
Author

Awesome, thank you @bsardo ! Any news?

Copy link
Collaborator

@bsardo bsardo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a few minor comments.

Comment on lines +44 to +45
`{"placementId": 42}`,
`{"endpointId": 42}`,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the following test cases to test the minimum length:

`{"placementId": ""}`
`{"endpointId": ""}`

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done ✅

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding these two separate test cases instead of combining them into one test case like you have ({"placementId": "", "endpointId": ""} ensures that there is a min length constraint on each field instead of on at least one of the fields. I suggest making this change.

if smootExt.PlacementID != "" {
impExt.SmootBidderExt.PlacementID = smootExt.PlacementID
impExt.SmootBidderExt.Type = "publisher"
} else if smootExt.EndpointID != "" {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This conditional can be deleted with the else if just becoming an else since you've guaranteed that your bidder will only be called if placementId or endpointId is set based on how you've defined your bidder parameters.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done ✅

Comment on lines +125 to +132
bid := seatBid.Bid[i]
bidType, err := getBidType(bid)
if err != nil {
return nil, []error{err}
}

b := &adapters.TypedBid{
Bid: &seatBid.Bid[i],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you have works. I'll leave it up to you but you can optimize this with a couple of simple tweaks so you don't ever copy the bid (which you're doing twice) but rather copy the bid address and pass that reference around to read the mtype and to include in the typed bid:

bid := &seatBid.Bid[i]
bidType, err := getBidType(bid)
if err != nil {
    return nil, []error{err}
}

b := &adapters.TypedBid{
    Bid:     bid,
    ....

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decided not to do it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use underscores in the file name: bad-media-type.json

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done ✅

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use underscores in the file name: bad-response.json

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done ✅

Comment on lines +89 to +94
"mockResponse": {
"status": 204
}
}
],
"expectedBidResponses": []
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is debatable and I know some adapters have done this but for an exemplary test like this, I would expect to see a happy path 200 with at least one bid, especially when we have a supplemental 204 test case defined.

Comment on lines 2 to 12
"mockBidRequest": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"ext": {
"bidder": 999
}
}
]
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: this gets the job done as far as forcing the error path. I suggest making this a stripped down valid mockBidRequest with just the imp[0].ext.bidder being invalid:

"mockBidRequest": {
    "id": "test-request-id",
    "imp": [
      {
        "id": "test-imp-id",
        "banner": {
          "format": [
            {
              "w": 300,
              "h": 250
            }
          ]
        },
        "ext": {
          "bidder": {
            "placementId": 999
          }
        }
      }
    ],
    "app": {
      "id": "1",
      "bundle": "com.wls.testwlsapplication"
    }
},

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done ✅

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: same suggestion as on invalid-bidder.json regarding minimum valid request with just the ext being invalid.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done ✅

@bsardo
Copy link
Collaborator

bsardo commented Jan 31, 2025

Also can you please merge with master? One of the validate jobs is failing because your branch is off of a version of master that contains a PR that has since been reverted. The validate job should then start passing.

Copy link

github-actions bot commented Feb 3, 2025

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, e61e169

smoot

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/smoot/smoot.go:29:	Builder		100.0%
github.com/prebid/prebid-server/v3/adapters/smoot/smoot.go:36:	MakeRequests	86.7%
github.com/prebid/prebid-server/v3/adapters/smoot/smoot.go:86:	makeRequest	85.7%
github.com/prebid/prebid-server/v3/adapters/smoot/smoot.go:104:	MakeBids	100.0%
github.com/prebid/prebid-server/v3/adapters/smoot/smoot.go:141:	getBidType	100.0%
total:								(statements)	92.1%

@leamarty
Copy link
Author

leamarty commented Feb 3, 2025

Thank you so much for your comments @bsardo ! We already went through them.

Please I'd ask you to have some speed on the remaining approval, since we've been waiting for 3 weeks already and we may get another "out of date" situation with the master branch.

Thanks!

Copy link
Collaborator

@bsardo bsardo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're close. I have just two comments stemming from previous ones.

Comment on lines 2 to 18
"mockBidRequest": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"banner": {
"format": [
{
"w": 300,
"h": 250
}
]
},
"ext": 123
}
]
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add site or app to make this a valid request. This should suffice:

    "app": {
      "id": "1",
      "bundle": "com.wls.testwlsapplication"
    }

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, done ✅

Comment on lines +44 to +45
`{"placementId": 42}`,
`{"endpointId": 42}`,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding these two separate test cases instead of combining them into one test case like you have ({"placementId": "", "endpointId": ""} ensures that there is a min length constraint on each field instead of on at least one of the fields. I suggest making this change.

@leamarty leamarty requested a review from bsardo February 6, 2025 15:12
Copy link

github-actions bot commented Feb 6, 2025

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 6ac536d

smoot

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/smoot/smoot.go:29:	Builder		100.0%
github.com/prebid/prebid-server/v3/adapters/smoot/smoot.go:36:	MakeRequests	86.7%
github.com/prebid/prebid-server/v3/adapters/smoot/smoot.go:86:	makeRequest	85.7%
github.com/prebid/prebid-server/v3/adapters/smoot/smoot.go:104:	MakeBids	100.0%
github.com/prebid/prebid-server/v3/adapters/smoot/smoot.go:141:	getBidType	100.0%
total:								(statements)	92.1%

@leamarty
Copy link
Author

leamarty commented Feb 6, 2025

Failed task says "Operation was cancelled". I guess we'll need a "retry"

image

@leamarty
Copy link
Author

leamarty commented Feb 6, 2025

🥳 Thank you @bsardo @ccorbo !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants