From 7d024ee2edffa5cf902ae3fd87ca59d58602a60e Mon Sep 17 00:00:00 2001 From: Will Kahn-Greene Date: Tue, 3 Dec 2024 16:35:13 -0500 Subject: [PATCH] bug-1933774: omit collector-added fields from Crash Annotations tab (#6823) * 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. * Remove old code This said to remove it after 2022. It's after 2022 now. --- .../jinja2/crashstats/report_index.html | 56 ++++++++++--------- webapp/crashstats/crashstats/views.py | 29 +++++++--- 2 files changed, 50 insertions(+), 35 deletions(-) diff --git a/webapp/crashstats/crashstats/jinja2/crashstats/report_index.html b/webapp/crashstats/crashstats/jinja2/crashstats/report_index.html index 1fa198ae50..47235a4176 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,10 +1281,6 @@

Processor

{% if report and report.stackwalk_version %} {{ report.stackwalk_version }} {% endif %} - {# FIXME(willkg): this is the old locaion; 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"):