Skip to content

Conversation

@anthony-murphy
Copy link
Owner

@anthony-murphy anthony-murphy commented Jan 14, 2026

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

  • Added the optional loadingFromPendingState property to the IChannelServices interface 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

  • Updated the SharedObjectCore.load() method to check loadingFromPendingState. If true, it skips binding and only sets the connection state, ensuring isAttached() remains false for channels never actually attached. (packages/dds/shared-object-base/src/sharedObject.ts packages/dds/shared-object-base/src/sharedObject.tsL303-R313)
  • Modified channel context creation and rehydration logic to propagate the loadingFromPendingState flag 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

Miscellaneous

  • Minor refactorings and comment updates in stress test code for clarity and correctness. (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.

anthony-murphy-agent and others added 2 commits January 13, 2026 19:18
- Add eslint-disable for prefer-const (variable is reassigned after async)
- Format if condition per biome requirements

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: anthony-murphy <[email protected]>
Channels loaded via loadPendingChannels() were incorrectly reporting
isAttached()=true when they should report false because they were
never actually attached (their handles were referenced but not stored
in an attached DDS).

This fix adds a loadingFromPendingState flag that propagates through
the channel loading path. When set, SharedObject.load() skips the
setBoundAndHandleAttach() call, keeping _isBoundToContext=false so
isAttached() returns false.

This resolves stress test failures when comparing a live client against
a frozen container loaded from pending state.

Co-Authored-By: anthony-murphy <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
@github-actions
Copy link

🔗 No broken links found! ✅

Your attention to detail is admirable.

linkcheck output


> [email protected] ci:check-links /home/runner/work/FluidFramework-1/FluidFramework-1/docs
> start-server-and-test "npm run serve -- --no-open" 3000 check-links

1: starting server using command "npm run serve -- --no-open"
and when url "[ 'http://127.0.0.1:3000' ]" is responding with HTTP status code 200
running tests using command "npm run check-links"


> [email protected] serve
> docusaurus serve --no-open

[SUCCESS] Serving "build" directory at: http://localhost:3000/

> [email protected] check-links
> linkcheck http://localhost:3000 --skip-file skipped-urls.txt

Crawling...

Stats:
  248787 links
    1796 destination URLs
    2036 URLs ignored
       0 warnings
       0 errors


@anthony-murphy anthony-murphy merged commit 4dd6329 into anthony-murphy:sm-pendingState-attachments Jan 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants