Tweaks to checkSchemaCompatibilitySnapshots#26346
Open
CraigMacomber wants to merge 19 commits intomicrosoft:mainfrom
Open
Tweaks to checkSchemaCompatibilitySnapshots#26346CraigMacomber wants to merge 19 commits intomicrosoft:mainfrom
CraigMacomber wants to merge 19 commits intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refines the checkSchemaCompatibilitySnapshots API and its documentation, adds a configurable version comparison function, and introduces a concrete example test plus more informative error messages.
Changes:
- Extend
SchemaCompatibilitySnapshotsOptionswith an optionalversionComparercallback and updatecheckSchemaCompatibilitySnapshotsto use it for version validation and ordering when provided. - Enhance JSDoc and runtime error messages to better explain snapshot management and include snapshot directory and available snapshot versions in failures.
- Add an end-to-end Mocha example (
snapshotCompatibilityCheckerExample) with a simple schema, version wiring, and a sample snapshot JSON file, and update tests to reflect the new error message format.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md |
Updates the alpha API report to include the new versionComparer?: (a: string, b: string) => number property on SchemaCompatibilitySnapshotsOptions. |
packages/dds/tree/api-report/tree.alpha.api.md |
Mirrors the API report change for the @fluidframework/tree alpha surface, keeping the public API docs in sync with the implementation. |
packages/dds/tree/src/simple-tree/api/snapshotCompatibilityChecker.ts |
Extends SchemaCompatibilitySnapshotsOptions (JSDoc and type) with versionComparer, wires it into checkSchemaCompatibilitySnapshots (including validation and ordering), improves the doc block with guidance and a full Mocha example, adjusts some error messages, and augments the final error with snapshot directory and snapshot-version list. |
packages/dds/tree/src/test/simple-tree/api/snapshotCompatibilityChecker.spec.ts |
Updates expectations in existing tests to assert the richer error message that now includes snapshot directory and existing snapshot versions, and keeps the doc-example test in sync with the user-facing documentation. |
packages/dds/tree/src/test/snapshotCompatibilityCheckerExample/schema.ts |
Adds a minimal TreeViewConfiguration example using SchemaFactory.number to be consumed by the new example test. |
packages/dds/tree/src/test/snapshotCompatibilityCheckerExample/version.ts |
Provides a packageVersion export, wired to cleanedPackageVersion, to demonstrate programmatic version sourcing in the example. |
packages/dds/tree/src/test/snapshotCompatibilityCheckerExample/snapshotCompatibilityChecker.example.mts |
Introduces a complete Mocha test example showing how to call checkSchemaCompatibilitySnapshots with a filesystem implementation, schema, and version, writing snapshots into a dedicated example directory. |
packages/dds/tree/src/test/snapshotCompatibilityCheckerExample/schema-snapshots/2.0.0.json |
Supplies a concrete schema snapshot JSON used by the new example, illustrating the snapshot format and enabling the example test to run. |
packages/dds/tree/src/simple-tree/api/snapshotCompatibilityChecker.ts
Outdated
Show resolved
Hide resolved
packages/dds/tree/src/simple-tree/api/snapshotCompatibilityChecker.ts
Outdated
Show resolved
Hide resolved
packages/dds/tree/src/simple-tree/api/snapshotCompatibilityChecker.ts
Outdated
Show resolved
Hide resolved
Josmithr
reviewed
Feb 3, 2026
packages/dds/tree/src/simple-tree/api/snapshotCompatibilityChecker.ts
Outdated
Show resolved
Hide resolved
…cker.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…cker.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…cker.ts Co-authored-by: Joshua Smithrud <54606601+Josmithr@users.noreply.github.com>
…to schemaCompatBetter
Josmithr
reviewed
Feb 4, 2026
| if (!compatibility.currentViewOfSnapshotDocument.canUpgrade) { | ||
| compatibilityErrors.push( | ||
| `Current version ${JSON.stringify(currentVersion)} cannot upgrade documents from ${JSON.stringify(snapshotVersion)}.`, | ||
| `Current version ${JSON.stringify(currentVersion)} cannot upgrade documents froPm ${JSON.stringify(snapshotVersion)}.`, |
Contributor
There was a problem hiding this comment.
Suggested change
| `Current version ${JSON.stringify(currentVersion)} cannot upgrade documents froPm ${JSON.stringify(snapshotVersion)}.`, | |
| `Current version ${JSON.stringify(currentVersion)} cannot upgrade documents from ${JSON.stringify(snapshotVersion)}.`, |
…into schemaCompatBetter
Contributor
|
🔗 No broken links found! ✅ Your attention to detail is admirable. linkcheck output |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A collection of improvements split out from #26288 which were made based on the API review of checkSchemaCompatibilitySnapshots.
Reviewer Guidance
The review process is outlined on this wiki page.