Skip to content
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

tree2: Refactor TreeNodeSchema #18217

Merged
merged 20 commits into from Nov 14, 2023
Merged

Conversation

CraigMacomber
Copy link
Contributor

@CraigMacomber CraigMacomber commented Nov 8, 2023

Description

Cleanup TreeNodeSchema for Schema2 changes.

Breaking Changes

TreeNodeSchema is now a union of classes, with ObjectNodeSchema and FieldNodeSchema properly separated.

Reviewer Guidance

The review process is outlined on this wiki page.

@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 8, 2023
@github-actions github-actions bot added the public api change Changes to a public API label Nov 9, 2023
@CraigMacomber CraigMacomber marked this pull request as ready for review November 11, 2023 00:05
@CraigMacomber CraigMacomber requested review from a team as code owners November 11, 2023 00:05
@CraigMacomber
Copy link
Contributor Author

CraigMacomber commented Nov 11, 2023

This commit 66810bd is on my fork's branch, and fixes the conflicts. It is not showing up in the PR for some reason.

Edit: pushing another commit seemed to nudge github into updating.

@msfluid-bot
Copy link
Collaborator

msfluid-bot commented Nov 11, 2023

@fluid-example/bundle-size-tests: +512 Bytes
Metric NameBaseline SizeCompare SizeSize Diff
aqueduct.js 447.51 KB 447.51 KB No change
connectionState.js 680 Bytes 680 Bytes No change
containerRuntime.js 240.61 KB 240.61 KB No change
loader.js 178.94 KB 178.94 KB No change
map.js 48.06 KB 48.06 KB No change
matrix.js 141.84 KB 141.84 KB No change
odspDriver.js 90.27 KB 90.27 KB No change
odspPrefetchSnapshot.js 41.9 KB 41.9 KB No change
sharedString.js 162.75 KB 162.75 KB No change
sharedTree2.js 275.77 KB 276.27 KB +512 Bytes
Total Size 1.74 MB 1.74 MB +512 Bytes

Baseline commit: 4f6f622

Generated by 🚫 dangerJS against 4b86cfa

@CraigMacomber
Copy link
Contributor Author

CLA bot seems broken. Close and reopen to try and fix.

@CraigMacomber CraigMacomber reopened this Nov 11, 2023
export abstract class TreeNodeSchemaBase<
const out Name extends string = string,
const out Specification = unknown,
> implements TreeNodeStoredSchema
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the implicication and reason for the change to have TreeNodeSchema and TreeFieldSchema implement *StoredSchema? It is not mentioned in the PR description.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It did so before, and removing it breaks some code. For example it would require a an API to convert to stored schema, and a few places to use it. Contextually typed data is one example, dynamic schema validation (once we have it) will be another place that can work with both, and would need a conversion if view schema don't implement stored.

@@ -165,9 +165,11 @@ describe("ContextuallyTyped", () => {
libraries: [leaf.library],
});

const nodeSchema = builder.objectRecursive("node", {
const recursiveReference = () => nodeSchema;
builder.fixRecursiveReference(recursiveReference);
Copy link
Contributor

Choose a reason for hiding this comment

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

chef's kiss

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, I forgot to revert this change since this pattern tends to crash the stop working if you use the resulting schema very much. I think it ends up being order dependent across files in some broken way 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.

I guess this one works so I can leave it.

@CraigMacomber CraigMacomber enabled auto-merge (squash) November 14, 2023 01:19
@CraigMacomber CraigMacomber merged commit 5e375cc into microsoft:main Nov 14, 2023
25 checks passed
@CraigMacomber CraigMacomber deleted the CleanupSchema branch November 14, 2023 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: dds: propertydds area: dds: tree area: dds Issues related to distributed data structures 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.

None yet

3 participants