Skip to content

Conversation

@CraigMacomber
Copy link
Contributor

@CraigMacomber CraigMacomber commented Nov 3, 2025

Description

Add some examples showing patterns for open polymorphism with tree schema.

These examples are derived from those in #23084, showing cases which motivate that work, but do not (yet) include the examples from that PR showing how it helps. Merging this PR first will help that one better show its value.

Reviewer Guidance

The review process is outlined on this wiki page.

Copilot AI review requested due to automatic review settings November 3, 2025 22:34
@CraigMacomber CraigMacomber requested a review from a team as a code owner November 3, 2025 22:34
@github-actions github-actions bot added area: dds Issues related to distributed data structures area: dds: tree base: main PRs targeted against main branch labels Nov 3, 2025
If there is a corresponding `spec` file which is sufficiently large in scope, the tests should be placed within it:
only when the tests don't cleanly correspond to a particular source file should a separate `integration` file be created.
When created, the file should be placed in the `src/test` directory's sub folder which is the most nested it can be while still including all the relevant APIs.
For example an example of using `src/thing/foo` with `src/thing/bar` would belong in `src/test/thing` and could be named something like `fooWithBar.example.ts`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this not be a test file? I would have expected fooWithBar.spec.ts or fooWithBar.integration.spec.ts or something.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This documentation defines them to be test files, so they are. Just above this is the definition of what we mean by ".spec" in a file, and these do not meet that. Nowhere in here (or anywhere that I know of) do we define that files without ".spec" in there name are not test files. Historically we have inaccurately followed that convention throughout our repo in a mostly undocumented way. Here in tree we have a documented policy (this file) and thus can make changes to the convention (as done here).

I don't think there is any value in making every kind of test file include ".spec" in its file name. If we wanted something to put in the name of every test file, we would pick something like ".test" (well we went with /src/test/ as path prefix which also works).

".spec" (which I assume is short for "specification test") can have a more useful meaning (defined above in this file) if we don't stick it on everything.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair enough. I guess my real concern is the overloaded use of ".example.ts". We use that below for examples we want to keep up to date. This seems distinct from that. Seems like it should have a different naming convention.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, the new test suite in this PR does use .integration.ts, so I'm guessing this paragraph just needs to be fixed to say that instead of example.ts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, .example.ts here is wrong. I was doing that earlier and changed my mind since a lot of examples fit inside of .spec tests. I'll update this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

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 adds a new integration test file demonstrating the "Open Polymorphism" design pattern and updates the testing documentation to clarify guidance for integration tests and examples.

  • Adds comprehensive integration tests showing various approaches to implementing open polymorphic schema patterns
  • Updates testing documentation to better distinguish integration tests from spec tests and provide guidance on examples
  • Demonstrates component-based composition patterns for managing polymorphic schemas

Reviewed Changes

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

File Description
packages/dds/tree/src/test/openPolymorphism.integration.ts New integration test file containing examples and tests for open polymorphism design patterns with schema composition utilities
packages/dds/tree/src/test/README.md Updated test documentation to add integration test guidelines and examples section

@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

🔗 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


> [email protected] 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"


> [email protected] serve
> docusaurus serve --no-open

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

> [email protected] check-links
> linkcheck http://localhost:3000 --skip-file skipped-urls.txt

 ELIFECYCLE  Command failed with exit code 1.

@CraigMacomber CraigMacomber merged commit 86a249c into microsoft:main Nov 4, 2025
39 checks passed
@CraigMacomber CraigMacomber deleted the OpenPolcyExamples branch November 4, 2025 01:22
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 base: main PRs targeted against main branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants