{% endmacro %}
{% macro render_exit_statuses(statuses, runs, summarized_panic_messages=()) %}
{% if not statuses %}
not present
{% endif %}
{% for status in statuses %}
{% if project.old_panic_messages or project.new_panic_messages %}
{% if project.introduced_panic_messages %}
❌ New panic message{{ 's' if project.introduced_panic_messages|length != 1 }} (introduced by this PR)
{{ project.introduced_panic_messages | join('\n') | e }}
{% endif %}
{% if project.fixed_panic_messages %}
{% set fixed_panics_are_improvement = failure_status in ['fixed', 'reduced'] %}
{{ '🎉 Fixed' if fixed_panics_are_improvement else '➖ Previous' }} panic message{{ 's' if project.fixed_panic_messages|length != 1 }} (no longer present)
{{ project.fixed_panic_messages | join('\n') | e }}
{% endif %}
{% if project.persistent_panic_messages %}
➖ Persistent panic message{{ 's' if project.persistent_panic_messages|length != 1 }} (present on both baseline and PR)
{% if project.old_persistent_panic_messages != project.new_persistent_panic_messages %}
Baseline
{{ project.old_persistent_panic_messages | join('\n') | e }}
PR
{{ project.new_persistent_panic_messages | join('\n') | e }}
{% else %}
{{ project.persistent_panic_messages | join('\n') | e }}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% if diffs.flaky_exit_status_changes %}
Flaky Exit Status Changes
Project
Baseline outcomes
PR outcomes
{% for project in diffs.flaky_exit_status_changes %}
{% if project.diffs.added_files %}
{% for file_data in project.diffs.added_files %}
{{ file_data.path }}
{% for diag in file_data.diagnostics %}
{{ render_diagnostic(diag, "added", project.project) }}
{% endfor %}
{# Flaky locations in this added file #}
{% if project.flaky_file_diffs is defined and file_data.path in project.flaky_file_diffs %}
{% for loc in project.flaky_file_diffs[file_data.path].added %}
{{ render_flaky_location(loc, "added", project.project) }}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% if project.diffs.removed_files %}
{% for file_data in project.diffs.removed_files %}
{{ file_data.path }}
{% for diag in file_data.diagnostics %}
{{ render_diagnostic(diag, "removed", project.project) }}
{% endfor %}
{# Flaky locations in this removed file #}
{% if project.flaky_file_diffs is defined and file_data.path in project.flaky_file_diffs %}
{% for loc in project.flaky_file_diffs[file_data.path].removed %}
{{ render_flaky_location(loc, "removed", project.project) }}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% if project.diffs.modified_files %}
{% for file_data in project.diffs.modified_files %}
{{ file_data.path }}
{% if file_data.diffs.added_lines %}
{% for line_data in file_data.diffs.added_lines %}
{% for diag in line_data.diagnostics %}
{{ render_diagnostic(diag, "added", project.project) }}
{% endfor %}
{% endfor %}
{% endif %}
{% if file_data.diffs.removed_lines %}
{% for line_data in file_data.diffs.removed_lines %}
{% for diag in line_data.diagnostics %}
{{ render_diagnostic(diag, "removed", project.project) }}
{% endfor %}
{% endfor %}
{% endif %}
{% if file_data.diffs.modified_lines %}
{% for line_data in file_data.diffs.modified_lines %}
{% for diff_item in line_data.text_diffs %}
{% endfor %}
{% for diag in line_data.removed %}
{{ render_diagnostic(diag, "removed", project.project) }}
{% endfor %}
{% for diag in line_data.added %}
{{ render_diagnostic(diag, "added", project.project) }}
{% endfor %}
{% endfor %}
{% endif %}
{# Flaky locations in this modified file #}
{% if project.flaky_file_diffs is defined and file_data.path in project.flaky_file_diffs %}
{% set ffd = project.flaky_file_diffs[file_data.path] %}
{% for loc in ffd.added %}
{{ render_flaky_location(loc, "added", project.project) }}
{% endfor %}
{% for loc in ffd.removed %}
{{ render_flaky_location(loc, "removed", project.project) }}
{% endfor %}
{% for change in ffd.changed %}
{{ render_flaky_changed(change, project.project) }}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{# Files that only have flaky changes (no stable diagnostic changes) #}
{% if project.flaky_file_diffs is defined %}
{% set stable_files = [] %}
{% for f in project.diffs.added_files %}{% if stable_files.append(f.path) %}{% endif %}{% endfor %}
{% for f in project.diffs.removed_files %}{% if stable_files.append(f.path) %}{% endif %}{% endfor %}
{% for f in project.diffs.modified_files %}{% if stable_files.append(f.path) %}{% endif %}{% endfor %}
{% for flaky_path, ffd in project.flaky_file_diffs.items()|sort %}
{% if flaky_path not in stable_files %}
{{ flaky_path }}
{% for loc in ffd.added %}
{{ render_flaky_location(loc, "added", project.project) }}
{% endfor %}
{% for loc in ffd.removed %}
{{ render_flaky_location(loc, "removed", project.project) }}
{% endfor %}
{% for change in ffd.changed %}
{{ render_flaky_changed(change, project.project) }}
{% endfor %}