Skip to content

schema compat property keys - #27938

Open
daesunp wants to merge 2 commits into
microsoft:mainfrom
daesunp:schema-compat-property-keys
Open

schema compat property keys#27938
daesunp wants to merge 2 commits into
microsoft:mainfrom
daesunp:schema-compat-property-keys

Conversation

@daesunp

@daesunp daesunp commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Description

Updated schema compatibility snapshots to use persisted stored keys instead of property keys, preventing property key renames appearing as schema changes.

Adds backward compatibility for upgrading version 1 snapshots.

Copilot AI lite review requested due to automatic review settings August 12, 2026 17:25
@daesunp
daesunp requested review from a team as code owners August 12, 2026 17:25
@github-actions github-actions Bot added base: main PRs targeted against main branch area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct area: tools area: dds Issues related to distributed data structures area: repo Repo related work area: website public api change Changes to a public API area: dds: tree changeset-present labels Aug 12, 2026
@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

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

Based on the diff (627 lines, 24 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

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.

Pull request overview

Updates the simple-tree schema compatibility snapshot format so object fields are keyed by their persisted stored keys (not developer-facing property keys), preventing property renames from showing up as schema changes. It also adds a normalize workflow to rewrite the latest compatible snapshot into the latest on-disk format while retaining support for upgrading v1 snapshots.

Changes:

  • Introduces simple schema snapshot format v2 (fields keyed by stored keys) and upgrades the codec to decode both v1 and v2.
  • Extends snapshotSchemaCompatibility with a new "normalize" mode to rewrite the latest compatible snapshot into the current format.
  • Updates snapshot test artifacts and adds tests to validate property-key-rename stability, v1 upgrade behavior, and normalization behavior.

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/framework/fluid-framework/api-report/fluid-framework.legacy.beta.api.md Updates API surface to include "normalize" in SnapshotSchemaCompatibilityOptions.mode.
packages/framework/fluid-framework/api-report/fluid-framework.beta.api.md Updates API surface to include "normalize" in SnapshotSchemaCompatibilityOptions.mode.
packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md Updates API surface to include "normalize" in SnapshotSchemaCompatibilityOptions.mode.
packages/dds/tree/src/test/snapshots/output/get-simple-schema/serialized - Union root.json Updates persisted snapshot artifact to schema snapshot format v2.
packages/dds/tree/src/test/snapshots/output/get-simple-schema/serialized - simpleAllowedTypes.json Updates persisted snapshot artifact to schema snapshot format v2.
packages/dds/tree/src/test/snapshots/output/get-simple-schema/serialized - Recursive object schema.json Updates persisted snapshot artifact to schema snapshot format v2 (including removal of per-field storedKey payload).
packages/dds/tree/src/test/snapshots/output/get-simple-schema/serialized - Record schema.json Updates persisted snapshot artifact to schema snapshot format v2.
packages/dds/tree/src/test/snapshots/output/get-simple-schema/serialized - Object schema.json Updates persisted snapshot artifact to schema snapshot format v2 (including removal of per-field storedKey payload).
packages/dds/tree/src/test/snapshots/output/get-simple-schema/serialized - Object schema including an identifier field.json Updates persisted snapshot artifact to schema snapshot format v2 (including removal of per-field storedKey payload).
packages/dds/tree/src/test/snapshots/output/get-simple-schema/serialized - Object schema including a union field.json Updates persisted snapshot artifact to schema snapshot format v2 (including removal of per-field storedKey payload).
packages/dds/tree/src/test/snapshots/output/get-simple-schema/serialized - Map schema.json Updates persisted snapshot artifact to schema snapshot format v2.
packages/dds/tree/src/test/snapshots/output/get-simple-schema/serialized - Leaf node.json Updates persisted snapshot artifact to schema snapshot format v2.
packages/dds/tree/src/test/snapshots/output/get-simple-schema/serialized - Field Schema.json Updates persisted snapshot artifact to schema snapshot format v2.
packages/dds/tree/src/test/snapshots/output/get-simple-schema/serialized - Array schema.json Updates persisted snapshot artifact to schema snapshot format v2.
packages/dds/tree/src/test/snapshots/output/get-simple-schema/serialized - allowUnknownOptionalFields.json Updates persisted snapshot artifact to schema snapshot format v2.
packages/dds/tree/src/test/simple-tree/api/snapshotCompatibilityChecker.spec.ts Adds coverage for property-key rename invariance, v1 upgrade behavior, and normalize mode semantics.
packages/dds/tree/src/simple-tree/simpleSchemaFormatV2.ts Adds the v2 persisted format definition (object fields keyed by stored key).
packages/dds/tree/src/simple-tree/api/snapshotCompatibilityChecker.ts Adds "normalize" mode and logic to compare/upgrade snapshots across format versions.
packages/dds/tree/src/simple-tree/api/simpleSchemaCodec.ts Switches encoding to v2, adds v1 decode+upgrade path, and changes object-field encoding to stored-key-keyed map.
packages/dds/tree/src/simple-tree/api/schemaFromSimple.ts Minor refactor: uses Object.fromEntries when generating field schema records.
packages/dds/tree/api-report/tree.legacy.beta.api.md Updates API surface to include "normalize" in SnapshotSchemaCompatibilityOptions.mode.
packages/dds/tree/api-report/tree.beta.api.md Updates API surface to include "normalize" in SnapshotSchemaCompatibilityOptions.mode.
packages/dds/tree/api-report/tree.alpha.api.md Updates API surface to include "normalize" in SnapshotSchemaCompatibilityOptions.mode.
.changeset/tall-clocks-scream.md Publishes the change as a minor bump for @fluidframework/tree and fluid-framework with release notes.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +537 to +541
const currentEncodedForSnapshotting = exportCompatibilitySchemaSnapshot(currentViewSchema);
const snapshots = checker.readAllSchemaSnapshots(versionComparer);
const rawSnapshots = transformMapValues(snapshots, (_snapshot, version) =>
checker.readSchemaSnapshotRaw(version),
);

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.

replaced eager rereading/parsing of snapshots with cache.

@github-actions

Copy link
Copy Markdown
Contributor

🔗 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

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-website@0.0.0 serve
> docusaurus serve --no-open

[SUCCESS] Serving "build" directory at: http://localhost:3000/
[ELIFECYCLE] Command failed with exit code 1.

Comment thread .changeset/tall-clocks-scream.md Outdated
Comment thread .changeset/tall-clocks-scream.md Outdated
Comment thread .changeset/tall-clocks-scream.md
Comment thread packages/dds/tree/src/simple-tree/api/simpleSchemaCodec.ts
@github-actions

Copy link
Copy Markdown
Contributor

Bundle size comparison

Base commit: 84184d49fe459b80d5f961fccf4fb4b73a73ffd9
Head commit: 320477e04a27e3b5b383be7d7bd173f1834e8451

Pending — Build - client packages is running. Results will appear here when the build completes.

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 area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct area: repo Repo related work area: tools area: website 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.

4 participants