Skip to content

Implement property migration #283

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 28 commits into from
Jun 15, 2023

Conversation

kennethloeffler
Copy link
Member

@kennethloeffler kennethloeffler commented Jun 13, 2023

This PR is based off of #268 - all of the description there also applies here. The only thing that really needed to be done was supporting Migrate patches in rbx_reflector.

I've also slightly refactored the whole canonical property dance in the rbx_binary deserializer state, hopefully it's a bit easier to follow.

TODO:

Don't need these anymore!
Giving myself an excuse for a future variable rename - I think
"type_name" is pretty poor because it's overloaded by other parts of
rbx_binary and also I'm pretty used to calling this concept "class
name!"
This allows the pattern matching in rbx_xml and rbx_binary to be a
little simpler and renames what was formerly "Property" to "MigratesTo,"
which I think is clearer
Dunno. Lemme know!
@kennethloeffler kennethloeffler force-pushed the property-migration-pr-fix branch from b293ddb to bd42512 Compare June 13, 2023 08:46
Comment on lines +133 to +142
// TODO: Do we need an additional fix here?
let canonical_name = &descriptors.canonical.name;
let canonical_type = match &descriptors.canonical.data_type {
DataType::Value(ty) => *ty,
DataType::Enum(_) => VariantType::Enum,
_ => {
// TODO: Configurable handling of unknown types?
return None;
}
};
Copy link
Member

Choose a reason for hiding this comment

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

I realize these are copied verbatim from the old source but it does make me wonder what was actually meant by the first one.

With regards to the second one, we don't really need to worry about it because I don't foresee a world where Roblox adds something that's not a data type or an enum that also serializes.

Copy link
Member Author

Choose a reason for hiding this comment

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

I realize these are copied verbatim from the old source but it does make me wonder what was actually meant by the first one.

With regards to the second one, we don't really need to worry about it because I don't foresee a world where Roblox adds something that's not a data type or an enum that also serializes.

These comments were added by #230.

The first comment might be talking about other possible ways rbx_binary can serialize properties that aren't supposed to serialize? But I'm not sure what other cases could lead to this kind of problem 🤷

The fall through is hit on an unknown property type, and the second comment is referring to doing something smarter in that case. I think we should keep this comment.

Comment on lines -24638 to +24762
"String": "{7EFC8201-25F5-42C7-8DDB-DD7BD2D32FE7}"
"String": "{7604441B-B379-4EE1-984B-AE157BC63C77}"
Copy link
Member

Choose a reason for hiding this comment

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

We should probably do something about ScriptGuid going forward because it seems like it isn't stable between versions... Which is probably expected behavior given it's a GUID.

It doesn't need to and shouldn't happen in this PR but it's something to think about because I'm not sure how to actually solve a property that we shouldn't store a default for like this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed that it doesn't make sense to have a default ScriptGuid - we ought to catalogue any properties for which defaults aren't sensible and figure out a good strategy to deal with them

@Dekkonot Dekkonot merged commit e99f37d into rojo-rbx:master Jun 15, 2023
@kennethloeffler kennethloeffler deleted the property-migration-pr-fix branch June 15, 2023 01:42
Dekkonot pushed a commit to Dekkonot/rbx-dom that referenced this pull request Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants