mirror of
https://git.datalinker.icu/ltdrdata/ComfyUI-Manager
synced 2025-12-10 06:34:24 +08:00
Remove package-level caching in cnr_utils and node_package modules to enable proper dynamic custom node installation and version switching without ComfyUI server restarts. Key Changes: - Remove @lru_cache decorators from version-sensitive functions - Remove cached_property from NodePackage for dynamic state updates - Add comprehensive test suite with parallel execution support - Implement version switching tests (CNR ↔ Nightly) - Add case sensitivity integration tests - Improve error handling and logging API Priority Rules (manager_core.py:1801): - Enabled-Priority: Show only enabled version when both exist - CNR-Priority: Show only CNR when both CNR and Nightly are disabled - Prevents duplicate package entries in /v2/customnode/installed API - Cross-match using cnr_id and aux_id for CNR ↔ Nightly detection Test Infrastructure: - 8 test files with 59 comprehensive test cases - Parallel test execution across 5 isolated environments - Automated test scripts with environment setup - Configurable timeout (60 minutes default) - Support for both master and dr-support-pip-cm branches Bug Fixes: - Fix COMFYUI_CUSTOM_NODES_PATH environment variable export - Resolve test fixture regression with module-level variables - Fix import timing issues in test configuration - Register pytest integration marker to eliminate warnings - Fix POSIX compliance in shell scripts (((var++)) → $((var + 1))) Documentation: - CNR_VERSION_MANAGEMENT_DESIGN.md v1.0 → v1.1 with API priority rules - Add test guides and execution documentation (TESTING_PROMPT.md) - Add security-enhanced installation guide - Create CLI migration guides and references - Document package version management 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Data Models
This directory contains Pydantic models for ComfyUI Manager, providing type safety, validation, and serialization for the API and internal data structures.
Overview
generated_models.py- All models auto-generated from OpenAPI spec__init__.py- Package exports for all models
Note: All models are now auto-generated from the OpenAPI specification. Manual model files (task_queue.py, state_management.py) have been deprecated in favor of a single source of truth.
Generating Types from OpenAPI
The state management models are automatically generated from the OpenAPI specification using datamodel-codegen. This ensures type safety and consistency between the API specification and the Python code.
Prerequisites
Install the code generator:
pipx install datamodel-code-generator
Generation Command
To regenerate all models after updating the OpenAPI spec:
datamodel-codegen \
--use-subclass-enum \
--field-constraints \
--strict-types bytes \
--use-double-quotes \
--input openapi.yaml \
--output comfyui_manager/data_models/generated_models.py \
--output-model-type pydantic_v2.BaseModel
When to Regenerate
You should regenerate the models when:
- Adding new API endpoints that return new data structures
- Modifying existing schemas in the OpenAPI specification
- Adding new state management features that require new models
Important Notes
- Single source of truth: All models are now generated from
openapi.yaml - No manual models: All previously manual models have been migrated to the OpenAPI spec
- OpenAPI requirements: New schemas must be referenced in API paths to be generated by datamodel-codegen
- Validation: Always validate the OpenAPI spec before generation:
python3 -c "import yaml; yaml.safe_load(open('openapi.yaml'))"
Example: Adding New State Models
- Add your schema to
openapi.yamlundercomponents/schemas/ - Reference the schema in an API endpoint response
- Run the generation command above
- Update
__init__.pyto export the new models - Import and use the models in your code
Troubleshooting
- Models not generated: Ensure schemas are under
components/schemas/(notparameters/) - Missing models: Verify schemas are referenced in at least one API path
- Import errors: Check that new models are added to
__init__.pyexports