HEL-892: pin bounded VHS combine and video load reference contracts

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
leefer
2026-10-30 04:11:19 +08:00
co-authored by multica-agent
parent 846d6fcbfe
commit ab4e47e662
88 changed files with 74883 additions and 28 deletions
@@ -33,6 +33,7 @@ from calliope.comfyui.serialization_reference import (
PROFILE,
REEL_PROFILE,
SEPARATION_PROFILE,
VHS_PROFILES,
resolve_reference_link,
serialize_case04_node,
serialize_promoted_node,
@@ -291,6 +292,7 @@ REFERENCE_PROFILES = (
*MEDIA_PROFILES,
SEPARATION_PROFILE,
*CROP_SPLIT_PROFILES,
*VHS_PROFILES,
)
@@ -455,10 +457,45 @@ def media_field_evidence(source, prompt, profile):
return fields
def vhs_field_evidence(source, prompt):
"""Re-read every final field from named source bytes or original links."""
fields = []
for i, node in enumerate(source["nodes"]):
nid = str(node["id"])
assert prompt[nid]["class_type"] == node["type"]
assert prompt[nid]["_meta"] == {"title": node.get("title") or node["type"]}
for name, value in prompt[nid]["inputs"].items():
socket = next(s for s in node["inputs"] if s["name"] == name)
if socket.get("link") is not None:
li, link = next(
(j, edge) for j, edge in enumerate(source["links"]) if edge[0] == socket["link"]
)
expected = [str(link[1]), link[2]]
pointer = f"/links/{li}"
else:
expected = node["widgets_values"][name]
pointer = f"/nodes/{i}/widgets_values/{name}"
assert type(value) is type(expected) and value == expected
fields.append(
{
"node_id": nid,
"class_type": node["type"],
"field": name,
"value": value,
"json_type": type(value).__name__,
"source_pointer": pointer,
}
)
return fields
def profile_attempt(source, profile):
expected = {**STRUCTURE_PROFILES, **PROMOTED_PROFILES, CASE04_PROFILE: "1.53.6"}.get(
profile, "1.37.11"
)
expected = {
**STRUCTURE_PROFILES,
**PROMOTED_PROFILES,
CASE04_PROFILE: "1.53.6",
**VHS_PROFILES,
}.get(profile, "1.37.11")
assumptions = {
"frontend": expected,
"unmodified_frontend_and_widgets": True,
@@ -522,8 +559,20 @@ def profile_attempt(source, profile):
"separation-reference/sources.json",
*assumptions["reference_sources"],
]
if profile in VHS_PROFILES:
assumptions["vhs_reference"] = {
"contracts": "vhs-reference/contract.json",
"unmodified_pinned_plugin_and_format_files": True,
"extension_overrides_and_target_installation": "unknown",
"named_mirror": "if present, assumed inert and required equal to VHS map",
"array_migration": "unsupported; never fill missing fields from defaults",
}
assumptions["reference_sources"] = [
"vhs-reference/sources.json",
"serialization-evidence/sources.json",
]
base = {"profile": profile, "assumptions": assumptions}
if profile in CROP_SPLIT_PROFILES:
if profile in (*CROP_SPLIT_PROFILES, *VHS_PROFILES):
base["source_declarations"] = [
{
"pointer": f"/nodes/{i}",
@@ -531,32 +580,48 @@ def profile_attempt(source, profile):
}
for i, n in enumerate(source.get("nodes", []))
]
base["verified_reference_facts"] = "crop-split-reference/verified-facts.json"
base["verified_reference_facts"] = (
"vhs-reference/contract.json"
if profile in VHS_PROFILES
else "crop-split-reference/verified-facts.json"
)
declared_frontend = (source.get("extra") or {}).get("frontendVersion")
assumptions["source_frontend_declaration"] = declared_frontend
if profile in VHS_PROFILES:
assumptions["vhs_reference"]["missing_frontend_policy"] = (
"explicit_1.37.11_reference_assumption"
if expected == "1.37.11"
else "requires_explicit_1.48.6"
)
assumptions["missing_frontend_policy"] = (
"explicit_media_reference_assumption"
if profile in (*MEDIA_PROFILES, SEPARATION_PROFILE, *CROP_SPLIT_PROFILES)
if profile in (*MEDIA_PROFILES, SEPARATION_PROFILE, *CROP_SPLIT_PROFILES, *VHS_PROFILES)
else "explicit_legacy_reference_assumption"
if profile in (PROFILE, AUX_PROFILE, PRIMITIVE_PROFILE)
else "requires_explicit_declaration"
)
if profile in VHS_PROFILES and expected == "1.48.6":
assumptions["missing_frontend_policy"] = "requires_explicit_1.48.6"
assumptions["missing_node_declarations"] = [
n["pointer"]
for n in node_inventory(source, include_aux=profile in CROP_SPLIT_PROFILES)
if n["type"] not in ("Note", "MarkdownNote", "Reroute", "PrimitiveNode")
and (n["provider"] is None or n["version"] is None)
]
if declared_frontend != expected and not (
declared_frontend is None
and profile
in (
PROFILE,
AUX_PROFILE,
PRIMITIVE_PROFILE,
*MEDIA_PROFILES,
SEPARATION_PROFILE,
*CROP_SPLIT_PROFILES,
if (profile in VHS_PROFILES and expected == "1.48.6" and declared_frontend is None) or (
declared_frontend != expected
and not (
declared_frontend is None
and profile
in (
PROFILE,
AUX_PROFILE,
PRIMITIVE_PROFILE,
*MEDIA_PROFILES,
SEPARATION_PROFILE,
*CROP_SPLIT_PROFILES,
*VHS_PROFILES,
)
)
):
return {
@@ -593,8 +658,10 @@ def profile_attempt(source, profile):
**(
{"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
else {"field_evidence": media_field_evidence(source, result.prompt, profile)}
if profile in (*MEDIA_PROFILES, SEPARATION_PROFILE, *CROP_SPLIT_PROFILES)
if profile in (*MEDIA_PROFILES, SEPARATION_PROFILE, *CROP_SPLIT_PROFILES, *VHS_PROFILES)
else {}
),
}
@@ -698,7 +765,10 @@ def audit_library(repo: Path, profiles=REFERENCE_PROFILES, *, baseline_profiles=
for cohort in ("without_companion", "with_companion")
}
if baseline_profiles is None:
baseline_profiles = tuple(p for p in profiles if p not in CROP_SPLIT_PROFILES)
excluded_profiles = (
VHS_PROFILES if any(p in VHS_PROFILES for p in profiles) else CROP_SPLIT_PROFILES
)
baseline_profiles = tuple(p for p in profiles if p not in excluded_profiles)
old_complete = {
row["source_path"]
for row in rows
@@ -754,6 +824,7 @@ def main():
*MEDIA_PROFILES,
SEPARATION_PROFILE,
*CROP_SPLIT_PROFILES,
*VHS_PROFILES,
PROFILE,
AUX_PROFILE,
PRIMITIVE_PROFILE,