schema compat property keys - #27938
Conversation
|
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:
How this works
|
There was a problem hiding this comment.
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
snapshotSchemaCompatibilitywith 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.
| const currentEncodedForSnapshotting = exportCompatibilitySchemaSnapshot(currentViewSchema); | ||
| const snapshots = checker.readAllSchemaSnapshots(versionComparer); | ||
| const rawSnapshots = transformMapValues(snapshots, (_snapshot, version) => | ||
| checker.readSchemaSnapshotRaw(version), | ||
| ); |
There was a problem hiding this comment.
replaced eager rereading/parsing of snapshots with cache.
|
🔗 Found some broken links! 💔 Run a link check locally to find them. See linkcheck output |
Bundle size comparisonBase commit: Pending — |
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.