"Check exact Git text/tag identity and independent raw-source inventory." import hashlib import json from build_definition import OUT, REF, REPO, build, canonical from inventory import inventory def main(): block = build() rows = json.loads((REF / "sources.json").read_bytes())["sources"] for e in rows: raw = (REF / e["local_file"]).read_bytes() blob = hashlib.sha1(b"blob " + str(len(raw)).encode() + b"\0" + raw).hexdigest() assert hashlib.sha256(raw).hexdigest() == e["sha256"] assert blob == e["git_blob_sha1"] t = json.loads((REF / (e["id"] + "-tree.json")).read_bytes()) c = json.loads((REF / (e["id"] + "-commit.json")).read_bytes()) assert c["sha"] == t["sha"] == e["commit"] and not t["truncated"] assert c["tree"]["sha"] == e["tree"] assert next(x["sha"] for x in t["tree"] if x["path"] == e["file"]) == blob for key, sha in [ ("core0357", "b0338e930bbc1f9d01f005f224573d5994732932"), ("frontend1348", "39037da56c70846a6fe6c4579e5ba15a3b35429d"), ]: tag = json.loads((REF / (key + "-tag.json")).read_bytes()) assert tag["object"]["sha"] == sha and tag["object"]["type"] == "commit" inv = inventory() assert len(inv["fields"]) == 94 and len(inv["notes"]) == 1 for a, f in zip(inv["fields"], block["fields"], strict=True): assert (a["pointer"], a["scope"], a["json_type"], canonical(a["value"])) == ( f["pointer"], f["scope"], f["json_type"], canonical(f["value"]), ) assert inv["notes"][0]["value"] == block["comments"][0]["text"] texts = set() 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()) texts.add(e["local_file"]) g = json.loads((REPO / block["source_path"]).read_bytes()) ns = {n["id"]: n for n in g["nodes"]} assert g["extra"]["frontendVersion"] == "1.34.8" assert g["extra"]["node_versions"]["comfy-core"] == "0.3.24" assert not g.get("definitions") and all("widgets_values_named" not in n for n in g["nodes"]) assert sum(n["mode"] == 4 for n in g["nodes"]) == 4 for eid, src, slot, dst, inp, _ in g["links"]: assert eid in ns[src]["outputs"][slot]["links"] and ns[dst]["inputs"][inp]["link"] == eid # Complete exact trees record the missing identity/license; no class is invented. for key in ["emotion", "basepro"]: paths = {e["path"] for e in json.loads((REF / (key + "-tree.json")).read_bytes())["tree"]} assert "LICENSE" not in paths and not any("tts2_pro" in p.lower() for p in paths) emotion_paths = { e["path"] for e in json.loads((REF / "emotion-tree.json").read_bytes())["tree"] } assert "index_tts2_mode_nodes.py" not in emotion_paths (OUT / "source-check.json").write_text( json.dumps( dict( all_pass=True, source_files=len(rows), cited_texts=len(texts), citations=len(block["sources"]), counts=block["counts"], local_file_base=str(OUT.relative_to(REPO)), upstream_executed=False, source_frontend="1.34.8", missing_emotion_classes_and_pro_preserved=True, index_license_body="absent from both exact trees", sdk_semantics="unknown; not loaded", ), ensure_ascii=False, indent=2, ) + "\n" ) print(("PASS exact commit/tree/blob/tag, 94 raw positions, Note, 13 physical edges")) if __name__ == "__main__": main()