fix: gate cClassTrib applicability by CRT and date

This commit is contained in:
gti
2026-09-25 17:47:04 -03:00
parent 95605c2ff5
commit 4a12640031
25 changed files with 498 additions and 72 deletions
+7 -2
View File
@@ -235,9 +235,14 @@ def test_batch_limit_bounds_the_blast_radius():
def test_simples_never_produces_candidates_even_with_rtc_on():
db = FakeFirebird(PRODUCTS)
out = uf.assess_from_connection(db, {"crt": "1"}, today=TODAY, ncm_valid={c: True for c in PRODUCTS})
products = [{"CODIGO": c, "CCLASSTRIB": v["CCLASSTRIB"], "CLASSIFICACAO_FISCAL": v["CLASSIFICACAO_FISCAL"]} for c, v in db.products.items()]
candidates, total = apply_mod.select_candidates(out["findings"], products)
assert out["context"]["rtc_resolution"]["ready_to_apply"] == 0
kinds = {b["type"] for f in out["findings"].values() for b in f["blockers"]}
assert "CCLASSTRIB_MISSING_UNRESOLVED" in kinds and "CCLASSTRIB_MISSING" not in kinds
assert out["context"]["rtc_resolution"]["not_applicable"] == len(PRODUCTS)
assert candidates == [] and total == 0
assert not [b for f in out["findings"].values() for b in f["blockers"] if b["category"] == "RTC"]
assert all(sql.lstrip().upper().startswith("SELECT") for sql, _ in db.statements)
def test_rtc_off_has_no_resolution_and_no_candidates():