322 Commits

Author SHA1 Message Date
bdca72b0b3 Refine error handling and context management in core modules
Some checks failed
Integration Tests / Integration Tests (ubuntu-latest, 3.12) (push) Has been cancelled
- Enhance context isolation in specialized_exceptions.py to prevent shared state mutations and ensure safe metadata updates.
- Improve execution timeout handling in security.py with backward-compatible fallback mechanisms.
- Streamline price extraction logic in c_intel.py to handle various input types more effectively.
- Update fallback messaging in paperless agent to preserve context and provide clearer error status during LLM access failures.
- Clean up import statements in test configuration files for better organization.
2025-09-28 21:04:59 -04:00
8c15c51df2 Refine error handling and improve context management in core modules
- Update error categorization in formatter.py to treat certain runtime errors as unknown to avoid masking programming issues.
- Enhance context isolation in specialized_exceptions.py by utilizing deep copy for context management, ensuring safe metadata updates.
- Improve fallback messaging in paperless agent to provide clearer error status during LLM access failures.
- Streamline price extraction logic in receipt.py by refining regex patterns and normalizing price values for better accuracy.
2025-09-28 20:39:23 -04:00
d6746c9e25 Enhance error handling in paperless agent and improve price extraction logic
- Refactor error handling in paperless agent to provide more informative fallback messages during LLM invocation failures and context length issues.
- Update receipt.py to refine price pattern matching, ensuring proper handling of unit-annotated numbers and improving overall extraction accuracy.
2025-09-28 20:24:20 -04:00
8d09d6efb2 Add script and certificate for git.lab integration
- Introduce add-git-lab-cert.sh to automate the installation of the git.lab certificate into system stores for Ubuntu, CentOS, and Alpine Linux.
- Add git.lab.crt certificate file for secure connections.
- Enhance error handling in paperless agent to provide user-friendly fallback messages during LLM access issues.
- Improve receipt.py to refine price pattern matching and avoid treating unit-annotated numbers as prices.
2025-09-28 20:14:12 -04:00
911b0aed0e Enhance error handling and validation in core modules
- Strengthen error categorization in formatter.py to include system error indicators.
- Improve context isolation in specialized_exceptions.py to prevent shared state mutations and ensure safe metadata updates.
- Refine state size calculation in security.py with enhanced JSON coercion and fallback mechanisms.
- Update receipt.py to improve price pattern matching for more accurate extraction of structured line item data.
2025-09-28 18:52:15 -04:00
f7f33824b0 Enhance error handling and validation in core modules
- Strengthen error categorization in formatter.py to require more specific validation phrasing.
- Improve context isolation in specialized_exceptions.py to prevent shared state mutations.
- Update metadata handling in URLProcessingError to ensure safe updates and limit string lengths.
- Refine JsonParsingError to include json_length in metadata and ensure response previews are properly truncated.
- Simplify state size calculation in security.py with improved exception handling and fallback mechanisms.
- Adjust receipt.py to enforce word boundaries in price pattern matching for more accurate extraction.
2025-09-28 17:41:40 -04:00
4d43945868 Enhance typing and error handling in receipt processing node
- Introduce CanonicalProduct type for improved type safety in receipt item validation.
- Refactor validation logic to handle exceptions more gracefully and ensure proper type annotations.
- Update async validation tasks to maintain concurrency limits while processing receipt items.
- Improve error messaging for validation failures and unexpected result formats.
2025-09-28 16:59:36 -04:00
b7d7a2d95c Refactor JSON coercion utilities and enhance error handling in specialized exceptions
- Introduce centralized JSON coercion utility in json_helpers.py to streamline JSON-compatible value conversion.
- Replace inline coercion logic in specialized_exceptions.py, security.py, and c_intel.py with the new utility for improved consistency and maintainability.
- Update error handling to utilize the centralized coercion method, enhancing type safety across the application.
2025-09-28 16:45:49 -04:00
9ae3476fbb Strengthen typing in buddy handoff integration tests (#68)
* Refine buddy handoff integration test types

* Refine handoff tests and centralize fixture types

* Align service and URL fixtures with review feedback

* Refine buddy handoff validators and HTTP response factory

* Tighten client fixtures and restore warnings cleanup

* Harden handoff timeout messaging and restore warnings hook
2025-09-28 16:18:28 -04:00
dc34bc0e66 dockerfile fix 2025-09-28 16:14:20 -04:00
3b5fb48194 Update Dockerfile to comment out user switch and npm package installation
- Comment out the USER vscode switch to avoid permission conflicts during npm global installs.
- Comment out the npm install command for task-master-ai, repomix, and claude-code to prevent installation as vscode user.
2025-09-28 15:59:22 -04:00
880dabe4f8 Update Docker Compose configuration and post-create script
- Add support for mounting the Codex CLI config directory in the Docker Compose file.
- Ensure the creation of necessary CLI config directories for Claude and Codex in the post-create script.
- Install additional developer CLI tooling including task-master, repomix, claude-code, and @openai/codex during the post-create process.
2025-09-28 15:52:24 -04:00
23036bd5f2 Remove deprecated configuration and ignore files
- Delete .claude.yaml, .codespellignore, .pyreflyignore, and other obsolete configuration files.
- Clean up test_tmp.txt and .idx/dev.nix to streamline the repository structure.
2025-09-28 13:53:10 -04:00
7a84d75d8e Refactor type safety checks and enhance error handling across various modules
- Update typing in error handling and validation nodes to improve type safety.
- Refactor cache decorators for async compatibility and cleanup functionality.
- Enhance URL processing and validation logic with improved type checks.
- Centralize error handling and recovery mechanisms in nodes.
- Simplify and standardize function signatures across multiple modules for consistency.
- Resolve linting issues and ensure compliance with type safety standards.
2025-09-28 13:45:52 -04:00
80d5bc6c23 stuff 2025-09-27 23:06:13 -04:00
d6f31ae41c Refactor graph node registries for analysis, catalog, and paperless workflows (#67)
* Refactor graph node registries for analysis, catalog, and paperless workflows

* Refine graph node registries and add validation

* Type annotate node registries and update ordering tests

* Harden node registry validation

* Tighten node registry validation and tests

* Enforce registry ordering and async validation

* Tighten node registry typing and async enforcement

* Centralize node registry mappings
2025-09-21 03:56:09 -04:00
841522a18a Simplify graph imports (#66)
* Simplify graph imports

* Re-export content availability router
2025-09-21 01:05:11 -04:00
bc18ac3fec Refine RAG node exports and imports (#65)
* Refine RAG node exports and imports

* Fix RAG node exports and restore security error re-export
2025-09-21 00:18:17 -04:00
7e15ea36df Refactor async graph factories to use shared helper (#64)
* Refactor async graph factories to use shared helper

* Use ParamSpec in make_async_factory
2025-09-20 23:31:34 -04:00
0763eef752 Refine error centralization for graph and HTTP utilities (#63)
* Refine error centralization for graph and HTTP utilities

* Align cache prefix handling and enum logging

* Centralize remaining standalone errors and logging stubs

* Fix graph validation error call and redundant redis check

* Improve Redis ping handling and logging compliance

* Refactor error metadata mixins and shared validators

* Restore NotImplemented for abstract placeholders

* Fix redis cache backend assignment
2025-09-20 21:42:29 -04:00
a6731cc185 fix: resolve all pyrefly linting errors in Discord implementation
- Fix Pydantic Field constraints using Annotated pattern
- Fix database access to use asyncpg pool directly
- Fix LLM client max_tokens parameter usage
- Add type safety checks for dict operations
- Fix Discord.py type annotations and overrides
- Add pyrefly ignore comments for false positives
- Fix bot.user null checks in event handlers
- Ensure all Discord services pass type checking
2025-09-20 18:17:56 -04:00
36e333d0c4 refactor: centralize request helpers for clients (#62)
* refactor: centralize request helpers for clients

* refactor: harden networking request validation

* fix: harden response parsing and cache fingerprints

* refactor: harden response parsing and cache key normalisation

* chore: normalize form encoding and cache keys
2025-09-20 03:43:12 -04:00
34154c5dd6 Modernize LangGraph routing helpers for mapping-based state (#61)
* Modernize LangGraph routing helpers for mapping-based state

* Refine LangGraph v1 reducers and search node handling

* Harden search workflow state handling

* Refine LangGraph routing and search handling

* Harden LangGraph search routing and reducer safety

* Improve LangGraph search hygiene and scraping validation

* Refine LangGraph integration and search sanitization

* Refine state access protocol for routing helpers

* Refine edge helper state access and numeric coercion

* Harden search sanitization and routing utilities

* refactor: remove url processing compatibility layer

* Harden langgraph reducers and routing helpers

* Break circular import in legacy URL processing shim

* Fix pytest async hook interaction

* Modernize LangGraph helpers and sanitizers

* Address follow-up LangGraph modernization issues

* Harden LangGraph routing and URL helpers

* Refine RAG integration nodes for typed state
2025-09-19 19:31:47 -04:00
8ad47a7640 Modernize research graph metadata for LangGraph v1 (#60)
* Modernize research graph metadata for LangGraph v1

* Update src/biz_bud/core/langgraph/graph_builder.py

Co-authored-by: qodo-merge-pro[bot] <151058649+qodo-merge-pro[bot]@users.noreply.github.com>

---------

Co-authored-by: qodo-merge-pro[bot] <151058649+qodo-merge-pro[bot]@users.noreply.github.com>
2025-09-19 03:01:18 -04:00
03f3c91719 Merge remote-tracking branch 'origin/main' into refine 2025-08-10 20:07:16 -04:00
876a8a3a03 clean 2025-08-10 13:47:35 -04:00
6079ea027e Refine (#59)
* feat: implement async factory functions and optimize blocking I/O operations

* refactor: improve thread safety and error handling in graph factory caching system

* Update src/biz_bud/agents/buddy_agent.py

Co-authored-by: qodo-merge-pro[bot] <151058649+qodo-merge-pro[bot]@users.noreply.github.com>

* Update src/biz_bud/services/factory/service_factory.py

Co-authored-by: qodo-merge-pro[bot] <151058649+qodo-merge-pro[bot]@users.noreply.github.com>

* Update src/biz_bud/core/edge_helpers/error_handling.py

Co-authored-by: qodo-merge-pro[bot] <151058649+qodo-merge-pro[bot]@users.noreply.github.com>

* refactor: extract validation helpers and improve code organization in workflow modules

* refactor: extract shared code into helper methods and reuse across modules

* fix: prevent task cancellation leaks and improve async handling across core services

* refactor: replace async methods with sync in URL processing and error handling

* refactor: replace emoji and unsafe regex with plain text and secure regex operations

* refactor: consolidate timeout handling and regex safety checks with cross-platform support

* refactor: consolidate async detection and error normalization utilities across core modules

* Update src/biz_bud/core/utils/url_analyzer.py

Co-authored-by: qodo-merge-pro[bot] <151058649+qodo-merge-pro[bot]@users.noreply.github.com>

* fix: prevent config override in LLM kwargs to maintain custom parameters

* refactor: centralize regex security and async context handling with improved error handling

* Update scripts/checks/audit_core_dependencies.py

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>

* Update scripts/checks/audit_core_dependencies.py

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>

* Update scripts/checks/audit_core_dependencies.py

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>

* Update scripts/checks/audit_core_dependencies.py

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>

* fix: correct regex pattern for alternation in repeated groups by removing escaped bracket

* fix: resolve pre-commit hooks configuration and update dependencies

- Clean and reinstall pre-commit hooks to fix corrupted cache
- Update isort to v6.0.1 to resolve deprecation warnings
- Fix pytest PT012 error by separating pytest.raises from context managers
- Fix pytest PT011 errors by using GraphInterrupt instead of generic Exception
- Fix formatting and trailing whitespace issues automatically applied by hooks

* chore: remove deprecated files and clean up project structure

* fix: use safe regex utilities in json_extractor validation

- Replace unsafe re.search() calls with SafeRegexCompiler in _validate_input_security
- Use already imported _compiler instance for pattern compilation
- Add timeout protection (0.5s) for security pattern checks
- Properly handle exceptions during pattern compilation
- This prevents the security validation itself from being vulnerable to ReDoS attacks

* chore: remove deprecated files and clean up project structure

* feat: enhance metric tracking and memory management utilities

- Introduced new functions for initializing and updating metrics in the langgraph module.
- Added memory usage and concurrency management functions in async_utils.
- Refactored extractors and orchestrator to utilize new memory management functions for dynamic concurrency scaling.
- Removed deprecated memory management code from extractors and orchestrator.

* refactor: enhance graph construction with new configuration approach

- Updated graph.py and subgraphs.py to utilize GraphBuilderConfig for defining nodes and edges.
- Removed deprecated StateGraph usage in favor of a more modular graph construction method.
- Improved readability and maintainability of graph creation functions across various modules.

* fix: improve error handling in async cleanup and shutdown processes

- Enhanced the cleanup method in the cache decorator to preserve CancelledError during cleanup.
- Updated the service lifecycle manager to better handle CancelledError during shutdown and service cleanup.
- Ensured that all exceptions are properly logged and handled, maintaining robustness in async operations.

* refactor: standardize return type annotations for CompiledStateGraph

- Updated function signatures across multiple modules to use a consistent return type annotation for CompiledStateGraph.
- Improved code clarity and maintainability by removing specific type parameters in favor of a more general annotation.

---------

Co-authored-by: qodo-merge-pro[bot] <151058649+qodo-merge-pro[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
2025-08-08 00:27:49 -04:00
5ce94eb050 refactor: standardize return type annotations for CompiledStateGraph
- Updated function signatures across multiple modules to use a consistent return type annotation for CompiledStateGraph.
- Improved code clarity and maintainability by removing specific type parameters in favor of a more general annotation.
2025-08-08 00:18:07 -04:00
086efcea5d fix: improve error handling in async cleanup and shutdown processes
- Enhanced the cleanup method in the cache decorator to preserve CancelledError during cleanup.
- Updated the service lifecycle manager to better handle CancelledError during shutdown and service cleanup.
- Ensured that all exceptions are properly logged and handled, maintaining robustness in async operations.
2025-08-08 00:05:48 -04:00
06b48ff7a8 refactor: enhance graph construction with new configuration approach
- Updated graph.py and subgraphs.py to utilize GraphBuilderConfig for defining nodes and edges.
- Removed deprecated StateGraph usage in favor of a more modular graph construction method.
- Improved readability and maintainability of graph creation functions across various modules.
2025-08-08 00:01:37 -04:00
3de42db6ea feat: enhance metric tracking and memory management utilities
- Introduced new functions for initializing and updating metrics in the langgraph module.
- Added memory usage and concurrency management functions in async_utils.
- Refactored extractors and orchestrator to utilize new memory management functions for dynamic concurrency scaling.
- Removed deprecated memory management code from extractors and orchestrator.
2025-08-07 23:40:40 -04:00
d2911c082b chore: remove deprecated files and clean up project structure 2025-08-07 22:46:25 -04:00
e64eb8fe56 fix: use safe regex utilities in json_extractor validation
- Replace unsafe re.search() calls with SafeRegexCompiler in _validate_input_security
- Use already imported _compiler instance for pattern compilation
- Add timeout protection (0.5s) for security pattern checks
- Properly handle exceptions during pattern compilation
- This prevents the security validation itself from being vulnerable to ReDoS attacks
2025-08-07 19:28:05 -04:00
e88d6d399a Merge branch 'origin/main' into refine
Resolved conflicts by:
- Keeping our improved versions of:
  - json_extractor.py (with fixed logging and timeout handling)
  - regex_security.py (with improved timeout cancellation)
  - graph.py (with excessive blank lines removed)
  - paperless agent (with improved concurrent task execution)
  - database tool (with connection timeout added)
  - receipt_processing.py (with safe regex usage)

- Using main branch versions for other files to get latest updates
- Removed deleted file src/biz_bud/graphs/paperless/nodes.py
- Fixed import sorting and formatting issues
2025-08-07 19:23:04 -04:00
5654f06a66 chore: remove deprecated files and clean up project structure 2025-08-07 19:17:02 -04:00
64f0f49d56 fix: resolve pre-commit hooks configuration and update dependencies
- Clean and reinstall pre-commit hooks to fix corrupted cache
- Update isort to v6.0.1 to resolve deprecation warnings
- Fix pytest PT012 error by separating pytest.raises from context managers
- Fix pytest PT011 errors by using GraphInterrupt instead of generic Exception
- Fix formatting and trailing whitespace issues automatically applied by hooks
2025-08-07 18:51:42 -04:00
033737be68 Refine (#58)
* feat: implement async factory functions and optimize blocking I/O operations

* refactor: improve thread safety and error handling in graph factory caching system

* Update src/biz_bud/agents/buddy_agent.py

Co-authored-by: qodo-merge-pro[bot] <151058649+qodo-merge-pro[bot]@users.noreply.github.com>

* Update src/biz_bud/services/factory/service_factory.py

Co-authored-by: qodo-merge-pro[bot] <151058649+qodo-merge-pro[bot]@users.noreply.github.com>

* Update src/biz_bud/core/edge_helpers/error_handling.py

Co-authored-by: qodo-merge-pro[bot] <151058649+qodo-merge-pro[bot]@users.noreply.github.com>

* refactor: extract validation helpers and improve code organization in workflow modules

* refactor: extract shared code into helper methods and reuse across modules

* fix: prevent task cancellation leaks and improve async handling across core services

* refactor: replace async methods with sync in URL processing and error handling

* refactor: replace emoji and unsafe regex with plain text and secure regex operations

* refactor: consolidate timeout handling and regex safety checks with cross-platform support

* refactor: consolidate async detection and error normalization utilities across core modules

* Update src/biz_bud/core/utils/url_analyzer.py

Co-authored-by: qodo-merge-pro[bot] <151058649+qodo-merge-pro[bot]@users.noreply.github.com>

* fix: prevent config override in LLM kwargs to maintain custom parameters

* refactor: centralize regex security and async context handling with improved error handling

* Update scripts/checks/audit_core_dependencies.py

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>

* Update scripts/checks/audit_core_dependencies.py

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>

* Update scripts/checks/audit_core_dependencies.py

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>

* Update scripts/checks/audit_core_dependencies.py

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>

* fix: correct regex pattern for alternation in repeated groups by removing escaped bracket

---------

Co-authored-by: qodo-merge-pro[bot] <151058649+qodo-merge-pro[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
2025-08-06 13:09:30 -04:00
869842b90b Merge branch 'refine' of https://github.com/vasceannie/competitor-costing into refine 2025-08-06 17:00:35 +00:00
99cc5b6a43 fix: correct regex pattern for alternation in repeated groups by removing escaped bracket 2025-08-06 16:57:59 +00:00
af2569e38a Update scripts/checks/audit_core_dependencies.py
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
2025-08-06 12:50:38 -04:00
8bce184348 Update scripts/checks/audit_core_dependencies.py
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
2025-08-06 12:50:28 -04:00
d0d517f90f Update scripts/checks/audit_core_dependencies.py
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
2025-08-06 12:50:17 -04:00
b0fa784ab3 Update scripts/checks/audit_core_dependencies.py
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
2025-08-06 12:50:04 -04:00
b52f9122a5 refactor: centralize regex security and async context handling with improved error handling 2025-08-06 16:49:03 +00:00
f895d0cfac fix: prevent config override in LLM kwargs to maintain custom parameters 2025-08-06 16:14:36 +00:00
f46c158f7a Update src/biz_bud/core/utils/url_analyzer.py
Co-authored-by: qodo-merge-pro[bot] <151058649+qodo-merge-pro[bot]@users.noreply.github.com>
2025-08-06 12:11:40 -04:00
af3e31c265 refactor: consolidate async detection and error normalization utilities across core modules 2025-08-06 16:10:12 +00:00
8bbb666ccf refactor: consolidate timeout handling and regex safety checks with cross-platform support 2025-08-06 12:49:28 +00:00
c9b2aa5c2d resolve: merge conflicts between refine and main branches
- Resolved conflicts in src/biz_bud/graphs/graph.py:
  - Unified create_initial_state functions to use main branch implementation
  - Maintained optimized async/sync patterns from main
  - Preserved performance improvements and caching logic

- Resolved conflicts in tests/integration_tests/graphs/test_main_graph_integration.py:
  - Fixed test assertions to use consistent state access patterns
  - Removed deprecated .get() calls in favor of direct dictionary access
  - Maintained test compatibility with resolved state structure

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-06 12:02:26 +00:00
fd7a4a2f58 refactor: replace emoji and unsafe regex with plain text and secure regex operations 2025-08-06 11:57:12 +00:00