-
Notifications
You must be signed in to change notification settings - Fork 853
Alias: Do not inherit the GVL ID from the parent by default #4641
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
Open
sigma-software-prebid
wants to merge
1
commit into
prebid:master
Choose a base branch
from
sigma-software-prebid:aliases-inheriting-gvl-ids
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,7 +89,7 @@ func TestLoadBidderInfoFromDisk(t *testing.T) { | |
| Maintainer: &MaintainerInfo{ | ||
| Email: "[email protected]", | ||
| }, | ||
| GVLVendorID: 42, | ||
| GVLVendorID: ptrutil.ToPtr[uint16](42), | ||
| Capabilities: &CapabilitiesInfo{ | ||
| App: &PlatformInfo{ | ||
| MediaTypes: []openrtb_ext.BidType{openrtb_ext.BidTypeBanner, openrtb_ext.BidTypeNative}, | ||
|
|
@@ -142,7 +142,7 @@ func TestProcessBidderInfo(t *testing.T) { | |
| Maintainer: &MaintainerInfo{ | ||
| Email: "[email protected]", | ||
| }, | ||
| GVLVendorID: 42, | ||
| GVLVendorID: ptrutil.ToPtr[uint16](42), | ||
| }, | ||
| }, | ||
| expectError: "", | ||
|
|
@@ -203,7 +203,7 @@ func TestProcessBidderInfo(t *testing.T) { | |
| }, | ||
| }, | ||
| ExtraAdapterInfo: "extra-info", | ||
| GVLVendorID: 42, | ||
| GVLVendorID: ptrutil.ToPtr[uint16](42), | ||
| Maintainer: &MaintainerInfo{ | ||
| Email: "[email protected]", | ||
| }, | ||
|
|
@@ -255,7 +255,7 @@ func TestProcessBidderInfo(t *testing.T) { | |
| }, | ||
| }, | ||
| ExtraAdapterInfo: "extra-info", | ||
| GVLVendorID: 42, | ||
| GVLVendorID: ptrutil.ToPtr[uint16](42), | ||
| Maintainer: &MaintainerInfo{ | ||
| Email: "[email protected]", | ||
| }, | ||
|
|
@@ -316,7 +316,7 @@ func TestProcessAliasBidderInfo(t *testing.T) { | |
| }, | ||
| }, | ||
| ExtraAdapterInfo: "extra-info", | ||
| GVLVendorID: 42, | ||
| GVLVendorID: ptrutil.ToPtr[uint16](42), | ||
| Maintainer: &MaintainerInfo{ | ||
| Email: "[email protected]", | ||
| }, | ||
|
|
@@ -364,7 +364,7 @@ func TestProcessAliasBidderInfo(t *testing.T) { | |
| }, | ||
| }, | ||
| ExtraAdapterInfo: "alias-extra-info", | ||
| GVLVendorID: 43, | ||
| GVLVendorID: ptrutil.ToPtr[uint16](43), | ||
| Maintainer: &MaintainerInfo{ | ||
| Email: "[email protected]", | ||
| }, | ||
|
|
@@ -561,10 +561,10 @@ func mockNormalizeBidderName(name string) (openrtb_ext.BidderName, bool) { | |
|
|
||
| func TestToGVLVendorIDMap(t *testing.T) { | ||
| givenBidderInfos := BidderInfos{ | ||
| "bidderA": BidderInfo{Disabled: false, GVLVendorID: 0}, | ||
| "bidderB": BidderInfo{Disabled: false, GVLVendorID: 100}, | ||
| "bidderC": BidderInfo{Disabled: true, GVLVendorID: 0}, | ||
| "bidderD": BidderInfo{Disabled: true, GVLVendorID: 200}, | ||
| "bidderA": BidderInfo{Disabled: false, GVLVendorID: ptrutil.ToPtr[uint16](0)}, | ||
| "bidderB": BidderInfo{Disabled: false, GVLVendorID: ptrutil.ToPtr[uint16](100)}, | ||
| "bidderC": BidderInfo{Disabled: true, GVLVendorID: ptrutil.ToPtr[uint16](0)}, | ||
| "bidderD": BidderInfo{Disabled: true, GVLVendorID: ptrutil.ToPtr[uint16](200)}, | ||
| } | ||
|
|
||
| expectedGVLVendorIDMap := map[openrtb_ext.BidderName]uint16{ | ||
|
|
@@ -594,7 +594,7 @@ func TestBidderInfoValidationPositive(t *testing.T) { | |
| Maintainer: &MaintainerInfo{ | ||
| Email: "[email protected]", | ||
| }, | ||
| GVLVendorID: 1, | ||
| GVLVendorID: ptrutil.ToPtr[uint16](1), | ||
| Capabilities: &CapabilitiesInfo{ | ||
| App: &PlatformInfo{ | ||
| MediaTypes: []openrtb_ext.BidType{ | ||
|
|
@@ -618,7 +618,7 @@ func TestBidderInfoValidationPositive(t *testing.T) { | |
| Maintainer: &MaintainerInfo{ | ||
| Email: "[email protected]", | ||
| }, | ||
| GVLVendorID: 2, | ||
| GVLVendorID: ptrutil.ToPtr[uint16](2), | ||
| Capabilities: &CapabilitiesInfo{ | ||
| Site: &PlatformInfo{ | ||
| MediaTypes: []openrtb_ext.BidType{ | ||
|
|
@@ -659,7 +659,7 @@ func TestBidderInfoValidationPositive(t *testing.T) { | |
| Maintainer: &MaintainerInfo{ | ||
| Email: "[email protected]", | ||
| }, | ||
| GVLVendorID: 3, | ||
| GVLVendorID: ptrutil.ToPtr[uint16](3), | ||
| Capabilities: &CapabilitiesInfo{ | ||
| DOOH: &PlatformInfo{ | ||
| MediaTypes: []openrtb_ext.BidType{ | ||
|
|
@@ -2209,15 +2209,15 @@ func TestApplyBidderInfoConfigOverrides(t *testing.T) { | |
| }, | ||
| { | ||
| description: "Don't override GVLVendorID", | ||
| givenFsBidderInfos: BidderInfos{"a": {GVLVendorID: 5}}, | ||
| givenFsBidderInfos: BidderInfos{"a": {GVLVendorID: ptrutil.ToPtr[uint16](5)}}, | ||
| givenConfigBidderInfos: nillableFieldBidderInfos{"a": {bidderInfo: BidderInfo{Syncer: &Syncer{Key: "override"}}}}, | ||
| expectedBidderInfos: BidderInfos{"a": {GVLVendorID: 5, Syncer: &Syncer{Key: "override"}}}, | ||
| expectedBidderInfos: BidderInfos{"a": {GVLVendorID: ptrutil.ToPtr[uint16](5), Syncer: &Syncer{Key: "override"}}}, | ||
| }, | ||
| { | ||
| description: "Override GVLVendorID", | ||
| givenFsBidderInfos: BidderInfos{"a": {}}, | ||
| givenConfigBidderInfos: nillableFieldBidderInfos{"a": {bidderInfo: BidderInfo{GVLVendorID: 5, Syncer: &Syncer{Key: "override"}}}}, | ||
| expectedBidderInfos: BidderInfos{"a": {GVLVendorID: 5, Syncer: &Syncer{Key: "override"}}}, | ||
| givenConfigBidderInfos: nillableFieldBidderInfos{"a": {bidderInfo: BidderInfo{GVLVendorID: ptrutil.ToPtr[uint16](5), Syncer: &Syncer{Key: "override"}}}}, | ||
| expectedBidderInfos: BidderInfos{"a": {GVLVendorID: ptrutil.ToPtr[uint16](5), Syncer: &Syncer{Key: "override"}}}, | ||
| }, | ||
| { | ||
| description: "Don't override XAPI", | ||
|
|
@@ -2396,7 +2396,7 @@ func TestReadFullYamlBidderConfig(t *testing.T) { | |
| Maintainer: &MaintainerInfo{ | ||
| Email: "[email protected]", | ||
| }, | ||
| GVLVendorID: 42, | ||
| GVLVendorID: ptrutil.ToPtr[uint16](42), | ||
| Capabilities: &CapabilitiesInfo{ | ||
| App: &PlatformInfo{ | ||
| MediaTypes: []openrtb_ext.BidType{openrtb_ext.BidTypeBanner, openrtb_ext.BidTypeVideo, openrtb_ext.BidTypeNative}, | ||
|
|
@@ -2448,6 +2448,94 @@ func TestReadFullYamlBidderConfig(t *testing.T) { | |
| assert.Equalf(t, expectedBidderInfo, actualBidderInfo, "Bidder info objects aren't matching") | ||
| } | ||
|
|
||
| func TestAliasGVLVendorIDInheritance(t *testing.T) { | ||
| testCases := []struct { | ||
| name string | ||
| parentGVLVendorID *uint16 | ||
| aliasGVLVendorID *uint16 | ||
| expectedAliasGVLID *uint16 | ||
| expectedInGVLMap bool | ||
| expectedGVLMapValue uint16 | ||
| description string | ||
| }{ | ||
| { | ||
| name: "alias with nil GVL ID inherits from parent", | ||
| parentGVLVendorID: ptrutil.ToPtr[uint16](42), | ||
| aliasGVLVendorID: nil, | ||
| expectedAliasGVLID: ptrutil.ToPtr[uint16](42), | ||
| expectedInGVLMap: true, | ||
| expectedGVLMapValue: 42, | ||
| description: "When alias GVLVendorID is nil, it should inherit parent's GVL vendor ID", | ||
| }, | ||
| { | ||
| name: "alias with zero GVL ID uses its own value", | ||
| parentGVLVendorID: ptrutil.ToPtr[uint16](42), | ||
| aliasGVLVendorID: ptrutil.ToPtr[uint16](0), | ||
| expectedAliasGVLID: ptrutil.ToPtr[uint16](0), | ||
| expectedInGVLMap: false, | ||
| expectedGVLMapValue: 0, | ||
| description: "When alias GVLVendorID is 0, it should keep its own value and not inherit", | ||
| }, | ||
| { | ||
| name: "alias with non-zero GVL ID uses its own value", | ||
| parentGVLVendorID: ptrutil.ToPtr[uint16](42), | ||
| aliasGVLVendorID: ptrutil.ToPtr[uint16](99), | ||
| expectedAliasGVLID: ptrutil.ToPtr[uint16](99), | ||
| expectedInGVLMap: true, | ||
| expectedGVLMapValue: 99, | ||
| description: "When alias GVLVendorID is non-zero, it should keep its own value", | ||
| }, | ||
| } | ||
|
|
||
| for _, tc := range testCases { | ||
| t.Run(tc.name, func(t *testing.T) { | ||
| parentBidderInfo := BidderInfo{ | ||
| Disabled: false, | ||
| GVLVendorID: tc.parentGVLVendorID, | ||
| Maintainer: &MaintainerInfo{ | ||
| Email: "[email protected]", | ||
| }, | ||
| Capabilities: &CapabilitiesInfo{ | ||
| Site: &PlatformInfo{ | ||
| MediaTypes: []openrtb_ext.BidType{openrtb_ext.BidTypeBanner}, | ||
| }, | ||
| }, | ||
| } | ||
|
|
||
| aliasBidderInfo := BidderInfo{ | ||
| AliasOf: "parentBidder", | ||
| Disabled: false, | ||
| GVLVendorID: tc.aliasGVLVendorID, | ||
| } | ||
|
|
||
| bidderInfos := BidderInfos{ | ||
| "parentBidder": parentBidderInfo, | ||
| "aliasBidder": aliasBidderInfo, | ||
| } | ||
|
|
||
| aliasNillableFields := map[string]aliasNillableFields{ | ||
| "aliasBidder": {}, | ||
| } | ||
|
|
||
| result, err := processBidderAliases(aliasNillableFields, bidderInfos) | ||
| assert.NoError(t, err) | ||
|
|
||
| processedAlias := result["aliasBidder"] | ||
| assert.NotNil(t, processedAlias.GVLVendorID, tc.description) | ||
| assert.Equal(t, *tc.expectedAliasGVLID, *processedAlias.GVLVendorID, tc.description) | ||
| gvlMap := result.ToGVLVendorIDMap() | ||
| if tc.expectedInGVLMap { | ||
| vendorID, exists := gvlMap["aliasBidder"] | ||
| assert.True(t, exists, "Alias should appear in GVL vendor map: "+tc.description) | ||
| assert.Equal(t, tc.expectedGVLMapValue, vendorID, "GVL vendor ID in map should match expected value") | ||
| } else { | ||
| _, exists := gvlMap["aliasBidder"] | ||
| assert.False(t, exists, "Alias should not appear in GVL vendor map: "+tc.description) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestValidateGeoscope(t *testing.T) { | ||
| testCases := []struct { | ||
| name string | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this still have the behavior of inheriting the GVL ID from the parent by default?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SyntaxNode According to the requirements in #4463, we now will have 3 cases:
nilthen we inherit from parent (default behavior).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SyntaxNode perhaps we should tweak the requirements so an alias never inherits the GVL ID to be safe? If the alias has the same GVL ID as its parent it would need to explicitly declare that GVL ID. Thoughts?