from __future__ import annotations

from pathlib import Path


ROOT = Path(__file__).resolve().parents[3]
BACKUP_STATUS = ROOT / "scripts" / "backup" / "backup-status.sh"


def test_backup_status_keeps_aggregate_failure_out_of_core_blockers() -> None:
    text = BACKUP_STATUS.read_text(encoding="utf-8")

    assert "metric_sum_excluding_backup_all" in text
    assert "component_failed_110" in text
    assert "component_failed_188" in text
    assert "aggregate_failed=${failed_total_110}" in text
    core_line = next(line for line in text.splitlines() if line.startswith("core_blockers="))
    assert "component_failed_110" in core_line
    assert "component_failed_188" in core_line
    assert "failed_total_110" not in core_line
    assert "failed_total_188" not in core_line
