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

[UID2-2005] Add new endpoint to check opt out status by raw UIDs #557

Merged
merged 9 commits into from
May 16, 2024

Conversation

asloobq
Copy link
Contributor

@asloobq asloobq commented May 11, 2024

Manual Testing:

  • Tested by starting up server locally and check for validation errors, unauthorized, etc. Couldn't test for positive case as reading deltas from local config is not straight forward.
  • Tested in E2E environment by starting all services and running public operator from this branch. Tested positive and negative use cases

Automated Testing

  • Added unit tests for both positive and negative cases

@asloobq asloobq marked this pull request as ready for review May 14, 2024 18:22
@@ -168,6 +173,8 @@ public UIDOperatorVerticle(JsonObject config,
this.allowClockSkewSeconds = config.getInteger(Const.Config.AllowClockSkewSecondsProp, 1800);
this.maxSharingLifetimeSeconds = config.getInteger(Const.Config.MaxSharingLifetimeProp, config.getInteger(Const.Config.SharingTokenExpiryProp));
this.saltRetrievalResponseHandler = saltRetrievalResponseHandler;
this.optOutStatusApiEnabled = config.getBoolean(Const.Config.OptOutStatusApiEnabled, false);
this.optOutStatusMaxRequestSize = config.getInteger(Const.Config.OptOutStatusMaxRequestSize, 1000);
Copy link
Contributor

Choose a reason for hiding this comment

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

the Optout API confluence page stated 5000? any reason why default stays at 1000?

Copy link
Contributor

Choose a reason for hiding this comment

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

I suggested we do some benchmarking and see if 1,000 would be a better place to start than 5,000, since can we always increase the limit later.

I've just benchmarked it and I think we're safe to go with 5,000. @asloobq could you please update the default?

@ParameterizedTest
@MethodSource("optOutStatusRequestData")
void optOutStatusRequest(Map<String, Long> optedOutIds, int optedOutCount, Vertx vertx, VertxTestContext testContext) {
fakeAuth(126, Role.MAPPER);
Copy link
Contributor

Choose a reason for hiding this comment

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

could you parameterise the role to test with id_reader/sharer too?

@@ -144,8 +166,9 @@ private byte[] entriesToByteArray(List<OptOutEntry> entries) {
return bytes;
}

private JsonObject make1mOptOutEntryConfig() {
private JsonObject make1mOptOutEntryConfig(boolean isEnabled) {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe rename to OptOutStatusApiEnabled as isEnabled is not clear on what is enabled, optout storage/optout lookup/or optout api?

@@ -79,6 +79,11 @@ public Instant getLatestEntry(UserIdentity firstLevelHashIdentity) {
return instant;
}

@Override
public long getLatestEntryByAdId(String adId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We actually return the earliest timestamp. Can we rename to getAdIdOptOutTimestamp or getOptOutTimestampByAdId?

@@ -168,6 +173,8 @@ public UIDOperatorVerticle(JsonObject config,
this.allowClockSkewSeconds = config.getInteger(Const.Config.AllowClockSkewSecondsProp, 1800);
this.maxSharingLifetimeSeconds = config.getInteger(Const.Config.MaxSharingLifetimeProp, config.getInteger(Const.Config.SharingTokenExpiryProp));
this.saltRetrievalResponseHandler = saltRetrievalResponseHandler;
this.optOutStatusApiEnabled = config.getBoolean(Const.Config.OptOutStatusApiEnabled, false);
this.optOutStatusMaxRequestSize = config.getInteger(Const.Config.OptOutStatusMaxRequestSize, 1000);
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggested we do some benchmarking and see if 1,000 would be a better place to start than 5,000, since can we always increase the limit later.

I've just benchmarked it and I think we're safe to go with 5,000. @asloobq could you please update the default?


private static Stream<Arguments> optOutStatusValidationErrorData() {
// Test case 1
int requestLimit = 1000;
Copy link
Contributor

Choose a reason for hiding this comment

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

At the moment if someone changes the default value in the verticle, they will have to run the tests in order to find that they need to change the value here as well.

Can we make this a field of the test class and use it to configure the verticle, so that changes to the default value in the verticle won't cause this test to break?

@asloobq asloobq merged commit 7e3366b into mkc-UID2-2937-optout-api May 16, 2024
6 checks passed
@asloobq asloobq deleted the aaq-UID2-2005-optout-api branch May 16, 2024 20:16
cYKatherine pushed a commit that referenced this pull request Jun 12, 2024
* Add new endpoint to check opt out status by raw UIDs

* Try loading optout deltas from local

* Revert "Try loading optout deltas from local"

This reverts commit d8e563a.

* Add a switch to disable endpoint and hashmap loading

* Add Snapshot store test for disabled status

* Add test cases for optout status endpoint processing

* Increase max request size to 5K. Refactor and update tests

* Update opt out status test

* Update default max size of opt out request
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.

3 participants