57 @brief Entry point for this script.
58 @return Value returned by `main()`.
60 parser = argparse.ArgumentParser(
62 "Scan PETSc option ingress in src/setup.c and src/io.c, then compare "
63 "against scripts/audit_ingress_manifest.json."
65 formatter_class=argparse.RawDescriptionHelpFormatter,
68 " python3 scripts/audit_ingress.py\n"
69 " python3 scripts/audit_ingress.py --show-scanned\n"
70 " python3 scripts/audit_ingress.py --manifest scripts/audit_ingress_manifest.json\n"
75 default=
"scripts/audit_ingress_manifest.json",
77 "Manifest JSON path, relative to repository root unless absolute "
78 "(default: scripts/audit_ingress_manifest.json)."
84 help=
"Print discovered PETSc options before drift comparison.",
86 args = parser.parse_args()
88 repo_root = pathlib.Path(__file__).resolve().parents[1]
89 manifest_path = (repo_root / args.manifest).resolve()
90 scan_paths = [repo_root /
"src/setup.c", repo_root /
"src/io.c"]
92 if not manifest_path.exists():
93 print(f
"[ERROR] Manifest not found: {manifest_path}", file=sys.stderr)
99 missing_in_manifest = sorted(scanned - expected)
100 stale_in_manifest = sorted(expected - scanned)
102 if args.show_scanned:
103 print(
"[INFO] Scanned PETSc options:")
104 for flag
in sorted(scanned):
108 print(f
"[INFO] Scanned options: {len(scanned)}")
109 print(f
"[INFO] Manifest options: {len(expected)}")
111 if missing_in_manifest:
112 print(
"[ERROR] New PETSc ingress options missing in manifest:")
113 for flag
in missing_in_manifest:
116 if stale_in_manifest:
117 print(
"[ERROR] Manifest options no longer present in setup/io scan:")
118 for flag
in stale_in_manifest:
121 if missing_in_manifest
or stale_in_manifest:
123 "[FAIL] Ingress drift detected. Update scripts/audit_ingress_manifest.json and docs mapping.",
128 print(
"[OK] Ingress manifest matches setup/io PETSc option scan.")