Skip to content

Conversation

@sophia-chen-ttd
Copy link
Contributor

@sophia-chen-ttd sophia-chen-ttd commented Jul 2, 2025

IdentityMapV3

  • IdentityMapV3Client
  • IdentityMapV3Input
  • IdentityMapV3Response
  • UnmappedIdentityReason

Tests

  • TestIdentityMapV3Client
    • Tests that client returns correct mapped and unmapped identities with different input
    • Aligned with java sdk tests
  • TestIdentityMapV3Response
    • Tests that the correct response object is created from the api response
    • Aligned with java sdk tests
  • Added e2e tests for BidstreamClient and SharingClient
  • Tested against UID2 and EUID public operator, and UID2 GCP, AWS, and Azure private operator

Additional refactoring to support binary requests and responses

  • refactored methods in request_response_util to have three major methods
    • create_envelope
    • make_request or make_binary_request
    • parse_response
  • Added Uid2Response class
  • Added Envelope class

@sophia-chen-ttd sophia-chen-ttd changed the title added identity map v3 client sch-UID2-5486 added identity map v3 client and binary support Jul 2, 2025
self._hashed_dii_to_raw_diis[hashed_dii].append(raw_dii)

def _get_hashed_dii(self, identity_type: str, index: int) -> str:
if identity_type == "email_hash":
Copy link

@aulme aulme Jul 2, 2025

Choose a reason for hiding this comment

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

Possible improvement: use Literal["email_hash", "phone"hash"] - this documents what the valid values are as well. https://typing.python.org/en/latest/spec/literal.html

Can use it all the way upstream with identity_type too.

Need to check if version of Python we're using supports this though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, added this in

body = response_json["body"]
self._populate_identities(body, identity_map_input)

def _populate_identities(self, api_response: Dict[str, List[Dict]], identity_map_input):
Copy link

Choose a reason for hiding this comment

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

Why List[Dict] without the inner Dict having types?

It would also be good to have some validation that what we get is what we expect - in Java SDK the type system does it for us at deserialization.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. I've also added some validation in the ApiResponse and ApiIdentity. If the structure isn't as we expect, it will throw an error



def make_v2_request(secret_key, now, data=None):
def create_envelope(secret_key, now, data=None) -> 'Envelope':
Copy link

Choose a reason for hiding this comment

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

It's nice that we started adding typing. Could we add them consistently to function inputs and outputs in this file as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

where is typing being consumed? are we adding mypy or similar in the pipelines?

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've just added typing to the function signatures to make it clearer for us to know what the function takes in and returns, especially since we're returning custom class objects now. I haven't added in any type checker but that could be an option, in another mr?

Copy link
Contributor

Choose a reason for hiding this comment

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

Have you tested with a type checker locally though? Good to check all the typing is correct before merging

Sounds good to add one in pipelines later - do you mind making a ticket?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Checked with mypy locally and created a ticket

from uid2_client.unmapped_identity_reason import UnmappedIdentityReason


@unittest.skipIf(
Copy link

Choose a reason for hiding this comment

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

I don't think this is a good idea, we should break if those are missing instead. Otherwise we may have those tests skipped permanently in the pipeline without anyone noticing.

Copy link
Contributor

Choose a reason for hiding this comment

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

these are integration tests, are they running in the pipeline?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it doesn't look like they've been running in the pipeline

Copy link
Contributor

Choose a reason for hiding this comment

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

Curious, what prevents them from running in the pipeline? (if not this skipIf ) ?

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've removed all the @unittest.skipIf(), now the tests require the env variables to set

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Curious, what prevents them from running in the pipeline? (if not this skipIf ) ?

Ah its because we've set the 'vulnerability_scan_only' param to true in our workflow so it will only run the vulnerability scan. I think if we want to turn this off and run the tests in the pipeline, we'll need to keep the unittest.skipIf or set the env variables in the workflow

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we try to turn off vulnerability_scan_only ? (and keep skipIf)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just tried it but it didn't work because the shared testing pipeline only works for java tests. I'm thinking to keep the vulnerability_scan_only on but then write a custom testing job in this repo

Copy link
Contributor

Choose a reason for hiding this comment

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

ah right I found UID2-3648 for that so we can leave it for now (skipIf should remain though)

@sophia-chen-ttd sophia-chen-ttd merged commit 0192b52 into main Jul 8, 2025
3 checks passed
@sophia-chen-ttd sophia-chen-ttd deleted the sch-UID2-5486-identity-map-v3 branch July 8, 2025 05:18
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