Skip to content

fix(tree): walk allowed types #24820

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 41 commits into from
Jun 20, 2025
Merged

Conversation

jenn-le
Copy link
Contributor

@jenn-le jenn-le commented Jun 11, 2025

Description

  • adds annotated allowed schema to an alpha TreeNodeSchema API so that annotations are available when walking the schema
  • fixes the walkAllowedTypes function by using this new API over the existing childTypes API

@Copilot Copilot AI review requested due to automatic review settings June 11, 2025 00:30
@jenn-le jenn-le requested a review from a team as a code owner June 11, 2025 00:30
@github-actions github-actions bot added area: dds Issues related to distributed data structures area: dds: tree public api change Changes to a public API base: main PRs targeted against main branch labels Jun 11, 2025
Copy link
Contributor

@Copilot 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 introduces a unified AnnotatedAllowedSchema abstraction for carrying per-type metadata and switches schema traversal and context wiring to use these annotated types. Key changes include:

  • Defining the AnnotatedAllowedSchema interface and replacing the old Map-based metadata API with a ReadonlySet<AnnotatedAllowedSchema> returned by normalizeAnnotatedAllowedTypes.
  • Refactoring FieldSchemaAlpha, node-kind modules (object, map, array, leaf), and core traversal (walkAllowedTypes/walkNodeSchema) to consume and propagate annotated schemas.
  • Updating consumers (e.g., Context, TreeViewConfiguration, SchematizingSimpleTreeView) to pass and handle annotated allowed schemas instead of raw type sets.

Reviewed Changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/dds/tree/src/simple-tree/schemaTypes.ts Added normalizeAnnotatedAllowedTypes, removed Map-based extractor, updated FieldSchemaAlpha to use annotated Set.
packages/dds/tree/src/simple-tree/core/walkSchema.ts Updated walkAllowedTypes and walkNodeSchema to traverse AnnotatedAllowedSchema.
packages/dds/tree/src/simple-tree/core/context.ts Changed Context/HydratedContext constructors to accept annotated schemas.
packages/dds/tree/src/simple-tree/node-kinds/{object,map,array}/… Exposed childAnnotatedAllowedTypes on all node‐kind static schemas.
packages/dds/tree/src/simple-tree/createContext.ts Passage of annotatedAllowedTypeSet into Context for unhydrated contexts.
Comments suppressed due to low confidence (3)

packages/dds/tree/src/simple-tree/schemaTypes.ts:553

  • [nitpick] Derive the identifiers from the lazyAnnotatedTypes value to keep them in sync with any filtering or ordering in normalizeAnnotatedAllowedTypes. For example:
this.lazyIdentifiers = new Lazy(
  () => new Set(
    [...this.lazyAnnotatedTypes.value].map(a => a.type.identifier),
  ),
);
this.lazyIdentifiers = new Lazy(() => new Set([...this.allowedTypeSet].map((t) => t.identifier)),

packages/dds/tree/src/simple-tree/core/context.ts:54

  • Add or update the JSDoc above the constructor to reflect that rootSchema now accepts an Iterable<AnnotatedAllowedSchema> (including metadata), not raw TreeNodeSchema instances.
public constructor(

packages/dds/tree/src/simple-tree/schemaTypes.ts:564

  • Enhance the JSDoc for annotatedAllowedTypeSet to explicitly state it returns a ReadonlySet<AnnotatedAllowedSchema> where each entry contains both the evaluated schema and its associated metadata, replacing any mention of the former Map-based return type.
public get annotatedAllowedTypeSet(): ReadonlySet<AnnotatedAllowedSchema> {

jenn-le and others added 4 commits June 10, 2025 23:35
Co-authored-by: Craig Macomber (Microsoft) <42876482+CraigMacomber@users.noreply.github.com>
Co-authored-by: Craig Macomber (Microsoft) <42876482+CraigMacomber@users.noreply.github.com>
@github-actions github-actions bot added the area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct label Jun 12, 2025
Co-authored-by: Craig Macomber (Microsoft) <42876482+CraigMacomber@users.noreply.github.com>
jenn-le and others added 9 commits June 19, 2025 13:26
Co-authored-by: Craig Macomber (Microsoft) <42876482+CraigMacomber@users.noreply.github.com>
Co-authored-by: Craig Macomber (Microsoft) <42876482+CraigMacomber@users.noreply.github.com>
Co-authored-by: Craig Macomber (Microsoft) <42876482+CraigMacomber@users.noreply.github.com>
Co-authored-by: Craig Macomber (Microsoft) <42876482+CraigMacomber@users.noreply.github.com>
Copy link
Contributor

🔗 No broken links found! ✅

Your attention to detail is admirable.

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

Crawling...

Stats:
  225443 links
    1710 destination URLs
    1941 URLs ignored
       0 warnings
       0 errors


@jenn-le jenn-le merged commit f4e8dc8 into microsoft:main Jun 20, 2025
38 checks passed
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 changeset-present public api change Changes to a public API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants