feat(HEL-892): add pinned MP3 and mixed LayerStyle reference profiles

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
leefer
2026-10-30 02:32:15 +08:00
co-authored by multica-agent
parent a8cd8e8ac5
commit 8ed420ebac
4 changed files with 619 additions and 6 deletions
@@ -25,9 +25,12 @@ from calliope.comfyui.serialization_reference import (
ASR_PROFILE,
AUX_PROFILE,
CASE04_PROFILE,
MEDIA_PROFILES,
MP3_PROFILE,
PREVIEW_PROFILE,
PRIMITIVE_PROFILE,
PROFILE,
REEL_PROFILE,
resolve_reference_link,
serialize_case04_node,
serialize_promoted_node,
@@ -283,6 +286,7 @@ REFERENCE_PROFILES = (
*PROMOTED_PROFILES,
CASE04_PROFILE,
ASR_PROFILE,
*MEDIA_PROFILES,
)
@@ -367,6 +371,69 @@ def asr_field_evidence(source, prompt):
return fields
def media_field_evidence(source, prompt, profile):
"""Independent final byte pointers, including every class/input/title/link."""
layouts = {
"LoadAudio": ("audio",),
"SaveAudioMP3": ("filename_prefix", "quality"),
"LoadImage": ("image",),
"PreviewImage": (),
"LayerUtility: ImageReel": (
"image1_text",
"image2_text",
"image3_text",
"image4_text",
"reel_height",
"border",
),
"LayerUtility: ImageReelComposit": ("font_file", "font_size", "border", "color_theme"),
}
fields = []
for index, node in enumerate(source["nodes"]):
nid = str(node["id"])
if nid not in prompt:
continue
actual = prompt[nid]
assert actual["class_type"] == node["type"]
assert actual["_meta"] == {"title": node.get("title") or node["type"]}
names = layouts[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:
li, link = next(
(i, link) for i, link in enumerate(source["links"]) if link[0] == socket["link"]
)
expected = [str(link[1]), link[2]]
pointer, rule = f"/links/{li}", "original final endpoint ID/slot"
elif name in names:
wi = names.index(name)
expected = node["widgets_values"][wi]
pointer, rule = f"/nodes/{index}/widgets_values/{wi}", "fixed constructor identity"
else:
assert name == "audioUI"
expected = ""
pointer, rule = None, "1.37.11 DOM getter without getValue; not a descriptor"
assert type(value) is type(expected) and value == expected
fields.append(
{
"node_id": nid,
"class_type": node["type"],
"class_pointer": f"/nodes/{index}/type",
"title_pointer": f"/nodes/{index}/title"
if node.get("title")
else f"/nodes/{index}/type",
"field": name,
"value": value,
"json_type": type(value).__name__,
"source_pointer": pointer,
"rule": rule,
"profile": profile,
"contract_manifest": "media-reference/contract.json",
}
)
return fields
def profile_attempt(source, profile):
expected = {**STRUCTURE_PROFILES, **PROMOTED_PROFILES, CASE04_PROFILE: "1.53.6"}.get(
profile, "1.37.11"
@@ -385,7 +452,19 @@ def profile_attempt(source, profile):
if profile == AUX_PROFILE
else None,
"aux_release_artifact_match": "unknown" if profile == AUX_PROFILE else "not_used",
"media_reference": (
{"core": "0.11.0@09725967cf76304371c390ca1d6483e04061da48"}
if profile == MP3_PROFILE
else {
"core": "0.4.0@fc657f471a29d07696ca16b566000e8e555d67d1",
"ImageReel": "4f4d5cbbe40e030a5a0bb474fb65c4032585bc3c",
"ImageReelComposit": "42ccdd8f75ab312285eaa77073a5cc20bdba484c",
}
if profile == REEL_PROFILE
else None
),
"reference_sources": [
"media-reference/sources.json",
"serialization-evidence/sources.json",
"structure-reference/sources.json",
"controlnet-reference/sources.json",
@@ -397,7 +476,9 @@ def profile_attempt(source, profile):
declared_frontend = (source.get("extra") or {}).get("frontendVersion")
assumptions["source_frontend_declaration"] = declared_frontend
assumptions["missing_frontend_policy"] = (
"explicit_legacy_reference_assumption"
"explicit_media_reference_assumption"
if profile in MEDIA_PROFILES
else "explicit_legacy_reference_assumption"
if profile in (PROFILE, AUX_PROFILE, PRIMITIVE_PROFILE)
else "requires_explicit_declaration"
)
@@ -408,7 +489,8 @@ def profile_attempt(source, profile):
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)
declared_frontend is None
and profile in (PROFILE, AUX_PROFILE, PRIMITIVE_PROFILE, *MEDIA_PROFILES)
):
return {
**base,
@@ -444,6 +526,8 @@ def profile_attempt(source, profile):
**(
{"field_evidence": asr_field_evidence(source, result.prompt)}
if profile == ASR_PROFILE
else {"field_evidence": media_field_evidence(source, result.prompt, profile)}
if profile in MEDIA_PROFILES
else {}
),
}
@@ -545,7 +629,7 @@ def audit_library(repo: Path, profiles=REFERENCE_PROFILES):
row["source_path"]
for row in rows
if any(
a["status"] == "complete_reference_candidate" and a["profile"] != ASR_PROFILE
a["status"] == "complete_reference_candidate" and a["profile"] not in MEDIA_PROFILES
for a in row["attempts"]
)
}
@@ -555,7 +639,7 @@ def audit_library(repo: Path, profiles=REFERENCE_PROFILES):
"source_total": len(manifest),
"target_total": len(rows) + len(api_paths),
"coverage_delta": {
"baseline": "all previous profiles excluding ASR_PROFILE; applied this run",
"baseline": "previous eleven profiles excluding MEDIA_PROFILES; applied this run",
"previous_complete_paths": sorted(old_complete),
"current_complete_paths": sorted(now_complete),
"new_complete_paths": sorted(now_complete - old_complete),
@@ -592,6 +676,7 @@ def main():
"--profile",
choices=(
ASR_PROFILE,
*MEDIA_PROFILES,
PROFILE,
AUX_PROFILE,
PRIMITIVE_PROFILE,