refactor(error): complete Result<T> migration in bridge/adapter layer#962
Merged
refactor(error): complete Result<T> migration in bridge/adapter layer#962
Conversation
Replace all 15 remaining throw statements in src/ with Result<T> factory patterns and error returns: Bridges (7 throws removed): - ObservabilityBridge: constructor -> create() factory, from_common_system() returns Result - ThreadPoolBridge: create() factory, from_thread_system/from_common_system return Result Adapters (4 throws removed): - thread_system_pool_adapter: constructor -> create() factory - network_to_common_thread_adapter: constructor -> create() factory, lambda throws replaced with promise::set_exception - common_to_network_thread_adapter: constructor -> create() factory Protocol (2 throws removed): - dtls_socket: constructor -> create() factory, callers updated Utility (1 throw removed): - message_validator: validate_size_or_throw -> validate_size returning validation_result enum Call sites updated: - secure_messaging_udp_client/server: use dtls_socket::create() - ThreadPoolBridge::from_common_system: use adapter::create() Tests updated: - test_input_validation.cpp: use validate_size() with result checks - message_validator_extended_test.cpp: same Closes #957
5 tasks
8 tasks
kcenon
added a commit
that referenced
this pull request
Apr 13, 2026
Fix compilation errors from the Result<T> migration in PR #962: - network_system_bridge.cpp: update from_thread_system(), from_common_system(), and with_custom() to handle Result returns - thread_system_adapter.cpp: update create_default() and from_service_or_default() to use create() factory
3 tasks
kcenon
added a commit
that referenced
this pull request
Apr 13, 2026
Replace direct std::make_shared<dtls_socket> calls with dtls_socket::create() factory method in secure_messaging_udp_client and secure_messaging_udp_server. The constructor was made private in the Result<T> migration (PR #962) but these call sites were missed.
kcenon
added a commit
that referenced
this pull request
Apr 13, 2026
* fix(bridge): update call sites for Result<T> factory migration Fix compilation errors from the Result<T> migration in PR #962: - network_system_bridge.cpp: update from_thread_system(), from_common_system(), and with_custom() to handle Result returns - thread_system_adapter.cpp: update create_default() and from_service_or_default() to use create() factory * fix(udp): update dtls_socket call sites for Result<T> factory migration Replace direct std::make_shared<dtls_socket> calls with dtls_socket::create() factory method in secure_messaging_udp_client and secure_messaging_udp_server. The constructor was made private in the Result<T> migration (PR #962) but these call sites were missed. * fix(adapters): qualify Result types and update tests for factory pattern Add ::kcenon::common:: namespace qualification to Result, error_codes, and ok in common_to_network_thread_adapter::create(). Update tests to use create() factory instead of private constructors for both adapter classes. * fix(test): update integration tests to use create() factory Replace remaining std::make_shared calls with create() factory in AdapterIntegrationTest for both network_to_common_thread_adapter and common_to_network_thread_adapter. * fix(test): update thread_pool_bridge tests for Result<T> factory migration Replace direct constructor calls and std::make_shared with ThreadPoolBridge::create() factory method. Update from_thread_system() and from_common_system() tests to handle Result<T> return types. * fix(test): update bridge tests for Result<T> factory migration Update test_network_system_bridge.cpp and test_observability_bridge.cpp to use create() factory methods instead of private constructors for ThreadPoolBridge and ObservabilityBridge. * fix(test): update dtls_socket tests for Result<T> factory migration Replace direct constructor calls with dtls_socket::create() factory method. Update null context test to check Result error instead of expecting exception. * fix(test): update server adapter test callback signatures to string_view Update disconnection_callback_t, receive_callback_t, and error_callback_t lambda parameters from legacy types to std::string_view to match the updated i_protocol_server interface. * fix(test): update client adapter test callback signatures Remove session parameters from client adapter callback lambdas to match simplified i_protocol_client interface where callbacks no longer receive shared_ptr<i_session>. * fix(test): update listener adapter tests for callback API changes Update on_disconnected to on_disconnect and accept_callback_t signature from string_view to unique_ptr<i_connection>. * fix(validation): remove duplicate validate_size overload Remove bool-returning validate_size that conflicted with validation_result-returning version. Update test assertions to use validation_result comparisons.
kcenon
added a commit
that referenced
this pull request
Apr 15, 2026
* fix(bridge): update call sites for Result<T> factory migration Fix compilation errors from the Result<T> migration in PR #962: - network_system_bridge.cpp: update from_thread_system(), from_common_system(), and with_custom() to handle Result returns - thread_system_adapter.cpp: update create_default() and from_service_or_default() to use create() factory * fix(udp): update dtls_socket call sites for Result<T> factory migration Replace direct std::make_shared<dtls_socket> calls with dtls_socket::create() factory method in secure_messaging_udp_client and secure_messaging_udp_server. The constructor was made private in the Result<T> migration (PR #962) but these call sites were missed. * fix(adapters): qualify Result types and update tests for factory pattern Add ::kcenon::common:: namespace qualification to Result, error_codes, and ok in common_to_network_thread_adapter::create(). Update tests to use create() factory instead of private constructors for both adapter classes. * fix(test): update integration tests to use create() factory Replace remaining std::make_shared calls with create() factory in AdapterIntegrationTest for both network_to_common_thread_adapter and common_to_network_thread_adapter. * fix(test): update thread_pool_bridge tests for Result<T> factory migration Replace direct constructor calls and std::make_shared with ThreadPoolBridge::create() factory method. Update from_thread_system() and from_common_system() tests to handle Result<T> return types. * fix(test): update bridge tests for Result<T> factory migration Update test_network_system_bridge.cpp and test_observability_bridge.cpp to use create() factory methods instead of private constructors for ThreadPoolBridge and ObservabilityBridge. * fix(test): update dtls_socket tests for Result<T> factory migration Replace direct constructor calls with dtls_socket::create() factory method. Update null context test to check Result error instead of expecting exception. * fix(test): update server adapter test callback signatures to string_view Update disconnection_callback_t, receive_callback_t, and error_callback_t lambda parameters from legacy types to std::string_view to match the updated i_protocol_server interface. * fix(test): update client adapter test callback signatures Remove session parameters from client adapter callback lambdas to match simplified i_protocol_client interface where callbacks no longer receive shared_ptr<i_session>. * fix(test): update listener adapter tests for callback API changes Update on_disconnected to on_disconnect and accept_callback_t signature from string_view to unique_ptr<i_connection>. * fix(validation): remove duplicate validate_size overload Remove bool-returning validate_size that conflicted with validation_result-returning version. Update test assertions to use validation_result comparisons. * fix(network): correct include path for secure_tcp_socket.h The header was using 'kcenon/network/internal/tcp/secure_tcp_socket.h' which does not exist under any include directory. The actual file resolves via the src/ include root as 'internal/tcp/secure_tcp_socket.h'. * fix(network): restore canonical include path and fix internal_include symlink Revert secure_session.h include path back to the canonical 'kcenon/network/internal/tcp/secure_tcp_socket.h' which resolves via the internal_include symlink created at CMake configure time. Add COPY_ON_ERROR to file(CREATE_LINK) so the symlink falls back to a directory copy on platforms where symbolic links require elevated privileges (e.g. Windows CI without Developer Mode). * docs: fix 60+ broken links, unify toolchain versions, sanitize paths Applied fixes from DOC_REVIEW_REPORT.md across 52 markdown files: Security / portability: - Replaced 11 committed absolute /Users/raphaelshin/... paths in docs/advanced/MIGRATION.md with repository-relative paths. Path-scoping fixes (inter-file): - Corrected ~30 bare filename references (TLS_SETUP_GUIDE.md, TROUBLESHOOTING.md, API_REFERENCE.md, BUILD.md, UDP_SUPPORT.md, LOAD_TEST_GUIDE.md, OPERATIONS.md) to include docs/guides/ or docs/advanced/ prefix as appropriate. - Fixed wrong relative depth from docs/integration/ for ECOSYSTEM and external-repo references. Toolchain version unification (authoritative: CMakeLists.txt + vcpkg.json): - CMake: 3.16 -> 3.20 across all docs and examples. - Compiler: normalized to GCC 13+, Clang 17+, MSVC 2022+, Apple Clang 14+ (removed inconsistent GCC 9+/10+/11+, Clang 10+/12+/14+ claims from README.kr.md, BUILD[.kr].md, CONTRIBUTING[.kr].md, PRODUCTION_QUALITY[.kr].md, PROJECT_STRUCTURE[.kr].md, FEATURES.md, LOAD_TEST_GUIDE.md, QUICK_START[.kr].md, MIGRATION.md). - ASIO: standardized to standalone ASIO 1.30.2+, explicitly noting Boost.ASIO is NOT supported (was contradictory: some docs allowed Boost.ASIO while CMake + CI reject it). - Updated CHANGELOG version support matrix to include 1.5.0 as Current with CMake 3.20. Anchor and TOC repairs: - Trimmed 34-entry stale TOC in docs/implementation/01-architecture-and-components.md to only include sections that actually exist; marked unwritten sections with TODO. - Fixed underscored anchors in docs/UNIFIED_API_GUIDE.md (i_transport, i_connection, i_listener). - Fixed broken ../INTEGRATION.md link in ARCHITECTURE_OVERVIEW.md and empty docs/ link in CHANGELOG[.kr].md. Missing targets: - Replaced references to unwritten files (IMPROVEMENTS.md, CODING_STYLE_RULES.md, MIGRATION_GUIDE.md, MIGRATION_KO.md, DESIGN_DECISIONS.kr.md, GRPC_GUIDE.kr.md, README.kr.md siblings for implementation/ parts 1-4, with-thread-system.md, with-database-system.md, api/, architecture/, security/, performance/OPTIMIZATION.md, WEBSOCKET_IMPLEMENTATION_PLAN.md, examples/unified/, examples/network/, ECOSYSTEM_OVERVIEW.kr.md) with TODO markers plus the closest existing canonical doc. SSOT deduplication: - Integration Guide SSOT collision: kept docs/INTEGRATION.md canonical, demoted docs/INTEGRATION.kr.md to Korean translation marker, demoted docs/integration/README.md to per-system guide index. - network-core/README.md demoted to pointer; libs/network-core/README.md remains canonical (matches active CMake target). - Root CHANGELOG.md annotated as mirror of docs/CHANGELOG.md SSOT. Bidirectional cross-references (Phase 3): - Added "See Also" footers to ADR-001/002/003 linking to DESIGN_DECISIONS.md and siblings. - Added tracing / performance xrefs in integration/with-monitoring.md. - Added DTLS xref in guides/TLS_SETUP_GUIDE.md. - Expanded docs/README.md registry to include ECOSYSTEM.md and GETTING_STARTED.md (previously orphaned). Other fixes: - Removed two stray bare ``` fences each in docs/API_REFERENCE_FACADES.md (3 total) and docs/API_REFERENCE_PROTOCOLS.md (1) that corrupted markdown parsing. - Checked in DOC_REVIEW_REPORT.md as reference. Counts: 11 absolute-path sanitizations, ~30 path-scoping corrections, ~25 compiler/CMake/ASIO alignments, 4 SSOT clarifications, 7 bidirectional xref additions, 4 code-fence repairs, 34 dangling TOC entries resolved, ~20 missing-target TODOs inserted. Skipped: - Korean (.kr.md) content translation sync (out of scope: large). - API/manifest version bumps (no code change requested). - Content review of docs/advanced/MIGRATION.md beyond path sanitization. * docs: add post-fix re-validation report
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Summary
Replace all 15 remaining throw statements in src/ with Result factory patterns,
completing the exception-to-Result migration for the internal implementation layer.
Change Type
Why
Related Issues
Motivation
Public APIs were already migrated to Result in PR #952, but internal code still used
exceptions. This created inconsistency where public APIs return Result but internal
calls could throw, leading to unhandled exception risk.
Where
Files Changed (14 files, +194/-112 lines)
How
Migration Patterns Applied
create()returningResult<shared_ptr<T>>promise::set_exception(make_exception_ptr(...))to propagate errors through futures without throwvalidate_size_or_throwreplaced withvalidate_sizereturningvalidation_resultenumVerification
grep -rn "throw " src/returns zero matches (excluding comments)Test Plan
Breaking Changes
dtls_socketconstructor is now private; usedtls_socket::create()factoryvalidate_size_or_throwremoved; usevalidate_size()returningvalidation_result::create()factories