Skip to content

feat(tree): Backport schema discrepancy API and SchemaArtifact telemetry tagging to release/client/2.118 - #28155

Merged
jzaffiro merged 9 commits into
microsoft:release/client/2.118from
jzaffiro:jzaffiro-cherry-pick-28090-to-2-118
Sep 3, 2026
Merged

jzaffiro merged 9 commits into
microsoft:release/client/2.118from
jzaffiro:jzaffiro-cherry-pick-28090-to-2-118

Conversation

@jzaffiro

@jzaffiro jzaffiro commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

Cherry-pick of these changes from main into release/client/2.118:

Reviewer Guidance

The review process is outlined in the pull request guidelines.

This is a straight cherry-pick, no adaptation was needed beyond ensuring the base branch had the prerequisite refactor. See the original PRs for full review discussion.

…a metadata (microsoft#28090)

Cherry-pick of microsoft#28090 from main into release/client/2.118.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: edc4b0db-aab4-4e27-bb42-e90ca8db801d
@jzaffiro
jzaffiro requested a review from a team September 2, 2026 21:33
@jzaffiro
jzaffiro requested a review from a team as a code owner September 2, 2026 21:33
@github-actions github-actions Bot added area: tools area: dds Issues related to distributed data structures area: repo Repo related work area: website area: dds: tree labels Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Warning

WARNING: This PR is targeting a release branch!

All changes must first be merged into main and then backported to the target release branch.
Please include a link to the main PR in the description of this PR.

Changes to release branches require approval from the Patch Triage group before merging.
You should have already discussed this change with them so they know to expect it.

For more details, see our internal documentation for the patch policy and processes for
patch releases.

@github-actions github-actions Bot added the base: release PRs targeted against a release branch label Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

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

Based on the diff (2069 lines, 56 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

@jzaffiro jzaffiro changed the title feat(telemetry-utils): Add SchemaArtifact telemetry tag for DDS schema metadata feat(telemetry-utils): backport of Add SchemaArtifact telemetry tag for DDS schema metadata Sep 2, 2026
@jzaffiro
jzaffiro enabled auto-merge (squash) September 2, 2026 21:38
microsoft#28044)

Cherry-pick of microsoft@e4c4fea from main into release/client/2.118.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: edc4b0db-aab4-4e27-bb42-e90ca8db801d
@jzaffiro
jzaffiro requested review from a team as code owners September 2, 2026 22:15
@github-actions github-actions Bot added area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct area: loader Loader related issues area: tests Tests to add, test infrastructure improvements, etc labels Sep 2, 2026
@jzaffiro
jzaffiro disabled auto-merge September 3, 2026 17:23
@jzaffiro
jzaffiro enabled auto-merge (squash) September 3, 2026 17:29
jzaffiro and others added 3 commits September 3, 2026 10:29
…#28136)

## Description

Simplifies the `TreeView.root` incompatible-schema `UsageError` so its
message no longer embeds application-defined schema identifiers or field
keys.

The incompatibilities are serialized as structured
`schemaIncompatibilityDetails` telemetry and tagged as `SchemaArtifact`.
The error continues to explain whether callers should initialize the
document, upgrade its stored schema, use a compatible view schema, or
migrate the schema and data.

Tests verify the stable messages and tagged telemetry details for
upgradable and non-upgradable schemas.

## Reviewer Guidance

The review process is outlined in [the pull request
guidelines](../docs/content/Contributing/PR-Guidelines.md#guidelines).

Please review the structured telemetry shape and confirm the
schema-artifact classification is appropriate for all included values.

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Alex Villarreal <716334+alexvy86@users.noreply.github.com>
Adds `TreeViewBeta.compatibility.discrepancies`, which exposes typed
`SchemaDiscrepancy` objects describing differences between the view
schema and stored schema when a beta tree view cannot access the tree. A
new `SchemaCompatibilityStatusBeta` type carries this beta-only
compatibility detail without changing the stable
`SchemaCompatibilityStatus` API.

Each entry includes a `mismatch` discriminator for allowed-type,
field-kind, value-schema, and node-kind differences. Allowed-type
discrepancies include staged types absent from the stored schema in
`stagedView`, while discrepancies on staged optional fields include
`viewIsStagedOptional: true`. Staged-only differences remain compatible
and do not produce discrepancies by themselves.

For example, if the stored schema allows `string` for `Todo.title` but
the view schema expects `number`:

```typescript
const sf = new SchemaFactory("com.example");
class Todo extends sf.object("Todo", {
	title: sf.number,
}) {}

const view = asBeta(tree.viewWith(new TreeViewConfiguration({ schema: Todo })));
if (!view.compatibility.canView) {
	// [{
	//   mismatch: "allowedTypes",
	//   location: { nodeType: "com.example.Todo", fieldKey: "title" },
	//   view: ["com.fluidframework.leaf.number"],
	//   stored: ["com.fluidframework.leaf.string"],
	// }]
	console.error(view.compatibility.discrepancies);
}
```

The `location` identifies the incompatible field, while `view` and
`stored` show the type identifiers allowed by each schema. Applications
can switch on `mismatch` to select the relevant fields when presenting
diagnostics.

Discrepancies and staged-upgrade status are collected during the same
compatibility walk. The discrepancy array remains structured for API
consumers and is JSON-serialized only when attached to schema
incompatibility telemetry. The stable `TreeView` and
`SchemaCompatibilityStatus` APIs remain unchanged.

The review process is outlined in [the pull request
guidelines](../docs/content/Contributing/PR-Guidelines.md#guidelines).

Please review the beta compatibility-status API, typed discrepancy
union, and staged-schema context. This `@beta` API addition requires API
Council approval in addition to area-owner review.

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@jenn-le
Jenn (jenn-le) requested a review from a team as a code owner September 3, 2026 18:11
@jenn-le
Jenn (jenn-le) requested a review from a team as a code owner September 3, 2026 18:11
@github-actions github-actions Bot added public api change Changes to a public API changeset-present labels Sep 3, 2026
@jzaffiro jzaffiro changed the title feat(telemetry-utils): backport of Add SchemaArtifact telemetry tag for DDS schema metadata feat(tree): Backport schema discrepancy API and SchemaArtifact telemetry tagging to release/client/2.118 Sep 3, 2026
Jenn (jenn-le) and others added 3 commits September 3, 2026 11:30
## Description

Marks `SchemaDiscrepancy` and `SchemaCompatibilityStatusBeta`,
introduced in microsoft#28142, as sealed APIs. This communicates that consumers
should use these types as returned rather than implementing or extending
them.

Updates the `@fluidframework/tree` and `fluid-framework` API reports
accordingly.

## Reviewer Guidance

The review process is outlined in [the pull request
guidelines](../docs/content/Contributing/PR-Guidelines.md#guidelines).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
## Description

Updates `TreeView.upgradeSchema()` to include staged schema upgrades
that are already enabled in the document by default. This prevents an
upgrade from attempting to narrow stored schema when another client
previously enabled a staged upgrade.

Applications that need to exclude previously enabled upgrades can
compose an explicit opt-out into their staged upgrade policy:

```typescript
const stagedUpgradePolicy = {
	includeAlreadyEnabledUpgrades: false,
	...StagedSchemaUpgradePolicy.enabledStagedUpgrades(myUpgrade),
};
```

Adds coverage for staged allowed-type and staged-optional upgrades,
including the explicit opt-out behavior.

## Reviewer Guidance

The review process is outlined in [the pull request
guidelines](../docs/content/Contributing/PR-Guidelines.md#guidelines).

The customer-facing addition is `@alpha` and does not require API
Council approval. Please focus on the policy composition and
compatibility calculations.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🔗 Found some broken links! 💔

Run a link check locally to find them. See Checking for Broken Links 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.

@jzaffiro
jzaffiro merged commit 9b61289 into microsoft:release/client/2.118 Sep 3, 2026
42 checks passed
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Bundle size comparison

Base commit: 46e6f7fe56e67d71f6d55c359313a98434cbb838
Head commit: b6584d6689c19b709d79a9adf9e4ed5eed467c43

Notable changes

No bundles changed by ≥ 500 bytes parsed.

Per-bundle deltas

@fluid-example/bundle-size-tests

  • fluidFrameworkAllAlpha.js: parsed 794270 → 794732 (+462), gzip 217640 → 217736 (+96)
  • azureClient.js: parsed 624847 → 624991 (+144), gzip 166640 → 166717 (+77)
  • odspClient.js: parsed 597823 → 597967 (+144), gzip 160097 → 160177 (+80)
  • aqueduct.js: parsed 531223 → 531346 (+123), gzip 142114 → 142178 (+64)
  • fluidFramework.js: parsed 413549 → 413990 (+441), gzip 116930 → 117021 (+91)
  • sharedTree.js: parsed 402953 → 403387 (+434), gzip 114378 → 114455 (+77)
  • containerRuntime.js: parsed 309144 → 309218 (+74), gzip 84569 → 84589 (+20)
  • sharedString.js: parsed 176510 → 176553 (+43), gzip 49798 → 49820 (+22)
  • experimentalSharedTree.js: parsed 160665 → 160699 (+34), gzip 46265 → 46274 (+9)
  • matrix.js: parsed 160341 → 160384 (+43), gzip 45798 → 45819 (+21)
  • loader.js: parsed 145704 → 145758 (+54), gzip 39286 → 39326 (+40)
  • odspDriver.js: parsed 104505 → 104560 (+55), gzip 32581 → 32597 (+16)
  • directory.js: parsed 67110 → 67151 (+41), gzip 18859 → 18879 (+20)
  • 578.js: parsed 58686 → 58686 (0), gzip 17657 → 17657 (0)
  • map.js: parsed 47205 → 47246 (+41), gzip 14455 → 14477 (+22)
  • odspPrefetchSnapshot.js: parsed 45635 → 45687 (+52), gzip 15242 → 15258 (+16)
  • 252.js: parsed 44362 → 44362 (0), gzip 13735 → 13735 (0)
  • summarizerDelayLoadedModule.js: parsed 30717 → 30717 (0), gzip 7716 → 7716 (0)
  • socketModule.js: parsed 26469 → 26476 (+7), gzip 7896 → 7904 (+8)
  • createNewModule.js: parsed 12454 → 12454 (0), gzip 4797 → 4797 (0)
  • 922.js: parsed 10497 → 10497 (0), gzip 3883 → 3883 (0)
  • summaryModule.js: parsed 3789 → 3789 (0), gzip 1857 → 1857 (0)
  • connectionState.js: parsed 909 → 909 (0), gzip 500 → 500 (0)
  • sharedTreeAttributes.js: parsed 847 → 854 (+7), gzip 499 → 508 (+9)
  • debugAssert.js: parsed 429 → 429 (0), gzip 299 → 299 (0)
  • FluidFramework-HashFallback.js: parsed 419 → 419 (0), gzip 313 → 313 (0)

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: loader Loader related issues area: repo Repo related work area: tests Tests to add, test infrastructure improvements, etc area: tools area: website base: release PRs targeted against a release branch changeset-present public api change Changes to a public API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants