refactor(error): migrate make_error call sites to typed error codes (Issue #230)#236
Conversation
…Issue #230) Replace all make_error/error_info call sites across 32 files to use messaging_error_category typed error codes via make_typed_error_code(). - Core: message.cpp, message_bus.cpp, message_broker.cpp, message_queue.cpp, topic_router.cpp - Patterns: request_reply.cpp, event_streaming.cpp, message_pipeline.cpp, pub_sub.cpp - Backends: standalone_backend.cpp, integration_backend.cpp - Adapters: http_transport.h/.cpp, websocket_transport.h/.cpp - Task: task.cpp, scheduler.cpp, cron_parser.cpp, worker_pool.cpp, and 7 more - Serialization: message_serializer.h - Integration: event_bridge.h, executor_adapter.h, task_event_bridge.h, task_handler.h - Tests: test_message_bus.cpp updated to use messaging_error_category type alias
CI/CD Failure AnalysisAnalysis Time: 2026-02-14 Failed Workflows
Root Cause AnalysisPrimary Error: Test assertions checking error message strings fail after migrating to typed error codes. The migration from Failed Tests (5):
Proposed FixUpdate test assertions to match new typed error code messages from Next Steps
Automated failure analysis - Attempt #1 |
Update test assertions to match new standardized error messages from messaging_error_category instead of custom per-call-site strings. - test_result_backend: "Something went wrong" -> "Task execution failed" - test_result_backend: "Timeout" -> "Task timeout" - test_async_result: "Invalid async_result handle" -> "Task not found" - test_worker_pool: "timed out" -> "Task timeout"
thread_pool_executor::worker_count() was calling get_active_worker_count() which only returns workers currently executing tasks. When no tasks are submitted, all workers are idle and the count returns 0. This caused StandaloneBackendTest.ZeroThreads to fail on Windows MSVC. Fix: sum active + idle workers to return the total worker count.
CI/CD Failure Analysis - Attempt #2Previous Attempt Result: 4/5 test failures fixed, 1 remaining New Failure Analysis
What ChangedPrevious Fix:
Remaining Failure:
Root CauseError: Analysis: The fix sums Fix Applied
Commits
Automated failure analysis - Attempt #2 of 3 |
Closes #230
Summary
make_error/error_infocall sites across 32 files to usemessaging_error_categorytyped error codes viamake_typed_error_code()#include <kcenon/messaging/error/error_codes.h>with#include <kcenon/messaging/error/messaging_error_category.h>in all migrated filesmessage_serializer.hto use messaging-specific error codes (message_serialization_failed,message_deserialization_failed,invalid_payload,not_supported) instead of genericcommon::error_codestest_message_bus.cppto usemessaging_error_categorytype alias for error code assertionsthread_pool_executor::worker_count()to return total workers (active + idle) instead of only active workersScope
Files Modified (32 total + 4 test fixes)
Core (5 files):
message.cpp,message_bus.cpp,message_broker.cpp,message_queue.cpp,topic_router.cppPatterns (4 files):
request_reply.cpp,event_streaming.cpp,message_pipeline.cpp,pub_sub.cppBackends (2 files):
standalone_backend.cpp,integration_backend.cppAdapters (4 files):
http_transport.h/.cpp,websocket_transport.h/.cppTask (11 files):
task.cpp,scheduler.cpp,cron_parser.cpp,worker_pool.cpp,monitor.cpp,memory_result_backend.cpp,task_queue.cpp,task_system.cpp,task_client.cpp,task_context.cpp,async_result.cppHeaders (5 files):
message_serializer.h,event_bridge.h,executor_adapter.h,task_event_bridge.h,task_handler.hTests (4 files):
test_message_bus.cpp,test_result_backend.cpp,test_async_result.cpp,test_worker_pool.cppNot migrated (intentional)
common::error::codes::common_errors::*(e.g.,invalid_argument,not_found) remain unchanged as they represent genuine common system errors, not messaging-specific errorsMigration Pattern
Test Plan
messaging/error/error_codes.hincludes in migrated files