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

TID activity #3012

Merged
merged 4 commits into from
Aug 21, 2023
Merged

TID activity #3012

merged 4 commits into from
Aug 21, 2023

Conversation

VeronikaSolovei9
Copy link
Contributor

No description provided.

Copy link
Contributor

@AlexBVolcy AlexBVolcy left a comment

Choose a reason for hiding this comment

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

Looks good, left one comment

Comment on lines +150 to +151
var sourceCopy *openrtb2.Source
sourceCopy = ptrutil.Clone(bidRequest.Source)
Copy link
Contributor

Choose a reason for hiding this comment

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

i think it's possible to remove the var declaration on line 150, and just have this line instead sourceCopy := ptrutil.Clone(bidRequest.Source)

Copy link
Collaborator

Choose a reason for hiding this comment

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

This may be the case, I think Clone(), while being a generic, will get the pointer type from the type if the argument used. That it, whatever pointer argument you feed it, it will return the same pointer type.

func Clone[T any](v *T) *T 

The provided type, a pointer to a T type, indicates that the return value should be another pointer to type T.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yup. I'd expect sourceCopy := ptrutil.Clone(bidRequest.Source) to work here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried it and it still needs some type conversion. Based on other usages of "Clone" in code, type is declared beforehand. I may miss something, please advice.

Copy link
Contributor

@SyntaxNode SyntaxNode Aug 11, 2023

Choose a reason for hiding this comment

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

Darn. Go's generic features are still pretty new. I was hoping this syntax would infer the generic type from the bidRequest.Source, but it this didn't work then it would seem the compiler is inferring from the variable's type to align the return type of Clone.

@hhhjort hhhjort self-requested a review August 10, 2023 17:09
@hhhjort hhhjort self-assigned this Aug 10, 2023
Copy link
Contributor

@SyntaxNode SyntaxNode left a comment

Choose a reason for hiding this comment

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

There are other parts of code which generate transaction ids. To be sure this functionality works correctly, could you please add an exchange level end-to-end test? Similar to the ccpa-featureflag-off/on tests. We do this for other privacy concerns, such eidpermissions, gdpr, lmt, etc..

@@ -5,6 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/prebid/prebid-server/privacy"
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI: Other editors group non-built in imports after the built-in ones. This is likely to be automatically overwritten in the future by other contributors. Does your IDE have that as an option?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think my IDE sorted it in alphabetical order. I'll fix this.

passTIDActivityAllowed := auctionReq.Activities.Allow(privacy.ActivityTransmitTids, scopedName)
if !passTIDActivityAllowed {
privacyEnforcement.TID = true
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The Transmit TID activity is new and doesn't have the baggage of TCF, CCPA, etc.. Could this be simplified as:

privacyEnforcement.TID = !auctionReq.Activities.Allow(privacy.ActivityTransmitTids, scopedName)

@@ -4288,6 +4289,7 @@ func TestCleanOpenRTBRequestsActivitiesFetchBids(t *testing.T) {
expectedUserYOB: 1982,
expectedUserLat: 123.456,
expectedDeviceDIDMD5: "some device ID hash",
expectedSourceTID: "61018dc9-fa61-4c41-b7dc-f90b9ae80e87",
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: Is there a need to use a guid as a test string? Could we instead use something simpler, such as "1" or "anyTID"? Specific values which are not immediately obvious as fake data may be misinterpreted as conveying a special meaning.

@VeronikaSolovei9
Copy link
Contributor Author

Addressed all comments, added E2E tests.

Copy link
Collaborator

@hhhjort hhhjort left a comment

Choose a reason for hiding this comment

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

LGTM

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