From e1dd98a03ebeffe5a69ea0232577ca02a15d99a3 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Mon, 2 Nov 2026 16:01:16 +0100 Subject: [PATCH 1/4] Ensure ALL_OBJECT_CHECKS actually run against the known items --- CHANGELOG.md | 1 + glean_parser/lint.py | 13 +++++++++++-- glean_parser/pings.py | 2 +- tests/data/unknown_ping_used.yaml | 2 ++ tests/test_lint.py | 2 +- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13c642f81..96bec9bd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Fix tests that failed when `SOURCE_DATE_EPOCH` is set in the environment - Add a `skip_schema_validation` option to `parse_objects` to skip schema validation of input files ([bug 2076540](https://bugzilla.mozilla.org/show_bug.cgi?id=2076540)) - Mark `test_logging` as requiring a web connection +- BUGFIX: Ensure ALL_OBJECT_CHECKS actually run against the known items ([bug 2088071](https://bugzilla.mozilla.org/show_bug.cgi?id=2088071)) ## 22.0.1 diff --git a/glean_parser/lint.py b/glean_parser/lint.py index cafb57310..5ed0ba9f0 100644 --- a/glean_parser/lint.py +++ b/glean_parser/lint.py @@ -641,11 +641,20 @@ def _lint_all_objects( ) -> List[GlinterNit]: nits: List[GlinterNit] = [] - pings = objects.get("pings") + pings = {} + metrics = {} + + for key, item in objects.items(): + if key == "pings": + pings.update(item) + elif key == "tags": + pass + else: + metrics.update(item) + if not pings: return [] - metrics = objects.get("all_metrics") if not metrics: return [] diff --git a/glean_parser/pings.py b/glean_parser/pings.py index 937bb48f3..267322c2b 100644 --- a/glean_parser/pings.py +++ b/glean_parser/pings.py @@ -14,7 +14,7 @@ from . import util -RESERVED_PING_NAMES = ["baseline", "metrics", "events", "deletion-request", "default"] +RESERVED_PING_NAMES = ["baseline", "metrics", "events", "deletion-request", "default", "server-deletion-request"] class Ping: diff --git a/tests/data/unknown_ping_used.yaml b/tests/data/unknown_ping_used.yaml index 66c98c951..75780f280 100644 --- a/tests/data/unknown_ping_used.yaml +++ b/tests/data/unknown_ping_used.yaml @@ -25,6 +25,8 @@ all_metrics: send_in_pings: - metrics - events + no_lint: + - METRIC_ON_EVENTS_LIFETIME non_existent_ping: <<: *defaults diff --git a/tests/test_lint.py b/tests/test_lint.py index f81fcccbb..46f3786b4 100644 --- a/tests/test_lint.py +++ b/tests/test_lint.py @@ -505,7 +505,7 @@ def test_unknown_pings_lint(): assert len(errs) == 0 nits = lint.lint_metrics(all_objects.value, parser_config={}) - assert len(nits) == 2 + assert len(nits) == 1 assert nits[0].check_name == "UNKNOWN_PING_REFERENCED" assert nits[0].name == "all_metrics.non_existent_ping" assert "does-not-exist" in nits[0].msg From 86e5c77a9840b1904150e39661e4b414382e58e0 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Mon, 2 Nov 2026 16:01:16 +0100 Subject: [PATCH 2/4] Reserve "tags" and "pings" as ping names and ensure our list is applied --- CHANGELOG.md | 1 + glean_parser/pings.py | 11 ++++++++++- tests/data/reserved_pings.yamlx | 27 +++++++++++++++++++++++++++ tests/test_parser.py | 10 ++++++++++ 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 tests/data/reserved_pings.yamlx diff --git a/CHANGELOG.md b/CHANGELOG.md index 96bec9bd5..83123f8e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Add a `skip_schema_validation` option to `parse_objects` to skip schema validation of input files ([bug 2076540](https://bugzilla.mozilla.org/show_bug.cgi?id=2076540)) - Mark `test_logging` as requiring a web connection - BUGFIX: Ensure ALL_OBJECT_CHECKS actually run against the known items ([bug 2088071](https://bugzilla.mozilla.org/show_bug.cgi?id=2088071)) +- Reserve "tags" and "pings" as ping names. These cannot be used for custom pings ## 22.0.1 diff --git a/glean_parser/pings.py b/glean_parser/pings.py index 267322c2b..6f7d35025 100644 --- a/glean_parser/pings.py +++ b/glean_parser/pings.py @@ -14,7 +14,16 @@ from . import util -RESERVED_PING_NAMES = ["baseline", "metrics", "events", "deletion-request", "default", "server-deletion-request"] +RESERVED_PING_NAMES = [ + "baseline", + "metrics", + "events", + "deletion-request", + "default", + "server-deletion-request", + "tags", + "pings", +] class Ping: diff --git a/tests/data/reserved_pings.yamlx b/tests/data/reserved_pings.yamlx new file mode 100644 index 000000000..fc3d4375d --- /dev/null +++ b/tests/data/reserved_pings.yamlx @@ -0,0 +1,27 @@ +# Any copyright is dedicated to the Public Domain. +# https://creativecommons.org/publicdomain/zero/1.0/ + +--- +$schema: moz://mozilla.org/schemas/glean/pings/2-0-0 + +# A list of all reserved ping names. +# This is verified in a test to match the list of defined reserved pings. + +metrics: + &common + description: A ping + include_client_id: true + bugs: + - https://example.com/bugs + data_reviews: + - https://example.com/reviews + notification_emails: + - CHANGE-ME@test-only.com + +baseline: *common +events: *common +deletion-request: *common +default: *common +server-deletion-request: *common +tags: *common +pings: *common diff --git a/tests/test_parser.py b/tests/test_parser.py index 7b9bec403..947100f86 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -12,6 +12,7 @@ import pytest from glean_parser import metrics +from glean_parser import pings from glean_parser import parser import util @@ -1637,3 +1638,12 @@ def test_categories(): errs = list(all_metrics) assert len(errs) == 0 + + +def test_reserved_pings(): + all_metrics = parser.parse_objects(ROOT / "data" / "reserved_pings.yamlx") + + errors = list(all_metrics) + assert len(errors) == len(pings.RESERVED_PING_NAMES) + for error in errors: + assert "Ping uses a reserved name" in error From 0b92ad6733ee32dc8c2d7be34dbf6e04c2ee511f Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Mon, 2 Nov 2026 17:16:21 +0100 Subject: [PATCH 3/4] Reserve the "health" ping (it's a builtin) --- glean_parser/pings.py | 1 + tests/data/reserved_pings.yamlx | 1 + 2 files changed, 2 insertions(+) diff --git a/glean_parser/pings.py b/glean_parser/pings.py index 6f7d35025..163ff52b4 100644 --- a/glean_parser/pings.py +++ b/glean_parser/pings.py @@ -23,6 +23,7 @@ "server-deletion-request", "tags", "pings", + "health", ] diff --git a/tests/data/reserved_pings.yamlx b/tests/data/reserved_pings.yamlx index fc3d4375d..ffd9ce37d 100644 --- a/tests/data/reserved_pings.yamlx +++ b/tests/data/reserved_pings.yamlx @@ -25,3 +25,4 @@ default: *common server-deletion-request: *common tags: *common pings: *common +health: *common From 7da8287f0516d6f1bdc5fdbf3b635efdd6b82423 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Mon, 2 Nov 2026 18:05:47 +0100 Subject: [PATCH 4/4] Update tests/data/reserved_pings.yamlx Co-authored-by: Chris H-C --- tests/data/reserved_pings.yamlx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/data/reserved_pings.yamlx b/tests/data/reserved_pings.yamlx index ffd9ce37d..cab3739c3 100644 --- a/tests/data/reserved_pings.yamlx +++ b/tests/data/reserved_pings.yamlx @@ -7,8 +7,7 @@ $schema: moz://mozilla.org/schemas/glean/pings/2-0-0 # A list of all reserved ping names. # This is verified in a test to match the list of defined reserved pings. -metrics: - &common +metrics: &common description: A ping include_client_id: true bugs: