Skip to content

Shared Tree: Persisted Schema Format v2 with persisted metadata support #24590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 30 commits into
base: main
Choose a base branch
from

Conversation

TommyBrosman
Copy link
Contributor

@TommyBrosman TommyBrosman commented May 12, 2025

Adds a new Persisted Schema Format with persisted metadata support. This change does not enable it by default.

Changes

  • Add schema FormatV2
  • Register FormatV2 with schema codec
  • Update codec.spec to cover FormatV2 as well as FormatV1
  • Add schema v2 snapshots
  • Persisted metadata object in schema
  • FormatV2-specific tests
  • Documentation

Notes for reviewers

Todo

  • Changeset description
  • simple-tree changes to expose persisted metadata
  • Tests for simple-tree layer
  • Clone and freeze the metadata trait passed to simple-tree

Related PRs

- Added in-memory schema format v2.
- Implemented the schema format v2 codec.
- Updated test utils that previously assumed there was only one format.
- Added snapshots for many of the v2 tests.
@github-actions github-actions bot added area: dds Issues related to distributed data structures area: dds: tree area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct public api change Changes to a public API base: main PRs targeted against main branch and removed area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct area: dds Issues related to distributed data structures public api change Changes to a public API area: dds: tree labels May 12, 2025
@github-actions github-actions bot added area: dds Issues related to distributed data structures area: dds: tree area: examples Changes that focus on our examples area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct public api change Changes to a public API labels May 13, 2025
@github-actions github-actions bot removed the area: examples Changes that focus on our examples label May 13, 2025
…ion as a parameter.

- Fixed naming of schema index formats.
- Changed schemaChangeFormat to be schema format-agnostic.
@TommyBrosman TommyBrosman marked this pull request as ready for review May 13, 2025 19:49
@TommyBrosman TommyBrosman requested a review from a team as a code owner May 13, 2025 19:49
Copy link
Contributor

🔗 No broken links found! ✅

Your attention to detail is admirable.

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

Crawling...

Stats:
  210260 links
    1663 destination URLs
    1895 URLs ignored
       0 warnings
       0 errors


@github-actions github-actions bot removed area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct public api change Changes to a public API labels May 19, 2025
@CraigMacomber
Copy link
Contributor

In the context of SharedTree, "Schema" without any specific qualifiers (meaning not "Stored Schema" or "Persisted Schema") refers to the "View Schema" the user facing API and objects for defining schema (TreeNodeSchema, SchemaFactory etc).

As this PR makes not changes at that layer, I don't think "Schema v2 with persisted metadata support" is a great name for this.

I think "Persisted Schema Format v2 with persisted metadata support" would be better.

Similar changes should be made to the PR description as well.

@CraigMacomber
Copy link
Contributor

This PR does not meet the criteria in https://github.com/microsoft/FluidFramework/wiki/PR-Guidelines#guidelines (also linked from the default PR description via the template) to be marked as non-draft.

I think the status of this PR and the kind of feedback desired could be better communicated by marking it as draft until those criteria are fulfilled.

@TommyBrosman TommyBrosman changed the title Shared Tree: Schema v2 with persisted metadata support Shared Tree: Persisted Schema Format v2 with persisted metadata support May 20, 2025
@TommyBrosman TommyBrosman marked this pull request as draft May 20, 2025 20:30
@github-actions github-actions bot added the public api change Changes to a public API label May 22, 2025
@@ -45,21 +48,23 @@ export function makeSchemaChangeCodec(
/**
* Compose the v1 schema change codec.
* @param options - The codec options.
* @param schemaWriteVersion - The schema write version.
Copy link
Contributor

Choose a reason for hiding this comment

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

With support for this now, should the function name should change? Or what am I not getting about what "V1" means?

@@ -89,7 +89,7 @@ export function convertField(schema: SimpleFieldSchema): TreeFieldStoredSchema {
const kind: FieldKindIdentifier =
convertFieldKind.get(schema.kind)?.identifier ?? fail(0xae3 /* Invalid field kind */);
const types: TreeTypeSet = schema.allowedTypesIdentifiers as TreeTypeSet;
return { kind, types };
return { kind, types, persistedMetadata: undefined };
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be schema.metadata, like we already do below for Map and Array nodes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: dds: tree area: dds Issues related to distributed data structures base: main PRs targeted against main branch changeset-present public api change Changes to a public API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants