commit fd03e3542b783b553ab1246d24e937a02da2f296
parent baa8bf06bae0790c4f7d5d7fa77e550249118078
Author: Jan-Erik Rediger <jrediger@mozilla.com>
Date: Fri, 24 Oct 2025 12:39:29 +0000
Bug 1991891 - Fix Glean lints and now-broken tests r=TravisLong,credential-management-reviewers,cookie-reviewers,android-reviewers,nalexander,dimi
- Fix newly occured lint triggers
- Fixes tests broken by newest Glean version
Differential Revision: https://phabricator.services.mozilla.com/D269374
Diffstat:
11 files changed, 49 insertions(+), 70 deletions(-)
diff --git a/browser/components/attribution/metrics.yaml b/browser/components/attribution/metrics.yaml
@@ -42,8 +42,6 @@ glean.attribution:
- baseline
- events
expires: never
- no_lint:
- - BASELINE_PING
structure:
type: object
properties:
@@ -86,8 +84,6 @@ glean.distribution:
- baseline
- events
expires: never
- no_lint:
- - BASELINE_PING
structure:
type: object
properties:
diff --git a/browser/components/newtab/metrics.yaml b/browser/components/newtab/metrics.yaml
@@ -2797,6 +2797,8 @@ newtab_content:
type: string
send_in_pings:
- newtab-content
+ no_lint:
+ - HIGHER_DATA_SENSITIVITY_REQUIRED
top_sites: # Replacement for PingCentre "topsites-impression|click" pings.
ping_type:
diff --git a/gfx/metrics.yaml b/gfx/metrics.yaml
@@ -1446,8 +1446,6 @@ gfx.hdr:
expires: never
unit: bitfield
telemetry_mirror: GFX_HDR_WINDOWS_DISPLAY_COLORSPACE_BITFIELD
- no_lint:
- - UNIT_IN_NAME
fontlist:
initotherfamilynames:
diff --git a/mobile/android/android-components/components/lib/crash/src/test/java/mozilla/components/lib/crash/service/GleanCrashReporterServiceTest.kt b/mobile/android/android-components/components/lib/crash/src/test/java/mozilla/components/lib/crash/service/GleanCrashReporterServiceTest.kt
@@ -10,6 +10,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.work.testing.WorkManagerTestInitHelper
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonArray
+import kotlinx.serialization.json.JsonElement
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.JsonPrimitive
import kotlinx.serialization.json.jsonArray
@@ -605,26 +606,26 @@ class GleanCrashReporterServiceTest {
val stackTracesGlean = """
{
- "crashType": "main",
- "crashAddress": "0xf001ba11",
- "crashThread": 1,
- "mainModule": 0,
+ "crash_type": "main",
+ "crash_address": "0xf001ba11",
+ "crash_thread": 1,
+ "main_module": 0,
"modules": [
{
- "baseAddress": "0x00000000",
- "endAddress": "0x00004000",
- "codeId": "8675309",
- "debugFile": "",
- "debugId": "18675309",
+ "base_address": "0x00000000",
+ "end_address": "0x00004000",
+ "code_id": "8675309",
+ "debug_file": "",
+ "debug_id": "18675309",
"filename": "foo.exe",
"version": "1.0.0"
},
{
- "baseAddress": "0x00004000",
- "endAddress": "0x00008000",
- "codeId": "42",
- "debugFile": "foo.pdb",
- "debugId": "43",
+ "base_address": "0x00004000",
+ "end_address": "0x00008000",
+ "code_id": "42",
+ "debug_file": "foo.pdb",
+ "debug_id": "43",
"filename": "foo.dll",
"version": "1.1.0"
}
@@ -632,14 +633,14 @@ class GleanCrashReporterServiceTest {
"threads": [
{
"frames": [
- { "moduleIndex": 0, "ip": "0x10", "trust": "context" },
- { "moduleIndex": 0, "ip": "0x20", "trust": "cfi" }
+ { "module_index": 0, "ip": "0x10", "trust": "context" },
+ { "module_index": 0, "ip": "0x20", "trust": "cfi" }
]
},
{
"frames": [
- { "moduleIndex": 1, "ip": "0x4010", "trust": "context" },
- { "moduleIndex": 0, "ip": "0x30", "trust": "cfi" }
+ { "module_index": 1, "ip": "0x4010", "trust": "context" },
+ { "module_index": 0, "ip": "0x30", "trust": "cfi" }
]
}
]
@@ -701,7 +702,7 @@ class GleanCrashReporterServiceTest {
mapOf(
"phase" to JsonPrimitive("abcd"),
"conditions" to JsonPrimitive("[{\"foo\":\"bar\"}]"),
- "brokenAddBlockers" to JsonArray(listOf(JsonPrimitive("foo"))),
+ "broken_add_blockers" to JsonArray(listOf(JsonPrimitive("foo"))),
),
),
GleanCrash.asyncShutdownTimeout.testGetValue(),
@@ -717,7 +718,7 @@ class GleanCrashReporterServiceTest {
GleanCrash.quotaManagerShutdownTimeout.testGetValue(),
)
assertEquals(
- Json.decodeFromString<JsonObject>(stackTracesGlean),
+ Json.decodeFromString<JsonElement>(stackTracesGlean),
GleanCrash.stackTraces.testGetValue(),
)
pingReceived = true
@@ -785,7 +786,7 @@ class GleanCrashReporterServiceTest {
assertEquals(
JsonObject(
mapOf(
- "typeName" to JsonPrimitive("java.lang.RuntimeException"),
+ "type_name" to JsonPrimitive("java.lang.RuntimeException"),
"message" to JsonPrimitive("Test"),
),
),
@@ -794,7 +795,7 @@ class GleanCrashReporterServiceTest {
assertEquals(
JsonObject(
mapOf(
- "typeName" to JsonPrimitive("java.io.IOException"),
+ "type_name" to JsonPrimitive("java.io.IOException"),
"message" to JsonPrimitive("IO"),
),
),
diff --git a/mobile/android/fenix/app/metrics.yaml b/mobile/android/fenix/app/metrics.yaml
@@ -5012,8 +5012,6 @@ activation:
notification_emails:
- android-probes@mozilla.com
expires: never
- no_lint:
- - USER_LIFETIME_EXPIRATION
metadata:
tags:
- Privacy&Security
@@ -12008,6 +12006,8 @@ wallpapers:
metadata:
tags:
- Wallpapers
+ no_lint:
+ - HIGHER_DATA_SENSITIVITY_REQUIRED
recently_visited_homepage:
history_highlight_opened:
diff --git a/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/experiments/RecordedNimbusContextTest.kt b/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/experiments/RecordedNimbusContextTest.kt
@@ -98,26 +98,26 @@ class RecordedNimbusContextTest {
assertNotNull(recordedValue)
assertEquals(
buildJsonObject {
- put("androidSdkVersion", Build.VERSION.SDK_INT.toString())
- put("appVersion", "")
- put("daysSinceInstall", 5)
- put("daysSinceUpdate", 0)
- put("deviceManufacturer", Build.MANUFACTURER)
- put("deviceModel", Build.MODEL)
- putJsonObject("eventQueryValues") {
- put("daysOpenedInLast28", 1)
+ put("android_sdk_version", Build.VERSION.SDK_INT.toString())
+ put("app_version", "")
+ put("days_since_install", 5)
+ put("days_since_update", 0)
+ put("device_manufacturer", Build.MANUFACTURER)
+ put("device_model", Build.MODEL)
+ putJsonObject("event_query_values") {
+ put("days_opened_in_last_28", 1)
}
- put("installReferrerResponseUtmSource", "")
- put("installReferrerResponseUtmMedium", "")
- put("installReferrerResponseUtmCampaign", "")
- put("installReferrerResponseUtmTerm", "")
- put("installReferrerResponseUtmContent", "")
- put("isFirstRun", false)
+ put("install_referrer_response_utm_source", "")
+ put("install_referrer_response_utm_medium", "")
+ put("install_referrer_response_utm_campaign", "")
+ put("install_referrer_response_utm_term", "")
+ put("install_referrer_response_utm_content", "")
+ put("is_first_run", false)
put("language", "en")
put("locale", "")
put("region", "US")
- put("userAcceptedTou", true)
- put("noShortcutsOrStoriesOptOuts", true)
+ put("user_accepted_tou", true)
+ put("no_shortcuts_or_stories_opt_outs", true)
},
recordedValue?.jsonObject,
)
diff --git a/netwerk/cookie/test/unit/test_timestamp_fixup.js b/netwerk/cookie/test/unit/test_timestamp_fixup.js
@@ -43,7 +43,7 @@ function initDB(conn, now) {
conn.executeSimpleSQL("PRAGMA wal_autocheckpoint = 16");
conn.executeSimpleSQL(
- `INSERT INTO moz_cookies(baseDomain, host, name, value, path, expiry, lastAccessed, creationTime, isSecure, isHttpOnly)
+ `INSERT INTO moz_cookies(baseDomain, host, name, value, path, expiry, lastAccessed, creationTime, isSecure, isHttpOnly)
VALUES ('foo.com', '.foo.com', 'foo', 'bar=baz', '/',
${now + ONE_DAY}, ${now + LAST_ACCESSED_DIFF} , ${
now + CREATION_DIFF
@@ -88,20 +88,14 @@ add_task(async function test_timestamp_fixup() {
await Glean.networking.cookieCreationFixupDiff.testGetValue();
info(JSON.stringify(values));
let keys = Object.keys(values).splice(-2, 2);
- Assert.equal(keys.length, 2, "There should be two entries in telemetry");
+ Assert.equal(keys.length, 1, "There should be one entry in telemetry");
Assert.equal(values[keys[0]], 1, "First entry should have value 1");
- Assert.equal(values[keys[1]], 0, "Second entry should have value 0");
const creationDiffInSeconds = CREATION_DIFF / USEC_PER_SEC;
Assert.lessOrEqual(
parseInt(keys[0]),
creationDiffInSeconds,
"The bucket should be smaller than time diff"
);
- Assert.lessOrEqual(
- creationDiffInSeconds,
- parseInt(keys[1]),
- "The next bucket should be larger than time diff"
- );
}
{
@@ -109,9 +103,8 @@ add_task(async function test_timestamp_fixup() {
await Glean.networking.cookieAccessFixupDiff.testGetValue();
info(JSON.stringify(values));
let keys = Object.keys(values).splice(-2, 2);
- Assert.equal(keys.length, 2, "There should be two entries in telemetry");
+ Assert.equal(keys.length, 1, "There should be one entry in telemetry");
Assert.equal(values[keys[0]], 1, "First entry should have value 1");
- Assert.equal(values[keys[1]], 0, "Second entry should have value 0");
info(now);
const lastAccessedDiffInSeconds = LAST_ACCESSED_DIFF / USEC_PER_SEC;
Assert.lessOrEqual(
@@ -119,11 +112,6 @@ add_task(async function test_timestamp_fixup() {
lastAccessedDiffInSeconds,
"The bucket should be smaller than time diff"
);
- Assert.lessOrEqual(
- lastAccessedDiffInSeconds,
- parseInt(keys[1]),
- "The next bucket should be larger than time diff"
- );
}
conn.close();
diff --git a/toolkit/components/glean/tests/xpcshell/test_Glean.js b/toolkit/components/glean/tests/xpcshell/test_Glean.js
@@ -816,12 +816,12 @@ add_task(async function test_fog_labeled_custom_distribution_works() {
Glean.testOnly.mabelsCustomLabelLengths.monospace.testGetValue();
Assert.equal(2, monospace.count);
Assert.equal(43, monospace.sum);
- Assert.deepEqual({ 0: 0, 1: 2, 268435456: 0 }, monospace.values);
+ Assert.deepEqual({ 1: 2 }, monospace.values);
let sanserif =
Glean.testOnly.mabelsCustomLabelLengths.sanserif.testGetValue();
Assert.equal(1, sanserif.count);
Assert.equal(13, sanserif.sum);
- Assert.deepEqual({ 0: 0, 1: 1, 268435456: 0 }, sanserif.values);
+ Assert.deepEqual({ 1: 1 }, sanserif.values);
// What about invalid/__other__?
Assert.equal(
undefined,
diff --git a/toolkit/components/nimbus/metrics.yaml b/toolkit/components/nimbus/metrics.yaml
@@ -292,8 +292,6 @@ nimbus_targeting_context:
unit: addresses
arch_bits:
- no_lint:
- - UNIT_IN_NAME # metric name must match the targeting context attribute
bugs: *targeting_context_bugs
data_reviews: *targeting_context_data_reviews
expires: *targeting_context_expiry
diff --git a/toolkit/components/passwordmgr/metrics.yaml b/toolkit/components/passwordmgr/metrics.yaml
@@ -818,8 +818,6 @@ pwmgr:
expires: never
unit: passwords
telemetry_mirror: PWMGR_POTENTIALLY_BREACHED_PASSWORDS
- no_lint:
- - UNIT_IN_NAME
num_saved_passwords:
type: quantity
@@ -835,8 +833,6 @@ pwmgr:
notification_emails:
- passwords-dev@mozilla.org
expires: never
- no_lint:
- - UNIT_IN_NAME
rust_mirror_status:
type: event
diff --git a/toolkit/content/tests/browser/browser_about_glean.js b/toolkit/content/tests/browser/browser_about_glean.js
@@ -242,7 +242,7 @@ add_task(async function test_about_glean_histogram() {
// td svg g.boxes g*n >rect+text+text
const boxes = valueCell.firstChild.firstChild.children;
- Assert.equal(boxes.length, 3);
+ Assert.equal(boxes.length, 2, "Bar graphs for bucket 0 and 1 shown");
Assert.equal(boxes[0].children[1].textContent, "2");
Assert.equal(boxes[0].children[2].textContent, "0");
Assert.equal(boxes[1].children[1].textContent, "3");