Fix pending channel is attached #17
Merged
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.
This pull request introduces a new mechanism for channels to distinguish when they are loaded from a "pending local state" (i.e., they were never attached and their handle was never stored in an attached DDS). This allows channels to correctly report their attachment status and handle connection state accordingly. The changes span API updates, core logic modifications, and test adjustments.
API and Interface Updates
loadingFromPendingStateproperty to theIChannelServicesinterface and related types, with documentation explaining its purpose. This enables channels to know if they are being loaded from pending local state and should not report as attached. (packages/runtime/datastore-definitions/src/channel.ts[1]packages/runtime/datastore-definitions/api-report/datastore-definitions.legacy.alpha.api.md[2]packages/runtime/datastore-definitions/api-report/datastore-definitions.legacy.beta.api.md[3]packages/runtime/datastore/src/channelContext.ts[4]Core Logic Changes
SharedObjectCore.load()method to checkloadingFromPendingState. If true, it skips binding and only sets the connection state, ensuringisAttached()remains false for channels never actually attached. (packages/dds/shared-object-base/src/sharedObject.tspackages/dds/shared-object-base/src/sharedObject.tsL303-R313)loadingFromPendingStateflag through the stack, ensuring correct behavior for pending channels. (packages/runtime/datastore/src/dataStoreRuntime.ts[1] [2] [3];packages/runtime/datastore/src/localChannelContext.ts[4] [5];packages/runtime/datastore/src/channelContext.ts[6] [7]Test and Validation Updates
loadingFromPendingStateproperty when constructing channel services, ensuring test coverage for the new logic. (packages/dds/shared-object-base/src/test/attachingBindingAndConnecting.spec.ts[1] [2] [3]FluidDataStoreRuntimedue to the new flag. (packages/runtime/datastore/src/test/types/validateDatastorePrevious.generated.tspackages/runtime/datastore/src/test/types/validateDatastorePrevious.generated.tsR28)package.jsonto declare expected forward compatibility break forFluidDataStoreRuntime. (packages/runtime/datastore/package.jsonpackages/runtime/datastore/package.jsonL161-R165)Miscellaneous
packages/test/local-server-stress-tests/src/stressDataObject.ts[1] [2]These changes ensure that channels loaded from pending state behave correctly and do not incorrectly report as attached, improving consistency and reliability in scenarios involving local, uncommitted channel state.