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

Add functional tests for aligning TCF and tests for support transmitEids activity controls #2893

Conversation

osulzhenko
Copy link
Collaborator

No description provided.

@osulzhenko osulzhenko requested a review from marki1an January 9, 2024 17:12
@osulzhenko osulzhenko added the tests Functional or other tests label Jan 10, 2024
@osulzhenko osulzhenko changed the base branch from master to add-transmit-eids-activity January 15, 2024 08:54
@osulzhenko osulzhenko added the work in progress Signals not finished work label Jan 16, 2024
@osulzhenko osulzhenko force-pushed the functional-tests/Aligning-TCF-and-Activity-Controls branch from 7acc755 to 010be34 Compare January 22, 2024 22:02
@osulzhenko osulzhenko removed the work in progress Signals not finished work label Jan 29, 2024
@osulzhenko osulzhenko force-pushed the functional-tests/Aligning-TCF-and-Activity-Controls branch from 47b66c3 to c6bd6a2 Compare February 5, 2024 11:46
@osulzhenko osulzhenko force-pushed the functional-tests/Aligning-TCF-and-Activity-Controls branch from c6bd6a2 to f23a2be Compare February 5, 2024 12:02
@ToString(includeNames = true, ignoreNulls = true)
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy)
class PurposeEid {

Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably missing this configuration prebid/prebid-server#2904.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

link for the general page. But config is:

privacy.gdpr.purposes.p4.eid.require_consent: true/false
privacy.gdpr.purposes.p4.eid.exceptions: ["pubcid.org"]

Did I miss something?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I suppose this one privacy.gdpr.purposes.p4.eid.activity_transition

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@marki1an added, thanks for notes


then: "Generic bidder request should have data in Eid field"
def bidderRequest = bidder.getBidderRequest(bidRequest.id)
assert bidderRequest.user.eids == userEids
Copy link
Collaborator

Choose a reason for hiding this comment

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

AFAIK we should check FPD fields, not a Eids

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated to Eids tests as the main point for this feature, let me know if ufpd test required

@@ -0,0 +1,23 @@
package org.prebid.server.functional.model.privacy

import com.iabtcf.v2.PublisherRestriction
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unused import

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated

List<BidderName> vendorExceptions
List<BidderName> softVendorExceptions
Purpose purposesLITransparency
List<RestrictionType> restrictionType
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. Please use your own RestroctionType
  2. I don't see the flexiblePurposes, legIntPurposes, publisherRestrictions, fields

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  1. good point, updated
  2. flexiblePurposes, legIntPurposes, publisherRestrictions are completely included in the GVL files for TcfFullTransmitEidsAligningActivitiesSpec. Creating separate files for each purpose would be unnecessarily resource-intensive for software systems

Comment on lines 99 to 115
def purposes = TcfUtils.getPurposeConfigsForPersonalizedAds(enforcementRequirments, true)
def accountGdprConfig = new AccountGdprConfig(purposes: purposes)
def activity = Activity.getDefaultActivity([ActivityRule.getDefaultActivityRule(Condition.baseCondition, true)])
def account = getAccountWithGdpr(bidRequest.accountId, accountGdprConfig).tap {
config.privacy.allowActivities = AllowActivities.getDefaultAllowActivities(TRANSMIT_UFPD, activity)
}
accountDao.save(account)

when: "PBS processes auction requests"
privacyPbsServiceWithMultipleGvl.sendAuctionRequest(bidRequest)

then: "Generic bidder request should have data in Eid field"
def bidderRequest = bidder.getBidderRequest(bidRequest.id)
assert bidderRequest.user.eids == userEids

where:
enforcementRequirments << getLegalEnforcementRequirments(P4) + getCompanyEnforcementRequirments(P4)
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. Minor, typo requierments
  2. You try to populate as much as you can, but the method getPurposeConfigsForPersonalizedAds() doesn't take a list of enforcementRequirements

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated typo, and we don't put a list of enforcementRequirements for getPurposeConfigsForPersonalizedAds. It simply creates a list concatenation by the + operator and then appends it to enforcement requirements by the “<<” operator. That is why we have all requirements separately

class TcfFullTransmitUfpdAligningActivitiesSpec extends PrivacyBaseSpec {

@Shared
static final int PURPOSES_ONLY_GVL_VERSION = PBSUtils.getRandomNumber(0, 4095)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please place private

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated

@osulzhenko osulzhenko requested a review from marki1an February 27, 2024 08:58
@osulzhenko osulzhenko force-pushed the functional-tests/Aligning-TCF-and-Activity-Controls branch from 894e020 to 44e6549 Compare February 27, 2024 11:46
import static org.prebid.server.functional.model.request.auction.TraceLevel.VERBOSE
import static org.prebid.server.functional.util.privacy.TcfConsent.GENERIC_VENDOR_ID

class TcfBasicTransmitEidsAligningActivitiesSpec extends PrivacyBaseSpec {
Copy link
Collaborator

Choose a reason for hiding this comment

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

TcfBasicTransmitEidsActivitiesSpec

assert bidderRequest.user.eids == userEids

where:
enforcementRequirments << getCompanyBasedEnforcementRequirments(P4) +
Copy link
Collaborator

Choose a reason for hiding this comment

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

Type: getCompanyBasedEnforcementRequirements

import org.prebid.server.functional.util.privacy.TcfConsent

@ToString(includeNames = true, ignoreNulls = true)
class EnforcementRequirements {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Better naming for me: EnforcementRequirement

static Map<Purpose, PurposeConfig> getPurposeConfigsForPersonalizedAds(EnforcementRequirements enforcementRequirments, boolean requireConsent = false, List<String> eidsExceptions = []) {
def purpose = enforcementRequirments.purposeConsent ?: enforcementRequirments.purpose
// Basic Ads required for any bidder call, should be present at least as company consent
Map<Purpose, PurposeConfig> purposes = [(Purpose.P2): new PurposeConfig(enforcePurpose: NO, enforceVendors: false)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor: please replace Map on def

import static org.prebid.server.functional.util.privacy.TcfConsent.RestrictionType.UNDEFINED
import static org.prebid.server.functional.util.privacy.TcfConsent.TcfPolicyVersion.TCF_POLICY_V2

class TcfFullTransmitEidsAligningActivitiesSpec extends PrivacyBaseSpec {
Copy link
Collaborator

Choose a reason for hiding this comment

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

TcfFullTransmitEidsActivitiesSpec


private final PrebidServerService activityPbsServiceExcludeGvl = pbsServiceFactory.getService(PBS_CONFIG)

private final PrebidServerService activityPbsServiceExcludeGvlWithElderOrtb = pbsServiceFactory.getService(PBS_CONFIG + ["adapters.generic.ortb-version": "2.5"])
Copy link
Collaborator

Choose a reason for hiding this comment

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

In my opinion, we can omit elder ORTB.

  1. We have tests for it, and privacy doesn't affect these fields.
  2. This is legacy behaviour and we should not care about it.
    @Net-burst What do you think about it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I haven't reviewed the whole PR yet, but I'd leave it be. Because otherwise, we won't be able to tell for sure whether masking happens before or after the normalization. But maybe it would be worth moving those tests to a separate location.

Comment on lines 710 to 712
private static String getVendorListPath(Integer gvlVersion) {
"/app/prebid-server/data/vendorlist-v${TCF_POLICY_V2.vendorListVersion}/${gvlVersion}.json"
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Better to move in PrivacyBaseSpec

@osulzhenko osulzhenko requested a review from marki1an February 27, 2024 15:29
import org.prebid.server.functional.model.request.auction.Eid
import org.prebid.server.functional.service.PrebidServerService
import org.prebid.server.functional.util.privacy.TcfUtils
import spock.lang.IgnoreRest
Copy link
Collaborator

Choose a reason for hiding this comment

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

used import


import static org.prebid.server.functional.model.bidder.BidderName.ALIAS
import static org.prebid.server.functional.model.bidder.BidderName.GENERIC
import static org.prebid.server.functional.model.bidder.BidderName.RUBICON
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

@@ -177,6 +181,55 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec {
assert metrics[DISALLOWED_COUNT_FOR_GENERIC_ADAPTER] == 1
}

def "PBS auction call when transmit UFPD activities is rejecting requests with activityTransition false should remove only UFPD fields in request"() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please move this test to the end of the spec

@@ -33,6 +33,11 @@ class VendorList extends NetworkScaffolding {
request().withPath(VENDOR_LIST_ENDPOINT)
}

@Override
void reset() {
TcfPolicyVersion.values().each { version -> super.reset("/v${version}/vendor-list.json") }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here should be ${version.vendorListVersion}

Comment on lines 400 to 401
it.setAccountId(accountId)
it.ext.prebid.trace = VERBOSE
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unnecessary setup of those fields since they are already applied in givenBidRequestWithAccountAndEidsData(...) and check other occurrences.

def purposesLITransparency = enforcementRequirements.getPurposesLITransparency()
def restrictionType = enforcementRequirements.restrictionType
def vendorIdGvl = enforcementRequirements.vendorIdGvl
def builder = new Builder()
Copy link
Collaborator

@marki1an marki1an Feb 28, 2024

Choose a reason for hiding this comment

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

Please use new TcfConsent.Builder() istead of new Builder()

@osulzhenko osulzhenko requested a review from marki1an February 28, 2024 16:37

then: "Generic bidder request should have data in Eid field"
def bidderRequest = bidder.getBidderRequest(bidRequest.id)
assert bidderRequest.user.eids == userEids
Copy link
Collaborator

Choose a reason for hiding this comment

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

What about bidderRequest.user?.ext?.eids


then: "Generic bidder request should have data in Eid field"
def bidderRequest = bidder.getBidderRequest(bidRequest.id)
assert bidderRequest.user.ext.eids == userEids
Copy link
Collaborator

Choose a reason for hiding this comment

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

bidderRequest.user?.eids?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Check other cases


then: "Generic bidder request shouldn't have data in Eid field"
def bidderRequest = bidder.getBidderRequest(bidRequest.id)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor empty line

import static org.prebid.server.functional.model.request.auction.ActivityType.TRANSMIT_EIDS
import static org.prebid.server.functional.model.request.auction.TraceLevel.VERBOSE

class PrivacyOrtbConverterSpec extends PrivacyBaseSpec {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably better naming TransmitEidsOrtbConverterActivitiesSpec


then: "Generic bidder request should have data in Eid field"
def bidderRequest = bidder.getBidderRequest(bidRequest.id)
assert bidderRequest?.user?.ext?.eids == userEids
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 an assertion for bidderRequest.user.eids?
Check other occurrences.

@osulzhenko osulzhenko requested a review from marki1an February 29, 2024 12:11
@SerhiiNahornyi SerhiiNahornyi merged commit 4eaf393 into add-transmit-eids-activity Feb 29, 2024
@SerhiiNahornyi SerhiiNahornyi deleted the functional-tests/Aligning-TCF-and-Activity-Controls branch February 29, 2024 12:21
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.

4 participants