{% extends "base.html" %}
{% from "macros/executive_summary.html" import executive_summary %}
{% from "macros/control_bars.html" import control_bars as render_control_bars %}
{% from "macros/method.html" import method_section %}
{% from "macros/report_purpose.html" import report_purpose %}
{# Control Review report shell. Mirrors the executive_posture shape:
header → hero (executive summary) → content (effects, collateral,
displacement, expected basis) → method → orientation disclosure. #}
{% block hero %}
{{ executive_summary(notes_by_slot, findings) }}
{% endblock %}
{% block content %}
{# Target panel — what was changed, when, and where. The target
descriptor and windows give the reader a stable anchor before the
numerical body of the report. #}
Target of this control
{{ target.descriptor or "Unspecified target" }}
- Before
- {{ windows.baseline | window_fmt }}
- After
- {{ windows.current | window_fmt }}
{% if windows.expected %}
- Expected basis window
- {{ windows.expected | window_fmt }}
{% endif %}
{% if expected_basis_label %}
- Expected basis
- {{ expected_basis_label }}
{% endif %}
{{ render_control_bars(control_bars) }}
{# Target effects table — every metric the control was scored against,
with before/after/expected, delta-vs-expected, status, confidence.
Keeps the same column order the legacy markdown rendered. #}
Target effects
Before / after / expected by metric
{% if effects %}
| Metric |
Before |
After |
Expected |
Δ vs expected |
% vs expected |
Status |
Confidence |
{% for row in effects %}
| {{ row.metric_label or row.metric }} |
{{ row.before if row.before is not none else "—" }} |
{{ row.after if row.after is not none else "—" }} |
{{ row.expected if row.expected is not none else "—" }} |
{%- if row.absolute_delta_vs_expected is not none -%}
{{ "%+.2f"|format(row.absolute_delta_vs_expected) }}
{%- else -%}—{%- endif -%}
|
{%- if row.pct_change_vs_expected is not none -%}
{{ row.pct_change_vs_expected | signed_pct(2) }}
{%- else -%}—{%- endif -%}
|
{{ row.status_label or row.status or "—" }}
|
{{ row.confidence or "—" }} |
{% endfor %}
{% else %}
No target effects available.
{% endif %}
{# Collateral checks — adjacent populations that should not have moved.
Renders even when empty so the reader can see the absence is
deliberate (the legacy markdown emits "No collateral checks
reported." in the same spot). #}
Collateral checks
Adjacent populations
{% if collateral_checks %}
{{ check_table(collateral_checks, "collateral") }}
{% else %}
No collateral checks reported.
{% endif %}
Displacement checks
Displacement to substitute paths
{% if displacement_checks %}
{{ check_table(displacement_checks, "displacement") }}
{% else %}
No displacement checks reported.
{% endif %}
{# Operational interpretation slot — analyst-authored interpretation
of the effects, mirroring the same slot in executive_posture.
Renders only when the wrapper carried an llm-operational note. #}
{% set op_note = notes_by_slot.get("operational_interpretation") if notes_by_slot else None %}
{% if op_note %}
Operational interpretation
What this means for the operator
{{ markdown_render(op_note.text) }}
From {{ (op_note.author_type or "analyst") | humanize_author }}
{% endif %}
{{ method_section(method, scope, confidence.reasons) }}
{% if orientation %}
Orientation — what this report measures
{{ report_purpose(orientation, palette) }}
{% endif %}
{% endblock %}
{# Inline macro: shared row format for collateral and displacement
tables. Keeping it inline because it is only used inside this
template and the row shape is unique to control_review. #}
{% macro check_table(rows, kind) %}
| Metric |
Before |
After |
Δ |
% change |
Status |
Confidence |
{% for row in rows %}
| {{ row.metric_label or row.metric or "—" }} |
{{ row.before if row.before is not none else "—" }} |
{{ row.after if row.after is not none else "—" }} |
{%- if row.delta is not none -%}
{{ "%+.2f"|format(row.delta) }}
{%- else -%}—{%- endif -%}
|
{%- if row.pct_change is not none -%}
{{ row.pct_change | signed_pct(2) }}
{%- else -%}—{%- endif -%}
|
{{ row.status_label or row.status or "—" }}
|
{{ row.confidence or "—" }} |
{% endfor %}
{% endmacro %}