Skip to content

Shared Tree: Add allowed types object with staged schema upgrade information to SimpleSchema#25770

Merged
TommyBrosman merged 26 commits intomicrosoft:mainfrom
TommyBrosman:simple-allowed-types
Oct 30, 2025
Merged

Shared Tree: Add allowed types object with staged schema upgrade information to SimpleSchema#25770
TommyBrosman merged 26 commits intomicrosoft:mainfrom
TommyBrosman:simple-allowed-types

Conversation

@TommyBrosman
Copy link
Contributor

This PR removes the allowedTypesIdentifiers Set from Simple Schema types and replaces it with a Map keyed on the identifier. Additionally, isStaged has been added to reflect whether the allowed types have associated schema upgrades.

Breaking Changes

This change breaks a few alpha APIs in SimpleSchema:

  • SimpleFieldSchema.allowedTypesIdentifiers
  • SimpleRecordNodeSchema.allowedTypesIdentifiers
  • SimpleMapNodeSchema.allowedTypesIdentifiers
  • SimpleArrayNodeSchema.allowedTypesIdentifiers

Reviewer Guidance

  • I would like feedback on the naming for the simpleAllowedTypes fields. I wanted to name this field allowedTypes to match the existing convention, but it conflicts with an existing field in the case of SimpleFieldSchema.

@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 labels Oct 29, 2025
@TommyBrosman TommyBrosman marked this pull request as ready for review October 29, 2025 21:35
@TommyBrosman TommyBrosman requested review from a team as code owners October 29, 2025 21:35
Copilot AI review requested due to automatic review settings October 29, 2025 21:35
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the schema representation to replace allowedTypesIdentifiers (a ReadonlySet<string>) with simpleAllowedTypes (a ReadonlyMap<string, SimpleAllowedTypes>) throughout the codebase. This change enables tracking additional metadata about allowed types, specifically whether a type is part of a staged schema upgrade.

Key changes:

  • Introduces a new SimpleAllowedTypes interface to track metadata like isStaged flag
  • Updates all schema interfaces to use simpleAllowedTypes instead of allowedTypesIdentifiers
  • Adds new methods (evaluateSimpleAllowedTypes) to compute the new map-based representation

Reviewed Changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/dds/tree/src/simple-tree/simpleSchema.ts Defines the new SimpleAllowedTypes interface and updates schema interfaces to use it
packages/dds/tree/src/simple-tree/core/allowedTypes.ts Adds evaluateSimpleAllowedTypes() method to compute the map representation
packages/dds/tree/src/simple-tree/fieldSchema.ts Implements simpleAllowedTypes getter in FieldSchemaAlpha
packages/dds/tree/src/simple-tree/node-kinds/array/arrayNode.ts Adds lazy evaluation of simpleAllowedTypes for array schemas
packages/dds/tree/src/simple-tree/node-kinds/map/mapNode.ts Adds lazy evaluation of simpleAllowedTypes for map schemas
packages/dds/tree/src/simple-tree/node-kinds/record/recordNode.ts Adds lazy evaluation of simpleAllowedTypes for record schemas
packages/dds/tree/src/simple-tree/toStoredSchema.ts Updates conversion logic to extract identifiers from the new map structure
packages/dds/tree/src/simple-tree/api/simpleSchemaToJsonSchema.ts Updates JSON schema conversion to work with the new map structure
packages/dds/tree/src/simple-tree/api/viewSchemaToSimpleSchema.ts Updates schema copying to use simpleAllowedTypes
packages/dds/tree/src/simple-tree/api/schemaFromSimple.ts Updates schema generation from simple schemas to extract keys from the map
packages/dds/tree/src/shared-tree/sharedTree.ts Adds helper function to build simpleAllowedTypes for stored schemas
packages/framework/tree-agent/src/typeGeneration.ts Updates type generation to work with the new map structure
packages/framework/ai-collab/src/explicit-strategy/typeGeneration.ts Updates AI collaboration type generation
packages/tools/devtools/devtools-core/src/data-visualization/*.ts Updates visualization code to work with the new structure
Test files Updates test expectations to use map-based representation
API report files Documents the public API changes

Comment on lines +173 to +177
* True if this schema is included as a {@link SchemaStaticsAlpha.staged | staged} schema upgrade,
* allowing the view schema be compatible with stored schema with (post upgrade) or without it (pre-upgrade).
* New documents and schema upgrades will omit any staged schema.
*
* Undefined if derived from a stored schema.
Copy link
Contributor

Choose a reason for hiding this comment

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

The fact that this differs between stored and view schema gives me some pause. I wonder if (at least longer term), we want slightly different variants of simple schema for stored vs view schema? What other differences are going to creep in over time here?

But for now this is probably fine. It is an alpha API. Maybe worth a quick @privateRemarks note about future considerations?

Copy link
Contributor

@Josmithr Josmithr left a comment

Choose a reason for hiding this comment

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

Left a couple of notes, but overall looks good to me.

Copy link
Contributor

@Josmithr Josmithr left a comment

Choose a reason for hiding this comment

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

Looks like your API reports are out of date. Happy to re-approve once those have been updated :)

@TommyBrosman TommyBrosman enabled auto-merge (squash) October 30, 2025 03:44
@TommyBrosman TommyBrosman disabled auto-merge October 30, 2025 16:34
@TommyBrosman TommyBrosman enabled auto-merge (squash) October 30, 2025 17:14
@github-actions
Copy link
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


> fluid-framework-docs-site@0.0.0 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"


> fluid-framework-docs-site@0.0.0 serve
> docusaurus serve --no-open

[SUCCESS] Serving "build" directory at: http://localhost:3000/

> fluid-framework-docs-site@0.0.0 check-links
> linkcheck http://localhost:3000 --skip-file skipped-urls.txt

 ELIFECYCLE  Command failed with exit code 1.

@TommyBrosman TommyBrosman merged commit 71f45ff into microsoft:main Oct 30, 2025
39 checks passed
anthony-murphy-agent pushed a commit to anthony-murphy-agent/FluidFramework that referenced this pull request Jan 14, 2026
…rmation to SimpleSchema (microsoft#25770)

This PR removes the `allowedTypesIdentifiers` Set from Simple Schema
types and replaces it with a Map keyed on the identifier. Additionally,
`isStaged` has been added to reflect whether the allowed types have
associated schema upgrades.

## Breaking Changes

This change breaks a few alpha APIs in SimpleSchema:
- `SimpleFieldSchema.allowedTypesIdentifiers`
- `SimpleRecordNodeSchema.allowedTypesIdentifiers`
- `SimpleMapNodeSchema.allowedTypesIdentifiers`
- `SimpleArrayNodeSchema.allowedTypesIdentifiers`

---------

Co-authored-by: Noah Encke <78610362+noencke@users.noreply.github.com>
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 base: main PRs targeted against main branch public api change Changes to a public API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants