-
Notifications
You must be signed in to change notification settings - Fork 536
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
Rewrite ViewSchema.checkCompatibility to leverage discrepancies #23192
Rewrite ViewSchema.checkCompatibility to leverage discrepancies #23192
Conversation
…edContentDiscrepancies
…AndPolicy, support it in schema validation. Add some import/export tests. Make linter pass.
It's probably feasible to split optional field work into a different PR and make this one more about using the new compatibility logic. I can do that if this space is difficult for the reviewer to reason about, or if we're concerned about risk of this change. I am aware of a few ways that the new compatibility logic is not totally equivalent to the old one, but only places where it is stricter and probably doesn't matter in practice (e.g. it doesn't detect all types of never fields as equivalent, but realistic customers probably aren't going around and declaring such things anyway). Another thing which we used to allow but now do not is upgrading from an object node schema to a map node schema over the union of all the object fields' types. This is probably not something people are particularly yearning for, and TBH I'm not totally convinced we have the test coverage which verifies this actually works beyond it being theoretically sound. One thing to watch out for is that a lot of our test coverage for 'the new code path' being equivalent to 'the old code path' comes from implementing an |
…oving it can come later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Coverage Summary
↓ packages.dds.tree.src.simple-tree.api:
Line Coverage Change: 0.21% Branch Coverage Change: -0.83%
Metric Name | Baseline coverage | PR coverage | Coverage Diff |
---|---|---|---|
Branch Coverage | 89.77% | 88.94% | ↓ -0.83% |
Line Coverage | 82.35% | 82.56% | ↑ 0.21% |
↓ packages.dds.tree.src.core.schema-view:
Line Coverage Change: -0.46% Branch Coverage Change: No change
Metric Name | Baseline coverage | PR coverage | Coverage Diff |
---|---|---|---|
Branch Coverage | 100.00% | 100.00% | → No change |
Line Coverage | 96.80% | 96.34% | ↓ -0.46% |
↓ packages.dds.tree.src.simple-tree:
Line Coverage Change: 0.03% Branch Coverage Change: -0.10%
Metric Name | Baseline coverage | PR coverage | Coverage Diff |
---|---|---|---|
Branch Coverage | 94.24% | 94.14% | ↓ -0.10% |
Line Coverage | 97.23% | 97.26% | ↑ 0.03% |
↓ packages.dds.tree.src.shared-tree:
Line Coverage Change: -0.01% Branch Coverage Change: No change
Metric Name | Baseline coverage | PR coverage | Coverage Diff |
---|---|---|---|
Branch Coverage | 91.70% | 91.70% | → No change |
Line Coverage | 97.16% | 97.15% | ↓ -0.01% |
↑ packages.dds.tree.src.core.schema-stored:
Line Coverage Change: 0.01% Branch Coverage Change: No change
Metric Name | Baseline coverage | PR coverage | Coverage Diff |
---|---|---|---|
Branch Coverage | 93.61% | 93.61% | → No change |
Line Coverage | 99.70% | 99.71% | ↑ 0.01% |
↑ packages.dds.tree.src.feature-libraries:
Line Coverage Change: 0.02% Branch Coverage Change: 0.03%
Metric Name | Baseline coverage | PR coverage | Coverage Diff |
---|---|---|---|
Branch Coverage | 94.08% | 94.11% | ↑ 0.03% |
Line Coverage | 97.79% | 97.81% | ↑ 0.02% |
↑ packages.dds.tree.src.feature-libraries.modular-schema:
Line Coverage Change: 0.06% Branch Coverage Change: 0.01%
Metric Name | Baseline coverage | PR coverage | Coverage Diff |
---|---|---|---|
Branch Coverage | 93.29% | 93.30% | ↑ 0.01% |
Line Coverage | 95.14% | 95.20% | ↑ 0.06% |
↑ packages.dds.tree.src.feature-libraries.default-schema:
Line Coverage Change: No change Branch Coverage Change: 0.11%
Metric Name | Baseline coverage | PR coverage | Coverage Diff |
---|---|---|---|
Branch Coverage | 93.16% | 93.27% | ↑ 0.11% |
Line Coverage | 98.56% | 98.56% | → No change |
Baseline commit: abde76d
Baseline build: 310021
Happy Coding!!
Code coverage comparison check passed!!
⯅ @fluid-example/bundle-size-tests: +6.31 KB
Baseline commit: abde76d |
packages/dds/tree/src/feature-libraries/modular-schema/discrepancies.ts
Outdated
Show resolved
Hide resolved
* Copy of {@link SchemaFactory} with additional alpha APIs. | ||
* | ||
* @privateRemarks | ||
* Not currently exported to the public API surface as doing so produces errors in API-extractor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the errors? Do you mean "problems with API extractor itself" or "it's not actually properly typed for export yet, and naturally API extractor complains"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some other features that have been thrown around lately that would be implemented in a SchemaFactoryAlpha, so this will need to get lifted/shared eventually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. I don't remember exactly what goes wrong, but agreed we'll need to sort this out. I'm planning on lifting this explicitly directly after this PR, so we'll revisit this at that point in a PR that is more scoped :)
🔗 No broken links found! ✅ Your attention to detail is admirable. linkcheck output
|
## Description Exposes `SchemaFactoryAlpha` and associated additional options on `object` and `objectRecursive` to tree's alpha API surface. This lights up the feature implemented in #23192, so I have also added a changeset with some user-facing guidance on that feature. --------- Co-authored-by: Abram Sanderson <absander@microsoft.com>
Description
Updates
ViewSchema.checkCompatibility
to leverage thegetFieldDiscrepancies
codepath.This also puts in place infrastructure to allow viewing the document when the only differences between view and stored schema are extra optional fields in the stored schema on nodes that the view schema author has declared are OK.