PIR: Add additional pixels and params for download errors#7894
Open
karlenDimla wants to merge 2 commits intodevelopfrom
Open
PIR: Add additional pixels and params for download errors#7894karlenDimla wants to merge 2 commits intodevelopfrom
karlenDimla wants to merge 2 commits intodevelopfrom
Conversation
Contributor
|
Privacy Review task: https://app.asana.com/0/69071770703008/1213521097314010 |
2c6dead to
0964c16
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Inner runCatching swallows CancellationException from suspend function
- Added explicit check to rethrow CancellationException in the onFailure block before other error handling, ensuring proper coroutine cancellation propagation.
Or push these changes by commenting:
@cursor push 95a8946f0d
Preview (95a8946f0d)
diff --git a/pir/pir-impl/src/main/java/com/duckduckgo/pir/impl/brokers/BrokerJsonUpdater.kt b/pir/pir-impl/src/main/java/com/duckduckgo/pir/impl/brokers/BrokerJsonUpdater.kt
--- a/pir/pir-impl/src/main/java/com/duckduckgo/pir/impl/brokers/BrokerJsonUpdater.kt
+++ b/pir/pir-impl/src/main/java/com/duckduckgo/pir/impl/brokers/BrokerJsonUpdater.kt
@@ -24,6 +24,7 @@
import com.duckduckgo.pir.impl.store.PirRepository
import com.duckduckgo.pir.impl.store.PirRepository.BrokerJson
import com.squareup.anvil.annotations.ContributesBinding
+import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.withContext
import logcat.LogPriority.ERROR
import logcat.asLog
@@ -77,6 +78,7 @@
pirRepository.updateMainEtag(config.etag)
}
.onFailure { e ->
+ if (e is CancellationException) throw e
logcat(ERROR) { "PIR-update: Failed to download broker json files: $e" }
val message = e.asLog().sanitize() ?: e.message ?: "Unknown error"
pixelSender.reportDownloadBrokerJsonFailure(message)
pir/pir-impl/src/main/java/com/duckduckgo/pir/impl/brokers/BrokerJsonUpdater.kt
Outdated
Show resolved
Hide resolved
0964c16 to
9bfade9
Compare
9bfade9 to
c94b9be
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Task/Issue URL: https://app.asana.com/1/137249556945/task/1213531646709003?focus=true
Description
Add additional params to download errors
Separate pixel for main config and json errors
Steps to test this PR
https://app.asana.com/1/137249556945/task/1213552181080627?focus=true
Note
Medium Risk
Medium risk because it changes
PirPixelSendermethod signatures (nowsuspend) and wiring/DI to always derive VPN state fromNetworkProtectionState, which can break call sites or affect pixel emission timing if any integration is missed.Overview
Adds more granular PIR download error telemetry by introducing a dedicated
m_dbp_download_broker-json_failurepixel and by attachingvpn_connection_stateto main-config download failure pixels.Updates the PIR pixel-sending pipeline so VPN state is computed inside
RealPirPixelSender(via injectedNetworkProtectionState) rather than being passed through, and adjusts download/update flows (BrokerJsonUpdater) to emit the new broker-json failure pixel when broker JSON downloads fail without advancing etags.Tests and integration setup are updated to match the new constructor dependencies and the
suspendpixel-reporting APIs.Written by Cursor Bugbot for commit c94b9be. This will update automatically on new commits. Configure here.