Skip to content

refactor(csharp): cleanup tcp connection after vsr implementation - #3858

Open
lukaszzborek wants to merge 19 commits into
masterfrom
dotnet-vsr-cleanup
Open

refactor(csharp): cleanup tcp connection after vsr implementation#3858
lukaszzborek wants to merge 19 commits into
masterfrom
dotnet-vsr-cleanup

Conversation

@lukaszzborek

Copy link
Copy Markdown
Contributor

Follow-up cleanup of the .NET SDK TCP transport after the VSR support landed

@github-actions github-actions Bot added the S-waiting-on-review PR is waiting on a reviewer label Aug 10, 2026
@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.29571% with 74 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.15%. Comparing base (e71e3c6) to head (eb05031).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
foreign/csharp/Iggy_SDK/Vsr/VsrConnection.cs 82.22% 26 Missing and 6 partials ⚠️
...IggyClient/Implementations/TcpMessageStream.Vsr.cs 71.01% 14 Missing and 6 partials ⚠️
...SDK/IggyClient/Implementations/TcpMessageStream.cs 92.06% 6 Missing and 4 partials ⚠️
foreign/csharp/Iggy_SDK/Consumers/IggyConsumer.cs 85.10% 2 Missing and 5 partials ⚠️
foreign/csharp/Iggy_SDK/Utils/ArrayPoolHelper.cs 75.00% 2 Missing and 1 partial ⚠️
...n/csharp/Iggy_SDK/Consumers/IggyConsumer.Rented.cs 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3858      +/-   ##
============================================
- Coverage     83.67%   83.15%   -0.52%     
+ Complexity     1358     1340      -18     
============================================
  Files          1212     1220       +8     
  Lines        165138   164377     -761     
  Branches     132612   132688      +76     
============================================
- Hits         138181   136695    -1486     
- Misses        23308    23928     +620     
- Partials       3649     3754     +105     
Components Coverage Δ
Rust Core 83.81% <ø> (-0.63%) ⬇️
Java SDK 66.54% <ø> (-0.13%) ⬇️
C# SDK 74.96% <83.21%> (-1.12%) ⬇️
Python SDK 90.00% <ø> (ø)
PHP SDK 84.48% <ø> (ø)
Node SDK 95.82% <ø> (-0.02%) ⬇️
Go SDK 69.04% <ø> (+0.72%) ⬆️
Files with missing lines Coverage Δ
foreign/csharp/Iggy_SDK/Mappers/BinaryMapper.cs 90.40% <100.00%> (-1.79%) ⬇️
...n/csharp/Iggy_SDK/Utils/TcpMessageStreamHelpers.cs 94.28% <ø> (+9.50%) ⬆️
foreign/csharp/Iggy_SDK/Vsr/ConsensusSession.cs 99.00% <100.00%> (-1.00%) ⬇️
...n/csharp/Iggy_SDK/Consumers/IggyConsumer.Rented.cs 68.69% <0.00%> (-4.99%) ⬇️
foreign/csharp/Iggy_SDK/Utils/ArrayPoolHelper.cs 75.00% <75.00%> (ø)
foreign/csharp/Iggy_SDK/Consumers/IggyConsumer.cs 73.57% <85.10%> (+7.89%) ⬆️
...SDK/IggyClient/Implementations/TcpMessageStream.cs 79.05% <92.06%> (-1.87%) ⬇️
...IggyClient/Implementations/TcpMessageStream.Vsr.cs 72.72% <71.01%> (+0.82%) ⬆️
foreign/csharp/Iggy_SDK/Vsr/VsrConnection.cs 82.22% <82.22%> (ø)

... and 161 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lukaszzborek

Copy link
Copy Markdown
Contributor Author

If possible, merge #3836 first. Then I will remove things with namespace which I refactoring 😅

@hubcio hubcio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solid direction overall - classic framing gone, the VsrConnection extraction, typed namespaces and the epoch rejoin are real improvements. blocking items are the probe losing its reconnect, the never-nulled _connection, the fail-open namespace and the edge-based Disconnected clear; the rest is small.

one thing outside the diff: SetConnectionStateAsync (TcpMessageStream.cs:1153) is a non-atomic check-then-set with the publish after the write, reachable from callers holding different locks - concurrent transitions can publish duplicates or a PreviousState that never actually preceded CurrentState. it predates this PR, and fixing it properly means moving the publish behind an ordered queue (holding a lock across the publish is not an option - the handler chain runs synchronously into socket I/O when the semaphores are uncontended, so a sync write fault re-enters the same lock). follow-up material, but it is the substrate under the Disconnected-clear race flagged inline.

Comment thread foreign/csharp/Iggy_SDK/IggyClient/Implementations/TcpMessageStream.cs Outdated
Comment thread foreign/csharp/Iggy_SDK/Vsr/VsrNamespace.cs Outdated
Comment thread foreign/csharp/Iggy_SDK/Consumers/IggyConsumer.cs Outdated
Comment thread foreign/csharp/Iggy_SDK/IggyClient/Implementations/TcpMessageStream.Vsr.cs Outdated
Comment thread foreign/csharp/Iggy_SDK/Vsr/VsrConnection.cs Outdated
Comment thread foreign/csharp/Iggy_SDK/Vsr/VsrConnection.cs Outdated
Comment thread foreign/csharp/Iggy_SDK/IggyClient/Implementations/TcpMessageStream.cs Outdated
Comment thread foreign/csharp/Iggy_SDK/Consumers/IggyConsumer.cs
@github-actions github-actions Bot added S-waiting-on-author PR is waiting on author response and removed S-waiting-on-review PR is waiting on a reviewer labels Aug 11, 2026
# Conflicts:
#	foreign/csharp/Iggy_SDK/Vsr/VsrHeader.cs
#	foreign/csharp/Iggy_SDK/Vsr/VsrNamespace.cs
#	foreign/csharp/Iggy_SDK_Tests/VsrTests/VsrHeaderTests.cs
#	foreign/csharp/Iggy_SDK_Tests/VsrTests/VsrNamespaceTests.cs
# Conflicts:
#	foreign/csharp/Iggy_SDK/IggyClient/Implementations/TcpMessageStream.cs
@lukaszzborek

Copy link
Copy Markdown
Contributor Author

/ready

@github-actions github-actions Bot added S-waiting-on-review PR is waiting on a reviewer and removed S-waiting-on-author PR is waiting on author response labels Aug 13, 2026
# Conflicts:
#	foreign/csharp/Iggy_SDK/IggyClient/Implementations/TcpMessageStream.cs
#	foreign/csharp/Iggy_SDK_Tests/MapperTests/BinaryMapper.cs
# Conflicts:
#	foreign/csharp/Iggy_SDK/IggyClient/Implementations/TcpMessageStream.cs
# Conflicts:
#	foreign/csharp/Iggy_SDK/IggyClient/Implementations/TcpMessageStream.Vsr.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review PR is waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants