Files
kunail0804-ComfyUI-Scene-Co…/tests/test_node_none_guards.py
T
5e146d5a55 feat!: v1.1 — Resolver emits a flat prompt, drop categories (#85)
* feat!: collapse pipeline — Resolver emits a flat prompt, drop categories (v1.1)

BREAKING CHANGE: the Category Splitter and Prompt Builder stages and nodes are
removed. The Resolver is now the translator from Scene JSON to prompt: it resolves
concepts to Knowledge Base tags and joins them into one flat comma-separated
prompt string, in resolution order (which naturally leads with character concepts).

Resolver node outputs are now (prompt, warnings, errors, json) — the json being
the traceable resolved tags so a translation problem is inspectable. Node count
drops from 8 to 6. The CategoryMap/PromptOutput models and their schemas are
removed; the `category` field remains on entries and resolved tags for
traceability only. Debug Viewer simplified to scene/warnings/errors.

Goldens, example scenes/workflow, integration/performance/repo-layout/release
tests, benchmark script, and the docs (README + wiki) are updated to the flat
prompt. Version bumped to 1.1.0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* build: drop removed splitter/builder packages from pyproject

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: kunail0804 <kunail0804@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-11 00:00:48 +02:00

30 lines
990 B
Python

"""Regression: nodes must not crash when an upstream stage produced no output.
A failed upstream node passes ``None`` down its data output; downstream nodes must
surface an error instead of raising AttributeError (found in ComfyUI: a failed
Scene Analyzer crashed the Scene Validator on ``None.to_json()``).
"""
from __future__ import annotations
from nodes.resolver_node import ResolverNode
from nodes.scene_validator_node import SceneValidatorNode
def test_validator_handles_none_scene() -> None:
scene, warnings, errors, *_ = SceneValidatorNode().run(None)
assert scene is None
assert "no output" in errors.lower()
def test_resolver_handles_none_scene() -> None:
prompt, _, errors, *_ = ResolverNode().run(None, knowledge_base=object())
assert prompt == ""
assert errors
def test_resolver_handles_none_knowledge_base() -> None:
prompt, _, errors, *_ = ResolverNode().run(scene=object(), knowledge_base=None)
assert prompt == ""
assert errors