Archive fork in favor of upstream and DUMAS nodes
tests / test (push) Canceled after 0s
tests / windows-storage (push) Canceled after 0s

This commit is contained in:
2026-10-20 10:46:16 +00:00
parent 881dcbcfba
commit 3716b02a57
76 changed files with 12140 additions and 4410 deletions
+102 -2
View File
@@ -13,6 +13,7 @@ import pytest
from ComfyUI_H3_Continuum_Join.v3.driving_nodes import (
H3ContinuumSamplerV37,
H3ContinuumSamplerV38,
H3ContinuumSamplerV39,
)
from ComfyUI_H3_Continuum_Join.v3.easy_nodes import H3ContinuumEasyV38
from ComfyUI_H3_Continuum_Join.v3.review_control import (
@@ -28,7 +29,7 @@ ROOT = Path(__file__).resolve().parents[1]
DEFAULT_COMFY_ROOT = Path(
os.environ.get(
"H3_CONTINUUM_COMFY_ROOT",
r"D:\StabilityMatrix\Data\Packages\ComfyUI_W",
str(ROOT.parent / "ComfyUI"),
)
)
@@ -71,6 +72,25 @@ def test_v38_full_run_keeps_stable_core_cache_behavior(review_action):
) is False
@pytest.mark.parametrize("node_class", [H3ContinuumSamplerV38, H3ContinuumSamplerV39])
@pytest.mark.parametrize("boundary,nonce,storage,changed", [
("Chunk 1", 0, "Save + Auto Resume", True),
("Chunk 2", 0, "Save + Auto Resume", True),
(2, 0, "Save + Auto Resume", True),
("Chunk 2", 5, "Save + Auto Resume", False),
("Auto", 0, "Save + Auto Resume", False),
(0, 0, "Save + Auto Resume", False),
("Chunk 2", 0, "Off", False),
])
def test_full_run_automatic_reroll_reaches_storage(node_class, boundary, nonce, storage, changed):
value = node_class.IS_CHANGED(generation_mode=GENERATION_MODE_FULL_RUN,
run_storage=storage, reroll_from_chunk=boundary, reroll_nonce=nonce, chunks=3)
if changed:
assert math.isnan(value)
else:
assert value is False
def test_v37_and_easy_do_not_inherit_the_v38_cache_contract():
assert "IS_CHANGED" not in H3ContinuumSamplerV37.__dict__
assert "IS_CHANGED" not in H3ContinuumEasyV38.__dict__
@@ -78,6 +98,37 @@ def test_v37_and_easy_do_not_inherit_the_v38_cache_contract():
assert not hasattr(H3ContinuumEasyV38, "IS_CHANGED")
@pytest.mark.parametrize("node_class", [H3ContinuumSamplerV38, H3ContinuumSamplerV39])
@pytest.mark.parametrize("changes,changed", [
({"chunks": None}, True),
({"chunks": 1}, True),
({"chunks": "not resolved"}, True),
({"reroll_nonce": None}, True),
({"run_storage": None}, True),
({"reroll_from_chunk": None}, True),
({"generation_mode": None}, True),
({"chunks": None, "reroll_nonce": None, "run_storage": None}, True),
({"chunks": None, "reroll_nonce": 5}, False),
({"run_storage": None, "reroll_nonce": 5}, False),
({"reroll_from_chunk": None, "reroll_nonce": 5}, False),
({"reroll_from_chunk": "Auto", "reroll_nonce": None}, False),
({"reroll_from_chunk": "Auto", "run_storage": None}, False),
({"run_storage": "Off", "reroll_nonce": None}, False),
({"run_storage": "Off", "reroll_from_chunk": None}, False),
({"run_storage": "invalid"}, False),
({"reroll_nonce": "invalid"}, False),
({"reroll_from_chunk": "invalid"}, False),
({"reroll_from_chunk": "Chunk 17"}, False),
({"generation_mode": GENERATION_MODE_REVIEW, "run_storage": "Off"}, True),
])
def test_cache_intent_handles_unresolved_inputs_without_validating_chunk_range(node_class, changes, changed):
inputs = dict(generation_mode=GENERATION_MODE_FULL_RUN, run_storage="Save + Auto Resume",
reroll_from_chunk="Chunk 2", reroll_nonce=0, chunks=3)
inputs.update(changes)
value = node_class.IS_CHANGED(**inputs)
assert math.isnan(value) if changed else value is False
def test_real_comfy_cache_signature_is_stable_only_for_full_run(tmp_path):
comfy_root = DEFAULT_COMFY_ROOT
if not (comfy_root / "execution.py").is_file():
@@ -130,7 +181,7 @@ def test_real_comfy_cache_signature_is_stable_only_for_full_run(tmp_path):
comfy_kitchen.int8_attention_is_available = lambda *a, **k: False
import nodes as comfy_nodes
from comfy_execution.caching import CacheKeySetInputSignature
from comfy_execution.caching import BasicCache, CacheKeySetInputSignature
from comfy_execution.graph import DynamicPrompt
from execution import IsChangedCache
@@ -187,7 +238,49 @@ def test_real_comfy_cache_signature_is_stable_only_for_full_run(tmp_path):
review_finish_2 = await signature(
"Review Each Chunk", "Finish Remaining"
)
cache_results = {{}}
for node_name in ["H3ContinuumSamplerV38", "H3ContinuumSamplerV39"]:
comfy_nodes.NODE_CLASS_MAPPINGS[class_type] = package.NODE_CLASS_MAPPINGS[node_name]
observed_counts = {{}}
for label, boundary, nonce, linked in [
("ordinary", "Auto", 0, None),
("automatic", "Chunk 2", 0, None),
("fixed", "Chunk 2", 5, None),
("linked_chunks", "Chunk 2", 0, "chunks"),
("linked_nonce", "Chunk 2", 0, "reroll_nonce"),
("linked_storage", "Chunk 2", 0, "run_storage"),
("linked_boundary", "Chunk 2", 0, "reroll_from_chunk"),
("linked_mode", "Chunk 2", 5, "generation_mode"),
("fixed_linked_chunks", "Chunk 2", 5, "chunks"),
("ordinary_linked_nonce", "Auto", 0, "reroll_nonce"),
("fixed_linked_nonce", "Chunk 2", 5, "reroll_nonce"),
]:
cache = BasicCache(CacheKeySetInputSignature)
executions = 0
for queue in range(2):
prompt = {{"305": {{"class_type": class_type, "inputs": {{
"generation_mode": "Full Run", "review_action": "Continue / Next",
"run_storage": "Save + Auto Resume", "reroll_from_chunk": boundary,
"reroll_nonce": nonce, "chunks": 3}}}}}}
if linked:
class ScalarProbe:
@classmethod
def INPUT_TYPES(cls):
return {{"required": {{"value": ("*",)}}}}
comfy_nodes.NODE_CLASS_MAPPINGS["H3CacheScalarProbe"] = ScalarProbe
value = prompt["305"]["inputs"][linked]
prompt["900"] = {{"class_type": "H3CacheScalarProbe", "inputs": {{"value": value}}}}
prompt["305"]["inputs"][linked] = ["900", 0]
dynprompt = DynamicPrompt(prompt)
await cache.set_prompt(dynprompt, ["305"], IsChangedCache(str(queue), dynprompt, None))
if cache.get_local("305") is None:
executions += 1
cache.set_local("305", ("CPU fixture output",))
observed_counts[label] = executions
cache_results[node_name] = observed_counts
print(json.dumps({{
"cache_executions": cache_results,
"full_stable": full_1 == full_2,
"review_continue_changed": review_continue_1 != review_continue_2,
"review_regenerate_changed": review_regen_1 != review_regen_2,
@@ -210,6 +303,13 @@ def test_real_comfy_cache_signature_is_stable_only_for_full_run(tmp_path):
)
observed = json.loads(result.stdout.strip().splitlines()[-1])
assert observed == {
"cache_executions": {
name: {"ordinary": 1, "automatic": 2, "fixed": 1,
"linked_chunks": 2, "linked_nonce": 2, "linked_storage": 2,
"linked_boundary": 2, "linked_mode": 2, "fixed_linked_chunks": 1,
"ordinary_linked_nonce": 1, "fixed_linked_nonce": 2}
for name in ("H3ContinuumSamplerV38", "H3ContinuumSamplerV39")
},
"full_stable": True,
"review_continue_changed": True,
"review_regenerate_changed": True,