{% extends "layout.html" %} {% block content %}
Pull Requests PR #{{ pr.pr_number }}
{# Header #}

Pull Request

#{{ pr.pr_number }}

{% if pr.status == 'open' %} Open {% elif pr.status == 'merged' %} Merged {% else %} Closed {% endif %} {% if verified_data %} {% if verified_data.status == 'confirmed' %} Savings Confirmed {% elif verified_data.status == 'negative' %} Costs Increased {% elif verified_data.status == 'collecting' %} Collecting Data {% elif verified_data.status == 'pending' %} Tracking Pending {% elif verified_data.status == 'insufficient_data' %} Insufficient Data {% endif %} {% endif %}
{# PR details - 2 column layout #}

Repository

{{ pr.repository }}

Branch

{{ pr.branch_name }}

Created

{{ pr.created_at.strftime('%d %b %Y %H:%M') if pr.created_at else '—' }}

Merged

{{ pr.merged_at.strftime('%d %b %Y %H:%M') if pr.merged_at else '—' }}

{# Lifecycle #}

Lifecycle

Created -> Open -> Verified -> Merged -> Savings collected

{% if pr.pr_url %} Open on GitHub {% endif %}
{% set lifecycle_verified = verified_data and verified_data.status in ['confirmed', 'negative'] %} {% set lifecycle_collecting = verified_data and verified_data.status in ['collecting', 'pending', 'insufficient_data'] %}

Created

{{ pr.created_at.strftime('%d %b %Y %H:%M') if pr.created_at else '—' }}

Open

{% if pr.status == 'open' %}Open{% else %}Archived{% endif %}

Verified

{% if lifecycle_verified %} {{ verified_data.status | replace('_', ' ') | title }} {% elif lifecycle_collecting %} {{ verified_data.status | replace('_', ' ') | title }} {% else %} Pending {% endif %}

Merged

{% if pr.merged_at %}Merged{% else %}Waiting{% endif %}

Savings Collected

{% if lifecycle_verified %} Collected {% elif lifecycle_collecting %} Collecting {% else %} Pending {% endif %}

{% if opportunity %} {# Linked opportunity #}

Linked Opportunity

{{ opportunity.opportunity_type | replace('_', ' ') | title }} {{ opportunity.affected_table }} {% if opportunity.dbt_model_name %} dbt: {{ opportunity.dbt_model_name }} {% endif %}
{% if config %} View opportunity details → {% endif %}
{% endif %} {% if verified_data and verified_data.status in ['confirmed', 'negative'] %} {# Verified savings metrics #}

Post-Merge Cost Verification

Pre-Merge Avg Cost

{% if verified_data.pre_merge_avg_cost is not none %} {{ verified_data.pre_merge_avg_cost | format_usd }} {% else %}—{% endif %}

{{ verified_data.pre_merge_job_count }} jobs

Post-Merge Avg Cost

{% if verified_data.post_merge_avg_cost is not none %} {{ verified_data.post_merge_avg_cost | format_usd }} {% else %}—{% endif %}

{{ verified_data.post_merge_job_count }} jobs

Verified Savings

{% if verified_data.verified_savings is not none %} {{ verified_data.verified_savings | format_usd }} {% else %}—{% endif %}

Per run

{% elif verified_data and verified_data.status == 'collecting' %}

Collecting post-merge job data. The cost verification chart will populate as new jobs run.

{% elif verified_data and verified_data.status == 'pending' %}

Cost tracking will begin after the next scheduled sync.

{% endif %} {% if verified_comparison %}

Verified Savings Comparison

Average BigQuery job cost before and after merge

{{ verified_data.status | replace('_', ' ') | title }}
{% endif %} {# ──────────────── Code Diff ──────────────── #}

Code Changes

{% if solution_diffs and solution_diffs | length > 0 %} {% for sol_diff in solution_diffs %}
{% set file_path = sol_diff.file_path %} {% set diff_lines = sol_diff.diff_lines %} {% include "components/code_diff.html" %}
{% endfor %} {% elif diff_error %}

Could not fetch diff from GitHub: {{ diff_error }}

View diff on GitHub instead
{% else %}

No code changes available for this PR.

{% endif %}
{# ──────────────── Cost Trend Chart ──────────────── #}

Cost Trend

{% if cost_trend and cost_trend | length > 0 %}
{% else %}

{% if pr.status == 'open' %} Cost trend will appear after the PR is merged and jobs begin running. {% else %} No job cost data available for this table yet. {% endif %}

{% endif %}
{# ──────────────── Cost History Table ──────────────── #} {% if cost_history and cost_history | length > 0 %}

Cost History

{% if merged_at_str %} {% endif %} {% for row in cost_history %} {# Merge date divider row #} {% if row.is_merge_date %} {% endif %} {% if merged_at_str %} {% endif %} {% endfor %}
Run Time Run CostSaving Cumulative Savings
PR Merged — {{ merged_at_str }}
{{ row.date }} ${{ '%.6f' % row.cost }} {% if row.is_post_merge and row.saving is defined %} {{ '+' if row.saving >= 0 else '' }}${{ '%.6f' % row.saving }} {% else %} {% endif %} {% if row.is_post_merge and row.cumulative_savings is defined %} {{ '+' if row.cumulative_savings >= 0 else '' }}${{ '%.6f' % row.cumulative_savings }} {% else %} {% endif %}
{% endif %}
← Back to Pull Requests
{% if cost_trend and cost_trend | length > 0 %} {% endif %} {% if verified_comparison %} {% endif %} {% endblock %}