* 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>
68 lines
1.9 KiB
Python
68 lines
1.9 KiB
Python
"""Tests for the Debug Viewer ComfyUI node (issue #24)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
|
|
import nodes
|
|
from nodes.debug_viewer_node import DebugViewerNode
|
|
from schemas.models import Scene
|
|
|
|
|
|
def sample_scene() -> Scene:
|
|
return Scene.from_json(
|
|
{
|
|
"characters": [],
|
|
"interactions": [],
|
|
"objects": ["chair"],
|
|
"environment": [],
|
|
"camera": [],
|
|
"lighting": [],
|
|
"metadata": {"schema_version": "1.0"},
|
|
}
|
|
)
|
|
|
|
|
|
def test_node_metadata() -> None:
|
|
assert DebugViewerNode.RETURN_NAMES == ("report",)
|
|
assert DebugViewerNode.OUTPUT_NODE is True
|
|
optional = DebugViewerNode.INPUT_TYPES()["optional"]
|
|
assert set(optional) == {"scene", "warnings", "errors"}
|
|
|
|
|
|
def test_empty_report_when_nothing_connected() -> None:
|
|
(report,) = DebugViewerNode().run()
|
|
assert report == ""
|
|
|
|
|
|
def test_renders_each_state() -> None:
|
|
scene = sample_scene()
|
|
(report,) = DebugViewerNode().run(
|
|
scene=scene,
|
|
warnings="SC0001: unknown",
|
|
errors="",
|
|
)
|
|
assert "== Scene JSON ==" in report
|
|
assert "== Warnings ==" in report
|
|
assert "== Errors ==" not in report # empty errors omitted
|
|
assert "chair" in report
|
|
|
|
|
|
def test_report_is_valid_serialization() -> None:
|
|
scene = sample_scene()
|
|
(report,) = DebugViewerNode().run(scene=scene)
|
|
payload = report.split("== Scene JSON ==\n", 1)[1]
|
|
assert json.loads(payload)["objects"] == ["chair"]
|
|
|
|
|
|
def test_is_read_only() -> None:
|
|
scene = sample_scene()
|
|
before = scene.to_json()
|
|
DebugViewerNode().run(scene=scene)
|
|
assert scene.to_json() == before # unchanged
|
|
|
|
|
|
def test_registered_for_comfyui() -> None:
|
|
assert nodes.NODE_CLASS_MAPPINGS["SceneCompilerDebugViewer"] is DebugViewerNode
|
|
assert nodes.NODE_DISPLAY_NAME_MAPPINGS["SceneCompilerDebugViewer"] == "Debug Viewer"
|