From 9ddc8604ffbf24ea0b54c862ac897f6f9b27558a Mon Sep 17 00:00:00 2001 From: Will Kahn-Greene Date: Wed, 27 Nov 2024 13:00:44 -0500 Subject: [PATCH 1/2] bug-1933774: omit collector-added fields from Crash Annotations tab This removes the collector-added fields from the Crash Annotations tab of the report view. It's confusing that these were there. This also adds "version" to the Debug tab. This value is the version of the raw crash structure in storage. It's relevant to Socorro internals, but nothing else. --- .../jinja2/crashstats/report_index.html | 54 +++++++++++-------- webapp/crashstats/crashstats/views.py | 29 ++++++---- 2 files changed, 51 insertions(+), 32 deletions(-) diff --git a/webapp/crashstats/crashstats/jinja2/crashstats/report_index.html b/webapp/crashstats/crashstats/jinja2/crashstats/report_index.html index 1fa198ae50..7648de07eb 100644 --- a/webapp/crashstats/crashstats/jinja2/crashstats/report_index.html +++ b/webapp/crashstats/crashstats/jinja2/crashstats/report_index.html @@ -909,17 +909,19 @@

Public data

- {% for key in public_raw_keys %} - - - - + {% for key in public_annotations %} + {% if key not in fields_from_collector %} + + + + + {% endif %} {% endfor %}
- {% if key %} - {{ key }} - {% else %} - empty key - {% endif %} -
{{ raw[key] }}
+ {% if key %} + {{ key }} + {% else %} + empty key + {% endif %} +
{{ raw[key] }}
@@ -936,17 +938,19 @@

Protected data

- {% for key in protected_raw_keys %} - - - - + {% for key in protected_annotations %} + {% if key not in fields_from_collector %} + + + + + {% endif %} {% endfor %}
- {% if key %} - {{ key }} - {% else %} - empty key - {% endif %} -
{{ raw[key] }}
+ {% if key %} + {{ key }} + {% else %} + empty key + {% endif %} +
{{ raw[key] }}
@@ -1203,6 +1207,10 @@

Collector

submitted_timestamp {{ raw.submitted_timestamp | human_readable_iso_date }} UTC + + version + {{ raw.version }} + Throttleable {{ raw.Throttleable|default("--") }} @@ -1273,7 +1281,7 @@

Processor

{% if report and report.stackwalk_version %} {{ report.stackwalk_version }} {% endif %} - {# FIXME(willkg): this is the old locaion; remove in December 2022 #} + {# FIXME(willkg): this is the old location; remove in December 2022 #} {% if report and report.json_dump and report.json_dump.stackwalk_version %} {{ report.json_dump.stackwalk_version }} {% endif %} diff --git a/webapp/crashstats/crashstats/views.py b/webapp/crashstats/crashstats/views.py index 4bf5723a12..f432e14f88 100644 --- a/webapp/crashstats/crashstats/views.py +++ b/webapp/crashstats/crashstats/views.py @@ -202,19 +202,30 @@ def report_index(request, crash_id, default_context=None): ) context["report"]["mac_crash_info"] = mac_crash_info - all_public_raw_keys = raw_api.public_keys() - context["public_raw_keys"] = [x for x in context["raw"] if x in all_public_raw_keys] + all_public_annotations = raw_api.public_keys() + context["public_annotations"] = [ + x for x in context["raw"] if x in all_public_annotations + ] + if request.user.has_perm("crashstats.view_pii"): # If the user can see PII or this is their crash report, include everything - context["protected_raw_keys"] = [ - x for x in context["raw"] if x not in all_public_raw_keys + context["protected_annotations"] = [ + x for x in context["raw"] if x not in all_public_annotations ] else: - context["protected_raw_keys"] = [] - - # Sort keys case-insensitively - context["public_raw_keys"].sort(key=lambda s: s.lower()) - context["protected_raw_keys"].sort(key=lambda s: s.lower()) + context["protected_annotations"] = [] + + # Set of fields added to the raw crash by the collector that are not annotations + context["fields_from_collector"] = { + "metadata", + "uuid", + "submitted_timestamp", + "version", + } + + # Sort annotation keys case-insensitively + context["public_annotations"].sort(key=lambda s: s.lower()) + context["protected_annotations"].sort(key=lambda s: s.lower()) data_urls = [] if request.user.has_perm("crashstats.view_pii"): From 0e9df84cad0958ed739b65706deaf2b4ac3f9c1f Mon Sep 17 00:00:00 2001 From: Will Kahn-Greene Date: Wed, 27 Nov 2024 13:03:01 -0500 Subject: [PATCH 2/2] Remove old code This said to remove it after 2022. It's after 2022 now. --- .../crashstats/crashstats/jinja2/crashstats/report_index.html | 4 ---- 1 file changed, 4 deletions(-) diff --git a/webapp/crashstats/crashstats/jinja2/crashstats/report_index.html b/webapp/crashstats/crashstats/jinja2/crashstats/report_index.html index 7648de07eb..47235a4176 100644 --- a/webapp/crashstats/crashstats/jinja2/crashstats/report_index.html +++ b/webapp/crashstats/crashstats/jinja2/crashstats/report_index.html @@ -1281,10 +1281,6 @@

Processor

{% if report and report.stackwalk_version %} {{ report.stackwalk_version }} {% endif %} - {# FIXME(willkg): this is the old location; remove in December 2022 #} - {% if report and report.json_dump and report.json_dump.stackwalk_version %} - {{ report.json_dump.stackwalk_version }} - {% endif %}