rojo-rbx / rojo

Rojo enables Roblox developers to use professional-grade software engineering tools
https://rojo.space
Mozilla Public License 2.0
938 stars 176 forks source link

Plugin crashes when read-only properties are defined in *.project.json #230

Closed NobleDraconian closed 4 years ago

NobleDraconian commented 5 years ago

Currently, when you try to live-sync in a project that has any read-only properties (in my case it's StarterPlayer.UserEmotesEnabled) inside of its *.project.json configuration file, the studio plugin crashes.

Plugin error:

18:42:46.205 - [Rojo-Warn] Rojo session terminated because of an error:
18:42:46.206 - [Rojo-Warn] Plugin_rojo.rbxm.Rojo.Plugin.Reconciler:65: Invalid property StarterPlayer.UserEmotesEnabled: Error(Roblox: Unable to assign property UserEmotesEnabled. Script write access is restricted
18:42:46.206 - [Rojo-Warn] Plugin_rojo.rbxm.Rojo.RbxDom.PropertyDescriptor:19 function set
18:42:46.206 - [Rojo-Warn] Plugin_rojo.rbxm.Rojo.RbxDom.PropertyDescriptor:58 function write
18:42:46.207 - [Rojo-Warn] Plugin_rojo.rbxm.Rojo.Plugin.setCanonicalProperty:21 function setCanonicalProperty
18:42:46.207 - [Rojo-Warn] Plugin_rojo.rbxm.Rojo.Plugin.Reconciler:65 function reconcile
18:42:46.207 - [Rojo-Warn] Plugin_rojo.rbxm.Rojo.Plugin.Reconciler:94 function reconcile
18:42:46.207 - [Rojo-Warn] Plugin_rojo.rbxm.Rojo.Plugin.Session:35
18:42:46.208 - [Rojo-Warn] )

The project configuration file can be found here : https://pastebin.com/mibRAAhP

LPGhatguy commented 5 years ago

Well here's our problem! According to the dump, UserEmotesEnabled is writable:

https://github.com/rojo-rbx/rbx-dom/blob/8af8e2898e37079aa7fbc3ecaf05026ece3c4443/rbx_dom_lua/src/ReflectionDatabase/classes.lua#L14295-L14304

I imagine it's restricted to built-in plugin security, which is why our generator script was able to pick it up as writable. If you run Rojo from your BuiltInPlugins folder, you can work around this temporarily, or you can open up your copy of this file in your plugin to temporarily patch this property to be scriptabillity = "None", which will make Rojo ignore it completely.

LPGhatguy commented 4 years ago

Just landed a partial fix for this issue! The notably case I fixed was MeshPart.MeshId, which had a similar problem, but is writable from no script identities.

I'll be doing some work in rbx-dom to fix this UserEmotesEnabled, since I think this is writable from a built-in plugin.

LPGhatguy commented 4 years ago

I believe this is resolved as well as we can from Rojo. From here, improvements to the reflection database will be our best bet.