fix: a failing target_rows provider is said, once; separate once-keys for the two modifier nodes; spam-guard test (attacker round 20)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
99568ba9ae
commit
618b5ba1c1
+4
-1
@@ -248,7 +248,10 @@ def target_rows(mod_segments, seq_len, device, stream):
|
||||
for _spec, provider in registry.current().providers("target_rows"):
|
||||
try:
|
||||
mask = provider(mod_segments, seq_len, device, stream)
|
||||
except Exception: # noqa: BLE001
|
||||
except Exception as exc: # noqa: BLE001
|
||||
from . import log
|
||||
log.once(f"provider:target_rows:{_spec.id}:{type(exc).__name__}", log.WARNING, f"target_rows provider {_spec.id}",
|
||||
f"failed while answering -- {type(exc).__name__}: {exc}") # skipped, but the callers' "could not find the rows" now has a cause
|
||||
continue
|
||||
if mask is not None:
|
||||
return mask
|
||||
|
||||
@@ -274,3 +274,19 @@ def test_a_provider_that_fails_in_a_new_way_is_said_again():
|
||||
reg.ask("cap"); reg.ask("cap")
|
||||
said = [r["message"] for r in log.history() if "failed while answering" in r["message"]]
|
||||
assert len(said) == 2 and "ValueError" in said[0] and "MemoryError" in said[1]
|
||||
|
||||
|
||||
def test_the_same_kind_of_failure_with_new_text_every_call_is_said_once():
|
||||
"""The spam guard: a provider asked on every sampling step must not fill the log."""
|
||||
from core import log
|
||||
from core.schema import validate
|
||||
log._reset()
|
||||
n = iter(range(100))
|
||||
|
||||
def noisy():
|
||||
raise ValueError(f"row {next(n)}")
|
||||
reg = registry_mod.Registry()
|
||||
reg.add(validate({"id": "noisy", "title": "N", "mount": "m", "provides": {"cap": noisy}}, source="a"))
|
||||
for _ in range(30):
|
||||
reg.ask("cap")
|
||||
assert len([r for r in log.history() if "failed while answering" in r["message"]]) == 1
|
||||
|
||||
@@ -276,7 +276,7 @@ class FunPackLoadModifiers(io.ComfyNode):
|
||||
known = registry_mod.current().specs
|
||||
for module_id in (settings or {}):
|
||||
if module_id not in known and module_id not in control_mod.RESERVED:
|
||||
log.once(f"stale_module:{module_id}", log.WARNING, "FunPack Load Modifiers",
|
||||
log.once(f"stale_module_load:{module_id}", log.WARNING, "FunPack Load Modifiers",
|
||||
f"saved settings for {module_id!r} ignored: no module with that id is loaded")
|
||||
for spec in ordered:
|
||||
values, said = schema_mod.check_values(
|
||||
|
||||
Reference in New Issue
Block a user