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

Loyal: New Adapter (#3140) #3183

Merged
merged 26 commits into from
Jun 3, 2024
Merged

Loyal: New Adapter (#3140) #3183

merged 26 commits into from
Jun 3, 2024

Conversation

przemkaczmarek
Copy link
Collaborator

No description provided.

Copy link
Collaborator

@SerhiiNahornyi SerhiiNahornyi left a comment

Choose a reason for hiding this comment

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

Java Ci failed because of checkstyle issues, please fix them

@przemkaczmarek przemkaczmarek changed the title Embimedia: New Adapter (#3140) Loyal: New Adapter (#3140) May 14, 2024
@AntoxaAntoxic
Copy link
Collaborator

Hi @przemkaczmarek

Could you fix the comments are left?

@przemkaczmarek
Copy link
Collaborator Author

Yesturday I pushed changes. whitch comments are left? (I think I prepared everythink)

@przemkaczmarek
Copy link
Collaborator Author

@SerhiiNahornyi Are we rdy to merge?

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.

My bad, I didn't pay attention to the Go version of the bidder

fyi @SerhiiNahornyi

src/main/resources/bidder-config/loyal.yaml Outdated Show resolved Hide resolved
src/main/resources/bidder-config/loyal.yaml Outdated Show resolved Hide resolved
src/main/resources/bidder-config/loyal.yaml Outdated Show resolved Hide resolved
src/main/resources/bidder-config/loyal.yaml Outdated Show resolved Hide resolved
@przemkaczmarek
Copy link
Collaborator Author

@AntoxaAntoxic U can check, I have hope that everthink is fine now.

src/main/resources/bidder-config/loyal.yaml Outdated Show resolved Hide resolved
Comment on lines 13 to 15
"bidder": {
"placementId": "testPlacementId"
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

the type is missing, isn't the test failing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes and this same is in Go. Its Request not expected response.

for (Imp imp : request.getImp()) {
try {
final ExtImpLoyal extImpLoyal = parseExtImp(imp);
if (isValidImp(extImpLoyal)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

no sure we need this check, one of those field are required by the json scheme

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You said:
AntoxaAntoxic 2 weeks ago
the following logic is missing

if len(adapterRequests) == 0 {
	errs = append(errs, errors.New("found no valid impressions"))
	return nil, errs
}

and this is part of this

Copy link
Collaborator

Choose a reason for hiding this comment

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

and you've implemented it already a few lines below

        if (httpRequests.isEmpty()) {
            return Result.withError(BidderError.badInput("found no valid impressions"));
        }

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

when I have deleted it "invalidImp goes to the results". We have to seperate invalidImp
image

Copy link
Collaborator

Choose a reason for hiding this comment

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

so this is the Go code

if loyalExt.PlacementID != "" {
			impExt.LoyalBidderExt.PlacementID = loyalExt.PlacementID
			impExt.LoyalBidderExt.Type = "publisher"
		} else if loyalExt.EndpointID != "" {
			impExt.LoyalBidderExt.EndpointID = loyalExt.EndpointID
			impExt.LoyalBidderExt.Type = "network"
		}

as you see the imp that doesn't have the placementId and endpointId fields won't be treated as invalid, but you've added the unit test that defines invalid bid as the following:

private static Imp givenBadImp(UnaryOperator<Imp.ImpBuilder> impCustomizer) {
        return impCustomizer.apply(Imp.builder()
                        .id("invalidImp")
                        .ext(mapper.valueToTree(ExtPrebid.of(null,
                                ExtImpLoyal.of(null, null)))))
                .build();
    }

So my conclusion the logic of your version of the bidder differs from the GO's version

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

okey, now its clear. I hade made wrong badImp, I was doing it in wrong way.

Comment on lines 349 to 363
private static Imp givenImp(UnaryOperator<Imp.ImpBuilder> impCustomizer) {
return impCustomizer.apply(Imp.builder()
.id("123")
.ext(mapper.valueToTree(ExtPrebid.of(null,
ExtImpLoyal.of("placementId", "endpointId")))))
.build();
}

private static Imp givenImp2(UnaryOperator<Imp.ImpBuilder> impCustomizer) {
return impCustomizer.apply(Imp.builder()
.id("321")
.ext(mapper.valueToTree(ExtPrebid.of(null,
ExtImpLoyal.of("placementId", "endpointId")))))
.build();
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

why do you need two different methods if there is a customizer that can be used for that matter?

for (Imp imp : request.getImp()) {
try {
final ExtImpLoyal extImpLoyal = parseExtImp(imp);
if (isValidImp(extImpLoyal)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

so this is the Go code

if loyalExt.PlacementID != "" {
			impExt.LoyalBidderExt.PlacementID = loyalExt.PlacementID
			impExt.LoyalBidderExt.Type = "publisher"
		} else if loyalExt.EndpointID != "" {
			impExt.LoyalBidderExt.EndpointID = loyalExt.EndpointID
			impExt.LoyalBidderExt.Type = "network"
		}

as you see the imp that doesn't have the placementId and endpointId fields won't be treated as invalid, but you've added the unit test that defines invalid bid as the following:

private static Imp givenBadImp(UnaryOperator<Imp.ImpBuilder> impCustomizer) {
        return impCustomizer.apply(Imp.builder()
                        .id("invalidImp")
                        .ext(mapper.valueToTree(ExtPrebid.of(null,
                                ExtImpLoyal.of(null, null)))))
                .build();
    }

So my conclusion the logic of your version of the bidder differs from the GO's version

AntoxaAntoxic
AntoxaAntoxic previously approved these changes Jun 3, 2024
@SerhiiNahornyi SerhiiNahornyi linked an issue Jun 3, 2024 that may be closed by this pull request
@SerhiiNahornyi SerhiiNahornyi merged commit 2319ff7 into master Jun 3, 2024
5 checks passed
@SerhiiNahornyi SerhiiNahornyi deleted the new-adapter-loyal-(#3140) branch June 3, 2024 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Port PR from PBS-Go: New Adapter: Loyal
4 participants