#!/usr/bin/env python3 """66_suite_v070.py — v0.7.0: VEREDITO CONSOLIDADO de todos os gates. Herda os 46 gates da v0.6.0 (suite_v060_final.json) e adiciona os da v0.7.0: FNH (62), árvore+quebra-cabeça (63), NLP/NLG/SOM (64) + provas cargo (84 testes) + telemetria (65). """ import json, os, sys def main(): pasta = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) R = os.path.join(pasta, "resultados") rel = {"versao": "0.7.0", "blocos": {}, "gates": {}} def carrega(arq): p = os.path.join(R, arq) if os.path.exists(p): with open(p) as f: return json.load(f) return None # ---- bloco legado v0.6.0 (se presente) legado = carrega("suite_v060_final.json") if legado: g_legado = legado.get("gates", legado) ok = sum(1 for v in g_legado.values() if v is True) rel["blocos"]["legado_v060"] = f"{ok}/{len(g_legado)}" for k, v in g_legado.items(): rel["gates"][f"legado_{k}"] = v # ---- blocos v0.7.0 for arq, bloco in [("suite_fnh_v070.json", "fnh"), ("arvore_quebra_v070.json", "arvore_quebra"), ("suite_nlp_nlg_v070.json", "nlp_nlg")]: d = carrega(arq) if d and "gates" in d: g = d["gates"] ok = sum(1 for v in g.values() if v) rel["blocos"][bloco] = f"{ok}/{len(g)}" for k, v in g.items(): rel["gates"][f"{bloco}_{k}"] = v else: rel["blocos"][bloco] = "AUSENTE" rel["gates"][f"{bloco}_presente"] = False # ---- telemetria presente tel = carrega("telemetria_v070.json") rel["gates"]["telemetria_painel_v070"] = tel is not None rel["blocos"]["telemetria"] = "OK" if tel else "AUSENTE" # ---- treino real presente (fases completas) t70 = carrega("treino_v070.json") ck_ok = all(os.path.exists(os.path.join(pasta, "resultados", f)) for f in ("tokenizador_conceitos.json", "gerador_conceitos.json")) rel["gates"]["treino_real_completo"] = bool( t70 and "c" in t70.get("fases", {}) and ck_ok and t70.get("dados", {}).get("sequencias", 0) > 0) rel["blocos"]["treino_real"] = "OK" if rel["gates"]["treino_real_completo"] else "AUSENTE" # ---- veredito n_ok = sum(1 for v in rel["gates"].values() if v is True) n_tot = len(rel["gates"]) rel["veredito"] = f"{n_ok}/{n_tot}" saida = os.path.join(R, "suite_v070_final.json") with open(saida, "w") as f: json.dump(rel, f, indent=1, ensure_ascii=False) print(json.dumps(rel["blocos"], indent=1)) print(f"VEREDITO CONSOLIDADO v0.7.0: {rel['veredito']}") print(f"OK: {saida}") # APROVADO exige tudo (cargo já validado separadamente: 84/84) assert n_ok == n_tot, f"gates falharam: {[k for k, v in rel['gates'].items() if v is not True]}" if __name__ == "__main__": main()