{# Single-execution detail page. This intentionally follows opportunities/detail.html's visual grammar: back link, header card, one-line summary, cohesive stat strip, trend, issue rows, query, and evidence panels. The content stays job-specific, but the page should feel like the same product surface. #} {% extends "layout.html" %} {% block content %} {% from "components/_page_header.html" import back_link, header_card %} {% from "components/_signal_chip.html" import signal_chip %} {% from "components/_sql_panel.html" import sql_panel %} {% from "components/_detail_side_card.html" import detail_side_card %} {% from "components/_materialization_side.html" import materialization_side_content %} {% from "components/_query_review.html" import query_review_card %}
{{ back_link("/dashboard", "Dashboard") }}
{% if job.destination_table and job.destination_table != '-' %} {% set _title %}{{ job.destination_short }}{% endset %} {% else %} {% set _title %}{{ job.job_id }}{% endset %} {% endif %} {% call header_card(_title) %} {% if job.workload_kind == "build" %} {{ signal_chip("Build", color="brand", title="Build - this query writes a destination table") }} {% elif job.workload_kind == "consumption" %} {{ signal_chip("Consumption", color="teal", title="Consumption - read-only query, no destination written") }} {% endif %} {% if job.is_dbt_originated or job.origin_tool == "dbt" %} dbt {% endif %} {% if job.user_email and job.user_email != "-" %} {% set _author_label %}{{ job.user_email }}{% endset %} {{ signal_chip(_author_label, color="slate") }} {% endif %} {% if job.origin_tool and job.origin_tool != "ad_hoc" and not (job.origin_tool == "dbt" and job.is_dbt_originated) %} {% set _origin_label %}{{ job.origin_tool | replace('_', ' ') }}{% endset %} {{ signal_chip(_origin_label, color="slate") }} {% endif %} {{ job.job_id }} {{ job.statement_type }} {% if job.cache_hit %} {{ signal_chip("Cache hit", color="slate") }} {% endif %} {% endcall %} {%- set _scan_cost = cohort_aggregates.cost_usd if cohort_aggregates else job.cost_usd -%} {%- set _runs = cohort_aggregates.execution_count if (cohort_aggregates and cohort_aggregates.execution_count) else 1 -%}

{{ issue_count }} issue{{ '' if issue_count == 1 else 's' }} · {{ suggestion_count }} suggestion{{ '' if suggestion_count == 1 else 's' }} · {{ _scan_cost | format_usd }} in the scan window

{# Same four-column stat grammar as opportunity detail. The primary values are aggregated across the destination table when a cohort exists; the muted line shows the latest execution snapshot. #} {%- set _last_ts = latest_execution.creation_time.strftime("%Y-%m-%d %H:%M UTC") if (latest_execution and latest_execution.creation_time) else "" -%} {%- set _agg_bytes = cohort_aggregates.bytes_processed if cohort_aggregates else job.bytes_processed -%} {%- set _agg_slot_ms = cohort_aggregates.slot_time_ms if cohort_aggregates else job.slot_time_ms -%} {%- set _cost_meta = ( "last " ~ (latest_execution.cost_usd | format_usd) ~ ((" / " ~ _last_ts) if _last_ts else "") ) if latest_execution else None -%} {%- set _bytes_meta = ( "last " ~ (latest_execution.bytes_processed | format_bytes) ~ ((" / billed " ~ (latest_execution.bytes_billed | format_bytes)) if latest_execution.bytes_billed is not none else "") ) if (latest_execution and latest_execution.bytes_processed is not none) else None -%} {%- set _slot_meta = ( ("last " ~ (latest_execution.duration_ms | format_duration) ~ " wall") if (latest_execution and latest_execution.duration_ms is not none) else None ) -%}

Cost

{{ _scan_cost | format_usd }}

{% if _cost_meta %}

{{ _cost_meta }}

{% endif %}

Bytes processed

{{ (_agg_bytes | format_bytes) if _agg_bytes is not none else "-" }}

{% if _bytes_meta %}

{{ _bytes_meta }}

{% endif %}

Slot time

{{ ("%.1f" | format((_agg_slot_ms or 0) / 3600000) ~ " hrs") if _agg_slot_ms is not none else "-" }}

{% if _slot_meta %}

{{ _slot_meta }}

{% endif %}

Executions

{{ "{:,}".format(_runs) }}

in scan window

{% if chart_points_payload %} {% set chart_title = "Cost trend and issues" %} {# Subtitle is derived from the payload granularity inside the partial (per-execution vs daily roll-up), so we don't hard-code "per day". #} {% set chart_collapsible = false %} {% include "jobs/_cost_chart.html" %} {% endif %}
{{ query_review_card(primary_query_improvement, job.query, improvements | length) }}
{% call detail_side_card("Issues", issue_count ~ (" issue" if issue_count == 1 else " issues")) %} {% if issue_count %}
{% for issue in issues %} {% if issue.is_issue %}
{{ signal_chip(issue.display_name, color="rose", title="Issue found on this job") }} {% if issue.explanation %}

{{ issue.explanation }}

{% endif %}
{% if issue.rule_description %}

{{ issue.rule_description }}

{% endif %} View opportunity
{% endif %} {% endfor %}
{% else %}

No issue rules fired for this job.

{% endif %} {% endcall %} {% set _job_sql_suggestion_total = improvements | length %} {% call detail_side_card("SQL Suggestions", _job_sql_suggestion_total ~ (" suggestion" if _job_sql_suggestion_total == 1 else " suggestions")) %} {% if improvements %}
{% for imp in improvements %}
{{ imp.display_name }} {% if imp.template_id %} deterministic rewrite {% endif %} {% if primary_query_improvement and imp.rule_type == primary_query_improvement.rule_type %} shown in query {% endif %} {% if imp.occurrences and imp.occurrences > 1 %} ×{{ imp.occurrences }} {% endif %}
{% if imp.diff_lines or imp.before_content %}

Original, suggested, and diff views are available in the query panel.

{% elif imp.explanation %}

{{ imp.explanation }}

{% endif %}
{% endfor %}
{% else %}

No deterministic SQL rewrite suggestions are attached to this job.

{% endif %} {% endcall %} {% set _materialization_count = (audit_mv_candidates | length) + (bq_mv_recommendations | length) %} {% call detail_side_card("Materialization Suggestion", _materialization_count ~ (" candidate" if _materialization_count == 1 else " candidates")) %} {{ materialization_side_content(audit_mv_candidates, bq_mv_recommendations) }} {% endcall %}
{% if visible_evidence or job_lookup_sql %}
{% if visible_evidence %}

Evidence

{% for key, value in visible_evidence.items() %}
{{ key }}
{% if value is mapping or (value is iterable and value is not string) %} {{ value | tojson }} {% else %} {{ value }} {% endif %}
{% endfor %}
{% endif %} {% if job_lookup_sql %} {{ sql_panel("job-lookup-sql", "BigQuery query", job_lookup_sql) }} {% endif %}
{% endif %}
{% endblock %}