feat: read-only RTC + PIS/COFINS assessment (capabilities, validators, applicability, legacy vs expanded coverage) with panel labels and docs

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
gti
2026-09-24 15:41:51 -03:00
co-authored by Claude Sonnet 5
parent e0ea842168
commit d897cceebb
8 changed files with 528 additions and 6 deletions
@@ -574,3 +574,14 @@ def test_remaining_technical_enums_have_human_labels():
assert health_reason_label("last heartbeat exceeds 300s") == "Sem heartbeat recente"
assert health_reason_label("persistent technical failure") == "Falha técnica persistente"
assert blocker_reason_label("SOMETHING_NEW") == "Something new" # unknown codes degrade readably, never crash
def test_expanded_scope_view_labels_and_absence():
from central.app.panel_presentation import expanded_scope_view
assert expanded_scope_view(None) is None and expanded_scope_view({"coverage": {}}) is None
view = expanded_scope_view({"total_products": 10, "legacy_scope": {"complete": 8, "safe_blocked": 2, "failed": 0},
"expanded_scope": {"complete": 1, "safe_blocked": 3, "failed": 0, "unknown_applicability": 6},
"blockers_by_type": {"PIS_CST_INVALID": 1, "CCLASSTRIB_MISSING": 2}, "local_catalog_only": True})
assert view["legacy_percent"] == 80.0 and view["expanded_percent"] == 10.0 and view["local_catalog_only"]
assert {b["label"] for b in view["blockers"]} == {"CST PIS inválido", "cClassTrib ausente"}
assert blocker_type_label("RTC_CST_INVALID") == "CST IBS/CBS inválido" and blocker_type_label("COFINS_RATE_INVALID") == "Alíquota COFINS inválida"