Simplify OrderedClientElection by reading quorum directly#26693
Open
ChumpChief wants to merge 16 commits intomicrosoft:mainfrom
Open
Simplify OrderedClientElection by reading quorum directly#26693ChumpChief wants to merge 16 commits intomicrosoft:mainfrom
ChumpChief wants to merge 16 commits intomicrosoft:mainfrom
Conversation
Collapse OrderedClientCollection and OrderedClientElection into a single OrderedClientElection class that scans quorum directly instead of maintaining a doubly-linked list. SummarizerClientElection is unchanged. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ructure Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…vents Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… findNextEligibleParentAfter Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When the elected parent leaves, prefer electing the next younger eligible client rather than resetting to the oldest, matching the original behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…clone resetElectedClient compared _electedClient === _electedParent by object reference, but our init path creates separate ITrackedClient objects for the same client. Switch to clientId comparison. Also restore the shallow clone of client details from the original implementation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors summarizer election by removing the OrderedClientCollection layer and having OrderedClientElection read quorum membership directly, aiming to reduce duplicated client tracking while preserving election behavior.
Changes:
- Removed
OrderedClientCollectionand updatedOrderedClientElectionto observeIQuorumClientsdirectly. - Updated runtime wiring (
ContainerRuntime) to constructOrderedClientElectionwith delta manager + quorum. - Updated unit tests to match the new
OrderedClientElectioninternals and telemetry payloads.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/runtime/container-runtime/src/summary/orderedClientElection.ts | Replaces the internal ordered-client list with direct quorum iteration and quorum event handling. |
| packages/runtime/container-runtime/src/summary/index.ts | Removes OrderedClientCollection (and interface) exports from the summary module surface. |
| packages/runtime/container-runtime/src/containerRuntime.ts | Updates summarizer election initialization to use the new OrderedClientElection constructor signature. |
| packages/runtime/container-runtime/src/test/summary/orderedClientElection.spec.ts | Updates tests to construct OrderedClientElection directly and adjusts assertions/log expectations. |
| packages/runtime/container-runtime/src/test/summary/summarizerClientElection.spec.ts | Updates test setup to use the new OrderedClientElection constructor signature. |
packages/runtime/container-runtime/src/summary/orderedClientElection.ts
Outdated
Show resolved
Hide resolved
Remove the unnecessary `_electedClient !== undefined` guard so that a summarizer already in the quorum can be elected even when no interactive parent client exists, matching the original upstream initialization logic. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
OrderedClientCollectionintoOrderedClientElection, eliminating a layer of indirectionOrderedClientElectionnow reads quorum members directly instead of maintaining its own parallel sorted list of tracked clients, de-duplicating the client tracking that the Quorum already providesFollow-up PRs will do further cleanup and collapse
OrderedClientElectionintoSummarizerClientElection.Test plan
pnpm buildpasses (compilation, lint, api-extractor)OrderedClientCollectionexport🤖 Generated with Claude Code