setup models

This commit is contained in:
Marcos Lohmann
2026-10-07 13:43:09 -03:00
parent aeee6c7de1
commit 84ea9a5307
75 changed files with 5093 additions and 58 deletions

31
harness/verify_bucket.py Normal file
View File

@@ -0,0 +1,31 @@
"""Audita o bucket de artefatos: o conteúdo real de cada objeto bate com o SHA-256 do manifesto?
Uso (na VM ou num job): python -m harness.verify_bucket
"""
import hashlib
import json
import sys
from pathlib import Path
from harness.objstore import client
MANIFEST = Path(__file__).resolve().parents[1] / "env" / "artifacts-manifest.json"
def main():
c, ns = client()
manifest = json.loads(MANIFEST.read_text())
bad = 0
for a in manifest["artifacts"]:
h = hashlib.sha256()
for chunk in c.get_object(ns, manifest["bucket"], a["object"]).data.raw.stream(1 << 22, decode_content=False):
h.update(chunk)
ok = h.hexdigest() == a["sha256"]
bad += not ok
print(("ok " if ok else "DIVERGENTE ") + a["object"], flush=True)
print(f"{len(manifest['artifacts']) - bad}/{len(manifest['artifacts'])} artefatos conferem")
sys.exit(1 if bad else 0)
if __name__ == "__main__":
main()