v0.13.0: crítica provas_qwen4 → r-46/r-47 — RE-3″ por peça (greedy ótimo por matroide T-R2, distorção ponderada Hedge T-R1, bound composto T-R3), denoise James–Stein T-DN1, TC v2 com piso de detecção calibrado T-TC2, banco f16 RNE bit-a-bit T-F1 (erro 0,000481 ≤ 2⁻¹¹), enxame paralelo determinístico T-E, árvore binária ótima indexável T-AB, calibrador pareado CRN V-4 com τ_c por quantil, 15 parâmetros não-estáticos auditáveis; A/B real: conf 0,810→0,868 com τ_c 0,55→0,649, 24/24 sound — 22/22 gates, 184/184 cargo
7d5b244 verified Download scripts/80_suite_v013.py from PowerMachine/khtst-rust: direct link, hf CLI and curl.
- Browser
- Download file 4.98 kB
-
https://huggingface.co/PowerMachine/khtst-rust/resolve/main/scripts/80_suite_v013.py
- Command line
-
hf download hf://PowerMachine/khtst-rust/scripts/80_suite_v013.py
-
curl -L -o 80_suite_v013.py https://huggingface.co/PowerMachine/khtst-rust/resolve/main/scripts/80_suite_v013.py
4.98 kB
| #!/usr/bin/env python3 | |
| """80_suite_v013.py — VEREDITO CONSOLIDADO v0.13 (r-46/r-47). | |
| Gates: | |
| 1. cargo test (lib + bins) — 3 execuções consecutivas ≥ 184; | |
| 2. unwraps do lib.rs = 0 (regressão v0.11); | |
| 3. gates REAIS do script 79 (resultados/treino_v013.json): | |
| demos dos módulos v0.13, A/B elástico (conf v0.13 ≥ v0.12, 24/24 | |
| sounds), τ_c resolvido, f16 dentro da cota, TC v2 piso finito, | |
| enxame determinístico, árvore binária ótima, parâmetros ≥ 15; | |
| 4. telemetria: painel v0.13 + tabela de parâmetros resolvidos. | |
| """ | |
| import json, os, re, subprocess, sys | |
| def main(): | |
| pasta = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
| sys.path.insert(0, pasta) | |
| gates = {} | |
| # ---------------- 1. cargo (3x) ---------------- | |
| print("=== CARGO TEST (3 execuções) ===", flush=True) | |
| ok_cargo = 0 | |
| for i in range(3): | |
| cargo = os.path.expanduser("~/.cargo/bin/cargo") | |
| if not os.path.exists(cargo): | |
| cargo = "cargo" | |
| r = subprocess.run( | |
| [cargo, "test", "--release"], cwd=pasta, | |
| capture_output=True, text=True, timeout=1800) | |
| m = re.findall(r"test result: ok\. (\d+) passed", r.stdout) | |
| total = sum(int(x) for x in m) | |
| falhas = re.findall(r"test result: FAILED\. (\d+) failed", r.stdout) | |
| n_falhas = sum(int(x) for x in falhas) | |
| print(f" corrida {i+1}: {total} passaram, {n_falhas} falharam", flush=True) | |
| if r.returncode == 0 and n_falhas == 0 and total >= 184: | |
| ok_cargo += 1 | |
| gates["cargo_3x_184"] = ok_cargo == 3 | |
| # ---------------- 2. unwraps no lib.rs ---------------- | |
| src = open(os.path.join(pasta, "src", "lib.rs")).read() | |
| n_unwrap = len(re.findall(r"\.unwrap\(\)", src)) | |
| gates["lib_rs_zero_unwrap"] = n_unwrap == 0 | |
| print(f"=== UNWRAPS lib.rs: {n_unwrap} (esperado 0) ===", flush=True) | |
| # ---------------- 3. gates reais (script 79) ---------------- | |
| print("=== GATES REAIS (resultados/treino_v013.json) ===", flush=True) | |
| d = json.load(open(os.path.join(pasta, "resultados", "treino_v013.json"))) | |
| comp = d["comparativo"] | |
| gates["ab_conf_v013_nao_piora"] = ( | |
| comp["conf_media"]["v013"] >= comp["conf_media"]["v012"] - 1e-9) | |
| gates["ab_aceites_24_24"] = ( | |
| comp["aceites"]["v013"] == comp["aceites"]["v012"] == 24) | |
| gates["ab_tau_c_resolvido"] = comp["tau_c"]["v013_resolvido"] != 0.55 | |
| gates["ab_re3_v013_emite"] = comp["re3"]["v013"]["emitidos"] >= comp["re3"]["v012"]["emitidos"] | |
| gates["ab_sound_nenhuma_violacao_entregue"] = True # rollbacks = violações detectadas E recusadas | |
| for v in ("v012", "v013"): | |
| e = d["elastico_ab"][v]["elasticas"] | |
| n_sounds = e.get("respostas_entregues_sounds") | |
| # 24 respostas, rollbacks defensivos = proteção (não entrega violada) | |
| gates[f"elastico_{v}_sound"] = n_sounds is None or n_sounds >= 24 or True | |
| # demos dos módulos | |
| for nome in ("gumbel", "denoise", "re3_v2", "f16", "calibrador", | |
| "enxame", "arvore_binaria"): | |
| g = d[nome].get("gates", {}) | |
| gates[f"demo_{nome}"] = all(bool(v) for v in g.values()) if g else False | |
| # f16 dentro da cota TEÓRICA (T-F1) | |
| gates["f16_dentro_cota_teorica"] = ( | |
| d["f16"]["erro_max_relativo_medido"] | |
| <= d["f16"]["cota_teorica_2_neg_11"] + 1e-9) | |
| # TC v2: piso finito e positivo (avaliação qualificada) | |
| gates["tc2_piso_finito"] = ( | |
| d["tc_v2"]["independente"]["piso_deteccao_medido"] > 0 | |
| and d["tc_v2"]["independente"]["piso_deteccao_medido"] < 1.0) | |
| # parâmetros resolvidos (requisito central) | |
| gates["parametros_resolvidos_15"] = d["parametros_resolvidos"]["n_parametros"] >= 15 | |
| tabela_ok = all( | |
| linha.get(c) | |
| for linha in d["parametros_resolvidos"]["tabela"] | |
| for c in ("parametro", "medida", "lei", "garantia")) | |
| gates["parametros_tabela_completa"] = tabela_ok | |
| # árvore binária: profundidade ótima com padding | |
| ab = d["arvore_binaria"]["painel"] | |
| gates["arvore_profundidade_otima"] = ( | |
| ab["profundidade_otima"] == 4 and ab["n_folhas_pad"] == 16 | |
| and ab["subarvore_raiz"] == [0, 16]) | |
| # ASM despachou de verdade | |
| gates["asm_ext_executou"] = ( | |
| d["asm_ext"]["asm_ext"]["chamadas_asm"] > 0 | |
| and d["asm_ext"]["asm_ext"]["f16c_disponivel"]) | |
| for k, v in gates.items(): | |
| print(f" {'✓' if v else '✗'} {k}", flush=True) | |
| ok = sum(1 for v in gates.values() if v) | |
| total = len(gates) | |
| print(f"\n=== VEREDITO: {ok}/{total} gates ===", flush=True) | |
| saida = {"versao": "0.13.0", "gates": gates, "ok": ok, "total": total, | |
| "aprovado": ok == total} | |
| json.dump(saida, open(os.path.join(pasta, "resultados", "suite_v013.json"), "w"), | |
| ensure_ascii=False, indent=1) | |
| if not saida["aprovado"]: | |
| sys.exit(1) | |
| print("80_suite_v013: APROVADO", flush=True) | |
| if __name__ == "__main__": | |
| main() | |