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

Reenable blocklist experiment feature #5511

Merged
merged 3 commits into from
Jan 24, 2025

Conversation

marcosholgado
Copy link
Contributor

@marcosholgado marcosholgado commented Jan 22, 2025

Task/Issue URL: https://app.asana.com/0/488551667048375/1209138858416176/f

Description

This PR reenables the blocklist feature but this time checking the full tds URL rather than the base url only.

Steps to test this PR

  • Use https://www.jsonblob.com/api/1331667217611415552 for the remote config
  • Change the blocklist feature to only assign control
  • Load the app
  • You should see an experiment_enroll pixel for the control and the eTag (app.db in tdsmetadata table) should match the one from https://staticcdn.duckduckgo.com/trackerblocking/v5/current/ios-tds.json currently is 75cff4e36f76d9a81af0643d775008c9
  • Change the controlURL in the remote config to something.json, change the version and the hash from the blocklist too.
  • Reload the app
  • You should see a blocklist_experiment_tds_download_failure pixel with a corresponding error code.

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@@ -3056,7 +3056,7 @@ class ContributesRemoteFeatureCodeGeneratorTest {
"testFeature",
"""
{
"hash": "3",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

While at it, fixed this test that was wrong.

@marcosholgado marcosholgado force-pushed the feature/marcos/reenable_blocklist_exp branch from 06e709a to 259d6a3 Compare January 22, 2025 16:47
trackerDataDownloader.downloadTds()
.subscribeOn(Schedulers.io())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We weren't downloading anything before 🤦

@@ -40,7 +51,7 @@ class BlockListInterceptorApiPlugin constructor(
override fun intercept(chain: Chain): Response {
val request = chain.request().newBuilder()
val url = chain.request().url
if (!url.toString().contains(TDS_BASE_URL)) {
if (url.toString() != TDS_URL) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We now check the full TDS url rather than the base url.

chain.proceed(request.url("$TDS_BASE_URL$path").build())
chain.proceed(request.url("$TDS_BASE_URL$path").build()).also { response ->
if (!response.isSuccessful) {
pixel.fire(BLOCKLIST_TDS_FAILURE, mapOf("code" to response.code.toString()))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sending a pixel if the path on the remote config is wrong and the request fails.

@marcosholgado marcosholgado force-pushed the feature/marcos/reenable_blocklist_exp branch from 259d6a3 to 13496eb Compare January 22, 2025 19:23
Copy link
Collaborator

@aitorvs aitorvs left a comment

Choose a reason for hiding this comment

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

Tested, works as expected

const val TDS_BASE_URL = "https://staticcdn.duckduckgo.com/trackerblocking/"
const val TDS_PATH = "v5/current/android-tds.json"
const val TDS_URL = "$TDS_BASE_URL$TDS_PATH"
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: I guess this can be reverted (removed) now (?)

@marcosholgado marcosholgado merged commit 00dee76 into develop Jan 24, 2025
6 checks passed
@marcosholgado marcosholgado deleted the feature/marcos/reenable_blocklist_exp branch January 24, 2025 11:17
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.

2 participants