[DTP-Worker 20260805_104219] FIX de COHÉRENCE 4Big : acceptance_gen.py était le SEUL des 23 générateurs à rompre la convention universelle de code de sortie (main() -> None + appel nu main() vs -> int + raise SystemExit(main()) chez les 22 autres) → aligné (cmd_build/cmd_validate/main -> int, return 0, SystemExit(main())) ; le paramètre argv que tous exposent pour la testabilité renvoyait None au lieu de 0 à un appelant programmatique. Comportement inchangé (chemin d'échec _validate_or_die -> sys.exit(1) préservé, succès=0/échec=1), artefacts byte-identiques, 37 tests OK, 33 PASS CI. Classe docstring-vs-code auditée end-to-end aujourd'hui (23 gen + *lib/ helpers) = exacte par ailleurs.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -280,7 +280,7 @@ def _validate_or_die(bundle: dict) -> None:
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def cmd_build(args) -> None:
|
||||
def cmd_build(args) -> int:
|
||||
bundle = _build_bundle()
|
||||
_validate_or_die(bundle)
|
||||
out_dir = args.out or _DEFAULT_OUT
|
||||
@@ -297,17 +297,19 @@ def cmd_build(args) -> None:
|
||||
f"hors-périmètre sourcés.")
|
||||
print(f" → {os.path.join(out_dir, 'acceptance_matrix.json')}")
|
||||
print(f" → {os.path.join(out_dir, 'MANIFEST.json')}")
|
||||
return 0
|
||||
|
||||
|
||||
def cmd_validate(args) -> None:
|
||||
def cmd_validate(args) -> int:
|
||||
bundle = _build_bundle()
|
||||
_validate_or_die(bundle)
|
||||
cov = bundle["manifest"]["coverage"]
|
||||
print(f"✅ Matrice valide — bijective={cov['bijective']} · "
|
||||
f"partition_ok={cov['partition_ok']} · verdict={bundle['verdict']}.")
|
||||
return 0
|
||||
|
||||
|
||||
def main(argv=None) -> None:
|
||||
def main(argv=None) -> int:
|
||||
p = argparse.ArgumentParser(
|
||||
prog="acceptance_gen",
|
||||
description="Matrice d'acceptation / traçabilité MVP (roadmap → preuve).")
|
||||
@@ -322,8 +324,8 @@ def main(argv=None) -> None:
|
||||
v.set_defaults(func=cmd_validate)
|
||||
|
||||
args = p.parse_args(argv)
|
||||
args.func(args)
|
||||
return args.func(args)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
raise SystemExit(main())
|
||||
|
||||
Reference in New Issue
Block a user