Repository navigation
New Module: ID5 User ID - #4318
pkowalski-id5 wants to merge 29 commits into
Conversation
ID5 basic module See merge request id5-sync/prebid-server-java!1
|
@CTMBNara Thank you for the review. I've updated the code. Could you please take another look? |
| @JsonProperty("us_privacy") | ||
| String usPrivacy; |
There was a problem hiding this comment.
No need for @JsonProperty here. snake_case is a standard for our object mapper
There was a problem hiding this comment.
Thank you for raising this. It made me realise how tightly coupled and risky it was to rely on the shared mapper.
The global ObjectMapper uses SNAKE_CASE today, but that is an implementation detail of the host application, not a guarantee this module can rely on. What's more, several fields use names that don't follow SNAKE_CASE at all like providerMetadata or _trace. They are defined by the ID5 API schema, not by any naming convention. Removing @JsonProperty and trusting the naming strategy would silently couple the wire format of ID5 requests to the
host configuration. If that ever changes, the breakage would be invisible at compile time and potentially very hard to trace in production.
HttpFetchClient will own a private ObjectMapper configured independently of the application-wide one. Together with explicit @JsonProperty annotations, this guarantees the request is serialized according to the ID5 API schema regardless of any changes to the host configuration.
|
I’ve updated the module based on your suggestions. Whenever you have a chance to re-review this, I’d love to hear your thoughts @Net-burst @CTMBNara |
Hello @pkowalski-id5! Thank you for your contribution. There are still a few comments that need to be addressed before we can proceed with merging your PR. |
|
@And1sS thanks for looking at this!
Can you help me better understand what is missing? Are there any issues not yet submitted, or are some of the submitted not fully resolved and cannot be approved? |
It looks like a few remarks from @CTMBNara are still pending. When you have a moment, could you please address them so we can continue with the review process? |
@And1sS @CTMBNara You can find the relevant updates in these commits: If I’ve missed anything specific, could you please point out which remarks are still outstanding? I’m happy to take another look |
|
@pkowalski-id5 Please, update your branch with latest master. |
…, WireMock scaffolding, InvocationContext httpMethod, alias vendor-id, module parent 4.2.0)
|
@CTMBNara, thanks for the review. I've updated the code as suggested. Please verify. |
CTMBNara
left a comment
There was a problem hiding this comment.
Please use pb-rule-engine as a reference when writing unit tests (style, mocks, assertions, etc.).
| @Getter | ||
| public class Id5IdModuleContext { | ||
|
|
||
| private static final Id5IdModuleContext EMPTY = new Id5IdModuleContext(Future.succeededFuture()); |
There was a problem hiding this comment.
Create new Future instance for each invocation. (remove EMPTY constant)
| final Future<Id5UserId> userIdFuture = Id5IdModuleContext.from(invocationContext).getId5UserIdFuture(); | ||
| return userIdFuture.map(id5UserId -> { | ||
| logger.debug("id5-user-id-inject: resolved userId for bidder {}", bidder); | ||
| final List<Eid> eids = id5UserId == null ? List.of() : id5UserId.eids(); |
There was a problem hiding this comment.
List.of -> Collections.emptyList
| httpClient = Mockito.mock(HttpClient.class); | ||
| versionInfo = Mockito.mock(VersionInfo.class); |
There was a problem hiding this comment.
replace with @Mock annotation. Same for other occurrences
|
|
||
| @BeforeEach | ||
| public void setUp() { | ||
| mapper = new JacksonMapper(new ObjectMapper()); |
| when(httpClient.post(eq(expectedUrl), any(MultiMap.class), anyString(), anyLong())) | ||
| .thenReturn(Future.succeededFuture( | ||
| HttpClientResponse.of(503, MultiMap.caseInsensitiveMultiMap(), "oops") | ||
| )); |
There was a problem hiding this comment.
Move )); to previous line. Same for other occurrences
| final String contentType = headers.get("Content-Type"); | ||
| assertThat(contentType).isEqualTo("application/json;charset=utf-8"); | ||
|
|
||
| // then: request body |
There was a problem hiding this comment.
No need for 2nd // then block. Just leave an empty line between headers and body assertions
There was a problem hiding this comment.
why do u still need a config for wiremock?
| final Timeout timeout = new TimeoutFactory(Clock.systemUTC()).create(1000); | ||
| final AuctionInvocationContext invocation = AuctionInvocationContextImpl.of( | ||
| InvocationContextImpl.of(timeout, null, Endpoint.openrtb2_auction), | ||
| AuctionContext.builder().account(Account.builder().id("acc").build()).build(), | ||
| false, | ||
| null, | ||
| moduleContext); |
There was a problem hiding this comment.
Mock only necessary things. Use mock instead of actual implementations for AuctionInvocationContext
| .build(); | ||
| final BidRequest bidRequest = BidRequest.builder().user(userWithId5).build(); | ||
|
|
||
| final Id5IdModuleContext expectedContext = new Id5IdModuleContext(Future.succeededFuture(Id5UserId.empty())); |
There was a problem hiding this comment.
Add some ids for this test
| assertThat(updated.bidRequest().getUser().getEids()).hasSize(1); | ||
| final Eid eid = updated.bidRequest().getUser().getEids().getFirst(); |
There was a problem hiding this comment.
Use assertThat(...).extracting(...).extracting(...).containsExactly(...) api (each part of chain on new line)
🔧 Type of changes
✨ What's the context?
ID5 wants to have its own module that can enrich bid requests with ID5 universal identifiers. This module fetches identity signals from ID5's API and automatically injects them into OpenRTB bid requests as Extended
Identifiers (EIDs).
🧠 Rationale behind the change
Why a dedicated module?
Key design decisions:
ProcessedAuctionRequestHook): Initiates async ID5 API call early in the request lifecycleBidderRequestHook): Injects EIDs into each bidder request only when not already presentTrade-offs:
🔎 New Bid Adapter Checklist
Not applicable - this is a module, not a bid adapter🧪 Test plan
Unit Tests:
Integration Tests:
sample/directoryManual Testing:
The module has been tested with various configurations and filter combinations to ensure safe production deployment.
🏎 Quality check
🤔 Questions for reviewers
1. Hook invocation status/action handling:
We would particularly appreciate review of our hook invocation status and action returns. Please verify that we're correctly returning:
InvocationStatusvalues in different scenarios (success, failure, skipped)InvocationActionto control execution flow2. Execution plan configuration simplification:
Both hooks (fetch + inject) are required for the module to function - the module is non-functional if either hook is missing from the execution plan. Currently, operators must configure both hooks separately in the
execution plan:
Question: Is there a way to simplify this configuration? For example: