HEL-892: add opt-in pinned root Set/Get reference projection
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -39,7 +39,12 @@ from calliope.comfyui.serialization_reference import (
|
||||
serialize_promoted_node,
|
||||
serialize_reference_widgets,
|
||||
)
|
||||
from calliope.comfyui.structure_reference import PROMOTED_PROFILES, STRUCTURE_PROFILES
|
||||
from calliope.comfyui.structure_reference import (
|
||||
PROMOTED_PROFILES,
|
||||
SETGET_COMMIT,
|
||||
SETGET_PROFILES,
|
||||
STRUCTURE_PROFILES,
|
||||
)
|
||||
from calliope.comfyui.ui2api import convert, convert_reference
|
||||
|
||||
|
||||
@@ -293,6 +298,7 @@ REFERENCE_PROFILES = (
|
||||
SEPARATION_PROFILE,
|
||||
*CROP_SPLIT_PROFILES,
|
||||
*VHS_PROFILES,
|
||||
*SETGET_PROFILES,
|
||||
)
|
||||
|
||||
|
||||
@@ -495,6 +501,7 @@ def profile_attempt(source, profile):
|
||||
**PROMOTED_PROFILES,
|
||||
CASE04_PROFILE: "1.53.6",
|
||||
**VHS_PROFILES,
|
||||
**SETGET_PROFILES,
|
||||
}.get(profile, "1.37.11")
|
||||
assumptions = {
|
||||
"frontend": expected,
|
||||
@@ -572,6 +579,38 @@ def profile_attempt(source, profile):
|
||||
"serialization-evidence/sources.json",
|
||||
]
|
||||
base = {"profile": profile, "assumptions": assumptions}
|
||||
if profile in SETGET_PROFILES:
|
||||
assumptions["setget_reference"] = {
|
||||
"commit": SETGET_COMMIT,
|
||||
"missing_version": "explicit_fixed_reference_assumption_only",
|
||||
"provider_policy": "exact_aux_id_required; missing/literal/conflict_rejected",
|
||||
"scope": "root_only; nested_and_cross_boundary_rejected",
|
||||
"name": "widgets_values/0 exact string; no normalization or previousName lookup",
|
||||
"duplicates": "reject_all; frontend_first_match_is_not_emulated",
|
||||
"unmodified_pinned_extensions": True,
|
||||
"target_installation_and_UE_match": "unknown",
|
||||
}
|
||||
assumptions["reference_sources"] = [
|
||||
"setget-reference/sources.json",
|
||||
"vhs-reference/sources.json",
|
||||
"serialization-evidence/sources.json",
|
||||
]
|
||||
base["verified_reference_facts"] = "setget-reference/contract.json"
|
||||
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", []))
|
||||
]
|
||||
if not any(n.get("type") in ("SetNode", "GetNode") for n in source.get("nodes", [])):
|
||||
return {
|
||||
**base,
|
||||
"status": "not_applicable",
|
||||
"issues": [
|
||||
{"code": "setget_not_present", "message": "新profile仅覆盖包含Set/Get的根图"}
|
||||
],
|
||||
}
|
||||
if profile in (*CROP_SPLIT_PROFILES, *VHS_PROFILES):
|
||||
base["source_declarations"] = [
|
||||
{
|
||||
@@ -594,21 +633,29 @@ def profile_attempt(source, profile):
|
||||
else "requires_explicit_1.48.6"
|
||||
)
|
||||
assumptions["missing_frontend_policy"] = (
|
||||
"explicit_media_reference_assumption"
|
||||
"explicit_1.37.11_reference_assumption"
|
||||
if profile in SETGET_PROFILES
|
||||
else "explicit_media_reference_assumption"
|
||||
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":
|
||||
if profile in (*VHS_PROFILES, *SETGET_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)
|
||||
for n in node_inventory(
|
||||
source, include_aux=profile in (*CROP_SPLIT_PROFILES, *SETGET_PROFILES)
|
||||
)
|
||||
if n["type"] not in ("Note", "MarkdownNote", "Reroute", "PrimitiveNode")
|
||||
and (n["provider"] is None or n["version"] is None)
|
||||
]
|
||||
if (profile in VHS_PROFILES and expected == "1.48.6" and declared_frontend is None) or (
|
||||
if (
|
||||
profile in (*VHS_PROFILES, *SETGET_PROFILES)
|
||||
and expected == "1.48.6"
|
||||
and declared_frontend is None
|
||||
) or (
|
||||
declared_frontend != expected
|
||||
and not (
|
||||
declared_frontend is None
|
||||
@@ -621,6 +668,7 @@ def profile_attempt(source, profile):
|
||||
SEPARATION_PROFILE,
|
||||
*CROP_SPLIT_PROFILES,
|
||||
*VHS_PROFILES,
|
||||
*SETGET_PROFILES,
|
||||
)
|
||||
)
|
||||
):
|
||||
@@ -644,6 +692,11 @@ def profile_attempt(source, profile):
|
||||
else "serializer_or_structure_rejected",
|
||||
"issues": result.issues,
|
||||
"unresolved_boundaries": result.unresolved_boundaries,
|
||||
**(
|
||||
{"virtual_resolutions": result.virtual_resolutions}
|
||||
if profile in SETGET_PROFILES
|
||||
else {}
|
||||
),
|
||||
}
|
||||
# Legacy core serializers explicitly assume absent declarations. Record
|
||||
# that assumption instead of implying that a type-name match proved it.
|
||||
@@ -655,6 +708,11 @@ def profile_attempt(source, profile):
|
||||
or "restored_saved_state_before_queue_hooks",
|
||||
"candidate_sha256": canonical_sha(result.prompt),
|
||||
"candidate_prompt": result.prompt,
|
||||
**(
|
||||
{"virtual_resolutions": result.virtual_resolutions}
|
||||
if profile in SETGET_PROFILES
|
||||
else {}
|
||||
),
|
||||
**(
|
||||
{"field_evidence": asr_field_evidence(source, result.prompt)}
|
||||
if profile == ASR_PROFILE
|
||||
@@ -740,7 +798,7 @@ def audit_library(repo: Path, profiles=REFERENCE_PROFILES, *, baseline_profiles=
|
||||
for issue in attempt["issues"]:
|
||||
gap_inventory = (
|
||||
node_inventory(source, include_aux=True)
|
||||
if attempt["profile"] in CROP_SPLIT_PROFILES
|
||||
if attempt["profile"] in (*CROP_SPLIT_PROFILES, *SETGET_PROFILES)
|
||||
else inventory
|
||||
)
|
||||
matches = [n for n in gap_inventory if n["node_id"] == issue.get("node_id")]
|
||||
@@ -766,7 +824,11 @@ def audit_library(repo: Path, profiles=REFERENCE_PROFILES, *, baseline_profiles=
|
||||
}
|
||||
if baseline_profiles is None:
|
||||
excluded_profiles = (
|
||||
VHS_PROFILES if any(p in VHS_PROFILES for p in profiles) else CROP_SPLIT_PROFILES
|
||||
SETGET_PROFILES
|
||||
if any(p in SETGET_PROFILES for p in profiles)
|
||||
else 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 = {
|
||||
|
||||
Reference in New Issue
Block a user