improvement(client-ordered-collection): ConsensusQueueFactory generic#27497
improvement(client-ordered-collection): ConsensusQueueFactory generic#27497jason-ha wants to merge 1 commit into
Conversation
- Remove unused `IConsensusOrderedCollectionFactory` - Make `ConsensusQueueFactory` generic (assumes `unknown`) - Get specific on `create` & `load` return types - Remove most intended internal class use in test
|
Hi! Thank you for opening this PR. Want me to review it? Based on the diff (115 lines, 5 files), I've queued these reviewers:
How this works
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR updates the ordered-collection DDS factory to be generic, removes the now-unneeded IConsensusOrderedCollectionFactory type, and adjusts tests/fuzz utilities to rely less on internal classes and more on public legacy typings.
Changes:
- Removed
IConsensusOrderedCollectionFactoryfrominterfaces.tsand public exports. - Made
ConsensusQueueFactorygeneric and tightenedcreate/loadreturn types. - Updated tests/fuzz utilities to use
ConsensusQueueFactory<T>and legacy imports/types.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/dds/ordered-collection/src/test/fuzzUtils.ts | Updates fuzz model/state typings to use ConsensusQueueFactory<T>. |
| packages/dds/ordered-collection/src/test/consensusOrderedCollection.spec.ts | Switches test typings/imports to legacy public interfaces and adjusts class generics. |
| packages/dds/ordered-collection/src/interfaces.ts | Removes the IConsensusOrderedCollectionFactory interface definition. |
| packages/dds/ordered-collection/src/index.ts | Stops exporting IConsensusOrderedCollectionFactory. |
| packages/dds/ordered-collection/src/consensusOrderedCollectionFactory.ts | Introduces generic ConsensusQueueFactory<T> and updates ConsensusQueue shared-object-kind export. |
| export const ConsensusQueue = createSharedObjectKind<IConsensusOrderedCollection>( | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO: #22835 Use unknown instead of any (breaking change) | ||
| ConsensusQueueFactory<any>, | ||
| ); |
| ConsensusResult, | ||
| type IConsensusOrderedCollection, | ||
| type IConsensusOrderedCollectionEvents, | ||
| type IConsensusOrderedCollectionFactory, | ||
| type IOrderedCollection, | ||
| type ISnapshotable, | ||
| } from "./interfaces.js"; |
| export class ConsensusQueueFactory<T> | ||
| implements IChannelFactory<IConsensusOrderedCollection<T>> | ||
| { |
| }; | ||
|
|
||
| type FuzzTestState = DDSFuzzTestState<ConsensusQueueFactory>; | ||
| type FuzzTestState = DDSFuzzTestState<ConsensusQueueFactory<string>>; |
| */ | ||
| export const baseConsensusOrderedCollectionModel: DDSFuzzModel< | ||
| ConsensusQueueFactory, | ||
| ConsensusQueueFactory<unknown>, |
| creator: () => IConsensusOrderedCollection & | ||
| SharedObjectCore<IConsensusOrderedCollectionEvents<unknown>>, | ||
| processMessages: () => void, | ||
| ): void { | ||
| let testCollection: ConsensusOrderedCollection; | ||
| let testCollection: IConsensusOrderedCollection & | ||
| SharedObjectCore<IConsensusOrderedCollectionEvents<unknown>>; |
IConsensusOrderedCollectionFactoryConsensusQueueFactorygeneric (assumesunknown)create&loadreturn types