"""Verify exact tags, trees, blobs, citation lines and bounded absence claims offline.""" import hashlib import json from build_definition import OUT, REF, build def main(): entries = json.loads((REF / "sources.json").read_bytes())["sources"] for e in entries: raw = (REF / e["local_file"]).read_bytes() assert hashlib.sha256(raw).hexdigest() == e["sha256"] tree = json.loads((REF / (e["id"] + "-tree.json")).read_bytes()) assert not tree["truncated"] and tree["sha"] == e["commit"] assert ( hashlib.sha1(b"blob " + str(len(raw)).encode() + b"\0" + raw).hexdigest() == e["git_blob_sha1"] == next(x["sha"] for x in tree["tree"] if x["path"] == e["file"]) ) tags = {} for key in ["core", "frontend"]: tag = json.loads((REF / (key + "-tag.json")).read_bytes()) tree = json.loads((REF / (key + "-tree.json")).read_bytes()) assert tag["object"] == dict(sha=tree["sha"], type="commit", url=tag["object"]["url"]) tags[key] = tree["sha"] block = build() for e in block["sources"]: raw = (OUT / e["local_file"]).read_bytes() assert hashlib.sha256(raw).hexdigest() == e["sha256"] assert 1 <= e["lines"][0] <= e["lines"][1] <= len(raw.decode().splitlines()) trees = json.loads((REF / "core-tree.json").read_bytes())["tree"] assert not [e for e in trees if "seedvr" in e["path"].lower()] investigation = [ "nodes.py", "comfy_extras/nodes_seed.py", "comfy_extras/nodes_compositing.py", "comfy_extras/nodes_post_processing.py", "comfy_extras/nodes_images.py", "comfy_extras/nodes_mask.py", "comfy_extras/nodes_sd3.py", ] for p in investigation: text = ( REF / next(e["local_file"] for e in entries if e["id"] == "core" and e["file"] == p) ).read_text() assert all( name not in text for name in ["SeedVR2Preprocess", "SeedVR2Conditioning", "SeedVR2PostProcessing"] ) report = dict( all_pass=True, git_texts=len(entries), citations=len(block["sources"]), tags=tags, rgthree="27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383", local_file_base="docs/hel-892/seedvr2-document-evidence", investigation=investigation, seedvr_classes="not established in bounded investigation; no global absence claim", source_links_executed=False, ) (OUT / "source-check.json").write_text(json.dumps(report, ensure_ascii=False, indent=2) + "\n") print("PASS exact sources", len(entries), "citations", len(block["sources"])) if __name__ == "__main__": main()