{# 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/_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) %} {% set _workload_label = "build" if job.workload_kind == "build" else ("consumption" if job.workload_kind == "consumption" else none) %}
{% if _workload_label %} {{ signal_chip(_workload_label, color="slate", title="Build writes a destination table; consumption is read-only.") }} {% endif %} {{ signal_chip("slot reservation" if job.reservation_id else "on demand", color="slate", title=("reservation_id: " ~ job.reservation_id) if job.reservation_id else "No reservation_id on this job.") }}

{{ job_header_summary }}

{% 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 -%} {# 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, query_improvements | length, query_improvements) }}
{% call detail_side_card("Issues", issue_count ~ (" issue" if issue_count == 1 else " issues"), open=True) %} {% 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 imp.diff_lines or imp.before_content or imp.after_content %} in query selector {% 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 %}
{# Technical details - same BigQuery record table + lookup SQL as Opportunity detail. #} {% if job_lookup_sql or job_lookup_rows %}

Technical details

Cached BigQuery job records and lookup SQL for verification.

{% include "components/_job_records_table.html" %} {% if job_lookup_sql %}

Job lookup SQL

{{ job_lookup_sql }}
{% endif %}
{% endif %}
{% endblock %}