HEL-892: add pinned frontend 1.41.20 grid reference conversion

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
leefer
2026-10-30 06:15:35 +08:00
co-authored by multica-agent
parent 0609341afa
commit 638c59035f
49 changed files with 21095 additions and 9 deletions
@@ -40,6 +40,7 @@ from calliope.comfyui.serialization_reference import (
serialize_reference_widgets,
)
from calliope.comfyui.structure_reference import (
GRID_PROFILE,
PROMOTED_PROFILES,
SCAIL_LOAD_PROFILES,
SETGET_COMMIT,
@@ -303,6 +304,7 @@ REFERENCE_PROFILES = (
*SETGET_PROFILES,
*VIDEOINFO_PROFILES,
*SCAIL_LOAD_PROFILES,
GRID_PROFILE,
)
@@ -499,11 +501,62 @@ def vhs_field_evidence(source, prompt):
return fields
def grid_field_evidence(source, prompt):
"""Every scalar/physical edge and metadata pointer in the fixed grid scope."""
layouts = {
"LoadImage": ("image", "upload"),
"SaveImage": ("filename_prefix",),
"ImageStitch": ("direction", "match_image_size", "spacing_width", "spacing_color"),
"ResizeImageMaskNode": (
"resize_type",
"resize_type.width",
"resize_type.height",
"resize_type.crop",
"scale_method",
),
}
fields = []
for i, node in enumerate(source["nodes"]):
nid = str(node["id"])
if node["type"] in ("Note", "MarkdownNote"):
continue
actual = prompt[nid]
assert actual["class_type"] == node["type"]
assert actual["_meta"] == {"title": node.get("title") or node["type"]}
for name, value in actual["inputs"].items():
socket = next(s for s in node["inputs"] if s["name"] == name)
if socket.get("link") is not None:
j, edge = next(
(j, e) for j, e in enumerate(source["links"]) if e[0] == socket["link"]
)
expected, pointer = [str(edge[1]), edge[2]], f"/links/{j}"
else:
w = layouts[node["type"]].index(name)
expected, pointer = node["widgets_values"][w], f"/nodes/{i}/widgets_values/{w}"
assert type(value) is type(expected) and value == expected
fields.append(
{
"node_id": nid,
"field": name,
"value": value,
"json_type": type(value).__name__,
"source_pointer": pointer,
"class_pointer": f"/nodes/{i}/type",
"title_pointer": f"/nodes/{i}/title"
if node.get("title")
else f"/nodes/{i}/type",
"contract_manifest": "grid-reference/sources.json",
}
)
return fields
def profile_attempt(source, profile):
expected = {
**STRUCTURE_PROFILES,
**PROMOTED_PROFILES,
CASE04_PROFILE: "1.53.6",
GRID_PROFILE: "1.41.20",
**VHS_PROFILES,
**SETGET_PROFILES,
**VIDEOINFO_PROFILES,
@@ -684,6 +737,10 @@ def profile_attempt(source, profile):
if profile in VHS_PROFILES
else "crop-split-reference/verified-facts.json"
)
if profile == GRID_PROFILE:
assumptions["grid_contract"] = "grid-reference/sources.json"
assumptions["core_version"] = "0.17.0"
assumptions["ue_policy"] = "reject_even_empty_metadata; implementation_not_pinned"
declared_frontend = (source.get("extra") or {}).get("frontendVersion")
assumptions["source_frontend_declaration"] = declared_frontend
if profile in VHS_PROFILES:
@@ -781,7 +838,9 @@ def profile_attempt(source, profile):
else {}
),
**(
{"field_evidence": asr_field_evidence(source, result.prompt)}
{"field_evidence": grid_field_evidence(source, result.prompt)}
if profile == GRID_PROFILE
else {"field_evidence": asr_field_evidence(source, result.prompt)}
if profile == ASR_PROFILE
else {"field_evidence": vhs_field_evidence(source, result.prompt)}
if profile in VHS_PROFILES
@@ -897,7 +956,9 @@ def audit_library(repo: Path, profiles=REFERENCE_PROFILES, *, baseline_profiles=
}
if baseline_profiles is None:
excluded_profiles = (
SCAIL_LOAD_PROFILES
(GRID_PROFILE,)
if GRID_PROFILE in profiles
else SCAIL_LOAD_PROFILES
if any(p in SCAIL_LOAD_PROFILES for p in profiles)
else VIDEOINFO_PROFILES
if any(p in VIDEOINFO_PROFILES for p in profiles)