Skip to content

Conversation

@znewton
Copy link
Contributor

@znewton znewton commented Nov 3, 2025

Description

Portion of #25597 to dedupe OdspClient functionality from partner codebase.

This PR exposes existing serialize and rehydrate functionality via OdspClient.rehydrateContainer() and OdspFluidContainer.serialize()

Reviewer Guidance

The serialize functionality has a lot of tests in the code currently, but likely need more from an end-to-end standpoint for cross compat, or we can document that the serialized container only works for the current fluid version?

@github-actions github-actions bot added area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct base: main PRs targeted against main branch labels Nov 3, 2025
@github-actions github-actions bot added the public api change Changes to a public API label Nov 3, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

🔗 Found some broken links! 💔

Run a link check locally to find them. See
https://github.com/microsoft/FluidFramework/wiki/Checking-for-broken-links-in-the-documentation for more information.

linkcheck output


> [email protected] 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"


> [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

 ELIFECYCLE  Command failed with exit code 1.

/**
* Serialize a detached container to a string representation. This can be saved for later rehydration.
*/
serialize(): string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Couple thoughts:

  1. IMO it's a flaw in the underlying API that we have diverging paths for detached containers (serialize/rehydrate) as compared to attached containers (getPendingLocalState and load props). Probably not reasonable to fix on your timeline, but just to set context.
  2. The API naming has always been awful too, but at least that's easier to paper over. So I'd suggest renaming at this layer to both:
    1. More clearly indicate that this is for detached containers only (such that throwing for non-detached containers isn't a surprise)
    2. More clearly pair it with its partner API, rehydrate.

Brainstorming some options:

  1. dehydrateDetachedContainer/rehydrateDetachedContainer
  2. saveDetachedContainer/loadDetachedContainer
  3. serializeDetachedContainer/loadFromSerialized

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, thank you for the naming context. I'm liking the direction of serializeDetachedContainer/loadFromSerialized. Maybe serializeDetachedContainer/createFromSerializedContainer?

"Cannot serialize container. Container must be in detached state and not closed.",
);
}
return this.container.serialize();
Copy link
Contributor

Choose a reason for hiding this comment

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

Serialization implies a compatibility contract against the outputted serialized form, e.g. if the customer serializes to a string, saves that somewhere, updates to a newer version of Fluid, then tries to use that serialized form to load -- probably needs to work within some support window.

  1. I don't know if we've discussed what that support window/contract is today for its current legacy/beta tagging on IContainer
  2. I suspect that since this PR exposes it on a public API, it might increase that window/contract.

We should at least document the lifespan/expectation of compat that we're giving as we expose this API, if not include more programmatic safeguards like timebomb/version checks.

This might merit some discussion, definitely also get @anthony-murphy 's opinion as it also includes the serialized form from getPendingLocalState.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe this PR is exposing it only through ODSP's FluidContainer, so it's Beta, but let me know if I missed something.

I agree the timing window is tricky. For the current usecase, they are basically serializing a "guest" user, logging in, then pretty immediately loading from that serialized state via localStorage.

I would think we could, for now, possibly say "only compatible with current version and tree schema" then improve that compatibility over time, rather than spending a lot of effort right now to meet some arbitrary goal.

/**
* Serialize the container to a string representation. This can be saved for later rehydration.
*/
serialize(): string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Serializing isn't service specific, so I'd expect to find it on IFluidContainer (even if AzureClient doesn't have a method to rehydrate).

Copy link
Contributor Author

@znewton znewton Nov 11, 2025

Choose a reason for hiding this comment

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

It is on IFluidContainer (internal version), but this is a way to expose some functionality of IFluidContainer with beta rather than public exposure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct base: main PRs targeted against main branch public api change Changes to a public API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants