HEL-892: pin AudioCrop and GuHai split reference contracts
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -25,6 +25,7 @@ from calliope.comfyui.serialization_reference import (
|
||||
ASR_PROFILE,
|
||||
AUX_PROFILE,
|
||||
CASE04_PROFILE,
|
||||
CROP_SPLIT_PROFILES,
|
||||
MEDIA_PROFILES,
|
||||
MP3_PROFILE,
|
||||
PREVIEW_PROFILE,
|
||||
@@ -289,6 +290,7 @@ REFERENCE_PROFILES = (
|
||||
ASR_PROFILE,
|
||||
*MEDIA_PROFILES,
|
||||
SEPARATION_PROFILE,
|
||||
*CROP_SPLIT_PROFILES,
|
||||
)
|
||||
|
||||
|
||||
@@ -305,7 +307,7 @@ def canonical_sha(value):
|
||||
).hexdigest()
|
||||
|
||||
|
||||
def node_inventory(source):
|
||||
def node_inventory(source, *, include_aux=False):
|
||||
rows = []
|
||||
graphs = [("", source)] + [
|
||||
(f"/definitions/subgraphs/{i}", graph)
|
||||
@@ -319,7 +321,8 @@ def node_inventory(source):
|
||||
"pointer": f"{prefix}/nodes/{i}",
|
||||
"node_id": str(node.get("id")),
|
||||
"type": node.get("type"),
|
||||
"provider": props.get("cnr_id"),
|
||||
"provider": props.get("cnr_id")
|
||||
or (props.get("aux_id") if include_aux else None),
|
||||
"version": props.get("ver"),
|
||||
"mode": node.get("mode", 0),
|
||||
"widget_count": len(node.get("widgets_values", [])),
|
||||
@@ -380,6 +383,16 @@ def media_field_evidence(source, prompt, profile):
|
||||
"SaveAudioMP3": ("filename_prefix", "quality"),
|
||||
"PreviewAudio": (),
|
||||
"AudioSeparation": ("chunk_fade_shape", "chunk_length", "chunk_overlap"),
|
||||
"AudioCrop": ("start_time", "end_time"),
|
||||
"GuHaiAutoImageSplit": (
|
||||
"保存目录",
|
||||
"水平张数",
|
||||
"垂直张数",
|
||||
"移除画布边缘",
|
||||
"移除描边",
|
||||
"文件名前缀",
|
||||
"保存格式",
|
||||
),
|
||||
"LoadImage": ("image",),
|
||||
"PreviewImage": (),
|
||||
"LayerUtility: ImageReel": (
|
||||
@@ -432,7 +445,9 @@ def media_field_evidence(source, prompt, profile):
|
||||
"source_pointer": pointer,
|
||||
"rule": rule,
|
||||
"profile": profile,
|
||||
"contract_manifest": "separation-reference/contract.json"
|
||||
"contract_manifest": "crop-split-reference/contract.json"
|
||||
if profile in CROP_SPLIT_PROFILES
|
||||
else "separation-reference/contract.json"
|
||||
if profile == SEPARATION_PROFILE
|
||||
else "media-reference/contract.json",
|
||||
}
|
||||
@@ -494,26 +509,55 @@ def profile_attempt(source, profile):
|
||||
"separation-reference/sources.json",
|
||||
*assumptions["reference_sources"],
|
||||
]
|
||||
if profile in CROP_SPLIT_PROFILES:
|
||||
assumptions["crop_split_reference"] = {
|
||||
"selected_profile": profile,
|
||||
"node_contracts": "crop-split-reference/contract.json",
|
||||
"unmodified_plugin_and_frontend": True,
|
||||
"target_node_version_and_UE_match": "unknown",
|
||||
"registry_commit_binding": "unknown",
|
||||
}
|
||||
assumptions["reference_sources"] = [
|
||||
"crop-split-reference/sources.json",
|
||||
"separation-reference/sources.json",
|
||||
*assumptions["reference_sources"],
|
||||
]
|
||||
base = {"profile": profile, "assumptions": assumptions}
|
||||
if profile in CROP_SPLIT_PROFILES:
|
||||
base["source_declarations"] = [
|
||||
{
|
||||
"pointer": f"/nodes/{i}",
|
||||
**{k: (n.get("properties") or {}).get(k) for k in ("cnr_id", "aux_id", "ver")},
|
||||
}
|
||||
for i, n in enumerate(source.get("nodes", []))
|
||||
]
|
||||
base["verified_reference_facts"] = "crop-split-reference/verified-facts.json"
|
||||
declared_frontend = (source.get("extra") or {}).get("frontendVersion")
|
||||
assumptions["source_frontend_declaration"] = declared_frontend
|
||||
assumptions["missing_frontend_policy"] = (
|
||||
"explicit_media_reference_assumption"
|
||||
if profile in (*MEDIA_PROFILES, SEPARATION_PROFILE)
|
||||
if profile in (*MEDIA_PROFILES, SEPARATION_PROFILE, *CROP_SPLIT_PROFILES)
|
||||
else "explicit_legacy_reference_assumption"
|
||||
if profile in (PROFILE, AUX_PROFILE, PRIMITIVE_PROFILE)
|
||||
else "requires_explicit_declaration"
|
||||
)
|
||||
assumptions["missing_node_declarations"] = [
|
||||
n["pointer"]
|
||||
for n in node_inventory(source)
|
||||
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)
|
||||
in (
|
||||
PROFILE,
|
||||
AUX_PROFILE,
|
||||
PRIMITIVE_PROFILE,
|
||||
*MEDIA_PROFILES,
|
||||
SEPARATION_PROFILE,
|
||||
*CROP_SPLIT_PROFILES,
|
||||
)
|
||||
):
|
||||
return {
|
||||
**base,
|
||||
@@ -550,7 +594,7 @@ 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, SEPARATION_PROFILE)
|
||||
if profile in (*MEDIA_PROFILES, SEPARATION_PROFILE, *CROP_SPLIT_PROFILES)
|
||||
else {}
|
||||
),
|
||||
}
|
||||
@@ -627,7 +671,12 @@ def audit_library(repo: Path, profiles=REFERENCE_PROFILES, *, baseline_profiles=
|
||||
if attempt["status"] != "rejected":
|
||||
continue
|
||||
for issue in attempt["issues"]:
|
||||
matches = [n for n in inventory if n["node_id"] == issue.get("node_id")]
|
||||
gap_inventory = (
|
||||
node_inventory(source, include_aux=True)
|
||||
if attempt["profile"] in CROP_SPLIT_PROFILES
|
||||
else inventory
|
||||
)
|
||||
matches = [n for n in gap_inventory if n["node_id"] == issue.get("node_id")]
|
||||
for node in matches or [{}]:
|
||||
key = (
|
||||
node.get("type"),
|
||||
@@ -649,7 +698,7 @@ 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 != SEPARATION_PROFILE)
|
||||
baseline_profiles = tuple(p for p in profiles if p not in CROP_SPLIT_PROFILES)
|
||||
old_complete = {
|
||||
row["source_path"]
|
||||
for row in rows
|
||||
@@ -704,6 +753,7 @@ def main():
|
||||
ASR_PROFILE,
|
||||
*MEDIA_PROFILES,
|
||||
SEPARATION_PROFILE,
|
||||
*CROP_SPLIT_PROFILES,
|
||||
PROFILE,
|
||||
AUX_PROFILE,
|
||||
PRIMITIVE_PROFILE,
|
||||
|
||||
Reference in New Issue
Block a user