Skip to content

Generalize ContainerRuntime.loadRuntime to allow custom Registry#27685

Draft
CraigMacomber wants to merge 1 commit into
microsoft:mainfrom
CraigMacomber:loadRuntime-non-root-datastores
Draft

Generalize ContainerRuntime.loadRuntime to allow custom Registry#27685
CraigMacomber wants to merge 1 commit into
microsoft:mainfrom
CraigMacomber:loadRuntime-non-root-datastores

Conversation

@CraigMacomber

@CraigMacomber CraigMacomber commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Description

This reworks the @internal static ContainerRuntime.loadRuntime to accept a caller-provided IFluidDataStoreRegistry instead of raw registryEntries, converging it with the existing ContainerRuntime.loadRuntime2 (which already takes an IFluidDataStoreRegistry).

Previously loadRuntime constructed a FluidDataStoreRegistry from registryEntries internally and then delegated to loadRuntime2. This change moves that construction up into the public loadContainerRuntime wrapper, so the two static entry points now share a single registry model.

What changed:

  • ContainerRuntime.loadRuntime now takes Omit<LoadContainerRuntimeParams, "registryEntries" | "runtimeOptions"> plus registry: IFluidDataStoreRegistry (and internal runtimeOptions), and simply forwards to loadRuntime2. The new FluidDataStoreRegistry(...) construction moves up into loadContainerRuntime.
  • The public loadContainerRuntime / loadContainerRuntimeAlpha entry points are unchanged (they still take registryEntries and build the registry for you). Only the internal static API changed, so there are no API report changes and no changeset is included.
  • Adds a ContainerRuntime.loadRuntimeAPIVersion marker so that @fluidframework/test-utils — which calls this internal API across multiple package versions and can't special-case on package version — can detect which loadRuntime signature a given ContainerRuntime exposes.
  • Updates the call sites that wrap/override loadRuntime to match the new signature: mixinAttributor (@fluid-experimental/attributor) now wraps the incoming IFluidDataStoreRegistry (intercepting get() to inject the attributor factory) rather than appending to registryEntries; createTestContainerRuntimeFactory (@fluidframework/test-utils) and replayFluidFactories (@fluidframework/replay-tool) are updated as well, along with the affected unit and layer-compat tests.

Motivation

This is a self-contained cleanup factored out of #27078 ("Introduce Unified API for Fluid Client").

What this change buys is convergence: it moves the older loadRuntime — and everything built on it (mixinAttributor, test-utils, replay-tool) — onto the same IFluidDataStoreRegistry model that loadRuntime2 and the new ServiceClient already use. Without it, #27078 would leave behind two parallel loadRuntime variants with different registry models. As the code comment notes, once these callers are aligned the registryEntries-based loadRuntime can eventually be removed and loadRuntime2 renamed back to loadRuntime.

Reviewer Guidance

The review process is outlined on this wiki page.

  • This change only affects the @internal static ContainerRuntime.loadRuntime; the public loadContainerRuntime / loadContainerRuntimeAlpha signatures and all API reports are unchanged, so no changeset is included — please confirm you agree this needs no changeset.
  • The loadRuntimeAPIVersion marker plus the @fluidframework/test-utils update handle the cross-version compatibility this internal, layer-compat-relevant API requires; feedback on that approach is welcome.

Extends the loadRuntime API to accept an optional entryPointFactory that
enables the new ServiceClient pattern to set an arbitrary root data store
as the container entry point rather than always using the single hard-coded
root store. Also updates all call sites that pass a runtime creation
callback (testContainerRuntimeFactory, replayFluidFactories, mixinAttributor)
to match the revised signature, and adjusts the unit and compat tests to
reflect the new parameter.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Hi! Thank you for opening this PR. Want me to review it?

Based on the diff (159 lines, 6 files), I've queued these reviewers:

  • Correctness — logic errors, race conditions, lifecycle issues
  • Security — vulnerabilities, secret exposure, injection
  • API Compatibility — breaking changes, release tags, type design
  • Performance — algorithmic regressions, memory leaks
  • Testing — coverage gaps, hollow tests

How this works

  • Adjust the reviewer set by ticking/unticking boxes above. Reviewer toggles alone don't trigger anything.

  • Tick Start review below to dispatch the review fleet.

  • After review finishes, tick Start review again to request another run — it auto-resets after each dispatch.

  • This comment updates as new commits land; your reviewer selections are preserved.

  • Start review

* @returns An object containing the runtime.
*
* @privateRemarks
* By using loadRuntime2 instead of loadRuntime, this prevents mixinAttributor's overriding of loadRuntime from affecting this new API:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a change in implementation, but rather documenting a potentially confusing consequence of how this was implemented. I'm unclear if this was desired/intended, but I figured making it more clear would be good.

@CraigMacomber
CraigMacomber marked this pull request as ready for review July 14, 2026 03:51
Copilot AI review requested due to automatic review settings July 14, 2026 03:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

@github-actions

Copy link
Copy Markdown
Contributor

Bundle size comparison

Base commit: ba99c6256f67650704fb174c9ab23780bdf908b6
Head commit: e7204e02a0edf0d038af60251aa55b67c198887f

Notable changes

No bundles changed by ≥ 500 bytes parsed.

Per-bundle deltas

@fluid-example/bundle-size-tests

  • azureClient.js: parsed 619911 → 619994 (+83), gzip 164958 → 165010 (+52)
  • odspClient.js: parsed 592637 → 592720 (+83), gzip 159070 → 159123 (+53)
  • aqueduct.js: parsed 526400 → 526462 (+62), gzip 140839 → 140879 (+40)
  • fluidFramework.js: parsed 394142 → 394163 (+21), gzip 111926 → 111943 (+17)
  • sharedTree.js: parsed 383529 → 383543 (+14), gzip 109311 → 109322 (+11)
  • containerRuntime.js: parsed 304750 → 304792 (+42), gzip 83332 → 83355 (+23)
  • sharedString.js: parsed 175984 → 175991 (+7), gzip 49445 → 49453 (+8)
  • experimentalSharedTree.js: parsed 160798 → 160798 (0), gzip 45804 → 45804 (0)
  • matrix.js: parsed 159845 → 159852 (+7), gzip 45411 → 45418 (+7)
  • loader.js: parsed 145256 → 145270 (+14), gzip 39063 → 39076 (+13)
  • odspDriver.js: parsed 104329 → 104350 (+21), gzip 32625 → 32634 (+9)
  • directory.js: parsed 66616 → 66623 (+7), gzip 18532 → 18540 (+8)
  • 748.js: parsed 58793 → 58793 (0), gzip 17827 → 17827 (0)
  • map.js: parsed 46709 → 46716 (+7), gzip 14310 → 14317 (+7)
  • odspPrefetchSnapshot.js: parsed 45642 → 45656 (+14), gzip 15277 → 15286 (+9)
  • 985.js: parsed 44491 → 44491 (0), gzip 13726 → 13726 (0)
  • summarizerDelayLoadedModule.js: parsed 30749 → 30749 (0), gzip 7753 → 7753 (0)
  • socketModule.js: parsed 26476 → 26483 (+7), gzip 7887 → 7894 (+7)
  • createNewModule.js: parsed 12480 → 12480 (0), gzip 4786 → 4786 (0)
  • summaryModule.js: parsed 3797 → 3797 (0), gzip 1860 → 1860 (0)
  • connectionState.js: parsed 724 → 724 (0), gzip 429 → 429 (0)
  • sharedTreeAttributes.js: parsed 666 → 673 (+7), gzip 432 → 441 (+9)
  • debugAssert.js: parsed 429 → 429 (0), gzip 299 → 299 (0)
  • FluidFramework-HashFallback.js: parsed 422 → 422 (0), gzip 316 → 316 (0)

@CraigMacomber CraigMacomber changed the title Update ContainerRuntime.loadRuntime to support non-root data stores Generalize ContainerRuntime.loadRuntime to allow custom Registry Jul 14, 2026
@CraigMacomber
CraigMacomber marked this pull request as draft July 14, 2026 16:35
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