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

Core: Transition PAAPI parameters #3670

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

Core: Transition PAAPI parameters #3670

wants to merge 21 commits into from

Conversation

And1sS
Copy link
Member

@And1sS And1sS commented Jan 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?

prebid/prebid-server#3536

🔎 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

Unit tests + functional tests

🏎 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?

Copy link
Collaborator

@AntoxaAntoxic AntoxaAntoxic left a comment

Choose a reason for hiding this comment

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

Great job!


final boolean shouldDropIgb = StringUtils.isEmpty(igi.getImpid());
if (shouldDropIgb) {
conditionalLogger.warn("ExtIgi with absent impId from bidder: " + bidder, logSamplingRate);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I've noticed the requirement to emit warning in debug mode, shouldn't we add the warning messages to the response?

Comment on lines -50 to -53
/**
* Restores ONLY imps from rejection, rejected bids are preserved for analytics.
* A bid can be rejected only once.
*/
Copy link
Collaborator

Choose a reason for hiding this comment

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

please keep these comments)

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't comment code. Only in super tricky situations, which is not the case.

Copy link
Contributor

@oronno oronno left a comment

Choose a reason for hiding this comment

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

Can we make this change without braking existing contract?

.fledgeAuctionConfigs(extractFledge(bidResponse))
.errors(bidderErrors)
.bids(extractBids(bidRequest, bidResponse, errors))
.igi(extractIgi(bidResponse))
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure about other exchanges' cases, but changing the existing contract of the IX bid response for PAAPI will immediately break the current PBS-Index integration. Index does not yet support the community extension for Protected Audience, which defines naming and structure differently from Google's defined format.

I assumed that any new implementation would be done separately to ensure backward compatibility with the current integration (i.e., still supporting the older format).

Copy link
Member Author

Choose a reason for hiding this comment

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

Its not breaking change. What I have done:

  1. I have rewritten all bidders to supply PBS with new PA format.
  2. Added ability to convert new PA format to old Fledge format.

Index does not need to support new PA extensions right now. You can configure output format (old/new) and by default it will respond with old format. Check this out: prebid/prebid-server#3536 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

I see.
In the integration test for IX, I I noticed that the protectedAudienceAuctionConfigs field was removed from Bid response src/test/resources/org/prebid/server/it/openrtb2/ix/test-ix-bid-response.json and thus I assumed the new implementation no longer supports the older format returned by the exchange. That should still work as it is. Could you please restore it?

Copy link
Member Author

@And1sS And1sS Jan 15, 2025

Choose a reason for hiding this comment

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

We don't test this kind of stuff in integration tests. We use them as sanity check (basically, only happy path is tested here). All bidder functionality is covered by unit tests. That's why I removed this.
It's an oversight from a reviewer, who approved this in a first place.

Conversion from Paa format to fledge will be covered with functional tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I see your point. I found the integration test useful as a quick reference for understanding the expected Exchange response format and ensuring the Adapter handles it correctly. Functional test doesn't give that quick overview (no raw json handling). However, if you say the policy is to keep integration tests very basic, I'll align with that.

On the IX side, I built and ran some internal end-to-end tests on top of your changes, and I can confirm everything works as expected. 👍

}

final ExtIgiIgs preparedExtIgiIgs = extIgiIgs.toBuilder()
.ext(ExtIgiIgsExt.of(bidder, bidderCatalog.resolveBaseBidder(bidder)))
Copy link
Collaborator

Choose a reason for hiding this comment

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

As I see, bidder can be an alias at the request level, so we need to resolve that mapping first.

Comment on lines +83 to +90
final boolean extIgsAePresent = Optional.ofNullable(ext)
.map(extNode -> extNode.get(EXT_IGS))
.filter(JsonNode::isArray)
.map(extNode -> StreamSupport.stream(extNode.spliterator(), false).toList())
.stream()
.flatMap(Collection::stream)
.filter(Objects::nonNull)
.anyMatch(igsElementNode -> igsElementNode.has(EXT_AE));
Copy link
Collaborator

Choose a reason for hiding this comment

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

        final boolean extIgsAePresent = Optional.ofNullable(ext)
                .map(extNode -> extNode.get(EXT_IGS))
                .filter(JsonNode::isArray)
                .stream()
                .flatMap(extNode -> StreamUtil.asStream(extNode.spliterator()))
                .filter(Objects::nonNull)
                .anyMatch(igsElementNode -> igsElementNode.has(EXT_AE));

/**
* Defines the contract for bidresponse.ext.igi
*/
@Builder(toBuilder = true)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure that we want to use builder for objects with 3 properties, remove it if you don't mind.

import lombok.Builder;
import lombok.Value;

@Builder(toBuilder = true)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here

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

Successfully merging this pull request may close these issues.

4 participants