{% if render_mode != 'fragment' %} {% if domain %}{% endif %} Component Diff - Finite State Report {% include "_design_system.html" %} {% include "_console_shell.html" %} {% endif %} {% if render_mode != 'fragment' %} {% endif %} {% import "_console_macros.html" as fs with context %} {# Defensive defaults #} {% set summary = summary | default({}) %} {% if summary is not mapping %}{% set summary = {} %}{% endif %} {% set version_skew = version_skew | default([]) %} {% set left_only = left_only | default([]) %} {% set right_only = right_only | default([]) %} {% set empty_side = empty_side | default(None) %} {% set left_label = summary.get('left_label', 'Left') if summary is mapping else 'Left' %} {% set right_label = summary.get('right_label', 'Right') if summary is mapping else 'Right' %} {% set shared_count = summary.get('shared_count', 0) if summary is mapping else 0 %} {% set left_only_count = summary.get('left_only_count', 0) if summary is mapping else 0 %} {% set right_only_count = summary.get('right_only_count', 0) if summary is mapping else 0 %} {% set version_skew_count = summary.get('version_skew_count', 0) if summary is mapping else 0 %} {% set union_count = shared_count + left_only_count + right_only_count %} {% if render_mode != 'fragment' %} {{ fs.topbar( crumbs=["Finite State", "Component Diff"], meta=[ {"label": "Left", "value": left_label}, {"label": "Right", "value": right_label}, {"label": "Generated", "value": generated_at or "—"}, ], controls=[], ) }} {% endif %}

Component Comparison

{{ left_label }} vs {{ right_label }}

{% if empty_side %}
{% if empty_side == 'both' %} No data. Both scopes had no component data — nothing to compare. {% elif empty_side == 'left' %} {{ left_label }}: no data. The {{ left_label }} scope had no component data — nothing to compare. {% elif empty_side == 'right' %} {{ right_label }}: no data. The {{ right_label }} scope had no component data — nothing to compare. {% endif %}
{% else %} {# Lede stat-line + scope tag #}

{{ shared_count }} shared · {{ left_only_count }} only in {{ left_label }} · {{ right_only_count }} only in {{ right_label }} · {{ version_skew_count }} shared component{{ 's' if version_skew_count != 1 }} at a different version.

● {{ left_label }} vs {{ right_label }} ●
{# KPI summary row #}
{{ fs.kpi_cell("Shared", shared_count, delta="on both sides") }} {{ fs.kpi_cell(left_label ~ " only", left_only_count, delta=("added attack surface" if left_only_count > 0 else "no unique surface"), dot=("high" if left_only_count > 0 else None)) }} {{ fs.kpi_cell(right_label ~ " only", right_only_count, delta=("added attack surface" if right_only_count > 0 else "no unique surface"), dot=("high" if right_only_count > 0 else None)) }} {{ fs.kpi_cell("Version skew", version_skew_count, delta="shared, differing version", dot=("medium" if version_skew_count > 0 else None)) }}
{# Proportion bar — segment widths straight from the counts, no chart lib #}
{{ fs.panel_head("Shared vs. divergent surface", meta=(union_count | string) ~ " component" ~ ("s" if union_count != 1 else "") ~ " in union") }}
{% if shared_count > 0 %}
{{ shared_count }}
{% endif %} {% if left_only_count > 0 %}
← {{ left_only_count }} in {{ left_label }} only
{% endif %} {% if right_only_count > 0 %}
{{ right_only_count }} in {{ right_label }} only →
{% endif %}
Shared {{ shared_count }} {{ left_label }} only {{ left_only_count }} {{ right_label }} only {{ right_only_count }}
{# Version skew cards — both versions side by side; NO newer/older ordering #} {% if version_skew and version_skew | length > 0 %}
{{ fs.panel_head("Version skew", meta=(version_skew | length | string) ~ " shared component" ~ ("s" if version_skew | length != 1 else "")) }}
{% for row in version_skew %}
{{ left_label | short_scope }}
{{ row.left_version or '—' }}
{# Owners per side — which variants carry the left version. NEVER merged with the right side. #} {% if row.left_project_names %}
{{ row.left_project_names | join(', ') }}
{% endif %}
{{ row.name or '—' }}{% if row.type %} · {{ row.type }}{% endif %}
{{ right_label | short_scope }}
{{ row.right_version or '—' }}
{% if row.right_project_names %}
{{ row.right_project_names | join(', ') }}
{% endif %}
{% if loop.last %}
Shared components carried at differing versions. Aligning the version closes the version-specific findings on the lower side.
{% endif %}
{% endfor %}
{% endif %} {# Right-only inventory table (reuses .data-table). Project column binds to row.right_project_names (the variants carrying the component). When the whole table shares a single owner, the panel-head names it. #} {% if right_only and right_only | length > 0 %} {% set rcount = right_only | length %} {% set rcollapse = rcount > 12 %} {% set r_owner_ns = namespace(items=[]) %} {% for row in right_only %}{% for p in (row.right_project_names or []) %}{% if p and p not in r_owner_ns.items %}{% set _ = r_owner_ns.items.append(p) %}{% endif %}{% endfor %}{% endfor %} {% set r_all_in = (r_owner_ns.items | first) if (r_owner_ns.items | length) == 1 else None %}
{{ fs.panel_head( (right_label | short_scope) ~ "-only components", meta=(rcount | string) ~ " component" ~ ("s" if rcount != 1 else "") ~ (" · all in " ~ r_all_in if r_all_in else "")) }}
{% for row in right_only %} 12 %} class="mc-row-hidden"{% endif %}> {% endfor %}
Component Type Version Project
{{ row.name or '—' }} {% if row.type %}{{ row.type }}{% else %}—{% endif %} {{ row.version or '—' }} {{ (row.right_project_names | join(', ')) if row.right_project_names else '—' }}
{% if rcollapse %}
{% endif %}
{% endif %} {# Left-only inventory table (reuses .data-table). Project column binds to row.left_project_names (mirror of right-only). #} {% if left_only and left_only | length > 0 %} {% set lcount = left_only | length %} {% set lcollapse = lcount > 12 %} {% set l_owner_ns = namespace(items=[]) %} {% for row in left_only %}{% for p in (row.left_project_names or []) %}{% if p and p not in l_owner_ns.items %}{% set _ = l_owner_ns.items.append(p) %}{% endif %}{% endfor %}{% endfor %} {% set l_all_in = (l_owner_ns.items | first) if (l_owner_ns.items | length) == 1 else None %}
{{ fs.panel_head( (left_label | short_scope) ~ "-only components", meta=(lcount | string) ~ " component" ~ ("s" if lcount != 1 else "") ~ (" · all in " ~ l_all_in if l_all_in else "")) }}
{% for row in left_only %} 12 %} class="mc-row-hidden"{% endif %}> {% endfor %}
Component Type Version Project
{{ row.name or '—' }} {% if row.type %}{{ row.type }}{% else %}—{% endif %} {{ row.version or '—' }} {{ (row.left_project_names | join(', ')) if row.left_project_names else '—' }}
{% if lcollapse %}
{% endif %}
{% endif %} {# Empty-side confident strip — conditional on *_only_count == 0 #} {% if right_only_count == 0 %}
{{ right_label }} only: 0. {{ right_label }} introduces no components {{ left_label }} lacks.
{% endif %} {% if left_only_count == 0 %}
{{ left_label }} only: 0. {{ left_label }} introduces no components {{ right_label }} lacks.
{% endif %} {% if not version_skew and not left_only and not right_only %}
Component inventories match. No component differences between {{ left_label }} and {{ right_label }}.
{% endif %} {% endif %}{# end empty_side else #}
{% if render_mode != 'fragment' %} {{ fs.status_bar(items=[ "Recipe: Component Diff", "Left: " ~ left_label, "Right: " ~ right_label, generated_at | default(''), ], version='fs-report ' ~ (fs_report_version | default('dev'))) }} {% include '_action_buttons.html' %} {% endif %}