Files
Travis Vasceannie 32fcab7a79 Tests (#56)
* fix: resolve linting issues for clean test runs

- Fix flake8 PT011 errors by adding match parameters to pytest.raises
- Fix flake8 PT012 error by restructuring pytest.raises block
- Fix pyrefly type checking errors in cache_manager.py
- Address trailing whitespace issues

These fixes ensure pre-commit hooks pass cleanly, enabling successful
test commits and maintaining code quality standards.

* fix: correct config validation test expectations

* fix: adjust config reload test expectations for environment override behavior

* fix: correct LLM client test expectations and error handling

- Fix test_call_model_node_list_content to expect 'a b' instead of "['a', 'b']"
- Fix builtins import issue in provider exception tests
- Fix LLMExceptionHandler patch path from call module to core.errors.llm_exceptions
- Adjust provider exception tests to validate user-friendly error messages
- These fixes align tests with actual LLM content processing and error handling behavior

* fix: additional LLM test error categorization improvements

- Fix test_call_model_node_llm_error_categorization to match actual error message format
- Simplify error categorization assertions to focus on core functionality
- Remove overly specific assertions about logging call structure
- These changes improve test stability while maintaining error handling validation

* fix: resolve concurrency and race condition issues across codebase

- Remove threading.Lock from lazy_loader.py in favor of pure async patterns
- Simplify weak reference handling by removing complex callbacks
- Remove LazyProxy and ThreadSafeLazyLoader classes (no longer needed)
- Fix race condition in Redis backend by adding initialization lock
- Make cleanup_registry concurrency configurable via ServiceConfig
- Remove sync cache methods and fix CancelledError handling in decorators
- Add ServiceConfig with timeout and concurrency settings to AppConfig
- Remove complex cleanup tracking from ServiceFactory
- Fix cache decorator to use lazy initialization pattern
- Update all tests to use new async-only implementations

This refactoring improves code quality by:
- Eliminating mixed threading/async patterns that could cause deadlocks
- Simplifying cleanup logic to avoid nested timeouts
- Making system behavior configurable instead of hardcoded
- Removing backwards compatibility code for cleaner implementation

* docs: update documentation and audit script for async-only patterns

- Update audit_core_dependencies.py to check for deprecated patterns
  - Add threading.Lock to disallowed imports
  - Add ThreadSafeLazyLoader, LazyProxy, ThreadSafeFactoryManager to disallowed instantiations
  - Add ImportFrom check for threading.Lock
- Update core README.md with AsyncSafeLazyLoader and AsyncFactoryManager documentation
  - Add new section on async-safe lazy loading utilities
  - Add best practices for async patterns
- Fix references to old patterns in documentation files
  - Update CACHING_GUIDELINES.md to use cleanup_cache_singletons
  - Update AGENTS.md to reference AsyncSafeLazyLoader
  - Fix comment in graph.py referencing LazyProxy
- Note: Found remaining threading.Lock uses in logging and error modules for future cleanup

* fix: add missing ErrorNamespace constants and fix error type validation

- Add CFG_INVALID_CONFIG and UNK_GENERAL_ERROR to ErrorNamespace enum
- Add these constants to the error registry mappings
- Fix error type validation in create_error_dict_from_incomplete to ensure strings
- Remaining pyrefly errors are false positives about missing returns
- Fixed trailing whitespace

* refactor: improve control flow clarity for static analysis

- Add explicit None checks before awaiting tasks to help pyrefly understand control flow
- Initialize task variables with None to make assignment tracking clearer
- Add StateError raises when tasks are unexpectedly None
- Remaining pyrefly 'missing return' errors are false positives where all paths do return
- Fixed trailing whitespace

* docs: update services README to highlight async-only architecture

- Add key features section highlighting pure async patterns
- Note race-condition-free initialization in ServiceFactory description
- Document weak reference usage in global factory management
- Add async patterns section to best practices
- Emphasize no threading is needed with proper asyncio usage

* refactor: improve cache key generation and lock management in decorators.py

* refactor: optimize test performance with list comprehensions and parallel execution

* fix: add type hints and fix type errors in test files

* refactor: consolidate validation tests using pytest parametrize and helper functions

* refactor: replace SimpleNamespace with proper callable wrapper classes in test fixtures
2025-08-05 13:03:53 -04:00
..
2025-08-05 13:03:53 -04:00