The docs had drifted badly: docs/nodes.md still documented the Category Splitter and Prompt Builder (removed in V1.1) and the Knowledge Base Loader (removed in V2.1), gave the Resolver the wrong outputs, and the consistency test actively pinned the retired RESOLVED_TAGS/CATEGORY_MAP types. - README: rewritten around the V2 philosophy shift — 'know more, ask less'. Documents the automatic Knowledge Base growth, the opt-in KB-bounded semantic fallback and the fidelity work (know more), and the configuration centralization, node consolidation (eight nodes -> five) and hidden non-user-facing options (ask less), plus what did not change: determinism. Corrects the tagline (flat prompt, not category-separated) and the node tables. - docs/nodes.md: rewritten for the five shipped nodes with their real inputs and outputs, plus a full Configuration input reference and the settings that are deliberately not exposed. - docs/definition_of_done.md: V1 record marked complete; evidence re-pointed at the code as it stands (no compiler/splitter, compiler/builder). - docs/README.md: MASTER_SPEC reframed as the original design spec (code wins); index the in-repo docs. - examples/README.md: pipeline diagram redrawn for the current graph. - tests/test_docs_consistency.py: stop requiring the retired inter-stage types and add a guard so removed nodes cannot reappear in the reference. Co-authored-by: kunail0804 <kunail0804@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
55 lines
1.9 KiB
Python
55 lines
1.9 KiB
Python
"""Guards that the docs describe the actual shipped nodes (issue #31).
|
|
|
|
Catches stale or missing node references so documentation cannot drift from the
|
|
registered ComfyUI nodes.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
import nodes
|
|
|
|
REPO_ROOT = Path(__file__).resolve().parent.parent
|
|
NODE_DISPLAY_NAMES = sorted(nodes.NODE_DISPLAY_NAME_MAPPINGS.values())
|
|
|
|
DOCS_LISTING_NODES = [
|
|
REPO_ROOT / "README.md",
|
|
REPO_ROOT / "docs" / "nodes.md",
|
|
]
|
|
|
|
|
|
@pytest.mark.parametrize("doc", DOCS_LISTING_NODES, ids=lambda p: p.name)
|
|
def test_docs_mention_every_node(doc: Path) -> None:
|
|
text = doc.read_text(encoding="utf-8")
|
|
missing = [name for name in NODE_DISPLAY_NAMES if name not in text]
|
|
assert not missing, f"{doc.name} is missing node references: {missing}"
|
|
|
|
|
|
def test_node_reference_covers_inter_stage_types() -> None:
|
|
# The live inter-stage types. RESOLVED_TAGS and CATEGORY_MAP were retired with
|
|
# the Category Splitter and Prompt Builder in V1.1, so the reference must not be
|
|
# required to mention them.
|
|
text = (REPO_ROOT / "docs" / "nodes.md").read_text(encoding="utf-8")
|
|
for type_name in ("SCENE", "KNOWLEDGE_BASE", "COMPILER_CONFIG"):
|
|
assert type_name in text
|
|
|
|
|
|
def test_node_reference_does_not_resurrect_removed_nodes() -> None:
|
|
"""Guard the reference against listing nodes that no longer ship.
|
|
|
|
Matches table rows only, so prose explaining that a node was removed is fine.
|
|
"""
|
|
text = (REPO_ROOT / "docs" / "nodes.md").read_text(encoding="utf-8")
|
|
for removed in ("Knowledge Base Loader", "Category Splitter", "Prompt Builder"):
|
|
row = f"| **{removed}**"
|
|
assert row not in text, f"docs/nodes.md still lists the removed {removed!r} node"
|
|
|
|
|
|
def test_contributing_links_the_knowledge_base_guide() -> None:
|
|
text = (REPO_ROOT / "CONTRIBUTING.md").read_text(encoding="utf-8")
|
|
assert "knowledge_base/README.md" in text
|
|
assert "validate_knowledge_base.py" in text
|