commit d984353f389b0da8a9400f72f5347801b1b34483
parent 5b9a31d66c3b23e04534ba1b94f3546ec4bf5fbf
Author: Maxx Crawford <mcrawford@mozilla.com>
Date: Tue, 30 Sep 2025 14:51:26 +0000
Bug 1991132 - Add train-hop compatibility for pocket.dimiss metrics.yaml update r=home-newtab-reviewers,nbarrett
Differential Revision: https://phabricator.services.mozilla.com/D266425
Diffstat:
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/browser/extensions/newtab/lib/TelemetryFeed.sys.mjs b/browser/extensions/newtab/lib/TelemetryFeed.sys.mjs
@@ -897,12 +897,16 @@ export class TelemetryFeed {
topic,
} = action.data.value ?? {};
+ /**
+ * @backward-compat { version 145 }
+ *
+ * Bug 1990626 - Train-hop Compat Fix (Missing metrics.yaml key)
+ */
const is145AndUp =
Services.vc.compare(AppConstants.MOZ_APP_VERSION, "145.0a1") >= 0;
const gleanData = {
tile_id,
- // Bug 1990626 - Remove version check after 145 has shipped
...(is145AndUp ? { position: action_position } : {}),
// We conditionally add in a few props.
...(corpus_item_id ? { corpus_item_id } : {}),
@@ -1817,8 +1821,28 @@ export class TelemetryFeed {
recommendation_id: datum.recommendation_id,
}),
};
+
+ /**
+ * @backward-compat { version 145 }
+ *
+ * Bug 1991132 - Train-hop Compat Fix (Missing metrics.yaml key)
+ * Optimization: This logic should be moved back to its previous position inside the Glean.pocket.dismiss.record() function
+ */
+ const possiblyRedactedNewTabPing = this.redactNewTabPing(
+ gleanData,
+ gleanData.is_sponsored
+ );
+
+ const is143_144 =
+ Services.vc.compare(AppConstants.MOZ_APP_VERSION, "143.0a1") >= 0 &&
+ Services.vc.compare(AppConstants.MOZ_APP_VERSION, "145.0a1") < 0;
+
+ if (is143_144) {
+ delete possiblyRedactedNewTabPing.content_redacted;
+ }
+
Glean.pocket.dismiss.record({
- ...this.redactNewTabPing(gleanData, gleanData.is_sponsored),
+ possiblyRedactedNewTabPing,
newtab_visit_id: session.session_id,
});
if (this.privatePingEnabled) {