Skip to content

PIR: Add pixels related to bundle json usage#8012

Merged
karlenDimla merged 1 commit intodevelopfrom
feature/karl/pir/broker-json-bundle-pixel
Mar 19, 2026
Merged

PIR: Add pixels related to bundle json usage#8012
karlenDimla merged 1 commit intodevelopfrom
feature/karl/pir/broker-json-bundle-pixel

Conversation

@karlenDimla
Copy link
Contributor

@karlenDimla karlenDimla commented Mar 18, 2026

Task/Issue URL: https://app.asana.com/1/137249556945/task/1213720291861205?focus=true

Description

See attached task description

Steps to test this PR

Run https://app.asana.com/1/137249556945/task/1213721083788440?focus=true and ensure that:

  • Test 1, no pixel emitted for bundled json
  • Test 2, no pixel emitted for bundled json
  • Test 3, pixel emitted for bundled json
  • Test 4, pixel emitted for bundled json
  • Test 5, no pixel emitted for bundled json
  • Test 5, no pixel emitted for bundled json

Copy link
Contributor Author

karlenDimla commented Mar 18, 2026

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

@github-actions
Copy link
Contributor

Privacy Review task: https://app.asana.com/0/69071770703008/1213725618532951

@github-actions
Copy link
Contributor

Privacy Review task: https://app.asana.com/0/69071770703008/1213725618568468

Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Missing vpn_connection_state parameter in failure pixel
    • Made reportBundleBrokerJsonFailure a suspend function and added the vpn_connection_state parameter to both the Kotlin implementation and JSON definition to match the pattern of other failure pixels.

Create PR

Or push these changes by commenting:

@cursor push d7fdf105b3
Preview (d7fdf105b3)
diff --git a/PixelDefinitions/pixels/personal_information_removal.json5 b/PixelDefinitions/pixels/personal_information_removal.json5
--- a/PixelDefinitions/pixels/personal_information_removal.json5
+++ b/PixelDefinitions/pixels/personal_information_removal.json5
@@ -1061,6 +1061,11 @@
                 "key": "error_details",
                 "description": "Sanitized exception message from the bundle load failure",
                 "type": "string"
+            },
+            {
+                "key": "vpn_connection_state",
+                "description": "Reported VPN connection state when the pixel is fired",
+                "type": "string"
             }
         ]
     },

diff --git a/pir/pir-impl/src/main/java/com/duckduckgo/pir/impl/pixels/PirPixelSender.kt b/pir/pir-impl/src/main/java/com/duckduckgo/pir/impl/pixels/PirPixelSender.kt
--- a/pir/pir-impl/src/main/java/com/duckduckgo/pir/impl/pixels/PirPixelSender.kt
+++ b/pir/pir-impl/src/main/java/com/duckduckgo/pir/impl/pixels/PirPixelSender.kt
@@ -552,7 +552,7 @@
 
     suspend fun reportBundleBrokerJsonLoaded()
 
-    fun reportBundleBrokerJsonFailure(
+    suspend fun reportBundleBrokerJsonFailure(
         message: String,
     )
 
@@ -1322,9 +1322,10 @@
         enqueueFire(PIR_BUNDLE_BROKER_JSON_LOADED, params)
     }
 
-    override fun reportBundleBrokerJsonFailure(message: String) {
+    override suspend fun reportBundleBrokerJsonFailure(message: String) {
         val params = mapOf(
             PARAM_KEY_ERROR_DETAILS to message,
+            PARAM_KEY_VPN_STATE to networkProtectionState.safeIsVpnRunning().toVpnConnectionState(),
         )
         fire(PIR_BUNDLE_BROKER_JSON_FAILURE, params)
     }

PARAM_KEY_ERROR_DETAILS to message,
)
fire(PIR_BUNDLE_BROKER_JSON_FAILURE, params)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing vpn_connection_state parameter in failure pixel

Low Severity

reportBundleBrokerJsonFailure omits the vpn_connection_state parameter, unlike every other failure pixel in this file (e.g., reportDownloadBrokerJsonFailure, reportDownloadMainConfigFailure) and even unlike its companion reportBundleBrokerJsonLoaded pixel which includes it. The omission appears in both the JSON definition and implementation, making the method non-suspend, but it breaks the diagnostic pattern where VPN state is included in failure pixels to aid in root cause analysis. If VPN interference is a potential cause of bundle load failures, this data will be missing.


Please tell me if this was useful or not with a 👍 or 👎.

Additional Locations (1)
Fix in Cursor Fix in Web

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need vpn state on this new pixels?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not for this failure. IF the bundled json fails, then it will not be due to any network issue.

Copy link
Contributor

@landomen landomen left a comment

Choose a reason for hiding this comment

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

Works as expected 👍

One thing I noticed is that we still emit m_dbp_update_databrokers_success_c for every broker even when loaded from json. Is that expected?

PARAM_KEY_ERROR_DETAILS to message,
)
fire(PIR_BUNDLE_BROKER_JSON_FAILURE, params)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need vpn state on this new pixels?

@karlenDimla karlenDimla merged commit 4b9ae3d into develop Mar 19, 2026
42 checks passed
@karlenDimla karlenDimla deleted the feature/karl/pir/broker-json-bundle-pixel branch March 19, 2026 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants