* chore: initialise BEACON framework with all bootstrap artefacts - Problem statement, constitution, architecture doc, roadmap populated - CHANGELOG.md created (Keep a Changelog); README expanded with What-is-this, Install, and Quickstart sections - pyproject.toml gains [project.urls] (repository + documentation) - beacon doctor: 32 pass, 2 pre-commit warns, 0 failures Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: Phase 1 — add NullHandler to package root, remove hardcoded setLevel T001: logging.getLogger("comfydv").addHandler(NullHandler()) in __init__.py T002: remove logger.setLevel(logging.DEBUG) from format_string.py Also fix pyproject.toml TOML structure (project.urls was inside [project] block) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * test: failing tests for logging modernisation (T010-T through T030-T) RED phase — 5 tests fail for the correct reasons before implementation: T010-T: format_string produces stdout (print block) T011-T: update_widget emits INFO records on hot path T012-T: random_choice produces stdout (colorama/rich prints) T020-T: load_node_state uses print() on error instead of logger.error T021-T: circuit_breaker uses print() instead of logger T001/T002/T030-T already green: NullHandler registered, setLevel removed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat: standardise logging across all nodes (T010-I through T044) GREEN phase — all 11 logging tests pass: T010-I: Remove 8-line diagnostic print block from format_string() T011-I: Downgrade all hot-path logger.info() calls to logger.debug(); switch all logger calls to %-style formatting; remove rich import T012-I: Replace colorama/termcolor/rich print calls in random_choice with logger.debug(); add logger = logging.getLogger(__name__) T020-I: Convert print() on load_node_state error to logger.error() T021-I: Add logger to circuit_breaker; replace print() with logger.debug(); fix logic so status=False triggers the interrupt (per BDD spec) T040: Remove colorama, rich, termcolor from pyproject.toml dependencies T042: ruff check + format clean T044: beacon doctor --strict passes (34/34) Also adds ADR-001 and ADR-002 capturing the stdlib logging and NullHandler decisions, linked from the logging-modernisation epic. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: mark all 001-standardise-logging tasks complete in tasks.md All [x] checkboxes flipped after 11/11 tests pass and beacon doctor --strict reports 0 failures. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: mark logging-modernisation epic success criteria complete All success criteria verified: NullHandler added, setLevel removed, print() calls converted, colorama/rich/termcolor removed from deps, zero stdout in normal operation, errors surface at ERROR level, all tests pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: commit spec artefacts and dependency lock for 001-standardise-logging Includes spec.md, plan.md, research.md, BDD feature files, contracts, .beacon.toml backlink, and uv.lock after removing colorama/rich/termcolor. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: James Veitch <darthveitcher@office-mac-mini.local> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2.5 KiB
comfydv Constitution
Core Principles
I. ComfyUI Contract First
Every node must expose INPUT_TYPES, RETURN_TYPES, RETURN_NAMES, FUNCTION, and CATEGORY to comply with ComfyUI's node registration contract. NODE_CLASS_MAPPINGS and NODE_DISPLAY_NAME_MAPPINGS in the package __init__.py are the only install-time interface — nothing else. Do not require changes to ComfyUI itself.
II. Sandbox All User-Supplied Code
Any template or expression evaluated at runtime from user input must run inside Jinja2's SandboxedEnvironment or equivalent. Plain eval() or exec() on user strings is forbidden. The additional_context dict is the only way to expose utilities to templates.
III. Test-First (NON-NEGOTIABLE)
Write the test before writing the implementation. Tests must pass without a live ComfyUI instance — all comfy.* and server.* imports are runtime-guarded (if "comfy" in sys.modules). The test suite runs via uv run pytest. Red → Green → Refactor; do not commit red tests.
IV. Graceful Degradation Outside ComfyUI
Modules imported outside ComfyUI (e.g., in tests or CI) must log a warning and continue loading rather than raising an ImportError. The node's core logic (template parsing, key extraction, formatting) must be independently testable without any ComfyUI dependency.
V. Simplicity — Function Before Class
Prefer module-level functions over class methods where there is no shared state. Prefer a single script over a service. Use classes only when ComfyUI's node registration pattern requires them. No premature abstractions; three similar lines beat a helper no one asked for.
VI. Fixed Output Positions
Primary outputs (formatted_string, saved_file_path) must always occupy positions 0 and 1 in RETURN_TYPES/RETURN_NAMES. Variable pass-through outputs follow at positions 2+. This contract, once established for a node, is immutable — changing it breaks existing workflows silently.
Quality Gates
Before any bullet is considered done:
uv run ruff check --fix && uv run ruff format
uv run ty check
uv run pytest
beacon doctor --strict
All four must be green. No exceptions.
Governance
This constitution supersedes style preferences and any CLAUDE.md defaults where they conflict. Amendments require an ADR entry in project-management/ADRs/ with a rationale and migration note. All PRs are checked against this constitution before merge.
Version: 1.0.0 | Ratified: 2026-06-28 | Last Amended: 2026-06-28