{# Confidence ribbon -- full-width strip immediately under the intent banner. Four states (T34.2 recalibrated thresholds): * replay_confidence is None -> ribbon hidden (replay did not run). * replay_confidence >= 0.85 -> green "High replay confidence." * 0.65 <= replay_confidence < 0.85 -> yellow "Moderate replay confidence." * replay_confidence < 0.65 -> red "Low replay confidence." Previously any confidence >= 0.5 was labelled "High", which oversold a real Staples capture at 67% (corrupted Akamai cookies dragging the replay down -- see T34.1). 67% is now Moderate, not High. We surface match counts so the user gets a "X of Y matched" summary regardless of side. Inline styles because styles.css is byte-pinned. #} {% if report.replay_confidence is not none %} {% set total = report.replay_per_endpoint | length %} {% set matches = report.replay_per_endpoint | selectattr('matched') | list | length %} {% set conf = report.replay_confidence %} {% if conf >= 0.85 %} {% set ribbon_tier = 'high' %} {% set border_color = 'var(--ok)' %} {% set badge_color = 'var(--ok)' %} {% set badge_text = 'High replay confidence.' %} {% set badge_glyph = '✔' %} {% elif conf >= 0.65 %} {% set ribbon_tier = 'moderate' %} {% set border_color = 'var(--warn, #d4a017)' %} {% set badge_color = 'var(--warn, #d4a017)' %} {% set badge_text = 'Moderate replay confidence.' %} {% set badge_glyph = '⚠' %} {% else %} {% set ribbon_tier = 'low' %} {% set border_color = 'var(--accent)' %} {% set badge_color = 'var(--accent)' %} {% set badge_text = 'Low replay confidence.' %} {% set badge_glyph = '⚠' %} {% endif %}
{{ badge_glyph | safe }} {{ badge_text }} {{ matches }} of {{ total }} recommended call{{ '' if total == 1 else 's' }} returned data matching the captured response shape ({{ '%.0f' | format(conf * 100) }}%). {% if ribbon_tier == 'moderate' %} Spot-check the partial matches before scaling. {% elif ribbon_tier == 'low' %} Verify each endpoint manually before scaling the recommended approach. {% endif %}
{% endif %}