"Verify exact text, Git/package provenance and source graph without upstream imports." import hashlib import json from build_definition import OUT, REF, build, canonical from inventory import inventory def object_hash(kind, raw): return hashlib.sha1(kind.encode() + b" " + str(len(raw)).encode() + b"\0" + raw).hexdigest() def main(): block, inv = build(), inventory() rows = json.loads((REF / "sources.json").read_bytes())["sources"] checks = [] for e in rows: raw = (REF / e["local_file"]).read_bytes() assert hashlib.sha256(raw).hexdigest() == e["sha256"] if e["id"] == "litegraph": root = REF / e["identity_root"] assert ( json.loads((root / "litegraph__package__package.json").read_bytes())["version"] == "0.15.15" ) front = next( x for x in rows if x["id"] == "frontend" and x["file"] == "package-lock.json" ) lock = json.loads((REF / front["local_file"]).read_bytes()) assert ( lock["packages"]["node_modules/@comfyorg/litegraph"]["integrity"] == "sha512-" + e["artifact_sha512_base64"] ) proof = ( "Pinned frontend1.23.0 lock, exact0.15." "15 member SHA; whole artifact digest r" "eused, Git unknown" ) elif "package_record" in e: package = json.loads((REF / e["package_record"]).read_bytes()) reg = json.loads((REF / e["registry_record"]).read_bytes()) member = next(x for x in package["members"] if x["path"] == e["file"]) assert member["saved"] and member["sha256"] == e["sha256"] assert reg["version"] == e["tag"] == "1.0.0" assert package["sha256"] == e["artifact_sha256"] proof = ( "复用已审准确发布成员SHA/registry/历史整包摘要记录;本轮未获取整包,不证明Git绑定" ) elif e["id"] == "llama-unavailable": proof = "准确20571提交不可得的有界调查原记录,仅缺口,不作为schema实现" else: root = REF / e["identity_root"] key = e["identity_key"] commit = (root / (key + "-commit.txt")).read_bytes() tree = json.loads((root / (key + "-tree.json")).read_bytes()) assert object_hash("commit", commit) == e["commit"] assert commit.decode().splitlines()[0] == "tree " + e["tree"] == "tree " + tree["sha"] assert not tree["truncated"] assert ( next(t["sha"] for t in tree["tree"] if t["path"] == e["file"]) == e["git_blob_sha1"] == object_hash("blob", raw) ) tag = json.loads((root / (key + "-tag.json")).read_bytes()) tag_raw = (root / (key + "-tag.txt")).read_bytes() assert tag["commit"] == e["commit"] if tag["object"] == e["commit"]: assert tag_raw == commit else: assert object_hash("tag", tag_raw) == tag["object"] assert tag_raw.decode().startswith("object " + e["commit"] + "\n") proof = ( "Rehashed commit/tag/selected blo" "b; complete tree listing, not fu" "ll tree-object rehash" ) if not e["license_file"].startswith("未知"): license_row = next( x for x in rows if x["id"] == e["id"] and ((REF / x["local_file"]).resolve() == (REF / e["license_file"]).resolve()) ) assert ( hashlib.sha256((REF / e["license_file"]).read_bytes()).hexdigest() == license_row["sha256"] ) checks.append(dict(id=e["id"], file=e["file"], sha256=e["sha256"], proof=proof)) assert inv["sha256"] == "2434bd48e3c29abf9e6ed0931f3c8825481772a134a065f6cfdd3c0b89ba81b7" assert len(inv["fields"]) == 151 and len(inv["notes"]) == 1 and len(inv["scopes"]) == 1 sc = inv["scopes"][0] assert (sc["nodes"], sc["edges"], sc["named_nodes"]) == (94, 95, 82) assert sc["modes"].count(0) == 93 and sc["modes"].count(4) == 1 assert {e["node"] for e in inv["empty"] if e["state"] == "missing"} == { 14, 244, 232, 78, 79, 95, 56, 212, 54, 297, 164, 245, } assert [e["node"] for e in inv["empty"] if e["state"] == "empty_list"] == [234] for f, x in zip(block["fields"], inv["fields"], strict=True): assert ( f["pointer"] == x["pointer"] and f["json_type"] == x["json_type"] and f["scope"] == "root" ) assert canonical(f["value"]) == canonical(x["value"]) == canonical(f["named_value"]) from build_definition import PATHS, REPO g = json.loads((REPO / PATHS[0]).read_bytes()) ns = {n["id"]: n for n in g["nodes"]} assert g["extra"]["frontendVersion"] == "1.49.6" for eid, src, si, dst, di, typ in g["links"]: assert eid in ns[src]["outputs"][si]["links"] and ns[dst]["inputs"][di]["link"] == eid assert {e[0]: e[1:5] for e in g["links"]} == { 75: [41, 0, 14, 0], 76: [41, 0, 15, 0], 77: [41, 1, 15, 1], 78: [41, 2, 15, 2], 79: [41, 3, 15, 3], 111: [56, 0, 54, 1], 113: [55, 0, 54, 0], 116: [9, 0, 56, 1], 236: [67, 0, 9, 8], 237: [67, 2, 9, 9], 342: [141, 0, 54, 2], 372: [151, 0, 149, 1], 379: [149, 0, 54, 3], 380: [9, 1, 54, 4], 389: [150, 0, 149, 0], 414: [95, 0, 164, 1], 460: [9, 0, 95, 1], 480: [178, 0, 164, 2], 492: [152, 0, 164, 3], 546: [50, 0, 212, 0], 558: [214, 0, 79, 0], 559: [214, 0, 78, 0], 560: [164, 1, 214, 0], 564: [215, 1, 205, 6], 570: [218, 0, 217, 1], 571: [217, 1, 9, 7], 599: [225, 0, 57, 0], 624: [234, 0, 232, 0], 625: [231, 0, 233, 0], 626: [235, 0, 234, 0], 627: [233, 0, 235, 0], 636: [236, 0, 235, 2], 643: [211, 0, 50, 0], 645: [212, 0, 224, 0], 646: [212, 0, 225, 0], 647: [224, 0, 57, 1], 648: [78, 0, 241, 0], 649: [79, 0, 241, 1], 652: [243, 0, 245, 0], 653: [244, 1, 245, 1], 656: [245, 0, 164, 4], 658: [14, 0, 248, 0], 659: [14, 1, 249, 0], 662: [252, 0, 67, 0], 663: [253, 0, 67, 1], 664: [45, 0, 254, 0], 665: [255, 0, 67, 2], 666: [256, 0, 214, 2], 668: [3, 0, 258, 0], 669: [4, 0, 259, 0], 670: [260, 0, 9, 1], 671: [261, 0, 9, 2], 672: [262, 0, 9, 0], 673: [15, 2, 263, 0], 675: [264, 0, 218, 1], 676: [266, 0, 9, 10], 677: [15, 3, 265, 0], 678: [15, 4, 267, 0], 679: [15, 5, 268, 0], 680: [15, 6, 269, 0], 681: [15, 0, 270, 0], 682: [15, 1, 271, 0], 683: [272, 0, 9, 3], 684: [273, 0, 9, 4], 685: [274, 0, 9, 5], 686: [232, 0, 275, 0], 687: [276, 0, 9, 6], 688: [277, 0, 78, 1], 689: [278, 0, 79, 1], 690: [279, 0, 164, 0], 691: [280, 0, 233, 6], 692: [281, 0, 233, 5], 693: [282, 0, 233, 2], 694: [57, 0, 284, 0], 695: [285, 0, 205, 0], 696: [224, 0, 286, 0], 697: [287, 0, 95, 0], 698: [29, 0, 288, 0], 699: [289, 0, 279, 0], 700: [290, 0, 55, 0], 701: [237, 0, 291, 0], 702: [292, 0, 149, 2], 703: [293, 0, 57, 2], 704: [281, 0, 235, 1], 706: [2, 0, 257, 0], 707: [228, 0, 211, 0], 708: [54, 1, 297, 0], 709: [297, 0, 214, 1], 710: [297, 0, 244, 0], 715: [205, 0, 56, 0], 705: [265, 0, 215, 0], 651: [244, 0, 243, 0], 650: [241, 0, 240, 0], 660: [250, 0, 243, 3], 661: [251, 0, 243, 4], } import collections types = collections.Counter(f["json_type"] for f in inv["fields"]) assert types == dict(str=102, int=32, bool=15, NoneType=1, float=1) raw = ns[41]["widgets_values"][4] state = json.loads(raw) assert raw == ns[41]["widgets_values_named"]["track_data"] assert ( len(raw), raw.count("\r"), raw.count("\n"), raw.count("\\n"), raw.endswith("\n"), hashlib.sha256(raw.encode()).hexdigest(), ) == ( 11917, 0, 0, 126, False, "4649e63b5d020560825267831f04c824a943d9dc954aca2c44b310984eadd134", ) keys = [] def scan(v, p=""): if isinstance(v, dict): for k, x in v.items(): if ( any( t in k.lower() for t in [ "api_key", "apikey", "authorization", "access_token", "password", "secret", ] ) and x ): keys.append(p + "/" + k) scan(x, p + "/" + k) elif isinstance(v, list): for i, x in enumerate(v): scan(x, p + "/" + str(i)) scan(state) assert not keys note = ns[246]["widgets_values"][0] assert note == ns[246]["widgets_values_named"]["text"] == block["comments"][0]["text"] assert ( len(note), note.count("\n"), note.count("\\n"), note.endswith("\n"), hashlib.sha256(note.encode()).hexdigest(), ) == (201, 5, 0, False, "1cc5278923600ace074a19d9469660920478f96978ef345ba31ce073d63cf942") assert ns[234]["widgets_values"] == [] and ns[234]["widgets_values_named"] == {} assert ns[224]["mode"] == 4 and ns[243]["widgets_values"][5:] == [False, "cuda", "cuda", "fp16"] assert ( ns[243]["widgets_values_named"]["force_unload"] == "cuda" and next(i for i in ns[243]["inputs"] if i["name"] == "force_unload")["type"] == "BOOLEAN" ) assert ns[54]["outputs"][0]["links"] is None and ns[54]["outputs"][1]["links"] == [708] assert ns[164]["outputs"][0]["links"] == [] and ns[164]["outputs"][1]["links"] == [560] assert all(o["links"] is None for o in ns[240]["outputs"]) bind = {e["node_id"]: e for e in block["node_bindings"]} assert len(bind) == 93 assert ( sum(len(e["candidates"]) == 1 for e in bind.values()) == 48 and sum(e["source_id"] == "unknown" for e in bind.values()) == 45 ) assert all( e["source_id"] == "unknown" and not e["candidates"] for e in bind.values() if e["class_type"] in ["SetNode", "GetNode", "Reroute", "MarkdownNote"] ) def text(key, file): return ( REF / next(e["local_file"] for e in rows if e["id"] == key and e["file"] == file) ).read_text() llama = text("llama", "nodes.py") assert ( '"llama_cpp_model_loader": llama_cpp_model_loader' in llama and '"llama_cpp_instruct_adv": llama_cpp_instruct_adv' in llama ) assert ( "class llama_cpp_model_loader:" in llama and "if not LLAMA_CPP_STORAGE.llm or LLAMA_CPP_STORAGE.current_config != custom_config:" in llama ) assert "create_chat_completion" in llama and "if force_offload:" in llama up = text("upscale", "nodes/minimax_h3_latent_upscaler_3d.py").split( "class MinimaxH3LatentUpscaler3D" )[1] assert ( "enable_temporal_chunking" not in up and "force_unload" not in up and '"keep_proportion", default=True' in up and 'selected_mode = mode["mode"]' in up ) media = ( text("media85", "nodes/minimax.py") .split("class EasyMiniMaxH3ToVideo")[1] .split("def execute")[0] ) assert ( '"multi_frames"' in media and '"last_frame"' not in media and "locked_video_timing_frames" not in media ) clip = text("core0290", "nodes.py").split("class CLIPLoader:")[1].split("class ")[0] assert ( '"minimax"' not in clip and "getattr(comfy.sd.CLIPType, type.upper(), comfy.sd.CLIPType.STABLE_DIFFUSION)" in clip ) audio = ( text("core0290", "comfy_extras/nodes_audio.py") .split("def vae_decode_audio(")[1] .split("class VAEDecodeAudio")[0] ) assert "unbind" not in audio video = text("core0330", "comfy_extras/nodes_video.py") assert 'codec_name = codec["codec"]' in video create = video.split("class CreateVideo")[1].split("class ")[0] assert '"color_space"' not in create and '"codec"' not in create clean = text("easynew", "py/nodes/logic.py").split("class cleanGPUUsed")[1].split("class ")[0] assert "cleanGPUUsedForce()" in clean and "return io.NodeOutput(anything)" in clean prev = text("core0320", "comfy_extras/nodes_preview_any.py") assert "torch.set_printoptions(edgeitems=6)" in prev and '"result": (value,)' in prev result = dict( sources=checks, positions=151, paired_positions=151, list_types=types, notes=1, edges=95, accurate_nodes=48, unknown_identity_nodes=[e for e in bind.values() if e["source_id"] == "unknown"], track_raw_sha256=hashlib.sha256(raw.encode()).hexdigest(), parsed_track_data=state, note_sha256=hashlib.sha256(note.encode()).hexdigest(), credential_keys_found=keys, schema_conflicts=[ "llama canonical repository vs aux", "core029 minimax CLIP absent/audio no nested extraction", "MiniMax9d lacks last_frame/locked timing", "upscale no temporal/force unload and typed mode/keep_proportion", "CreateVideo extra fields/bit_depth COMBO", "SaveVideo single data output/typed codec", ], upstream_executed=False, ) (OUT / "source-check.json").write_text(json.dumps(result, ensure_ascii=False, indent=2) + "\n") (OUT / "node-version-bindings.json").write_text( json.dumps(block["node_bindings"], ensure_ascii=False, indent=2) + "\n" ) print("PASS151 positions/named;1Note/95edges;48 exact/45 unknown; raw state11917/SHA") if __name__ == "__main__": main()