{# Shared project header strip + sync-action affordances + the not-IN_SYNC banner. Used by project.html (lenses), feedback.html, and review_pack.html so the sync truth + actions read identically on every project sub-page. `active_lens` keys the Check/Force-sync forms' lens; `sync_result` (optional) is the just-taken action. #} {% import "macros.html" as m %}
{{ meta.name }}
{{ meta.kind }}
{% if meta.wired %} generated@ {{ meta.source_short }} HEAD@ {{ meta.head_short }} at {{ meta.generated_at or '—' }} {% else %} not wired into the federation {% endif %}
{{ m.sync_chip(meta.sync_state) }} {# Sync actions (spec §5.5): Check sync is safe (deep, non-mutating); Force-sync is the affirmative mutation behind a confirm disclosure. Compose feedback opens the one sanctioned write (§5.4, §5.6). An unwired/unreadable project can't be deep-checked — offer nothing false, say why (honest-absence). #}
{% if meta.wired %} Compose feedback
Force-sync

Rebuilds generated/ in the working tree — uncommitted; you review + commit project-side.

{% else %} {{ meta.sync_state }} — can't check {% endif %}
{% if sync_result %} {# The result of the action just taken — kept in the readout so it prints. #}
{{ '✓' if sync_result.ok else '!' }} {{ sync_result.text }}
{% endif %} {% if not meta.wired %} {# Project-level honest-absence: requested but not discoverable / unreadable. #}
{{ m.absence({ 'state': meta.sync_state, 'title': "This project isn't wired yet" if meta.sync_state == 'UNKNOWN' else "This project's resources can't be read", 'reason': meta.sync_detail, 'action': 'Add a fed-resources/ tree and run the fedres generator; it then appears in the federation.' if meta.sync_state == 'UNKNOWN' else 'Regenerate on a supported schema (0.1), or upgrade the reader.', 'errors': [], }) }}
{% else %} {# Not-IN_SYNC banner — one line: exactly what's behind + the single action that fixes it (spec §5.4, §5.7). #} {% if meta.sync_state == 'STALE' %}
{{ meta.name }} is behind — {{ meta.sync_detail }}. Force-sync to rebuild generated/ from current source.
{% elif meta.sync_state == 'TAMPERED' %}
{{ meta.name }} — {{ meta.sync_detail }}. Force-sync to regenerate from source.
{% elif meta.sync_state in ('UNREADABLE', 'ERROR') %}
{{ meta.sync_detail }}
{% endif %} {% endif %}