feat(client): make reconnect behavior policy-driven - #602
Merged
Conversation
SunSi12138
force-pushed
the
issue-592-reconnect-policy
branch
4 times, most recently
from
September 8, 2026 11:30
c7e7952 to
21487e5
Compare
SunSi12138
commented
Sep 8, 2026
SunSi12138
left a comment
Owner
Author
There was a problem hiding this comment.
Two engineering-significant correctness findings in the reconnect state model: a valid zero monotonic timestamp is currently treated as “no Ready history”, and reconnect-success reconciliation can mix fields/semantics from two policy generations if an update lands between repeated generation.Policy reads. Inline details below; otherwise I did not find a reason to broaden scope.
SunSi12138
force-pushed
the
issue-592-reconnect-policy
branch
from
September 8, 2026 12:08
9bdf941 to
52ee9e5
Compare
SunSi12138
commented
Sep 8, 2026
SunSi12138
left a comment
Owner
Author
There was a problem hiding this comment.
The two earlier findings are fixed on the current head. One additional lifecycle-state correctness issue surfaced while checking the rollback path: a failed Ready publication can leave fabricated stable-ready history. Inline below; the dynamic path has the same ordering.
Complete runtime reconnect policy semantics across fixed, static, and dynamic topologies. Preserve topology-owned backoff and Ready history across policy publication, linearize completion to one effective policy snapshot, represent timestamp-zero history explicitly, and anchor stable-reset history only after Ready reconciliation succeeds. Add deterministic fake-time coverage for policy updates, lifecycle races, topology/pool changes, and Ready-publication rollback.
SunSi12138
force-pushed
the
issue-592-reconnect-policy
branch
from
September 8, 2026 13:19
306fe1e to
0c49b62
Compare
SunSi12138
marked this pull request as ready for review
September 8, 2026 13:34
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.
Closes #592
Summary
SharpLinkReconnectPolicycovering initial delay, max backoff, multiplier, jitter bounds, and stable-reset window.SharpClientBuilder.UseReconnectPolicy(...)plus runtimeGetReconnectPolicy()/UpdateReconnectPolicy(...).InitialDelayor loweredMaxBackoff, retain position when bounds expand, and use the latest multiplier/jitter for subsequent scheduling.StableResetWindowchanges evaluate existing monotonic history rather than manufacturing a new stable period.doc/client-reconnect-policy.md.Review follow-up
Engineering review identified three reconnect-state correctness issues; all are fixed in the final head.
_hasReconnectReadyTimestamp; static/dynamic endpoint states use explicitHasReadyTimestampstate with mark/clear operations. A validTimeProvider.GetTimestamp() == 0is preserved, and later Ready publications do not shift an already-active stability anchor.completionPolicy = generation.Policyexactly once after the attempt and use that immutable object for the entire state transition throughResolveReconnectCompletionDelay. A runtime publication cannot combineStableResetWindowfrom one successor generation withInitialDelay/backoff semantics from another within a single completion transition.MarkReadyTimestamp(...)only afterReconcileResponseCompressionPreferenceAfterReadyPublication(...)succeeds. If reconciliation rolls the candidate connection/snapshot back, no Ready-history anchor is committed. A later successful reconnect therefore starts its stability window from the real successful Ready publication.The obsolete
ReconnectPolicyChanged()topology reset seam was also removed so ordinary policy publication has no path that zeroes live backoff state.All three inline review threads were replied to and resolved after exact-head validation.
Validation coverage
Deterministic fake-time/unit coverage includes:
InitialDelayincrease/decrease andMaxBackoffincrease/decrease mid-streakFinal branch / CI evidence
Final branch is based directly on
dev@09d6804c026dc2456d68e96a7ccf31487589334eand is one commit ahead / zero behind. Temporary issue-592 validation workflow/script files are absent from the final diff.Exact head:
0c49b62817e7ea6f1c62dcfa3e48cbf08b4d6e9b34231236789— success: formatting, maintainability, Release build, generated-assembly boundary, full Unit/Generator/Load suites, and deterministic allocation gate.34231236723— success.34231236698— success.34231236705— success.Maintainability
Reconnect scheduling remains inside
StaticClusterRuntime's existing single-gate lifecycle owner. The repository's narrow maintainability-baseline mechanism carriesmaxLoc: 850for this file, explicitly tied to #592 and the broader topology-decomposition debt tracked by #350. The maintainability gate and its own tests pass on the final exact head.This PR intentionally remains Draft for maintainer review.