Files
aigc-home/docs/hel-892/dualloop-document-evidence/verify-dualloop.py.txt
T
2026-11-01 17:19:37 +08:00

63 lines
5.2 KiB
Plaintext

from pathlib import Path
R=Path.cwd();S=R/'docs/hel-892/singleloop-document-evidence/verify_sources.py';D=R/'docs/hel-892/dualloop-document-evidence';t=S.read_text().replace('ebd0c2823b70e5121f9642f781f2d0fa32cda6abe7d4a68fb0eecacc30e92d06','87412366e6bedd2a2f4490d1a945d0fc005251bb49a20e4ba1157cd6c4ddfbcd').replace('len(g["nodes"]) == 95','len(g["nodes"]) == 109').replace('len(g["links"]) == 90','len(g["links"]) == 100').replace('{0: 95}','{0: 109}').replace('len(inv["fields"]) == 129 and len(inv["notes"]) == 5','len(inv["fields"]) == 147 and len(inv["notes"]) == 6').replace('{17, 172, 238, 25, 253, 260, 266, 267}','{17, 172, 238, 25, 253, 260, 266, 267, 278}').replace('str=82, int=34, bool=8, float=1, NoneType=2, dict=2','str=96, int=35, bool=8, float=2, NoneType=4, dict=2').replace('(42, 2, 46)','(45, 2, 56)')
a=t.index(' assert not any("audioUI"');z=t.index(' assert g["extra"]["frontendVersion"]',a)
t=t[:a]+''' for nid in ["263", "274"]:
assert "audioUI" not in schemas[nid] and "upload" not in schemas[nid]
assert nodes[int(nid)]["widgets_values"][1:] == [None, None]
assert type(nodes[248]["widgets_values"][0]) is int
assert nodes[174]["widgets_values"] == [5]
assert nodes[212]["widgets_values"] == ["ceil((a*b+1-c)/c)"]
assert nodes[254]["widgets_values"] == ["a+1"]
edges = {e[0]: e[1:] for e in g["links"]}
for eid, src, dst in [(532,129,172),(599,232,238),(636,172,266),(641,238,267),
(642,267,259),(625,232,259),(616,252,232),(628,252,260),
(622,259,260),(626,260,253),(634,265,246),(621,212,252),
(617,252,254),(618,254,255),(635,254,253),(619,256,257),
(632,263,262),(643,262,268),(644,268,190),(645,200,25),
(650,274,275),(652,275,277),(651,277,276),(653,280,278),
(437,26,25),(655,26,278),(654,278,279),(656,281,129),(661,286,232),
(542,32,183),(646,273,269),(657,32,282),(658,273,283),
(659,284,129),(660,285,129),(662,287,232),(663,288,232),
(606,191,245),(609,235,246),(664,209,14),(568,209,210)]:
assert edges[eid][0] == src and edges[eid][2] == dst
assert nodes[172]["outputs"][1]["links"] == []
assert nodes[238]["outputs"][1]["links"] == []
assert "links" not in nodes[253]["outputs"][1]
assert not {239,240} & nodes.keys()
for nid, ids in [(129,[656,659,660]),(232,[661,662,663])]:
assert nodes[nid]["widgets_values"][0] == "two_speakers"
assert next(x for x in nodes[nid]["inputs"] if x["name"] == "clip_vision_output")["link"] is None
for name, eid in zip(["mode.audio_encoder_output_2","mode.mask_1","mode.mask_2"],ids,strict=True):
assert next(x for x in nodes[nid]["inputs"] if x["name"] == name)["link"] == eid
assert nodes[209]["outputs"][0]["links"] == [568,664]
assert nodes[14]["inputs"][1]["link"] == 664
assert nodes[171]["widgets_values"] == [73361528061560,"randomize"]
assert nodes[229]["widgets_values"] == [665118465597533,"randomize"]
histories = []
for nid, rate, save in [(245,16,False),(246,25,True)]:
assert "links" not in nodes[nid]["outputs"][0]
w = nodes[nid]["widgets_values"]
assert type(w["frame_rate"]) is int and w["frame_rate"] == 25
assert w["videopreview"]["params"]["score"] == "0"
assert w["videopreview"]["params"]["frame_rate"] == rate
assert w["save_output"] is save
v = w["videopreview"]
raw_order_json = json.dumps(v,ensure_ascii=False,separators=(",",":"))
histories.append(dict(node=nid, original_key_order=list(v),params_key_order=list(v["params"]),
original_order_json=raw_order_json,
original_order_sha256=hashlib.sha256(raw_order_json.encode()).hexdigest(),
sorted_canonical_sha256=hashlib.sha256(canonical(v)).hexdigest(),
comparison="原对象键序JSON与排序canonical分别记,不是HTTP或源文件对象片段原字节"))
write("history-order-evidence.json",histories)
'''+t[z:]
t=t.replace('(REF / "rgthree-range-requests.json")','(REF.parent / "singleloop-reference/rgthree-range-requests.json")')
a=t.index(' assert [(n["node"]');z=t.index(' texts = [',a)
t=t[:a]+''' assert [(n["node"], n["characters"], n["LF"], n["tail_LF"]) for n in notes] == [
("165",2467,55,True),("211",14,0,False),("205",4,0,False),
("206",24,4,False),("217",6,0,False),("289",84,0,False)]
'''+t[z:]
t=t.replace('nodes=95','nodes=109').replace('edges=90','edges=100').replace('saved_fields=129','saved_fields=147').replace('accurate_instances=42','accurate_instances=45').replace('129 values/5 full Notes/90 physical edges','147 values/6 full Notes/100 physical edges').replace('42 exact/2 bounded unresolved/46 no-version aliases','45 exact/2 bounded unresolved/56 no-version aliases')
(D/'verify_sources.py').write_text(t)
p=D/'source_closure.py';t=p.read_text().replace('OUT / "identity-gaps.json",','OUT / "identity-gaps.json",\n OUT / "history-order-evidence.json",');p.write_text(t)
print('Prepared independent dual graph assertions and history key-order/canonical separation')