HEL-892: pin core0.33 first-group saved-state contracts and fail-closed diagnostics

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
leefer
2026-10-30 07:19:30 +08:00
co-authored by multica-agent
parent 8e832b8e0e
commit af7a094aa3
31 changed files with 14579 additions and 19 deletions
@@ -21,6 +21,7 @@ except ModuleNotFoundError:
from calliope.comfyui.companions import load_companions
from calliope.comfyui.delivery_scope import exclusion_for
from calliope.comfyui.h3_core_reference import CORE_PROFILE
from calliope.comfyui.serialization_reference import (
ASR_PROFILE,
AUX_PROFILE,
@@ -307,6 +308,7 @@ REFERENCE_PROFILES = (
*SCAIL_LOAD_PROFILES,
GRID_PROFILE,
H3_PROFILE,
CORE_PROFILE,
)
@@ -601,6 +603,89 @@ def h3_field_evidence(source, prompt):
return fields
def core_field_evidence(source):
"""Node diagnostics only, including rejected layouts; never a partial prompt."""
from calliope.comfyui.h3_core_reference import LAYOUTS, saved_values, serialize_node
evidence = []
links = {
e[0]: (i, e)
for i, e in enumerate(source.get("links", []))
if isinstance(e, list) and len(e) == 6
}
for i, node in enumerate(source.get("nodes", [])):
ct = node.get("type")
if ct not in LAYOUTS:
continue
fields, reasons = [], []
try:
saved = saved_values(node)
except (ValueError, TypeError, KeyError, AttributeError) as exc:
saved = {}
reasons.append(str(exc))
for name, value in saved.items():
wi = LAYOUTS[ct].index(name)
fields.append(
{
"field": name,
"value": value,
"json_type": type(value).__name__,
"source_value_pointer": f"/nodes/{i}/widgets_values/{wi}",
"named_pointer": f"/nodes/{i}/widgets_values_named/{name}"
if name in (node.get("widgets_values_named") or {})
else None,
}
)
try:
serialize_node(node)
layout_accepted = True
except (ValueError, TypeError, KeyError, AttributeError) as exc:
layout_accepted = False
if str(exc) not in reasons:
reasons.append(str(exc))
physical = []
for si, socket in enumerate(node.get("inputs", [])):
entry = links.get(socket.get("link"))
if entry:
li, edge = entry
physical.append(
{
"input": socket.get("name"),
"socket_pointer": f"/nodes/{i}/inputs/{si}",
"link_pointer": f"/links/{li}",
"endpoint": [str(edge[1]), edge[2]],
"declared_type": edge[5],
"source_endpoint_only": True,
"upstream_type_in_public_profile": any(
n.get("id") == edge[1] and n.get("type") in LAYOUTS
for n in source.get("nodes", [])
),
}
)
evidence.append(
{
"node_id": str(node.get("id")),
"type": ct,
"pointer": f"/nodes/{i}",
"layout_accepted": layout_accepted,
"saved_fields": fields,
"physical_input_evidence": physical,
"reasons": reasons,
"outputs_pointer": f"/nodes/{i}/outputs",
"outputs": node.get("outputs", []),
"workflow_only_control": {
"pointer": f"/nodes/{i}/widgets_values/1",
"value": "fixed",
}
if ct == "RandomNoise" and saved
else None,
"contract_manifest": "h3-core-reference/sources.json",
"not_a_submittable_node_or_partial_prompt": True,
}
)
return evidence
def profile_attempt(source, profile):
expected = {
**STRUCTURE_PROFILES,
@@ -608,6 +693,7 @@ def profile_attempt(source, profile):
CASE04_PROFILE: "1.53.6",
GRID_PROFILE: "1.41.20",
H3_PROFILE: "1.53.10",
CORE_PROFILE: "1.53.10",
**VHS_PROFILES,
**SETGET_PROFILES,
**VIDEOINFO_PROFILES,
@@ -788,6 +874,23 @@ def profile_attempt(source, profile):
if profile in VHS_PROFILES
else "crop-split-reference/verified-facts.json"
)
if profile == CORE_PROFILE:
assumptions.update(
{
"reference_sources": [
"h3-core-reference/sources.json",
"h3-reference/sources.json",
],
"core_version": "0.33.0",
"core_commit": "2f35f4a08176d993cded35dac3332be4f7287f41",
"source_core_provider_version": "unknown_unless_explicitly_declared",
"reference_provider": "comfy-core",
"restoration_policy": "positional_when_named_absent_else_exact_typed_agreement",
"expressions": "opaque_strings_never_evaluated",
"primitive_float_bound": "conservative_32_64_bit_sys_maxsize_intersection",
"random_seed_bound": "core_uint64_intersect_JS_safe_integer",
}
)
if profile == H3_PROFILE:
assumptions["h3_contract"] = "h3-reference/sources.json"
assumptions["reference_sources"] = ["h3-reference/sources.json"]
@@ -821,6 +924,8 @@ def profile_attempt(source, profile):
and expected == "1.48.6"
):
assumptions["missing_frontend_policy"] = "requires_explicit_1.48.6"
if profile == CORE_PROFILE:
assumptions["missing_frontend_policy"] = "explicit_1.53.10_reference_assumption"
assumptions["missing_node_declarations"] = [
n["pointer"]
for n in node_inventory(
@@ -844,6 +949,7 @@ def profile_attempt(source, profile):
PROFILE,
AUX_PROFILE,
PRIMITIVE_PROFILE,
CORE_PROFILE,
*MEDIA_PROFILES,
SEPARATION_PROFILE,
*CROP_SPLIT_PROFILES,
@@ -874,6 +980,11 @@ def profile_attempt(source, profile):
else "serializer_or_structure_rejected",
"issues": result.issues,
"unresolved_boundaries": result.unresolved_boundaries,
**(
{"supported_node_evidence": core_field_evidence(source)}
if profile == CORE_PROFILE
else {}
),
**(
{"virtual_resolutions": result.virtual_resolutions}
if profile in (*SETGET_PROFILES, *VIDEOINFO_PROFILES, *SCAIL_LOAD_PROFILES)
@@ -890,6 +1001,11 @@ def profile_attempt(source, profile):
or "restored_saved_state_before_queue_hooks",
"candidate_sha256": canonical_sha(result.prompt),
"candidate_prompt": result.prompt,
**(
{"supported_node_evidence": core_field_evidence(source)}
if profile == CORE_PROFILE
else {}
),
**(
{"virtual_resolutions": result.virtual_resolutions}
if profile in (*SETGET_PROFILES, *VIDEOINFO_PROFILES, *SCAIL_LOAD_PROFILES)
@@ -1016,7 +1132,9 @@ def audit_library(repo: Path, profiles=REFERENCE_PROFILES, *, baseline_profiles=
}
if baseline_profiles is None:
excluded_profiles = (
(H3_PROFILE,)
(CORE_PROFILE,)
if CORE_PROFILE in profiles
else (H3_PROFILE,)
if H3_PROFILE in profiles
else (GRID_PROFILE,)
if GRID_PROFILE in profiles