Skip to content

feat: replace onReconnect with onTransportRestore#10

Merged
maxence2997 merged 6 commits intomainfrom
feature/transport-restore
Mar 24, 2026
Merged

feat: replace onReconnect with onTransportRestore#10
maxence2997 merged 6 commits intomainfrom
feature/transport-restore

Conversation

@maxence2997
Copy link
Contributor

Summary

  • Remove onReconnect from ClientConfig (fired before dial, weak semantics)
  • Add onTransportRestore — fires after successful reconnect
  • Breaking change at v0, aligns with contract update

Test plan

  • Updated scenario 3 and 5 tests
  • Added onTransportRestore fires after successful reconnect
  • Added onTransportRestore does not fire on initial connect
  • make check passes (lint + tests)
  • ./gradlew integrationTest passes

1.onReconnect fired before dial → replaced with onTransportRestore after connect
2.Updated integration tests for scenarios 3 and 5
3.Added unit tests for restore callback
Copilot AI review requested due to automatic review settings March 23, 2026 03:29
@github-actions github-actions bot added the feature New feature label Mar 23, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the client reconnection callback API by removing onReconnect (pre-dial, ambiguous semantics) and introducing onTransportRestore, which fires after a successful reconnect when the new transport is established. This aligns reconnect notifications with a clearer “transport is back” moment and updates the test suite accordingly.

Changes:

  • Remove onReconnect from ClientConfig and stop firing it in the reconnect loop.
  • Add onTransportRestore and invoke it after a successful reconnect.
  • Update integration/unit tests and add targeted tests for onTransportRestore behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/main/kotlin/com/wspulse/client/ClientConfig.kt Replaces onReconnect config hook with onTransportRestore and updates KDoc.
src/main/kotlin/com/wspulse/client/WspulseClient.kt Fires onTransportRestore after a successful reconnect, removing pre-dial onReconnect.
src/test/kotlin/com/wspulse/client/ClientIntegrationTest.kt Updates scenarios to wait for onTransportRestore and adjusts the close-during-reconnect signaling.
src/test/kotlin/com/wspulse/client/WspulseClientResourceTest.kt Updates reconnection-related unit test wiring and adds new tests for onTransportRestore.

1. Add "Replaces the former onReconnect callback" to
   onTransportRestore KDoc in ClientConfig.kt
2. Fix onTransportDrop comment in ClientIntegrationTest
   to clarify it fires before the reconnect loop starts
3. Update README table: onReconnect -> onTransportRestore
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

1.Variable was set but never asserted → added null check
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings March 24, 2026 03:50
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@maxence2997 maxence2997 merged commit b36ed57 into main Mar 24, 2026
8 checks passed
@maxence2997 maxence2997 deleted the feature/transport-restore branch March 24, 2026 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants