Skip to content

Conversation

@marki1an
Copy link
Collaborator

@marki1an marki1an commented Apr 9, 2025

🔧 Type of changes

  • new bid adapter
  • bid adapter update
  • new feature
  • new analytics adapter
  • new module
  • module update
  • bugfix
  • documentation
  • configuration
  • dependency update
  • tech debt (test coverage, refactorings, etc.)

✨ What's the context?

What's the context for the changes?

🧠 Rationale behind the change

Why did you choose to make these changes? Were there any trade-offs you had to consider?

🔎 New Bid Adapter Checklist

  • verify email contact works
  • NO fully dynamic hostnames
  • geographic host parameters are NOT required
  • direct use of HTTP is prohibited - implement an existing Bidder interface that will do all the job
  • if the ORTB is just forwarded to the endpoint, use the generic adapter - define the new adapter as the alias of the generic adapter
  • cover an adapter configuration with an integration test

🧪 Test plan

How do you know the changes are safe to ship to production?

🏎 Quality check

  • Are your changes following our code style guidelines?
  • Are there any breaking changes in your code?
  • Does your test coverage exceed 90%?
  • Are there any erroneous console logs, debuggers or leftover code in your changes?

@marki1an marki1an added the tests Functional or other tests label Apr 9, 2025
@marki1an marki1an requested review from CTMBNara and osulzhenko April 9, 2025 22:06
@marki1an marki1an self-assigned this Apr 9, 2025
@marki1an marki1an changed the base branch from master to account-bid-rounding May 15, 2025 10:06

class BidRoundingSpec extends BaseSpec {

def "PBS should round bid value to the down when account bid rounding empty or unknown"() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

PBS should round bid value down when account bid rounding setting is #bidRoundingValue. Same for others

accountDao.save(account)

and: "Default bid response"
def bidPrice = PBSUtils.getRandomFloorValue(0.15, 0.19)
Copy link
Collaborator

Choose a reason for hiding this comment

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

magic numbers

Comment on lines 111 to 139
def "PBS should round bid value to the 50% down and 50% up when account bid rounding time split"() {
given: "Default bid request"
def bidRequest = BidRequest.getDefaultBidRequest().tap {
ext.prebid.targeting = new Targeting()
}

and: "Account in the DB"
def account = getAccountWithBidRounding(bidRequest.accountId, accountAuctionConfig)
accountDao.save(account)

and: "Default bid response"
def bidPrice = PBSUtils.randomFloorValue
def bidResponse = BidResponse.getDefaultBidResponse(bidRequest).tap {
seatbid[0].bid[0].price = bidPrice
}
bidder.setResponse(bidRequest.id, bidResponse)

when: "PBS processes auction request"
def response = defaultPbsService.sendAuctionRequest(bidRequest)

then: "Targeting hb_pb should be round"
def targeting = response.seatbid[0].bid[0].ext.prebid.targeting
assert targeting["hb_pb"] == getRoundedTargetingValueWithDefaultPrecision(bidPrice) ||
getRoundedTargetingValueWithUpPrecision(bidPrice)

where:
accountAuctionConfig << [new AccountAuctionConfig(bidRounding: TIME_SPLIT),
new AccountAuctionConfig(bidRoundingSnakeCase: TIME_SPLIT)]
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should never use the or operator in the assert statement. Besides, I’m not sure this test is valid or helpful in any way because it will always pass

@osulzhenko osulzhenko merged commit 5011754 into account-bid-rounding May 23, 2025
1 check passed
@osulzhenko osulzhenko deleted the qaa/bid-rounding branch May 23, 2025 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Functional or other tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants