From 1470db40532ffe1d9d8df9effc936252798bfb55 Mon Sep 17 00:00:00 2001 From: leefer Date: Fri, 30 Oct 2026 08:17:25 +0800 Subject: [PATCH] HEL-892: show source-bound Chinese H3 parameter definitions Co-authored-by: multica-agent --- .../src/calliope/comfyui/fixed_document.py | 45 + .../src/calliope/comfyui/library.py | 26 +- .../src/calliope/comfyui/source_reviews.json | 928 +++++++++++++++++- calliope-backend/tests/test_fixed_document.py | 221 +++++ calliope-web/src/lib/comfy/types.ts | 42 + .../components/WorkflowDocumentDrawer.svelte | 73 +- .../h3-document-evidence/build_definition.py | 425 ++++++++ .../h3-document-evidence/definition.json | 926 +++++++++++++++++ .../hel-892/h3-document-evidence/recompute.py | 299 ++++++ .../hel-892/无UE文生视频核心第二组参考契约.md | 2 +- e2e/h3-document.mjs | 119 +++ e2e/run-h3-document.py | 78 ++ e2e/workflow-document-server.py | 60 +- 13 files changed, 3217 insertions(+), 27 deletions(-) create mode 100644 calliope-backend/src/calliope/comfyui/fixed_document.py create mode 100644 calliope-backend/tests/test_fixed_document.py create mode 100644 docs/hel-892/h3-document-evidence/build_definition.py create mode 100644 docs/hel-892/h3-document-evidence/definition.json create mode 100644 docs/hel-892/h3-document-evidence/recompute.py create mode 100644 e2e/h3-document.mjs create mode 100644 e2e/run-h3-document.py diff --git a/calliope-backend/src/calliope/comfyui/fixed_document.py b/calliope-backend/src/calliope/comfyui/fixed_document.py new file mode 100644 index 00000000..5992ec15 --- /dev/null +++ b/calliope-backend/src/calliope/comfyui/fixed_document.py @@ -0,0 +1,45 @@ +"""One source-bound editorial document; never a conversion or execution contract.""" + +from __future__ import annotations + +import copy +import hashlib +import json + +SOURCE_PATH = ( + "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/" + "Minimax-H3提示词增强.json" +) +# Pins the reviewed Chinese text, saved values, pointers and complete evidence citations. +DEFINITION_SHA256 = "76d877b68660509c9305dd807109525da42d49481b1e2878a5ce2686bba99799" + + +def canonical(value: object) -> bytes: + return json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(",", ":")).encode() + + +def fixed_document_for(path: str, source: object, review: dict | None) -> dict | None: + """Fail closed on any source, identity, dual saved value or citation mismatch. + + review_for already checks the original byte SHA1 before supplying a review. + The canonical digest also protects direct build_document callers from mixing + another source object with that review. No upstream code or network is used. + """ + if path != SOURCE_PATH: + return None + pending = { + "matched": False, + "notice": "固定版本参数说明待核对:源文件、声明版本或说明依据未匹配,未采用旧定义。", + } + block = (review or {}).get("fixed_version_document") + if not isinstance(block, dict): + return pending + if hashlib.sha256(canonical(block)).hexdigest() != DEFINITION_SHA256: + return pending + if ( + block["source_path"] != path + or (review or {}).get("source_sha") != block["source_sha1"] + or hashlib.sha256(canonical(source)).hexdigest() != block["canonical_sha256"] + ): + return pending + return {**copy.deepcopy(block), "matched": True} diff --git a/calliope-backend/src/calliope/comfyui/library.py b/calliope-backend/src/calliope/comfyui/library.py index 9865a27b..98151eb6 100644 --- a/calliope-backend/src/calliope/comfyui/library.py +++ b/calliope-backend/src/calliope/comfyui/library.py @@ -13,6 +13,7 @@ from typing import Any from calliope.comfyui.companions import resolve_companion from calliope.comfyui.delivery_scope import exclusion_for +from calliope.comfyui.fixed_document import fixed_document_for from calliope.comfyui.lint import workflow_warnings from calliope.comfyui.output_map import auto_output_map, needs_user_output_map from calliope.comfyui.parser import classify_usage, parse_dynamic_inputs, parse_dynamic_outputs @@ -272,7 +273,7 @@ def build_document( if review.get("fourth_review"): document["steps"].insert(1, review["fourth_review"]["operation_check"]) document["source_review"] = { - **review, + **{k: v for k, v in review.items() if k != "fixed_version_document"}, "scope": review.get("scope", ["结构及用途局部审校"]), "complete": False, "unconfirmed": [ @@ -299,6 +300,11 @@ def build_document( ], }, } + fixed = fixed_document_for(path, source, review) + if fixed: + document["fixed_version"] = fixed + if fixed["matched"]: + document["steps"] = document["steps"][:-3] + fixed["steps"] return document @@ -342,13 +348,17 @@ def import_library( companion = (companions or {}).get(relative) # Version companion documentation separately from the immutable received bytes. companion_sha = hashlib.sha256( - _json({ - "record": companion, - "doc_version": 2, - "output_protocol_reference": companion_protocol_reference( - companion["binding"], json.loads(companion["raw"].lstrip("\ufeff")) - ), - } if companion else None).encode() + _json( + { + "record": companion, + "doc_version": 2, + "output_protocol_reference": companion_protocol_reference( + companion["binding"], json.loads(companion["raw"].lstrip("\ufeff")) + ), + } + if companion + else None + ).encode() ).hexdigest() if existing and fingerprint(dict(existing)) != existing["library_fingerprint"]: report["files"].append( diff --git a/calliope-backend/src/calliope/comfyui/source_reviews.json b/calliope-backend/src/calliope/comfyui/source_reviews.json index d32c1c9f..1cb03bff 100644 --- a/calliope-backend/src/calliope/comfyui/source_reviews.json +++ b/calliope-backend/src/calliope/comfyui/source_reviews.json @@ -113,7 +113,933 @@ "scope": [ "结构及用途局部审校", "源具名参数/注释/连线/素材模型用途人工语义局部审校" - ] + ], + "fixed_version_document": { + "notice": "按源图声明版本核对,目标环境未核对", + "source_path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/Minimax-H3提示词增强.json", + "source_sha1": "baa9413092e5f5d013e6e65eacd1203278b5c754", + "source_sha256": "ffea53b27d52c63aa9ec9c60144489cc4f9e5a44d9478bcc297be9d9008f1a4c", + "canonical_sha256": "bc526d473b9206d1feb300ae1a99708d585dc73eab93a9ee1f0455a3815eb26f", + "versions": [ + "前端1.53.10(743be3f4fe2e374b0ee39f0ded56e7cb65a837c5)", + "minimax-h3-prompt-rewriter(a59888df88a69385d429b6865ea441e7844f49c9)", + "comfy-core0.30.0(b1693ecba9f5b65f8c80ab36b195ab963ec92413)" + ], + "counts": { + "saved_fields": 18, + "final_scalars": 16, + "linked_saved_fields": 1, + "frontend_only": 1, + "physical_edges": 3 + }, + "fields": [ + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "prompt", + "label": "原始提示文本", + "type": "STRING", + "value": "图1的男人和图2的女人赤身躺在床上,女人跨坐在他身上,缓慢地起伏,双手撑在他胸口,头向后仰,呼吸越来越急。男人仰面躺着,喘息着低声说:\"看着我。\"女人俯下身吻他,镜头从侧面缓慢推近。\n", + "json_type": "str", + "pointer": "/nodes/0/widgets_values/0", + "named_pointer": "/nodes/0/widgets_values_named/prompt", + "unit": null, + "limits": "未声明静态长度界限;内容效果待真实验证", + "effect": "将输入文字交给所选任务的写作消息组装。原文本作为不透明字符串保存;本轮没有改写、增强或调用模型。", + "role": "scalar", + "evidence": [ + 19, + 0, + 2 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "model", + "label": "写作模型选择", + "type": "动态COMBO / STRING", + "value": "on disk: Qwen3.5-9B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf [qwen35, 5.2 GB]", + "json_type": "str", + "pointer": "/nodes/0/widgets_values/1", + "named_pointer": "/nodes/0/widgets_values_named/model", + "unit": null, + "limits": "动态模型列表成员、实际路径和加载状态待目标环境核对", + "effect": "传给写作模型选择解析。保留源字符串;on disk只是源标签,不证明文件存在、模型已加载或当前列表包含它。", + "role": "scalar", + "evidence": [ + 20, + 0, + 3, + 2 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "task", + "label": "写作任务", + "type": "静态COMBO / STRING", + "value": "T2VA", + "json_type": "str", + "pointer": "/nodes/0/widgets_values/2", + "named_pointer": "/nodes/0/widgets_values_named/task", + "unit": null, + "limits": "静态枚举:T2VA、I2VA、FL2VA、L2VA", + "effect": "T2VA按文字组织描述;I2VA以首帧、FL2VA以首尾帧、L2VA以尾帧组织对齐说明。切换会改变所用指南和消息结构,输出质量待验证。", + "role": "scalar", + "evidence": [ + 21, + 0, + 5, + 2 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "resolution", + "label": "目标画面比例", + "type": "静态COMBO / STRING", + "value": "16:9", + "json_type": "str", + "pointer": "/nodes/0/widgets_values/3", + "named_pointer": "/nodes/0/widgets_values_named/resolution", + "unit": "宽高比(无量纲)", + "limits": "静态枚举:48:9、32:9、21:9、16:9、4:3、1:1、3:4、9:16", + "effect": "给写作消息提供目标宽高比例,不是像素分辨率。非空aspect_ratio按固定解析覆盖此选择;本图该槽未接线且保存为空。", + "role": "scalar", + "evidence": [ + 22, + 0, + 4, + 6, + 1 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "duration", + "label": "写作目标时长", + "type": "INT", + "value": 10, + "json_type": "int", + "pointer": "/nodes/0/widgets_values/4", + "named_pointer": "/nodes/0/widgets_values_named/duration", + "unit": "秒", + "limits": "固定Writer声明:4~15,步长1;源properties.max_duration=30不能当此类生效范围", + "effect": "用于写作消息中的目标片长、镜头数量及节奏提示。仅表示固定源码定义,不保证生成视频长度;本图Writer为10秒、Check另为5秒,未自动同步。", + "role": "scalar", + "evidence": [ + 23, + 0, + 4, + 2 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "greedy", + "label": "贪心解码开关", + "type": "BOOLEAN", + "value": true, + "json_type": "bool", + "pointer": "/nodes/0/widgets_values/5", + "named_pointer": "/nodes/0/widgets_values_named/greedy", + "unit": "不适用", + "limits": "布尔:true / false", + "effect": "固定声明称其为确定性解码,并将布尔值传给推理层。改变将影响传入的解码选项;本轮未验证解码结果,开启不保证跨环境可重复。", + "role": "scalar", + "evidence": [ + 24, + 0, + 2 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "seed", + "label": "写作随机种子", + "type": "INT", + "value": 42, + "json_type": "int", + "pointer": "/nodes/0/widgets_values/6", + "named_pointer": "/nodes/0/widgets_values_named/seed", + "unit": "不适用", + "limits": "固定声明:0~4294967295;不是推荐区间", + "effect": "转为整数传给写作推理层;fixed仅指前端不在排队后调整种子,不能保证实际推理必然可重复。", + "role": "scalar", + "evidence": [ + 25, + 0, + 2, + 14 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "control_after_generate", + "label": "生成后种子控制", + "type": "前端COMBO / STRING", + "value": "fixed", + "json_type": "str", + "pointer": "/nodes/0/widgets_values/7", + "named_pointer": "/nodes/0/widgets_values_named/control_after_generate", + "unit": "不适用", + "limits": "前端控制枚举:fixed、increment、decrement、randomize;本说明仅核对源fixed保存态", + "effect": "源保存fixed,前端固定分支不改种子。只保存于工作流,不进入prompt执行输入;不计入16个最终标量。", + "role": "frontend", + "evidence": [ + 0, + 14, + 15, + 16 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "keep_model_loaded", + "label": "保留写作模型", + "type": "BOOLEAN", + "value": false, + "json_type": "bool", + "pointer": "/nodes/0/widgets_values/8", + "named_pointer": "/nodes/0/widgets_values_named/keep_model_loaded", + "unit": "不适用", + "limits": "布尔:true / false;显存占用和释放行为待验证", + "effect": "作为keep_loaded传给写作推理层;声明意图是在改写后保留显存中的写作模型。false不代表当前显存已释放或模型未加载。", + "role": "scalar", + "evidence": [ + 26, + 0, + 2 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "aspect_ratio", + "label": "外部画面比例", + "type": "STRING,COMBO(STRING控件)", + "value": "", + "json_type": "str", + "pointer": "/nodes/0/widgets_values/9", + "named_pointer": "/nodes/0/widgets_values_named/aspect_ratio", + "unit": "宽高比(无量纲)", + "limits": "未声明静态字符串长度;可接受语法见固定解析,目标运行效果待验证", + "effect": "非空值经固定比例解析覆盖resolution;可读取宽高对、尺寸或数字,空串回退到比例选择。本图未接线且为空,不产生覆盖。", + "role": "scalar", + "evidence": [ + 27, + 0, + 6, + 7, + 1 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "reference_material", + "label": "参考素材文字描述", + "type": "STRING", + "value": "", + "json_type": "str", + "pointer": "/nodes/0/widgets_values/10", + "named_pointer": "/nodes/0/widgets_values_named/reference_material", + "unit": null, + "limits": "未声明静态长度界限;实际素材与效果待核对", + "effect": "将参考帧或资产的文字描述送入消息组装。此节点读文字,不直接读取像素;原图为空串,不据此宣称参考素材已就绪。", + "role": "scalar", + "evidence": [ + 28, + 0, + 2 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "bypass", + "label": "原文旁通", + "type": "BOOLEAN", + "value": false, + "json_type": "bool", + "pointer": "/nodes/0/widgets_values/11", + "named_pointer": "/nodes/0/widgets_values_named/bypass", + "unit": "不适用", + "limits": "布尔:true / false", + "effect": "为true时在库选择、会话复用和写作之前返回原提示;本图false。此参数旁通与图节点mode旁路不同。", + "role": "scalar", + "evidence": [ + 29, + 0, + 1, + 17 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "system_prompt", + "label": "替代系统提示文本", + "type": "STRING", + "value": "", + "json_type": "str", + "pointer": "/nodes/0/widgets_values/12", + "named_pointer": "/nodes/0/widgets_values_named/system_prompt", + "unit": null, + "limits": "未声明静态长度界限;内容效果待验证", + "effect": "非空文本替代整份组装指南且不获取该指南;空串沿固定默认指南分支。源文本原样保留,不执行指南获取或生成。", + "role": "scalar", + "evidence": [ + 30, + 0, + 2 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "repeat_last", + "label": "复用上次文本", + "type": "BOOLEAN", + "value": false, + "json_type": "bool", + "pointer": "/nodes/0/widgets_values/13", + "named_pointer": "/nodes/0/widgets_values_named/repeat_last", + "unit": "不适用", + "limits": "布尔:true / false;现有会话缓存与库内容未知", + "effect": "虽属界面隐藏/定制控制,仍是真实执行输入。bypass优先;开启后先尝试library_pick,再尝试本节点会话内上次结果;无可用结果时才进入写作分支。会话缓存不随工作流保存,重启丢失。", + "role": "scalar", + "evidence": [ + 31, + 0, + 1, + 8, + 9 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "library_pick", + "label": "保存库文本选择", + "type": "STRING", + "value": "", + "json_type": "str", + "pointer": "/nodes/0/widgets_values/14", + "named_pointer": "/nodes/0/widgets_values_named/library_pick", + "unit": null, + "limits": "未声明静态长度;保存库JSON选择的实际成员待核对", + "effect": "界面隐藏但仍传入执行。仅repeat_last开启时使用;空串或无有效id不选择库记录。有效选择记录丢失会报错;同类同形状可直接复用,否则取保存文本再拆分。选择可随工作流保存,库实际存在未知。", + "role": "scalar", + "evidence": [ + 32, + 0, + 1, + 9, + 10 + ] + }, + { + "node_id": "170", + "class_type": "MiniMaxH3PromptCheck", + "field": "prompt", + "label": "待核对文本", + "type": "STRING", + "value": "", + "json_type": "str", + "pointer": "/nodes/1/widgets_values/0", + "named_pointer": "/nodes/1/widgets_values_named/prompt", + "unit": null, + "limits": "未声明静态长度界限;真实输出内容未验证", + "effect": "源保存文本仍保留,但执行时被169槽0→170.prompt物理线覆盖,不能把该保存文本当最终标量。固定实现读入字符串、按规则拆分核对并从槽0传出;本轮没有运行审查器。", + "role": "linked", + "evidence": [ + 33, + 11, + 12, + 16 + ] + }, + { + "node_id": "170", + "class_type": "MiniMaxH3PromptCheck", + "field": "task", + "label": "核对任务", + "type": "静态COMBO / STRING", + "value": "T2VA", + "json_type": "str", + "pointer": "/nodes/1/widgets_values/1", + "named_pointer": "/nodes/1/widgets_values_named/task", + "unit": null, + "limits": "静态枚举:T2VA、I2VA、FL2VA、L2VA、Ref2VA", + "effect": "选择应核对的字段与引用规则,不自动跟随Writer。固定枚举多出Ref2VA;原图与Writer都保存T2VA。", + "role": "scalar", + "evidence": [ + 34, + 11, + 13, + 5, + 12 + ] + }, + { + "node_id": "170", + "class_type": "MiniMaxH3PromptCheck", + "field": "duration", + "label": "核对目标时长", + "type": "FLOAT", + "value": 5, + "json_type": "int", + "pointer": "/nodes/1/widgets_values/2", + "named_pointer": "/nodes/1/widgets_values_named/duration", + "unit": "秒", + "limits": "固定Check schema:0.1~600,步长0.1;不借其它类动态max_duration当本类范围", + "effect": "按目标秒数核对镜头切点等规则;原图保存JSON整数5,由固定FLOAT控件承载。Writer保存10秒,两者不同,使用前应核对意图;此处不修改源值。", + "role": "scalar", + "evidence": [ + 35, + 11, + 13, + 12 + ] + } + ], + "sources": [ + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1453, + 1576 + ], + "claim": "GuidedWriter输入声明、类型与控件提示" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1594, + 1658 + ], + "claim": "旁通、库选择、会话复用、比例解析及写作参数传递" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1224, + 1297 + ], + "claim": "system_prompt替代指南、时长和seed/greedy/keep_loaded传递;未验证底层推理行为" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 199, + 261 + ], + "claim": "写作模型列表动态构造及选择解析;并非目标机目录快照" + }, + { + "id": "h3:minimax_h3_rewriter/constants.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/constants.py", + "sha256": "3681fabe3ee718fbe877a29850ee984ac4f7c09f437646f98e3dcf5956e9f807", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/constants.py", + "local_file": "h3__minimax_h3_rewriter__constants.py", + "license": "MIT", + "lines": [ + 18, + 20 + ], + "claim": "固定比例枚举、Writer时长静态界限" + }, + { + "id": "h3:minimax_h3_rewriter/guide_prompt.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/guide_prompt.py", + "sha256": "dc9cd4861d4112bbc7d9c12e2e1d1b26f429283066c88a68df665ffcaaab90b5", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/guide_prompt.py", + "local_file": "h3__minimax_h3_rewriter__guide_prompt.py", + "license": "MIT", + "lines": [ + 29, + 46 + ], + "claim": "四种基础任务及完整参考任务的字段对应" + }, + { + "id": "h3:minimax_h3_rewriter/aspect.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/aspect.py", + "sha256": "da6320ee5d4ad0465734ba96ba81148c1baeb88bc7b90b6afb3926983c8b5e32", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/aspect.py", + "local_file": "h3__minimax_h3_rewriter__aspect.py", + "license": "MIT", + "lines": [ + 30, + 43 + ], + "claim": "比例选择与aspect_ratio覆盖关系" + }, + { + "id": "h3:minimax_h3_rewriter/aspect.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/aspect.py", + "sha256": "da6320ee5d4ad0465734ba96ba81148c1baeb88bc7b90b6afb3926983c8b5e32", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/aspect.py", + "local_file": "h3__minimax_h3_rewriter__aspect.py", + "license": "MIT", + "lines": [ + 71, + 109 + ], + "claim": "宽高对/尺寸/数字读取及空值回退;仅说明固定实现" + }, + { + "id": "h3:minimax_h3_rewriter/memory.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/memory.py", + "sha256": "0e38cc2d86059e5549843aa0fc6932eb820ee6de34d8f58954b6dc72c30bf5c7", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/memory.py", + "local_file": "h3__minimax_h3_rewriter__memory.py", + "license": "MIT", + "lines": [ + 1, + 43 + ], + "claim": "每节点会话内复用,重启丢失;保存库选择另行持久化" + }, + { + "id": "h3:minimax_h3_rewriter/library.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/library.py", + "sha256": "20d1d77be6e829ef3a58476c052d345ad5457c7d1ffd608c2c3324bccf596937", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/library.py", + "local_file": "h3__minimax_h3_rewriter__library.py", + "license": "MIT", + "lines": [ + 323, + 386 + ], + "claim": "repeat_last开启后解析库选择;有效选择丢失报错,否则可能回退" + }, + { + "id": "h3:web/js/prompt_library.js", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "web/js/prompt_library.js", + "sha256": "a218e99753fcf01844e8564ad130c8829930d13d0d36718ab6809dc701581099", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/web/js/prompt_library.js", + "local_file": "h3__web__js__prompt_library.js", + "license": "MIT", + "lines": [ + 1046, + 1090 + ], + "claim": "隐藏library_pick的界面处理不删除执行输入" + }, + { + "id": "h3:minimax_h3_rewriter/prompt_check.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/prompt_check.py", + "sha256": "d3a9b06923704b0160d2917cf212f602bb2c09a27a763cd9722c78bd59890fa2", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/prompt_check.py", + "local_file": "h3__minimax_h3_rewriter__prompt_check.py", + "license": "MIT", + "lines": [ + 48, + 151 + ], + "claim": "Check提示、任务、秒数、可选options/references及9个输出槽" + }, + { + "id": "h3:minimax_h3_rewriter/prompt_check.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/prompt_check.py", + "sha256": "d3a9b06923704b0160d2917cf212f602bb2c09a27a763cd9722c78bd59890fa2", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/prompt_check.py", + "local_file": "h3__minimax_h3_rewriter__prompt_check.py", + "license": "MIT", + "lines": [ + 153, + 202 + ], + "claim": "Check读入文本、规则核对、字段拆分及输出;未运行验证" + }, + { + "id": "h3:minimax_h3_rewriter/universal.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/universal.py", + "sha256": "5af26c72b73dfa25ac65fa091386daf950ea941549160db0625ad491c5d9c5bd", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/universal.py", + "local_file": "h3__minimax_h3_rewriter__universal.py", + "license": "MIT", + "lines": [ + 76, + 102 + ], + "claim": "Check任务枚举、字段及0.1至600秒schema界限" + }, + { + "id": "frontend:src/scripts/valueControl.ts", + "commit": "743be3f4fe2e374b0ee39f0ded56e7cb65a837c5", + "file": "src/scripts/valueControl.ts", + "sha256": "007c7204d1fe88d156e07fee783a55e79fa7610e98a8a9f7761704a076a60458", + "url": "https://github.com/Comfy-Org/ComfyUI_frontend/blob/743be3f4fe2e374b0ee39f0ded56e7cb65a837c5/src/scripts/valueControl.ts", + "local_file": "frontend__src__scripts__valueControl.ts", + "license": "GPL-3.0", + "lines": [ + 1, + 92 + ], + "claim": "control_after_generate控制与fixed不改值分支" + }, + { + "id": "frontend:src/scripts/widgets.ts", + "commit": "743be3f4fe2e374b0ee39f0ded56e7cb65a837c5", + "file": "src/scripts/widgets.ts", + "sha256": "932a143a1a48c93aa3bee43b6dc3f932cd7f9a946802530650b4acdd41d36bd5", + "url": "https://github.com/Comfy-Org/ComfyUI_frontend/blob/743be3f4fe2e374b0ee39f0ded56e7cb65a837c5/src/scripts/widgets.ts", + "local_file": "frontend__src__scripts__widgets.ts", + "license": "GPL-3.0", + "lines": [ + 91, + 148 + ], + "claim": "INT种子附加控件构造;精确规则与序列化见既有固定证据" + }, + { + "id": "frontend:src/utils/executionUtil.ts", + "commit": "743be3f4fe2e374b0ee39f0ded56e7cb65a837c5", + "file": "src/utils/executionUtil.ts", + "sha256": "b29fd312e66c7415fa4c720654ac121dc67600b0c1fedf079b6575a174960698", + "url": "https://github.com/Comfy-Org/ComfyUI_frontend/blob/743be3f4fe2e374b0ee39f0ded56e7cb65a837c5/src/utils/executionUtil.ts", + "local_file": "frontend__src__utils__executionUtil.ts", + "license": "GPL-3.0", + "lines": [ + 124, + 168 + ], + "claim": "执行输入构造与物理线覆盖;该文件未调用" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 929, + 932 + ], + "claim": "旁通函数将原文本作为首出口返回" + }, + { + "id": "core:comfy_extras/nodes_preview_any.py", + "commit": "b1693ecba9f5b65f8c80ab36b195ab963ec92413", + "file": "comfy_extras/nodes_preview_any.py", + "sha256": "d51a648031621d638ae5f42787042ec08b06792e0b61045b7993b42db8ea7e7b", + "url": "https://github.com/Comfy-Org/ComfyUI/blob/b1693ecba9f5b65f8c80ab36b195ab963ec92413/comfy_extras/nodes_preview_any.py", + "local_file": "core__comfy_extras__nodes_preview_any.py", + "license": "GPL-3.0", + "lines": [ + 8, + 39 + ], + "claim": "PreviewAny以文本显示输入;不生成文件" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1468, + 1475 + ], + "claim": "prompt的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1476, + 1486 + ], + "claim": "model的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1487, + 1498 + ], + "claim": "task的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1499, + 1502 + ], + "claim": "resolution的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1503, + 1512 + ], + "claim": "duration的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1513, + 1522 + ], + "claim": "greedy的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1523, + 1531 + ], + "claim": "seed的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1532, + 1542 + ], + "claim": "keep_model_loaded的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1545, + 1548 + ], + "claim": "aspect_ratio的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1549, + 1561 + ], + "claim": "reference_material的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1563, + 1563 + ], + "claim": "bypass的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1564, + 1567 + ], + "claim": "system_prompt的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1568, + 1568 + ], + "claim": "repeat_last的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1569, + 1569 + ], + "claim": "library_pick的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/prompt_check.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/prompt_check.py", + "sha256": "d3a9b06923704b0160d2917cf212f602bb2c09a27a763cd9722c78bd59890fa2", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/prompt_check.py", + "local_file": "h3__minimax_h3_rewriter__prompt_check.py", + "license": "MIT", + "lines": [ + 103, + 103 + ], + "claim": "Check.prompt的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/prompt_check.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/prompt_check.py", + "sha256": "d3a9b06923704b0160d2917cf212f602bb2c09a27a763cd9722c78bd59890fa2", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/prompt_check.py", + "local_file": "h3__minimax_h3_rewriter__prompt_check.py", + "license": "MIT", + "lines": [ + 104, + 106 + ], + "claim": "Check.task的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/prompt_check.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/prompt_check.py", + "sha256": "d3a9b06923704b0160d2917cf212f602bb2c09a27a763cd9722c78bd59890fa2", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/prompt_check.py", + "local_file": "h3__minimax_h3_rewriter__prompt_check.py", + "license": "MIT", + "lines": [ + 107, + 114 + ], + "claim": "Check.duration的精确字段声明" + } + ], + "flow": [ + "169(GuidedWriter)按所选模型与任务写作文本;170(PromptCheck)按规则核对并拆分。这里仅展示固定实现说明,没有运行两个节点。", + "169槽0 → 170.prompt;170槽0 → 171.source;170槽8 → 172.source,均为原图物理连线。", + "171与172均为PreviewAny:显示字符串,分别为传入文本与核对发现;不是文件下载,也不证明成功生成。", + "169.options、170.options与170.references可选槽未接线;options按固定实现使用DEFAULT_OPTIONS副本,references未接时跳过依赖引用实物数量的规则。默认实现不证明目标环境状态。" + ], + "flow_evidence": [ + 0, + 1, + 11, + 12, + 18 + ], + "steps": [ + "先核对169的模型源字符串、T2VA任务和16:9比例;模型文件和目标节点是否存在仍待环境检查。本图没有上传素材入口。", + "核对169的原始提示文本与可选system_prompt、reference_material;文本原样保留。aspect_ratio未接线且为空,options未接线;不把默认实现当已安装环境。", + "核对169时长10秒与170时长5秒是否符合使用意图;Check任务也是T2VA,它不会自动同步Writer的任务或时长。", + "核对169的seed=42、fixed控制及greedy=true;bypass=false、repeat_last=false、library_pick为空,隐藏输入仍应核对,会话和库状态未知。", + "沿169槽0→170.prompt阅读数据流,再看171的文本显示及172的核对发现显示。170保存的prompt被连线覆盖;options/reference未接线,真实输出字符串未验证。", + "本条仍停用、待可靠转换、说明未定稿且未实跑;目标环境、依赖与执行资格待后续审核,不通过此说明发起生成。" + ] + } }, "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/birefnet_图像移除背景.json": { "source_sha": "9d99de736806f8eeffed114cc1ba075c16276b69", diff --git a/calliope-backend/tests/test_fixed_document.py b/calliope-backend/tests/test_fixed_document.py new file mode 100644 index 00000000..1c242b35 --- /dev/null +++ b/calliope-backend/tests/test_fixed_document.py @@ -0,0 +1,221 @@ +"""The source-bound editorial block cannot grant conversion or execution eligibility.""" + +from __future__ import annotations + +import copy +import hashlib +import json +from collections import Counter +from pathlib import Path + +import pytest + +from calliope.comfyui import source_reviews +from calliope.comfyui.companions import load_companions +from calliope.comfyui.fixed_document import SOURCE_PATH +from calliope.comfyui.library import build_document, import_library, rollback_batch +from calliope.db import get_db, migrate_db + +REPO = Path(__file__).resolve().parents[2] +RAW = (REPO / SOURCE_PATH).read_bytes() +SOURCE = json.loads(RAW) +REVIEW = source_reviews.review_for(SOURCE_PATH, hashlib.sha1(RAW).hexdigest()) +BLOCK = REVIEW["fixed_version_document"] + + +def pointer(value, path): + for token in path.strip("/").split("/"): + value = value[int(token)] if isinstance(value, list) else value[token] + return value + + +def document(source=SOURCE, review=REVIEW, path=SOURCE_PATH): + return build_document(path, source, None, None, [], review) + + +def test_original_binding_and_independent_accounts(): + doc = document() + fixed = doc["fixed_version"] + assert fixed["matched"] and fixed["counts"] == { + "saved_fields": 18, + "final_scalars": 16, + "linked_saved_fields": 1, + "frontend_only": 1, + "physical_edges": 3, + } + assert Counter(f["role"] for f in fixed["fields"]) == {"scalar": 16, "linked": 1, "frontend": 1} + assert len({(f["node_id"], f["field"]) for f in fixed["fields"]}) == 18 + assert doc["params"] == [] + assert "fixed_version_document" not in doc["source_review"] + assert doc["source_review"]["reviewed_named_fields"] == REVIEW["reviewed_named_fields"] + assert doc["status"] == {"imported": True, "doc_done": False, "exec_verified": False} + assert doc["dependencies"]["check_state"] == "unchecked" + assert all(step in doc["steps"] for step in fixed["steps"]) + # No shared mutable state leaks into later builds. + fixed["fields"][0]["value"] = "consumer edit" + assert ( + document()["fixed_version"]["fields"][0]["value"] == SOURCE["nodes"][0]["widgets_values"][0] + ) + + +@pytest.mark.parametrize("index", range(18)) +def test_every_value_pointer_and_fixed_evidence(index): + field = BLOCK["fields"][index] + for key in ("pointer", "named_pointer"): + value = pointer(SOURCE, field[key]) + assert type(value).__name__ == field["json_type"] + assert type(value) is type(field["value"]) and value == field["value"] + assert field["label"] and field["effect"] and field["limits"] and field["evidence"] + for number in field["evidence"]: + evidence = BLOCK["sources"][number] + raw = (REPO / "docs/hel-892/h3-reference" / evidence["local_file"]).read_bytes() + assert hashlib.sha256(raw).hexdigest() == evidence["sha256"] + assert len(evidence["commit"]) == 40 + a, b = evidence["lines"] + assert 1 <= a <= b <= len(raw.decode().splitlines()) + assert evidence["commit"] in evidence["url"] + + +@pytest.mark.parametrize("index", range(18)) +@pytest.mark.parametrize("form", ["pointer", "named_pointer"]) +def test_each_saved_value_change_refuses_old_definition(index, form): + source = copy.deepcopy(SOURCE) + path = BLOCK["fields"][index][form] + parent, _, token = path.rpartition("/") + target = pointer(source, parent) + if isinstance(target, list): + target[int(token)] = None + else: + target[token] = None + fixed = document(source)["fixed_version"] + assert not fixed["matched"] and "fields" not in fixed + + +@pytest.mark.parametrize( + "change", + [ + "frontend", + "provider", + "plugin_version", + "core_version", + "node_id", + "node_type", + "edge", + "title", + "mode", + "extra", + ], +) +def test_whole_graph_identity_binding(change): + source = copy.deepcopy(SOURCE) + if change == "frontend": + source["extra"]["frontendVersion"] = "1.0.0" + elif change in ("provider", "plugin_version", "core_version"): + index = 2 if change == "core_version" else 0 + source["nodes"][index]["properties"]["cnr_id" if change == "provider" else "ver"] = "other" + elif change == "edge": + source["links"][0][2] = 9 + elif change == "extra": + source["nodes"].append({"id": 173, "type": "Unknown"}) + else: + source["nodes"][0][ + {"node_id": "id", "node_type": "type", "title": "title", "mode": "mode"}[change] + ] = "changed" + assert not document(source)["fixed_version"]["matched"] + + +@pytest.mark.parametrize( + "change", ["missing", "sha", "citation", "lines", "pointer", "value", "text"] +) +def test_document_evidence_is_bound_too(change): + review = copy.deepcopy(REVIEW) + block = review["fixed_version_document"] + if change == "missing": + del review["fixed_version_document"] + elif change == "sha": + review["source_sha"] = "wrong" + elif change == "citation": + block["sources"][0]["sha256"] = "0" * 64 + elif change == "lines": + block["sources"][0]["lines"] = [1, 2] + elif change == "text": + block["fields"][0]["effect"] = "unreviewed" + else: + block["fields"][0][change] = "changed" + assert not document(review=review)["fixed_version"]["matched"] + assert document(review=None)["fixed_version"]["matched"] is False + assert "fixed_version" not in document(path="another/Minimax-H3提示词增强.json") + + +async def test_existing_db_single_refresh_rollback_reimport_and_user_whole_row( + tmp_path, monkeypatch +): + reviews = copy.deepcopy(source_reviews._reviews()) + previous = copy.deepcopy(reviews) + del previous[SOURCE_PATH]["fixed_version_document"] + monkeypatch.setattr(source_reviews, "_reviews", lambda: previous) + await migrate_db(tmp_path / "db") + conn = get_db(tmp_path / "db") + companions = load_companions(REPO / "docs/hel-892/supplied-api/manifest.json") + + def run(): + return import_library( + conn, + REPO / "example_ComfyUI_workflows", + source_commit="fixed-document-test", + companions=companions, + ) + + first = run() + assert first["counts"] == {"imported": 155, "user_excluded": 1} + before = {r["source_repo_path"]: dict(r) for r in conn.execute("SELECT * FROM workflows")} + assert run()["counts"] == {"skipped": 155, "user_excluded": 1} + monkeypatch.setattr(source_reviews, "_reviews", lambda: reviews) + refreshed = run() + assert refreshed["counts"] == {"updated": 1, "skipped": 154, "user_excluded": 1} + assert refreshed["states"] == {"pending_check": 16, "needs_conversion": 139} + for row in conn.execute("SELECT * FROM workflows"): + saved = dict(row) + if row["source_repo_path"] != SOURCE_PATH: + assert saved == before[row["source_repo_path"]] + else: + assert json.loads(row["doc_json"])["fixed_version"]["matched"] + # Only documentation/audit bookkeeping changes; eligibility columns stay identical. + for key in saved.keys() - { + "doc_json", + "batch_id", + "imported_at", + "library_fingerprint", + }: + assert saved[key] == before[SOURCE_PATH][key] + assert rollback_batch(conn, refreshed["batch_id"])["files"][0]["result"] == "restored" + row = dict( + conn.execute("SELECT * FROM workflows WHERE source_repo_path=?", (SOURCE_PATH,)).fetchone() + ) + assert row == before[SOURCE_PATH] + assert run()["counts"] == {"updated": 1, "skipped": 154, "user_excluded": 1} + assert run()["counts"] == {"skipped": 155, "user_excluded": 1} + conn.execute( + "UPDATE workflows SET description=? WHERE source_repo_path=?", ("用户说明", SOURCE_PATH) + ) + conn.commit() + snapshot = dict( + conn.execute("SELECT * FROM workflows WHERE source_repo_path=?", (SOURCE_PATH,)).fetchone() + ) + assert len(snapshot) == 29 + assert run()["counts"] == {"conflict": 1, "skipped": 154, "user_excluded": 1} + assert ( + dict( + conn.execute( + "SELECT * FROM workflows WHERE source_repo_path=?", (SOURCE_PATH,) + ).fetchone() + ) + == snapshot + ) + for row in conn.execute("SELECT * FROM workflows"): + assert ( + not row["is_enabled"] + and row["doc_completed_at"] is None + and row["exec_verified_at"] is None + ) + conn.close() diff --git a/calliope-web/src/lib/comfy/types.ts b/calliope-web/src/lib/comfy/types.ts index c8207e72..c55ece62 100644 --- a/calliope-web/src/lib/comfy/types.ts +++ b/calliope-web/src/lib/comfy/types.ts @@ -152,6 +152,48 @@ export interface WorkflowNode { /** Persisted library document; list responses omit doc_json, detail GET includes it. */ export interface WorkflowDocument { + fixed_version?: { + matched: boolean; + notice: string; + source_path?: string; + source_sha1?: string; + source_sha256?: string; + versions?: string[]; + counts?: { + saved_fields: number; + final_scalars: number; + linked_saved_fields: number; + frontend_only: number; + physical_edges: number; + }; + fields?: { + node_id: string; + class_type: string; + field: string; + label: string; + type: string; + value: unknown; + json_type: string; + pointer: string; + named_pointer: string; + unit: string | null; + limits: string; + effect: string; + role: "scalar" | "linked" | "frontend"; + evidence: number[]; + }[]; + sources?: { + id: string; + commit: string; + file: string; + sha256: string; + lines: number[]; + claim: string; + }[]; + flow?: string[]; + flow_evidence?: number[]; + steps?: string[]; + }; title?: string; purpose?: string; source_path?: string; diff --git a/calliope-web/src/lib/components/WorkflowDocumentDrawer.svelte b/calliope-web/src/lib/components/WorkflowDocumentDrawer.svelte index 1f5e853e..ac0acf7f 100644 --- a/calliope-web/src/lib/components/WorkflowDocumentDrawer.svelte +++ b/calliope-web/src/lib/components/WorkflowDocumentDrawer.svelte @@ -25,6 +25,7 @@ ); const wf = $derived($detail.data); const doc = $derived(wf?.doc_json); + const fixed = $derived(doc?.fixed_version); const review = $derived(doc?.source_review); const deps = $derived(doc?.dependencies); const categories: Record = { @@ -115,6 +116,72 @@ {/if} + {#if fixed} + +

{fixed.notice}

+ {#if fixed.matched} +

+ 保存字段 {fixed.counts?.saved_fields} 项;最终标量 {fixed.counts + ?.final_scalars} 项;被连线覆盖 {fixed.counts + ?.linked_saved_fields} 项;仅前端控制 {fixed.counts + ?.frontend_only} 项。 +

+ {#each fixed.flow ?? [] as line}

{line}

{/each} +
+ 版本、源图与连线依据 + {#each fixed.versions ?? [] as version}

{version}

{/each} +

源图 SHA256:{fixed.source_sha256}

+ {#each fixed.flow_evidence ?? [] as index} + {@const evidence = fixed.sources?.[index]} + {#if evidence} +

+ {evidence.claim}:{evidence.file},第 {evidence.lines.join( + "~", + )} 行;提交 {evidence.commit};原文件 SHA256:{evidence.sha256} +

+ {/if} + {/each} +
+ {#each fixed.fields ?? [] as field} +
+ 节点 {field.node_id} · {field.label}({field.field}) +

{field.effect}

+

定义类型:{field.type};源 JSON 类型:{field.json_type}

+

源现值(非定义默认值):

+
{value(field.value)}
+

单位:{field.unit ?? "待确认"}

+

范围与限定:{field.limits}

+

+ 执行取值:{field.role === "frontend" + ? "仅保存,不进入执行输入" + : field.role === "linked" + ? "保存值被物理连线覆盖(169槽0 → 170.prompt)" + : "最终标量;实际运行未验证"} +

+
+ 来源依据 +

源节点类型:{field.class_type}

+

+ 源取值指针:{field.pointer};具名保存互证:{field.named_pointer} +

+ {#each field.evidence as index} + {@const evidence = fixed.sources?.[index]} + {#if evidence} +

+ {evidence.claim}:{evidence.file},第 {evidence.lines.join( + "~", + )} 行;提交 {evidence.commit};原文件 SHA256:{evidence.sha256} +

+ {/if} + {/each} +
+
+ {/each} + {/if} +
+ {/if}

源现值不代表推荐值。下列审校分类与单位、范围、调整效果的确认分别记录。 @@ -148,7 +215,11 @@ {#if param.options}

可选值:{value(param.options)}

{/if}

调整效果:{param.effect || "待确认"}

- {:else}

暂无具名参数说明;位置控件不能按顺序猜测。

{/each} + {:else}

+ {fixed?.matched + ? "源文件参数审校区未记录具名项;固定版本定义另见上方说明。" + : "暂无具名参数说明;位置控件不能按顺序猜测。"} +

{/each}

diff --git a/docs/hel-892/h3-document-evidence/build_definition.py b/docs/hel-892/h3-document-evidence/build_definition.py new file mode 100644 index 00000000..27c93f1e --- /dev/null +++ b/docs/hel-892/h3-document-evidence/build_definition.py @@ -0,0 +1,425 @@ +"""Rebuild the single reviewed definition block from pinned source bytes; never execute upstream.""" + +from __future__ import annotations + +import ast +import hashlib +import json +from pathlib import Path + +REPO = Path(__file__).resolve().parents[3] +OUT = Path(__file__).resolve().parent +REF = REPO / "docs/hel-892/h3-reference" +PATH = ( + "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/" + "Minimax-H3提示词增强.json" +) + + +def canonical(value): + return json.dumps( + value, ensure_ascii=False, sort_keys=True, separators=(",", ":") + ).encode() + + +def build(): + raw = (REPO / PATH).read_bytes() + assert ( + hashlib.sha256(raw).hexdigest() + == "ffea53b27d52c63aa9ec9c60144489cc4f9e5a44d9478bcc297be9d9008f1a4c" + ) + source = json.loads(raw) + manifest = json.loads((REF / "sources.json").read_bytes()) + sources = {s["id"]: s for s in manifest["sources"]} + refs = [] + + def ref(key, start, end, claim): + s = sources[key] + content = (REF / s["local_file"]).read_bytes() + assert hashlib.sha256(content).hexdigest() == s["sha256"] + assert 1 <= start <= end <= len(content.decode().splitlines()) + entry = { + k: s[k] + for k in ("id", "commit", "file", "sha256", "url", "local_file", "license") + } + entry.update(lines=[start, end], claim=claim) + refs.append(entry) + return len(refs) - 1 + + nodes = "h3:minimax_h3_rewriter/nodes.py" + check = "h3:minimax_h3_rewriter/prompt_check.py" + schema = ref(nodes, 1453, 1576, "GuidedWriter输入声明、类型与控件提示") + run = ref(nodes, 1594, 1658, "旁通、库选择、会话复用、比例解析及写作参数传递") + inference = ref( + nodes, + 1224, + 1297, + "system_prompt替代指南、时长和seed/greedy/keep_loaded传递;未验证底层推理行为", + ) + choices = ref(nodes, 199, 261, "写作模型列表动态构造及选择解析;并非目标机目录快照") + const = ref( + "h3:minimax_h3_rewriter/constants.py", + 18, + 20, + "固定比例枚举、Writer时长静态界限", + ) + modes = ref( + "h3:minimax_h3_rewriter/guide_prompt.py", + 29, + 46, + "四种基础任务及完整参考任务的字段对应", + ) + aspect = ref( + "h3:minimax_h3_rewriter/aspect.py", 30, 43, "比例选择与aspect_ratio覆盖关系" + ) + aspect_run = ref( + "h3:minimax_h3_rewriter/aspect.py", + 71, + 109, + "宽高对/尺寸/数字读取及空值回退;仅说明固定实现", + ) + memory = ref( + "h3:minimax_h3_rewriter/memory.py", + 1, + 43, + "每节点会话内复用,重启丢失;保存库选择另行持久化", + ) + library = ref( + "h3:minimax_h3_rewriter/library.py", + 323, + 386, + "repeat_last开启后解析库选择;有效选择丢失报错,否则可能回退", + ) + hidden = ref( + "h3:web/js/prompt_library.js", + 1046, + 1090, + "隐藏library_pick的界面处理不删除执行输入", + ) + cschema = ref( + check, 48, 151, "Check提示、任务、秒数、可选options/references及9个输出槽" + ) + crun = ref(check, 153, 202, "Check读入文本、规则核对、字段拆分及输出;未运行验证") + cconst = ref( + "h3:minimax_h3_rewriter/universal.py", + 76, + 102, + "Check任务枚举、字段及0.1至600秒schema界限", + ) + seed = ref( + "frontend:src/scripts/valueControl.ts", + 1, + 92, + "control_after_generate控制与fixed不改值分支", + ) + seed_widget = ref( + "frontend:src/scripts/widgets.ts", + 91, + 148, + "INT种子附加控件构造;精确规则与序列化见既有固定证据", + ) + serial = ref( + "frontend:src/utils/executionUtil.ts", + 124, + 168, + "执行输入构造与物理线覆盖;该文件未调用", + ) + bypass_return = ref(nodes, 929, 932, "旁通函数将原文本作为首出口返回") + preview = ref( + "core:comfy_extras/nodes_preview_any.py", + 8, + 39, + "PreviewAny以文本显示输入;不生成文件", + ) + # Editorial text states only behavior established by the ranges above. + writer = [ + ( + "prompt", + "原始提示文本", + "STRING", + "将输入文字交给所选任务的写作消息组装。原文本作为不透明字符串保存;本轮没有改写、增强或调用模型。", + None, + "未声明静态长度界限;内容效果待真实验证", + [schema, inference], + ), + ( + "model", + "写作模型选择", + "动态COMBO / STRING", + "传给写作模型选择解析。保留源字符串;on disk只是源标签,不证明文件存在、模型已加载或当前列表包含它。", + None, + "动态模型列表成员、实际路径和加载状态待目标环境核对", + [schema, choices, inference], + ), + ( + "task", + "写作任务", + "静态COMBO / STRING", + "T2VA按文字组织描述;I2VA以首帧、FL2VA以首尾帧、L2VA以尾帧组织对齐说明。切换会改变所用指南和消息结构,输出质量待验证。", + None, + "静态枚举:T2VA、I2VA、FL2VA、L2VA", + [schema, modes, inference], + ), + ( + "resolution", + "目标画面比例", + "静态COMBO / STRING", + "给写作消息提供目标宽高比例,不是像素分辨率。非空aspect_ratio按固定解析覆盖此选择;本图该槽未接线且保存为空。", + "宽高比(无量纲)", + "静态枚举:48:9、32:9、21:9、16:9、4:3、1:1、3:4、9:16", + [schema, const, aspect, run], + ), + ( + "duration", + "写作目标时长", + "INT", + "用于写作消息中的目标片长、镜头数量及节奏提示。仅表示固定源码定义,不保证生成视频长度;本图Writer为10秒、Check另为5秒,未自动同步。", + "秒", + "固定Writer声明:4~15,步长1;源properties.max_duration=30不能当此类生效范围", + [schema, const, inference], + ), + ( + "greedy", + "贪心解码开关", + "BOOLEAN", + "固定声明称其为确定性解码,并将布尔值传给推理层。改变将影响传入的解码选项;本轮未验证解码结果,开启不保证跨环境可重复。", + "不适用", + "布尔:true / false", + [schema, inference], + ), + ( + "seed", + "写作随机种子", + "INT", + "转为整数传给写作推理层;fixed仅指前端不在排队后调整种子,不能保证实际推理必然可重复。", + "不适用", + "固定声明:0~4294967295;不是推荐区间", + [schema, inference, seed], + ), + ( + "control_after_generate", + "生成后种子控制", + "前端COMBO / STRING", + "源保存fixed,前端固定分支不改种子。只保存于工作流,不进入prompt执行输入;不计入16个最终标量。", + "不适用", + "前端控制枚举:fixed、increment、decrement、randomize;本说明仅核对源fixed保存态", + [schema, seed, seed_widget, serial], + ), + ( + "keep_model_loaded", + "保留写作模型", + "BOOLEAN", + "作为keep_loaded传给写作推理层;声明意图是在改写后保留显存中的写作模型。false不代表当前显存已释放或模型未加载。", + "不适用", + "布尔:true / false;显存占用和释放行为待验证", + [schema, inference], + ), + ( + "aspect_ratio", + "外部画面比例", + "STRING,COMBO(STRING控件)", + "非空值经固定比例解析覆盖resolution;可读取宽高对、尺寸或数字,空串回退到比例选择。本图未接线且为空,不产生覆盖。", + "宽高比(无量纲)", + "未声明静态字符串长度;可接受语法见固定解析,目标运行效果待验证", + [schema, aspect, aspect_run, run], + ), + ( + "reference_material", + "参考素材文字描述", + "STRING", + "将参考帧或资产的文字描述送入消息组装。此节点读文字,不直接读取像素;原图为空串,不据此宣称参考素材已就绪。", + None, + "未声明静态长度界限;实际素材与效果待核对", + [schema, inference], + ), + ( + "bypass", + "原文旁通", + "BOOLEAN", + "为true时在库选择、会话复用和写作之前返回原提示;本图false。此参数旁通与图节点mode旁路不同。", + "不适用", + "布尔:true / false", + [schema, run], + ), + ( + "system_prompt", + "替代系统提示文本", + "STRING", + "非空文本替代整份组装指南且不获取该指南;空串沿固定默认指南分支。源文本原样保留,不执行指南获取或生成。", + None, + "未声明静态长度界限;内容效果待验证", + [schema, inference], + ), + ( + "repeat_last", + "复用上次文本", + "BOOLEAN", + "虽属界面隐藏/定制控制,仍是真实执行输入。bypass优先;开启后先尝试library_pick,再尝试本节点会话内上次结果;无可用结果时才进入写作分支。会话缓存不随工作流保存,重启丢失。", + "不适用", + "布尔:true / false;现有会话缓存与库内容未知", + [schema, run, memory, library], + ), + ( + "library_pick", + "保存库文本选择", + "STRING", + "界面隐藏但仍传入执行。仅repeat_last开启时使用;空串或无有效id不选择库记录。有效选择记录丢失会报错;同类同形状可直接复用,否则取保存文本再拆分。选择可随工作流保存,库实际存在未知。", + None, + "未声明静态长度;保存库JSON选择的实际成员待核对", + [schema, run, library, hidden], + ), + ] + checker = [ + ( + "prompt", + "待核对文本", + "STRING", + "源保存文本仍保留,但执行时被169槽0→170.prompt物理线覆盖,不能把该保存文本当最终标量。固定实现读入字符串、按规则拆分核对并从槽0传出;本轮没有运行审查器。", + None, + "未声明静态长度界限;真实输出内容未验证", + [cschema, crun, serial], + ), + ( + "task", + "核对任务", + "静态COMBO / STRING", + "选择应核对的字段与引用规则,不自动跟随Writer。固定枚举多出Ref2VA;原图与Writer都保存T2VA。", + None, + "静态枚举:T2VA、I2VA、FL2VA、L2VA、Ref2VA", + [cschema, cconst, modes, crun], + ), + ( + "duration", + "核对目标时长", + "FLOAT", + "按目标秒数核对镜头切点等规则;原图保存JSON整数5,由固定FLOAT控件承载。Writer保存10秒,两者不同,使用前应核对意图;此处不修改源值。", + "秒", + "固定Check schema:0.1~600,步长0.1;不借其它类动态max_duration当本类范围", + [cschema, cconst, crun], + ), + ] + tree = ast.parse((REF / sources[nodes]["local_file"]).read_text()) + cls = next( + n + for n in tree.body + if isinstance(n, ast.ClassDef) and n.name == "MiniMaxH3GuidedWriter" + ) + method = next( + n + for n in cls.body + if isinstance(n, ast.FunctionDef) and n.name == "INPUT_TYPES" + ) + specs = {} + for item in ast.walk(method): + if isinstance(item, ast.Dict): + for key, val in zip(item.keys, item.values): + if isinstance(key, ast.Constant) and isinstance(key.value, str): + specs[key.value] = (val.lineno, val.end_lineno) + check_specs = {"prompt": (103, 103), "task": (104, 106), "duration": (107, 114)} + fields = [] + for index, definitions in enumerate((writer, checker)): + n = source["nodes"][index] + for offset, ( + name, + label, + type_name, + effect, + unit, + limits, + citations, + ) in enumerate(definitions): + if name == "bypass": + citations = [*citations, bypass_return] + if index == 0 and name != "control_after_generate": + start, end = specs[name] + citations = [ + ref(nodes, start, end, f"{name}的精确字段声明"), + *citations, + ] + elif index == 1: + start, end = check_specs[name] + citations = [ + ref(check, start, end, f"Check.{name}的精确字段声明"), + *citations, + ] + val = n["widgets_values"][offset] + assert canonical(val) == canonical(n["widgets_values_named"][name]) + role = ( + "frontend" + if name == "control_after_generate" + else "linked" + if index == 1 and name == "prompt" + else "scalar" + ) + fields.append( + { + "node_id": str(n["id"]), + "class_type": n["type"], + "field": name, + "label": label, + "type": type_name, + "value": val, + "json_type": type(val).__name__, + "pointer": f"/nodes/{index}/widgets_values/{offset}", + "named_pointer": f"/nodes/{index}/widgets_values_named/{name}", + "unit": unit, + "limits": limits, + "effect": effect, + "role": role, + "evidence": citations, + } + ) + data = { + "notice": "按源图声明版本核对,目标环境未核对", + "source_path": PATH, + "source_sha1": hashlib.sha1(raw).hexdigest(), + "source_sha256": hashlib.sha256(raw).hexdigest(), + "canonical_sha256": hashlib.sha256(canonical(source)).hexdigest(), + "versions": [ + "前端1.53.10(743be3f4fe2e374b0ee39f0ded56e7cb65a837c5)", + "minimax-h3-prompt-rewriter(a59888df88a69385d429b6865ea441e7844f49c9)", + "comfy-core0.30.0(b1693ecba9f5b65f8c80ab36b195ab963ec92413)", + ], + "counts": { + "saved_fields": 18, + "final_scalars": 16, + "linked_saved_fields": 1, + "frontend_only": 1, + "physical_edges": 3, + }, + "fields": fields, + "sources": refs, + "flow": [ + "169(GuidedWriter)按所选模型与任务写作文本;170(PromptCheck)按规则核对并拆分。这里仅展示固定实现说明,没有运行两个节点。", + "169槽0 → 170.prompt;170槽0 → 171.source;170槽8 → 172.source,均为原图物理连线。", + "171与172均为PreviewAny:显示字符串,分别为传入文本与核对发现;不是文件下载,也不证明成功生成。", + "169.options、170.options与170.references可选槽未接线;options按固定实现使用DEFAULT_OPTIONS副本,references未接时跳过依赖引用实物数量的规则。默认实现不证明目标环境状态。", + ], + "flow_evidence": [schema, run, cschema, crun, preview], + "steps": [ + "先核对169的模型源字符串、T2VA任务和16:9比例;模型文件和目标节点是否存在仍待环境检查。本图没有上传素材入口。", + "核对169的原始提示文本与可选system_prompt、reference_material;文本原样保留。aspect_ratio未接线且为空,options未接线;不把默认实现当已安装环境。", + "核对169时长10秒与170时长5秒是否符合使用意图;Check任务也是T2VA,它不会自动同步Writer的任务或时长。", + "核对169的seed=42、fixed控制及greedy=true;bypass=false、repeat_last=false、library_pick为空,隐藏输入仍应核对,会话和库状态未知。", + "沿169槽0→170.prompt阅读数据流,再看171的文本显示及172的核对发现显示。170保存的prompt被连线覆盖;options/reference未接线,真实输出字符串未验证。", + "本条仍停用、待可靠转换、说明未定稿且未实跑;目标环境、依赖与执行资格待后续审核,不通过此说明发起生成。", + ], + } + assert len(fields) == 18 + return data + + +def main(): + data = build() + (OUT / "definition.json").write_text( + json.dumps(data, ensure_ascii=False, indent=2) + "\n" + ) + path = REPO / "calliope-backend/src/calliope/comfyui/source_reviews.json" + reviews = json.loads(path.read_bytes()) + reviews[PATH]["fixed_version_document"] = data + path.write_text(json.dumps(reviews, ensure_ascii=False, indent=2) + "\n") + print(hashlib.sha256(canonical(data)).hexdigest()) + + +if __name__ == "__main__": + main() diff --git a/docs/hel-892/h3-document-evidence/definition.json b/docs/hel-892/h3-document-evidence/definition.json new file mode 100644 index 00000000..57c6bc04 --- /dev/null +++ b/docs/hel-892/h3-document-evidence/definition.json @@ -0,0 +1,926 @@ +{ + "notice": "按源图声明版本核对,目标环境未核对", + "source_path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/Minimax-H3提示词增强.json", + "source_sha1": "baa9413092e5f5d013e6e65eacd1203278b5c754", + "source_sha256": "ffea53b27d52c63aa9ec9c60144489cc4f9e5a44d9478bcc297be9d9008f1a4c", + "canonical_sha256": "bc526d473b9206d1feb300ae1a99708d585dc73eab93a9ee1f0455a3815eb26f", + "versions": [ + "前端1.53.10(743be3f4fe2e374b0ee39f0ded56e7cb65a837c5)", + "minimax-h3-prompt-rewriter(a59888df88a69385d429b6865ea441e7844f49c9)", + "comfy-core0.30.0(b1693ecba9f5b65f8c80ab36b195ab963ec92413)" + ], + "counts": { + "saved_fields": 18, + "final_scalars": 16, + "linked_saved_fields": 1, + "frontend_only": 1, + "physical_edges": 3 + }, + "fields": [ + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "prompt", + "label": "原始提示文本", + "type": "STRING", + "value": "图1的男人和图2的女人赤身躺在床上,女人跨坐在他身上,缓慢地起伏,双手撑在他胸口,头向后仰,呼吸越来越急。男人仰面躺着,喘息着低声说:\"看着我。\"女人俯下身吻他,镜头从侧面缓慢推近。\n", + "json_type": "str", + "pointer": "/nodes/0/widgets_values/0", + "named_pointer": "/nodes/0/widgets_values_named/prompt", + "unit": null, + "limits": "未声明静态长度界限;内容效果待真实验证", + "effect": "将输入文字交给所选任务的写作消息组装。原文本作为不透明字符串保存;本轮没有改写、增强或调用模型。", + "role": "scalar", + "evidence": [ + 19, + 0, + 2 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "model", + "label": "写作模型选择", + "type": "动态COMBO / STRING", + "value": "on disk: Qwen3.5-9B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf [qwen35, 5.2 GB]", + "json_type": "str", + "pointer": "/nodes/0/widgets_values/1", + "named_pointer": "/nodes/0/widgets_values_named/model", + "unit": null, + "limits": "动态模型列表成员、实际路径和加载状态待目标环境核对", + "effect": "传给写作模型选择解析。保留源字符串;on disk只是源标签,不证明文件存在、模型已加载或当前列表包含它。", + "role": "scalar", + "evidence": [ + 20, + 0, + 3, + 2 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "task", + "label": "写作任务", + "type": "静态COMBO / STRING", + "value": "T2VA", + "json_type": "str", + "pointer": "/nodes/0/widgets_values/2", + "named_pointer": "/nodes/0/widgets_values_named/task", + "unit": null, + "limits": "静态枚举:T2VA、I2VA、FL2VA、L2VA", + "effect": "T2VA按文字组织描述;I2VA以首帧、FL2VA以首尾帧、L2VA以尾帧组织对齐说明。切换会改变所用指南和消息结构,输出质量待验证。", + "role": "scalar", + "evidence": [ + 21, + 0, + 5, + 2 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "resolution", + "label": "目标画面比例", + "type": "静态COMBO / STRING", + "value": "16:9", + "json_type": "str", + "pointer": "/nodes/0/widgets_values/3", + "named_pointer": "/nodes/0/widgets_values_named/resolution", + "unit": "宽高比(无量纲)", + "limits": "静态枚举:48:9、32:9、21:9、16:9、4:3、1:1、3:4、9:16", + "effect": "给写作消息提供目标宽高比例,不是像素分辨率。非空aspect_ratio按固定解析覆盖此选择;本图该槽未接线且保存为空。", + "role": "scalar", + "evidence": [ + 22, + 0, + 4, + 6, + 1 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "duration", + "label": "写作目标时长", + "type": "INT", + "value": 10, + "json_type": "int", + "pointer": "/nodes/0/widgets_values/4", + "named_pointer": "/nodes/0/widgets_values_named/duration", + "unit": "秒", + "limits": "固定Writer声明:4~15,步长1;源properties.max_duration=30不能当此类生效范围", + "effect": "用于写作消息中的目标片长、镜头数量及节奏提示。仅表示固定源码定义,不保证生成视频长度;本图Writer为10秒、Check另为5秒,未自动同步。", + "role": "scalar", + "evidence": [ + 23, + 0, + 4, + 2 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "greedy", + "label": "贪心解码开关", + "type": "BOOLEAN", + "value": true, + "json_type": "bool", + "pointer": "/nodes/0/widgets_values/5", + "named_pointer": "/nodes/0/widgets_values_named/greedy", + "unit": "不适用", + "limits": "布尔:true / false", + "effect": "固定声明称其为确定性解码,并将布尔值传给推理层。改变将影响传入的解码选项;本轮未验证解码结果,开启不保证跨环境可重复。", + "role": "scalar", + "evidence": [ + 24, + 0, + 2 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "seed", + "label": "写作随机种子", + "type": "INT", + "value": 42, + "json_type": "int", + "pointer": "/nodes/0/widgets_values/6", + "named_pointer": "/nodes/0/widgets_values_named/seed", + "unit": "不适用", + "limits": "固定声明:0~4294967295;不是推荐区间", + "effect": "转为整数传给写作推理层;fixed仅指前端不在排队后调整种子,不能保证实际推理必然可重复。", + "role": "scalar", + "evidence": [ + 25, + 0, + 2, + 14 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "control_after_generate", + "label": "生成后种子控制", + "type": "前端COMBO / STRING", + "value": "fixed", + "json_type": "str", + "pointer": "/nodes/0/widgets_values/7", + "named_pointer": "/nodes/0/widgets_values_named/control_after_generate", + "unit": "不适用", + "limits": "前端控制枚举:fixed、increment、decrement、randomize;本说明仅核对源fixed保存态", + "effect": "源保存fixed,前端固定分支不改种子。只保存于工作流,不进入prompt执行输入;不计入16个最终标量。", + "role": "frontend", + "evidence": [ + 0, + 14, + 15, + 16 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "keep_model_loaded", + "label": "保留写作模型", + "type": "BOOLEAN", + "value": false, + "json_type": "bool", + "pointer": "/nodes/0/widgets_values/8", + "named_pointer": "/nodes/0/widgets_values_named/keep_model_loaded", + "unit": "不适用", + "limits": "布尔:true / false;显存占用和释放行为待验证", + "effect": "作为keep_loaded传给写作推理层;声明意图是在改写后保留显存中的写作模型。false不代表当前显存已释放或模型未加载。", + "role": "scalar", + "evidence": [ + 26, + 0, + 2 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "aspect_ratio", + "label": "外部画面比例", + "type": "STRING,COMBO(STRING控件)", + "value": "", + "json_type": "str", + "pointer": "/nodes/0/widgets_values/9", + "named_pointer": "/nodes/0/widgets_values_named/aspect_ratio", + "unit": "宽高比(无量纲)", + "limits": "未声明静态字符串长度;可接受语法见固定解析,目标运行效果待验证", + "effect": "非空值经固定比例解析覆盖resolution;可读取宽高对、尺寸或数字,空串回退到比例选择。本图未接线且为空,不产生覆盖。", + "role": "scalar", + "evidence": [ + 27, + 0, + 6, + 7, + 1 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "reference_material", + "label": "参考素材文字描述", + "type": "STRING", + "value": "", + "json_type": "str", + "pointer": "/nodes/0/widgets_values/10", + "named_pointer": "/nodes/0/widgets_values_named/reference_material", + "unit": null, + "limits": "未声明静态长度界限;实际素材与效果待核对", + "effect": "将参考帧或资产的文字描述送入消息组装。此节点读文字,不直接读取像素;原图为空串,不据此宣称参考素材已就绪。", + "role": "scalar", + "evidence": [ + 28, + 0, + 2 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "bypass", + "label": "原文旁通", + "type": "BOOLEAN", + "value": false, + "json_type": "bool", + "pointer": "/nodes/0/widgets_values/11", + "named_pointer": "/nodes/0/widgets_values_named/bypass", + "unit": "不适用", + "limits": "布尔:true / false", + "effect": "为true时在库选择、会话复用和写作之前返回原提示;本图false。此参数旁通与图节点mode旁路不同。", + "role": "scalar", + "evidence": [ + 29, + 0, + 1, + 17 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "system_prompt", + "label": "替代系统提示文本", + "type": "STRING", + "value": "", + "json_type": "str", + "pointer": "/nodes/0/widgets_values/12", + "named_pointer": "/nodes/0/widgets_values_named/system_prompt", + "unit": null, + "limits": "未声明静态长度界限;内容效果待验证", + "effect": "非空文本替代整份组装指南且不获取该指南;空串沿固定默认指南分支。源文本原样保留,不执行指南获取或生成。", + "role": "scalar", + "evidence": [ + 30, + 0, + 2 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "repeat_last", + "label": "复用上次文本", + "type": "BOOLEAN", + "value": false, + "json_type": "bool", + "pointer": "/nodes/0/widgets_values/13", + "named_pointer": "/nodes/0/widgets_values_named/repeat_last", + "unit": "不适用", + "limits": "布尔:true / false;现有会话缓存与库内容未知", + "effect": "虽属界面隐藏/定制控制,仍是真实执行输入。bypass优先;开启后先尝试library_pick,再尝试本节点会话内上次结果;无可用结果时才进入写作分支。会话缓存不随工作流保存,重启丢失。", + "role": "scalar", + "evidence": [ + 31, + 0, + 1, + 8, + 9 + ] + }, + { + "node_id": "169", + "class_type": "MiniMaxH3GuidedWriter", + "field": "library_pick", + "label": "保存库文本选择", + "type": "STRING", + "value": "", + "json_type": "str", + "pointer": "/nodes/0/widgets_values/14", + "named_pointer": "/nodes/0/widgets_values_named/library_pick", + "unit": null, + "limits": "未声明静态长度;保存库JSON选择的实际成员待核对", + "effect": "界面隐藏但仍传入执行。仅repeat_last开启时使用;空串或无有效id不选择库记录。有效选择记录丢失会报错;同类同形状可直接复用,否则取保存文本再拆分。选择可随工作流保存,库实际存在未知。", + "role": "scalar", + "evidence": [ + 32, + 0, + 1, + 9, + 10 + ] + }, + { + "node_id": "170", + "class_type": "MiniMaxH3PromptCheck", + "field": "prompt", + "label": "待核对文本", + "type": "STRING", + "value": "", + "json_type": "str", + "pointer": "/nodes/1/widgets_values/0", + "named_pointer": "/nodes/1/widgets_values_named/prompt", + "unit": null, + "limits": "未声明静态长度界限;真实输出内容未验证", + "effect": "源保存文本仍保留,但执行时被169槽0→170.prompt物理线覆盖,不能把该保存文本当最终标量。固定实现读入字符串、按规则拆分核对并从槽0传出;本轮没有运行审查器。", + "role": "linked", + "evidence": [ + 33, + 11, + 12, + 16 + ] + }, + { + "node_id": "170", + "class_type": "MiniMaxH3PromptCheck", + "field": "task", + "label": "核对任务", + "type": "静态COMBO / STRING", + "value": "T2VA", + "json_type": "str", + "pointer": "/nodes/1/widgets_values/1", + "named_pointer": "/nodes/1/widgets_values_named/task", + "unit": null, + "limits": "静态枚举:T2VA、I2VA、FL2VA、L2VA、Ref2VA", + "effect": "选择应核对的字段与引用规则,不自动跟随Writer。固定枚举多出Ref2VA;原图与Writer都保存T2VA。", + "role": "scalar", + "evidence": [ + 34, + 11, + 13, + 5, + 12 + ] + }, + { + "node_id": "170", + "class_type": "MiniMaxH3PromptCheck", + "field": "duration", + "label": "核对目标时长", + "type": "FLOAT", + "value": 5, + "json_type": "int", + "pointer": "/nodes/1/widgets_values/2", + "named_pointer": "/nodes/1/widgets_values_named/duration", + "unit": "秒", + "limits": "固定Check schema:0.1~600,步长0.1;不借其它类动态max_duration当本类范围", + "effect": "按目标秒数核对镜头切点等规则;原图保存JSON整数5,由固定FLOAT控件承载。Writer保存10秒,两者不同,使用前应核对意图;此处不修改源值。", + "role": "scalar", + "evidence": [ + 35, + 11, + 13, + 12 + ] + } + ], + "sources": [ + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1453, + 1576 + ], + "claim": "GuidedWriter输入声明、类型与控件提示" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1594, + 1658 + ], + "claim": "旁通、库选择、会话复用、比例解析及写作参数传递" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1224, + 1297 + ], + "claim": "system_prompt替代指南、时长和seed/greedy/keep_loaded传递;未验证底层推理行为" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 199, + 261 + ], + "claim": "写作模型列表动态构造及选择解析;并非目标机目录快照" + }, + { + "id": "h3:minimax_h3_rewriter/constants.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/constants.py", + "sha256": "3681fabe3ee718fbe877a29850ee984ac4f7c09f437646f98e3dcf5956e9f807", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/constants.py", + "local_file": "h3__minimax_h3_rewriter__constants.py", + "license": "MIT", + "lines": [ + 18, + 20 + ], + "claim": "固定比例枚举、Writer时长静态界限" + }, + { + "id": "h3:minimax_h3_rewriter/guide_prompt.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/guide_prompt.py", + "sha256": "dc9cd4861d4112bbc7d9c12e2e1d1b26f429283066c88a68df665ffcaaab90b5", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/guide_prompt.py", + "local_file": "h3__minimax_h3_rewriter__guide_prompt.py", + "license": "MIT", + "lines": [ + 29, + 46 + ], + "claim": "四种基础任务及完整参考任务的字段对应" + }, + { + "id": "h3:minimax_h3_rewriter/aspect.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/aspect.py", + "sha256": "da6320ee5d4ad0465734ba96ba81148c1baeb88bc7b90b6afb3926983c8b5e32", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/aspect.py", + "local_file": "h3__minimax_h3_rewriter__aspect.py", + "license": "MIT", + "lines": [ + 30, + 43 + ], + "claim": "比例选择与aspect_ratio覆盖关系" + }, + { + "id": "h3:minimax_h3_rewriter/aspect.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/aspect.py", + "sha256": "da6320ee5d4ad0465734ba96ba81148c1baeb88bc7b90b6afb3926983c8b5e32", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/aspect.py", + "local_file": "h3__minimax_h3_rewriter__aspect.py", + "license": "MIT", + "lines": [ + 71, + 109 + ], + "claim": "宽高对/尺寸/数字读取及空值回退;仅说明固定实现" + }, + { + "id": "h3:minimax_h3_rewriter/memory.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/memory.py", + "sha256": "0e38cc2d86059e5549843aa0fc6932eb820ee6de34d8f58954b6dc72c30bf5c7", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/memory.py", + "local_file": "h3__minimax_h3_rewriter__memory.py", + "license": "MIT", + "lines": [ + 1, + 43 + ], + "claim": "每节点会话内复用,重启丢失;保存库选择另行持久化" + }, + { + "id": "h3:minimax_h3_rewriter/library.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/library.py", + "sha256": "20d1d77be6e829ef3a58476c052d345ad5457c7d1ffd608c2c3324bccf596937", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/library.py", + "local_file": "h3__minimax_h3_rewriter__library.py", + "license": "MIT", + "lines": [ + 323, + 386 + ], + "claim": "repeat_last开启后解析库选择;有效选择丢失报错,否则可能回退" + }, + { + "id": "h3:web/js/prompt_library.js", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "web/js/prompt_library.js", + "sha256": "a218e99753fcf01844e8564ad130c8829930d13d0d36718ab6809dc701581099", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/web/js/prompt_library.js", + "local_file": "h3__web__js__prompt_library.js", + "license": "MIT", + "lines": [ + 1046, + 1090 + ], + "claim": "隐藏library_pick的界面处理不删除执行输入" + }, + { + "id": "h3:minimax_h3_rewriter/prompt_check.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/prompt_check.py", + "sha256": "d3a9b06923704b0160d2917cf212f602bb2c09a27a763cd9722c78bd59890fa2", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/prompt_check.py", + "local_file": "h3__minimax_h3_rewriter__prompt_check.py", + "license": "MIT", + "lines": [ + 48, + 151 + ], + "claim": "Check提示、任务、秒数、可选options/references及9个输出槽" + }, + { + "id": "h3:minimax_h3_rewriter/prompt_check.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/prompt_check.py", + "sha256": "d3a9b06923704b0160d2917cf212f602bb2c09a27a763cd9722c78bd59890fa2", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/prompt_check.py", + "local_file": "h3__minimax_h3_rewriter__prompt_check.py", + "license": "MIT", + "lines": [ + 153, + 202 + ], + "claim": "Check读入文本、规则核对、字段拆分及输出;未运行验证" + }, + { + "id": "h3:minimax_h3_rewriter/universal.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/universal.py", + "sha256": "5af26c72b73dfa25ac65fa091386daf950ea941549160db0625ad491c5d9c5bd", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/universal.py", + "local_file": "h3__minimax_h3_rewriter__universal.py", + "license": "MIT", + "lines": [ + 76, + 102 + ], + "claim": "Check任务枚举、字段及0.1至600秒schema界限" + }, + { + "id": "frontend:src/scripts/valueControl.ts", + "commit": "743be3f4fe2e374b0ee39f0ded56e7cb65a837c5", + "file": "src/scripts/valueControl.ts", + "sha256": "007c7204d1fe88d156e07fee783a55e79fa7610e98a8a9f7761704a076a60458", + "url": "https://github.com/Comfy-Org/ComfyUI_frontend/blob/743be3f4fe2e374b0ee39f0ded56e7cb65a837c5/src/scripts/valueControl.ts", + "local_file": "frontend__src__scripts__valueControl.ts", + "license": "GPL-3.0", + "lines": [ + 1, + 92 + ], + "claim": "control_after_generate控制与fixed不改值分支" + }, + { + "id": "frontend:src/scripts/widgets.ts", + "commit": "743be3f4fe2e374b0ee39f0ded56e7cb65a837c5", + "file": "src/scripts/widgets.ts", + "sha256": "932a143a1a48c93aa3bee43b6dc3f932cd7f9a946802530650b4acdd41d36bd5", + "url": "https://github.com/Comfy-Org/ComfyUI_frontend/blob/743be3f4fe2e374b0ee39f0ded56e7cb65a837c5/src/scripts/widgets.ts", + "local_file": "frontend__src__scripts__widgets.ts", + "license": "GPL-3.0", + "lines": [ + 91, + 148 + ], + "claim": "INT种子附加控件构造;精确规则与序列化见既有固定证据" + }, + { + "id": "frontend:src/utils/executionUtil.ts", + "commit": "743be3f4fe2e374b0ee39f0ded56e7cb65a837c5", + "file": "src/utils/executionUtil.ts", + "sha256": "b29fd312e66c7415fa4c720654ac121dc67600b0c1fedf079b6575a174960698", + "url": "https://github.com/Comfy-Org/ComfyUI_frontend/blob/743be3f4fe2e374b0ee39f0ded56e7cb65a837c5/src/utils/executionUtil.ts", + "local_file": "frontend__src__utils__executionUtil.ts", + "license": "GPL-3.0", + "lines": [ + 124, + 168 + ], + "claim": "执行输入构造与物理线覆盖;该文件未调用" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 929, + 932 + ], + "claim": "旁通函数将原文本作为首出口返回" + }, + { + "id": "core:comfy_extras/nodes_preview_any.py", + "commit": "b1693ecba9f5b65f8c80ab36b195ab963ec92413", + "file": "comfy_extras/nodes_preview_any.py", + "sha256": "d51a648031621d638ae5f42787042ec08b06792e0b61045b7993b42db8ea7e7b", + "url": "https://github.com/Comfy-Org/ComfyUI/blob/b1693ecba9f5b65f8c80ab36b195ab963ec92413/comfy_extras/nodes_preview_any.py", + "local_file": "core__comfy_extras__nodes_preview_any.py", + "license": "GPL-3.0", + "lines": [ + 8, + 39 + ], + "claim": "PreviewAny以文本显示输入;不生成文件" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1468, + 1475 + ], + "claim": "prompt的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1476, + 1486 + ], + "claim": "model的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1487, + 1498 + ], + "claim": "task的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1499, + 1502 + ], + "claim": "resolution的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1503, + 1512 + ], + "claim": "duration的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1513, + 1522 + ], + "claim": "greedy的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1523, + 1531 + ], + "claim": "seed的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1532, + 1542 + ], + "claim": "keep_model_loaded的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1545, + 1548 + ], + "claim": "aspect_ratio的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1549, + 1561 + ], + "claim": "reference_material的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1563, + 1563 + ], + "claim": "bypass的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1564, + 1567 + ], + "claim": "system_prompt的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1568, + 1568 + ], + "claim": "repeat_last的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/nodes.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/nodes.py", + "sha256": "93995f62675dc5d2ca8054eb961ffcfa9d3ba07446ef76fbbe5fb0bf56ab0a67", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/nodes.py", + "local_file": "h3__minimax_h3_rewriter__nodes.py", + "license": "MIT", + "lines": [ + 1569, + 1569 + ], + "claim": "library_pick的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/prompt_check.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/prompt_check.py", + "sha256": "d3a9b06923704b0160d2917cf212f602bb2c09a27a763cd9722c78bd59890fa2", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/prompt_check.py", + "local_file": "h3__minimax_h3_rewriter__prompt_check.py", + "license": "MIT", + "lines": [ + 103, + 103 + ], + "claim": "Check.prompt的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/prompt_check.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/prompt_check.py", + "sha256": "d3a9b06923704b0160d2917cf212f602bb2c09a27a763cd9722c78bd59890fa2", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/prompt_check.py", + "local_file": "h3__minimax_h3_rewriter__prompt_check.py", + "license": "MIT", + "lines": [ + 104, + 106 + ], + "claim": "Check.task的精确字段声明" + }, + { + "id": "h3:minimax_h3_rewriter/prompt_check.py", + "commit": "a59888df88a69385d429b6865ea441e7844f49c9", + "file": "minimax_h3_rewriter/prompt_check.py", + "sha256": "d3a9b06923704b0160d2917cf212f602bb2c09a27a763cd9722c78bd59890fa2", + "url": "https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/blob/a59888df88a69385d429b6865ea441e7844f49c9/minimax_h3_rewriter/prompt_check.py", + "local_file": "h3__minimax_h3_rewriter__prompt_check.py", + "license": "MIT", + "lines": [ + 107, + 114 + ], + "claim": "Check.duration的精确字段声明" + } + ], + "flow": [ + "169(GuidedWriter)按所选模型与任务写作文本;170(PromptCheck)按规则核对并拆分。这里仅展示固定实现说明,没有运行两个节点。", + "169槽0 → 170.prompt;170槽0 → 171.source;170槽8 → 172.source,均为原图物理连线。", + "171与172均为PreviewAny:显示字符串,分别为传入文本与核对发现;不是文件下载,也不证明成功生成。", + "169.options、170.options与170.references可选槽未接线;options按固定实现使用DEFAULT_OPTIONS副本,references未接时跳过依赖引用实物数量的规则。默认实现不证明目标环境状态。" + ], + "flow_evidence": [ + 0, + 1, + 11, + 12, + 18 + ], + "steps": [ + "先核对169的模型源字符串、T2VA任务和16:9比例;模型文件和目标节点是否存在仍待环境检查。本图没有上传素材入口。", + "核对169的原始提示文本与可选system_prompt、reference_material;文本原样保留。aspect_ratio未接线且为空,options未接线;不把默认实现当已安装环境。", + "核对169时长10秒与170时长5秒是否符合使用意图;Check任务也是T2VA,它不会自动同步Writer的任务或时长。", + "核对169的seed=42、fixed控制及greedy=true;bypass=false、repeat_last=false、library_pick为空,隐藏输入仍应核对,会话和库状态未知。", + "沿169槽0→170.prompt阅读数据流,再看171的文本显示及172的核对发现显示。170保存的prompt被连线覆盖;options/reference未接线,真实输出字符串未验证。", + "本条仍停用、待可靠转换、说明未定稿且未实跑;目标环境、依赖与执行资格待后续审核,不通过此说明发起生成。" + ] +} diff --git a/docs/hel-892/h3-document-evidence/recompute.py b/docs/hel-892/h3-document-evidence/recompute.py new file mode 100644 index 00000000..2fbed7cd --- /dev/null +++ b/docs/hel-892/h3-document-evidence/recompute.py @@ -0,0 +1,299 @@ +"""Reproduce H3 document adoption, real old-DB refresh and untouched boundaries offline.""" + +from __future__ import annotations + +import hashlib +import io +import json +import os +import sqlite3 +import subprocess +import sys +import tarfile +import tempfile +import zipfile +from pathlib import Path + +REPO = Path(__file__).resolve().parents[3] +OUT = Path(__file__).resolve().parent +BASE = "b47e13d169be9a786f69625f2fda58895204802a" +sys.path.insert(0, str(REPO / "calliope-backend")) +from calliope.comfyui.fixed_document import ( + DEFINITION_SHA256, + SOURCE_PATH, + canonical, +) +from scripts.audit_library_documents import audit + + +def write(name, data): + (OUT / name).write_text(json.dumps(data, ensure_ascii=False, indent=2) + "\n") + + +def main(): + local = REPO / ".local-evidence/h3-document" + local.mkdir(parents=True, exist_ok=True) + with tempfile.TemporaryDirectory(dir=local) as directory: + work = Path(directory) + baseline = work / "baseline" + baseline.mkdir() + raw = subprocess.check_output( + ["git", "archive", BASE, "calliope-backend/src"], cwd=REPO + ) + with tarfile.open(fileobj=io.BytesIO(raw)) as archive: + archive.extractall(baseline, filter="data") + db = work / "library.db" + + def run(name, old=False): + output = work / name + env = { + **os.environ, + "PYTHONPATH": str((baseline if old else REPO) / "calliope-backend/src"), + } + command = [ + sys.executable, + "-m", + "calliope.comfyui.library_cli", + "import", + "--root", + str(REPO / "example_ComfyUI_workflows"), + "--db", + str(db), + "--source-commit", + BASE, + "--companions", + str(REPO / "docs/hel-892/supplied-api/manifest.json"), + "--output-dir", + str(output), + ] + subprocess.run( + command, env=env, cwd=REPO, check=True, stdout=subprocess.DEVNULL + ) + return json.loads((output / "import_report.json").read_bytes()), output + + def rows(): + with sqlite3.connect(db) as conn: + conn.row_factory = sqlite3.Row + return { + r["source_repo_path"]: dict(r) + for r in conn.execute("SELECT * FROM workflows") + } + + first, _ = run("first", old=True) + before = rows() + assert first["counts"] == {"imported": 155, "user_excluded": 1} + assert "fixed_version" not in json.loads(before[SOURCE_PATH]["doc_json"]) + original_db = db + db = work / "old-user.db" + with sqlite3.connect(original_db) as src, sqlite3.connect(db) as dst: + src.backup(dst) + dst.execute( + "UPDATE workflows SET description=? WHERE source_repo_path=?", + ("旧库用户版", SOURCE_PATH), + ) + old_user_before = rows() + old_user, _ = run("old-user-protection") + assert old_user["counts"] == {"conflict": 1, "skipped": 154, "user_excluded": 1} + assert rows() == old_user_before + db = original_db + refreshed, exported = run("refresh") + after = rows() + assert refreshed["counts"] == {"updated": 1, "skipped": 154, "user_excluded": 1} + for path, row in after.items(): + if path != SOURCE_PATH: + assert row == before[path] + else: + for column in row.keys() - { + "doc_json", + "batch_id", + "imported_at", + "library_fingerprint", + }: + assert row[column] == before[path][column] + doc = json.loads(after[SOURCE_PATH]["doc_json"]) + assert doc["fixed_version"]["matched"] + block = {k: v for k, v in doc["fixed_version"].items() if k != "matched"} + assert hashlib.sha256(canonical(block)).hexdigest() == DEFINITION_SHA256 + write("actual-document.json", doc) + report = audit(REPO, exported) + assert ( + report["named_values_preserved"] == 1217 + and report["unnamed_widget_nodes"] == 3660 + ) + assert report["full_documents_completed"] == report["real_executions"] == 0 + write( + "document-audit-summary.json", + {k: v for k, v in report.items() if k != "files"}, + ) + companion = 0 + for row in after.values(): + d = json.loads(row["doc_json"]) + companion += sum( + p.get("value_origin") == "supplied_api_companion" for p in d["params"] + ) + assert ( + not row["is_enabled"] + and row["doc_completed_at"] is None + and row["exec_verified_at"] is None + ) + assert d["dependencies"]["check_state"] == "unchecked" + assert companion == 294 + repeat, _ = run("repeat") + assert repeat["counts"] == {"skipped": 155, "user_excluded": 1} + # Restore the actual historical row, then repeat adoption. No mocks here. + from calliope.comfyui.library import rollback_batch + + with sqlite3.connect(db) as conn: + conn.row_factory = sqlite3.Row + rollback = rollback_batch(conn, refreshed["batch_id"]) + assert rollback["files"] == [ + {"workflow_id": after[SOURCE_PATH]["id"], "result": "restored"} + ] + assert rows() == before + restored, _ = run("after-rollback") + assert restored["counts"] == {"updated": 1, "skipped": 154, "user_excluded": 1} + with sqlite3.connect(db) as conn: + conn.execute( + "UPDATE workflows SET description=? WHERE source_repo_path=?", + ("用户整行保护", SOURCE_PATH), + ) + protected = rows() + user, _ = run("user") + assert user["counts"] == {"conflict": 1, "skipped": 154, "user_excluded": 1} + assert rows() == protected and len(protected[SOURCE_PATH]) == 29 + # A second genuinely fresh current import, distinct from the historical upgrade. + db = work / "current-fresh.db" + current, _ = run("current-first") + again, _ = run("current-repeat") + assert current["counts"] == {"imported": 155, "user_excluded": 1} + assert current["states"] == {"pending_check": 16, "needs_conversion": 139} + assert again["counts"] == {"skipped": 155, "user_excluded": 1} + write( + "import-protection.json", + { + "historical_code": BASE, + "historical_first": first["counts"], + "actual_historical_doc_lacked_fixed_block": True, + "refresh": refreshed["counts"], + "only_updated_path": SOURCE_PATH, + "other_154_rows_byte_equal": True, + "repeat": repeat["counts"], + "rollback_restored_actual_old_row": True, + "after_rollback": restored["counts"], + "user_modified": user["counts"], + "old_user_before_refresh": old_user["counts"], + "old_user_all_columns_preserved": True, + "protected_columns": 29, + "whole_row_equal": True, + "current_fresh": current["counts"], + "current_repeat": again["counts"], + "states": current["states"], + "source_named": 1217, + "source_positional": 3660, + "companion_values": companion, + "new_definitions": doc["fixed_version"]["counts"], + "all_disabled": True, + "environment_unchecked": True, + "completed": 0, + "executed": 0, + }, + ) + originals = json.loads( + (REPO / "docs/hel-892/media-evidence/original-bytes.json").read_bytes() + )["files"] + production = json.loads( + (REPO / "docs/hel-892/setget-evidence/production-protection.json").read_bytes() + )["files"] + preserved = [] + protected_production = [ + p for p in production if not p["path"].endswith("/library.py") + ] + for item in originals + protected_production: + path = item["path"] + raw = (REPO / path).read_bytes() + assert raw == subprocess.check_output( + ["git", "show", f"{BASE}:{path}"], cwd=REPO + ) + preserved.append({"path": path, "sha256": hashlib.sha256(raw).hexdigest()}) + assert len(originals) == 163 and len(production) == 9 + # Freeze the complete 28-profile baseline artifacts and every executable conversion module. + boundaries = [ + "docs/hel-892/h3-chain-evidence/library.json", + "docs/hel-892/media-evidence/protected-six-cases.json", + "calliope-backend/src/calliope/comfyui/structure_reference.py", + "calliope-backend/src/calliope/comfyui/serialization_reference.py", + "calliope-backend/src/calliope/comfyui/ui2api.py", + "calliope-backend/src/calliope/comfyui/h3_core_reference.py", + "calliope-backend/src/calliope/comfyui/h3_chain_reference.py", + ] + for path in boundaries: + assert (REPO / path).read_bytes() == subprocess.check_output( + ["git", "show", f"{BASE}:{path}"], cwd=REPO + ) + frozen = json.loads((REPO / boundaries[0]).read_bytes()) + assert len(frozen["profiles"]) == 28 + write( + "unchanged-boundaries.json", + { + "base": BASE, + "original_files": 163, + "unchanged_production_files": 8, + "authorized_document_integration": "library.py", + "files": preserved, + "frozen_conversion_and_audits": boundaries, + "old_28_attempts_and_gaps_9_candidate_hashes_six_diffs": "unchanged artifacts and implementation; no conversion rerun claimed", + }, + ) + review_path = "calliope-backend/src/calliope/comfyui/source_reviews.json" + old_reviews = json.loads( + subprocess.check_output(["git", "show", f"{BASE}:{review_path}"], cwd=REPO) + ) + current_reviews = json.loads((REPO / review_path).read_bytes()) + del current_reviews[SOURCE_PATH]["fixed_version_document"] + assert current_reviews == old_reviews + ui_path = "calliope-web/src/lib/components/WorkflowDocumentDrawer.svelte" + old_ui = subprocess.check_output( + ["git", "show", f"{BASE}:{ui_path}"], cwd=REPO + ).decode() + assert (REPO / ui_path).read_text().split("