Skip to content

refactor(experimental-tree): extract ISharedTree interface, hide class from API#26496

Draft
tylerbutler wants to merge 3 commits intomicrosoft:mainfrom
tylerbutler:refactor/experimental-tree-internal
Draft

refactor(experimental-tree): extract ISharedTree interface, hide class from API#26496
tylerbutler wants to merge 3 commits intomicrosoft:mainfrom
tylerbutler:refactor/experimental-tree-internal

Conversation

@tylerbutler
Copy link
Member

Summary

Extract an ISharedTree interface from the SharedTree class in @fluid-experimental/tree so that the class no longer leaks SharedObject in the public API surface.

Changes

  • New file ISharedTree.ts: Defines the ISharedTree interface that extends ISharedObject<ISharedTreeEvents> and NodeIdContext, exposing only the public contract (properties like attributionId, logViewer, currentView, edits, and methods like applyEdit, mergeEditsFrom, revert, etc.)
  • index.ts: Exports the new ISharedTree type
  • SummaryTestUtilities.ts: Updated to use ISharedTree instead of the concrete SharedTree class
  • API report regenerated: experimental-tree.alpha.api.md now includes the ISharedTree interface

Why

This is part of a broader effort to stop leaking SharedObject (and its dependency chain including IChannelFactory, IFluidDataStoreRuntime, etc.) through the public API surface of DDS packages. By introducing an interface, external consumers interact with ISharedTree while internal code can continue using the concrete SharedTree class.

This follows the same pattern used by other DDSes in the Fluid Framework (SharedMap, SharedString, etc.).

Test plan

  • Package builds successfully (pnpm build @fluid-experimental/tree)
  • API report regenerated and checked in
  • CI passes all existing tests

…s from API

Extract ISharedTree interface from the SharedTree class so the class
no longer leaks SharedObject in the public API surface. Export SharedTree
as a const + type alias backed by the interface, following the same
pattern used by other DDSes.

Update internal consumers (LazyCheckout, MergeHealth, SummaryTestUtilities)
to use ISharedTree instead of the class directly.
…more consumers

Fix ISharedTreeEvents event name mismatch: the interface declared
'appliedSequencedEdit' but the class emits 'sequencedEditApplied'
(via SharedTreeEvent.SequencedEditApplied enum).

With the event name corrected, migrate MergeHealth.ts and
UndoRedoHandler.ts to use ISharedTree instead of the concrete
SharedTree class. Also update EditCommittedEventArguments and
SequencedEditAppliedEventArguments tree fields to ISharedTree.
…action APIs

Change Checkout.tree and Transaction.tree public properties from
SharedTree (concrete class) to ISharedTree (interface), removing the
class from the public API surface of these types.

Internally, both classes retain a private _concreteTree reference for
operations that require SharedTree-specific details (emit, instanceof).
@github-actions
Copy link
Contributor

🔗 No broken links found! ✅

Your attention to detail is admirable.

linkcheck output


> fluid-framework-docs-site@0.0.0 ci:check-links /home/runner/work/FluidFramework/FluidFramework/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"


> fluid-framework-docs-site@0.0.0 serve
> docusaurus serve --no-open

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

> fluid-framework-docs-site@0.0.0 check-links
> linkcheck http://localhost:3000 --skip-file skipped-urls.txt

Crawling...

Stats:
  257789 links
    1822 destination URLs
    2063 URLs ignored
       0 warnings
       0 errors


@tylerbutler tylerbutler self-assigned this Feb 20, 2026
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.

1 participant

Comments