Skip to content

fix(bridge): update call sites for Result<T> factory migration#963

Merged
kcenon merged 11 commits intodevelopfrom
fix/issue-957-ci-fixes
Apr 13, 2026
Merged

fix(bridge): update call sites for Result<T> factory migration#963
kcenon merged 11 commits intodevelopfrom
fix/issue-957-ci-fixes

Conversation

@kcenon
Copy link
Copy Markdown
Owner

@kcenon kcenon commented Apr 13, 2026

What

Summary

Fix compilation errors introduced by PR #962 (Result migration). Two call site files
were not updated to handle the new Result return types from bridge factory methods.

Change Type

  • Bugfix (fixes compilation errors)

Why

Related Issues

Root Cause

PR #962 changed bridge constructors to private and factory methods to return Result,
but missed updating callers in network_system_bridge.cpp and thread_system_adapter.cpp.

Where

File Fix
src/integration/network_system_bridge.cpp Handle Result from from_thread_system, from_common_system, create
src/integration/thread_system_adapter.cpp Use create() factory instead of make_shared

How

Test Plan

  • Minimal Build passes (previously failing at network_system_bridge.cpp:346)
  • All CI workflows pass on develop

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
@kcenon
Copy link
Copy Markdown
Owner Author

kcenon commented Apr 13, 2026

CI/CD Failure Analysis

Analysis Time: 2026-04-13 20:30:00 UTC
Attempt: #1

Failed Workflows

Workflow Job Step Status
Minimal Build macos-latest - Debug Build Failed
Minimal Build macos-latest - Release Build Failed
Minimal Build ubuntu-latest - Debug Build Failed
Minimal Build ubuntu-latest - Release Build Failed

Root Cause Analysis

Primary Error:

no matching function for call to 'construct_at(kcenon::network::internal::dtls_socket*&,
  asio::basic_datagram_socket<asio::ip::udp>, ssl_ctx_st*&)'

Analysis:
PR #962 migrated dtls_socket to the Result factory pattern — the constructor was
made private (expects 4 args: socket, SSL*, BIO*, BIO*) and a public static
create(socket, SSL_CTX*) factory method was added. However, two UDP call sites were
not updated and still call std::make_shared<internal::dtls_socket>(socket, ssl_ctx).

Identified Issues:

  1. libs/network-udp/src/secure_messaging_udp_client.cpp:300make_shared with private ctor
  2. libs/network-udp/src/secure_messaging_udp_server.cpp:352make_shared with private ctor

Proposed Fix

Issue Proposed Solution Files Affected
Client ctor call Use dtls_socket::create() factory + Result error handling secure_messaging_udp_client.cpp
Server ctor call Use dtls_socket::create() factory + null return on failure secure_messaging_udp_server.cpp

Next Steps

  • Apply proposed fixes
  • Push and monitor CI

Automated failure analysis - Attempt #1

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
Copy link
Copy Markdown
Owner Author

kcenon commented Apr 13, 2026

CI/CD Failure Analysis - Attempt #2

Previous Attempt Result: Failed (macOS Debug/Release)
Previous Fix Applied: Updated dtls_socket call sites in UDP client/server to use create() factory

New Failure Analysis

Workflow Job Step Previous Status Current Status
Minimal Build macos-latest - Debug Build Fixed (dtls_socket) New Failure
Minimal Build macos-latest - Release Build Fixed (dtls_socket) New Failure
Minimal Build ubuntu-latest - Debug Build Fixed (dtls_socket) Pending
Minimal Build ubuntu-latest - Release Build Fixed (dtls_socket) Pending

What Changed

Previous Fix:

  • Replaced std::make_shared<dtls_socket> with dtls_socket::create() factory in UDP files

Why It Still Fails:

  • Additional call sites not updated for Result factory migration in thread pool adapters

New Root Cause

Error 1: thread_pool_adapters.h:280-288 — Missing namespace qualification

error: no template named 'Result'; did you mean 'common::Result'?
error: use of undeclared identifier 'error_codes'
error: use of undeclared identifier 'ok'; did you mean 'common::ok'?

Error 2: test_thread_pool_adapters.cpp:204,313 — Calling private constructors

error: calling a private constructor of class 'network_to_common_thread_adapter'
error: calling a private constructor of class 'common_to_network_thread_adapter'

Updated Proposed Fix

Issue Proposed Solution Files Affected
Missing namespace Add ::kcenon::common:: qualification to Result, error_codes, ok thread_pool_adapters.h
Private ctor in tests Use create() factory + Result checks test_thread_pool_adapters.cpp

Automated failure analysis - Attempt #2 of 3

kcenon added 2 commits April 14, 2026 05:32
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.
Replace remaining std::make_shared calls with create() factory in
AdapterIntegrationTest for both network_to_common_thread_adapter
and common_to_network_thread_adapter.
@kcenon
Copy link
Copy Markdown
Owner Author

kcenon commented Apr 13, 2026

CI/CD Failure Analysis - Attempt #3

Previous Attempt Result: Failed (macOS Debug/Release)
Previous Fix Applied: Namespace qualification in thread_pool_adapters.h + test SetUp/null tests updated

What Changed

Previous Fix (Attempt #2):

  • Fixed common_to_network_thread_adapter::create() namespace qualification
  • Updated NetworkToCommonAdapterTest::SetUp() and CommonToNetworkAdapterTest::SetUp()
  • Updated null-argument tests

Why It Still Failed:

  • Additional make_shared calls in AdapterIntegrationTest (lines 412, 415, 431, 432) were missed

Fix Applied

Updated all remaining std::make_shared calls in integration tests to use create() factory:

  • AdapterIntegrationTest::RoundTripAdaptation (lines 412, 415)
  • AdapterIntegrationTest::RoundTripWorkerCount (lines 431, 432)

Verified: no make_shared<network_to_common_thread_adapter> or make_shared<common_to_network_thread_adapter> calls remain in test source files.


Automated failure analysis - Attempt #3 of 3 (final)

@kcenon
Copy link
Copy Markdown
Owner Author

kcenon commented Apr 13, 2026

Auto-fix Summary

Attempted fixes: 3
Status: Manual intervention required

Attempted Fixes

  1. `c4c0e78a` fix(udp): update dtls_socket call sites — Fixed UDP client/server compilation
  2. `97e6d6a0` fix(adapters): qualify Result types and update tests — Fixed thread_pool_adapters.h namespace + SetUp tests
  3. `7d898f70` fix(test): update integration tests — Fixed AdapterIntegrationTest make_shared calls

Current Failures (Attempt #3)

The Result factory migration from PR #962 made constructors private across many bridge/adapter classes, but test files were not updated. The scope is significantly larger than the original 2-file fix:

Test File Private Ctor Calls Class
test_thread_pool_bridge.cpp ~15 instances ThreadPoolBridge
test_network_system_bridge.cpp ~15 instances NetworkSystemBridge
test_observability_bridge.cpp ~12 instances ObservabilityBridge

Each instance needs:

  1. Replace std::make_shared<Class>(args) with Class::create(args)
  2. Unwrap the Result<T> return (check is_ok(), extract .value())
  3. Update null-argument tests from EXPECT_THROW to Result error checks

Recommendation

This PR's scope should be expanded to cover all test files affected by the Result migration, or a follow-up PR should address the remaining ~42 test call sites.

Please review manually.

@kcenon kcenon added the needs-manual-review Automated fixes failed, requires human intervention label Apr 13, 2026
@kcenon
Copy link
Copy Markdown
Owner Author

kcenon commented Apr 13, 2026

CI/CD Failure Analysis

Analysis Time: 2026-04-14 06:30 UTC
Attempt: #1

Failed Workflows

Workflow Job Step Status
Integration Tests macos-latest - Release Build Failed
Integration Tests macos-latest - Debug Build Failed
Integration Tests ubuntu-latest - Release Build Failed
Integration Tests ubuntu-latest - Debug Build Failed

Root Cause Analysis

Primary Error:

tests/unit/test_thread_pool_bridge.cpp:91:9: error: calling a private constructor of class 'ThreadPoolBridge'
tests/unit/test_thread_pool_bridge.cpp:227:21: error: member reference type 'Result<std::shared_ptr<ThreadPoolBridge>>' is not a pointer

Analysis:
PR #962 migrated ThreadPoolBridge to use the Result pattern:

  1. Constructor moved to private — callers must use create() factory method
  2. from_thread_system() now returns Result<std::shared_ptr<ThreadPoolBridge>> instead of raw std::shared_ptr
  3. from_common_system() similarly returns Result<std::shared_ptr<ThreadPoolBridge>>

The test file tests/unit/test_thread_pool_bridge.cpp was not updated to reflect these API changes.

Identified Issues:

  1. Direct constructor calls (lines 91, 96) — must use create() factory
  2. std::make_shared<ThreadPoolBridge>(...) usage throughout — must use create() factory
  3. from_thread_system() return value used as raw pointer (lines 224-230) — must unwrap Result<T>
  4. ASSERT_NE(bridge, nullptr) on Result<T> — incompatible types

Proposed Fix

Issue Proposed Solution Files Affected
Private constructor calls Replace with ThreadPoolBridge::create() + .value() tests/unit/test_thread_pool_bridge.cpp
make_shared usage Replace with ThreadPoolBridge::create() + .value() tests/unit/test_thread_pool_bridge.cpp
from_thread_system() unwrap Use ASSERT_TRUE(bridge_result.is_ok()) then bridge_result.value() tests/unit/test_thread_pool_bridge.cpp

Next Steps

  • Apply proposed fixes to test file
  • Verify locally (if possible)
  • Push and monitor CI

Automated failure analysis - Attempt #1

…ation

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.
@kcenon
Copy link
Copy Markdown
Owner Author

kcenon commented Apr 13, 2026

CI/CD Failure Analysis - Attempt #2

Previous Attempt Result: Failed
Previous Fix Applied: Updated test_thread_pool_bridge.cpp for Result factory migration

New Failure Analysis

Workflow Job Step Previous Status Current Status
Integration Tests ubuntu-latest - Debug Build Fixed (thread_pool_bridge) New Failure
Integration Tests ubuntu-latest - Release Build Fixed (thread_pool_bridge) New Failure
Integration Tests macos-latest - Debug Build Fixed (thread_pool_bridge) New Failure
Integration Tests macos-latest - Release Build Fixed (thread_pool_bridge) New Failure

What Changed

Previous Fix:

  • Updated test_thread_pool_bridge.cpp to use ThreadPoolBridge::create() factory instead of private constructor

Why It Still Fails:

  • Two additional test files also use private constructors from the Result migration:
    1. test_network_system_bridge.cpp — uses make_shared<ThreadPoolBridge> in SetUp()
    2. test_observability_bridge.cpp — uses make_shared<ObservabilityBridge> + direct constructor calls

New Root Cause

Error:

test_network_system_bridge.cpp: error: 'ThreadPoolBridge::ThreadPoolBridge(...)' is private
test_observability_bridge.cpp: error: 'ObservabilityBridge::ObservabilityBridge(...)' is private

Analysis:
Both ThreadPoolBridge and ObservabilityBridge had their constructors made private in PR #962.
All test files using direct construction must migrate to ::create() factory methods.

Updated Proposed Fix

Issue Proposed Solution Files Affected
ThreadPoolBridge private ctor in SetUp Use ThreadPoolBridge::create().value() test_network_system_bridge.cpp
ObservabilityBridge direct ctor calls Use ObservabilityBridge::create().value() test_observability_bridge.cpp
ObservabilityBridge null-arg EXPECT_THROW Use EXPECT_TRUE(result.is_err()) test_observability_bridge.cpp
from_common_system EXPECT_THROW Use EXPECT_TRUE(result.is_err()) test_observability_bridge.cpp

Automated failure analysis - Attempt #2 of 3

kcenon added 2 commits April 14, 2026 06:13
Update test_network_system_bridge.cpp and test_observability_bridge.cpp
to use create() factory methods instead of private constructors for
ThreadPoolBridge and ObservabilityBridge.
Replace direct constructor calls with dtls_socket::create() factory
method. Update null context test to check Result error instead of
expecting exception.
@kcenon
Copy link
Copy Markdown
Owner Author

kcenon commented Apr 13, 2026

CI/CD Failure Analysis - Attempt #3

Previous Attempt Result: Failed
Previous Fix Applied: Updated test_network_system_bridge.cpp and test_observability_bridge.cpp

New Failure Analysis

Workflow Job Step Previous Status Current Status
Integration Tests all platforms Build Fixed (bridge tests) New Failure

What Changed

Previous Fix:

  • Updated bridge test files to use factory methods

New Root Cause:

  • test_dtls_socket.cpp also uses make_shared<dtls_socket> with a now-private constructor
  • Same Result factory migration pattern as bridge classes

Fix Applied

Issue Solution Files Affected
dtls_socket private constructor Use dtls_socket::create().value() tests/unit/test_dtls_socket.cpp
Null context EXPECT_THROW Use EXPECT_TRUE(result.is_err()) tests/unit/test_dtls_socket.cpp

All Test Files Updated in This PR

File Status
tests/unit/test_thread_pool_bridge.cpp Fixed (commit 1)
tests/unit/test_network_system_bridge.cpp Fixed (commit 2)
tests/unit/test_observability_bridge.cpp Fixed (commit 2)
tests/unit/test_dtls_socket.cpp Fixed (commit 3)

Automated failure analysis - Attempt #3 of 3

kcenon added 3 commits April 14, 2026 06:34
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.
Remove session parameters from client adapter callback lambdas to match
simplified i_protocol_client interface where callbacks no longer receive
shared_ptr<i_session>.
Update on_disconnected to on_disconnect and accept_callback_t
signature from string_view to unique_ptr<i_connection>.
@kcenon
Copy link
Copy Markdown
Owner Author

kcenon commented Apr 13, 2026

CI/CD Failure Analysis

Analysis Time: 2026-04-13 21:55 UTC
Attempt: #6

Failed Workflows

Workflow Job Step Status
Build & Test All 4 platform jobs Build Failed

Root Cause Analysis

Primary Errors:

test_tcp_listener_adapter.cpp:41: error: no member named 'on_disconnected' in 'listener_callbacks'; did you mean 'on_disconnect'?
test_tcp_listener_adapter.cpp:49: error: no viable conversion from lambda to 'accept_callback_t' (aka 'function<void (unique_ptr<i_connection>)>')

Same errors in test_udp_listener_adapter.cpp.

Analysis: The listener_callbacks struct uses on_disconnect (not on_disconnected), and accept_callback_t takes std::unique_ptr<i_connection> (not std::string_view). Both listener adapter test files used the old naming/signatures.

Fix Applied (Commit 0a04c66)

Issue Fix Files
on_disconnected member name Changed to on_disconnect test_tcp_listener_adapter.cpp, test_udp_listener_adapter.cpp
accept_callback_t signature Changed lambda from std::string_view to std::unique_ptr<i_connection> Same 2 files

Automated failure analysis - Attempt #6

Remove bool-returning validate_size that conflicted with
validation_result-returning version. Update test assertions
to use validation_result comparisons.
@kcenon
Copy link
Copy Markdown
Owner Author

kcenon commented Apr 13, 2026

CI/CD Failure Analysis

Analysis Time: 2026-04-13 22:08 UTC
Attempt: #7

Failed Workflows (Attempt #6)

Workflow Job Step Status
Build & Test All 4 platform jobs Build Failed

Root Cause Analysis

Primary Error:

message_validator.h:143: error: functions that differ only in their return type cannot be overloaded

Analysis: validate_size() was defined twice — once returning bool (line 130) and once returning validation_result (line 143). C++ does not allow overloading by return type alone. This was a leftover from the Result/validation_result migration where the old bool version was not removed.

Fix Applied (Commit fa2e9f2)

Issue Fix Files
Duplicate validate_size overload Removed bool version, kept validation_result version message_validator.h
Tests using EXPECT_TRUE/FALSE with bool return Updated to EXPECT_EQ with validation_result test_input_validation.cpp, message_validator_extended_test.cpp

Automated failure analysis - Attempt #7

@kcenon kcenon merged commit 7df8e13 into develop Apr 13, 2026
7 checks passed
@kcenon kcenon deleted the fix/issue-957-ci-fixes branch April 13, 2026 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-manual-review Automated fixes failed, requires human intervention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant