Closed kennethloeffler closed 3 months ago
I'll be completely honest: I'm not sure what part of the code I need to touch for this. I can do some backtracing to work out what part, but it might be easier to just ask if you know. So, what part of the code would I need to look in for this? Outside the patch application code, I mean.
The root cause seems to be that ref properties specified via attributes are not included in snapshots of the file system, i.e. when we get here
https://github.com/rojo-rbx/rojo/blob/3ca975d81dfd6f06e024dec5a87bedf5f796dfc2/src/snapshot/patch_compute.rs#L120-L141
visited_properties is only populated with properties directly from the snapshot. Ref properties specified via attributes will not exist there, and will be detected as having changed to None
in the second loop
why this happens makes sense - it's just that resolving ref properties here will require a slight design change
To reproduce:
rojo plugin install
rojo serve
on theref_properties
test projectdefault.project.json
(I added a newline)null
for all theRef
properties specified with attributes in ref_properties'default.project.json
:I noticed this behavior in some test failures after #843 was merged: https://github.com/rojo-rbx/rojo/actions/runs/9605402645/job/26492956529#step:7:762. This makes it impossible for the Rojo plugin to live update a Ref property, could cause problems once rbx_dom_lua gains better ability to represent optional values, and can currently cause test failures on macOS due to seemingly inherent noisiness in FSEvents.
One reason this could happen is because deferred Ref property application appears to not influence the returned result of patch application (i.e.
PatchApplyContext.applied_patch_set
), but rather only influences the tree: https://github.com/rojo-rbx/rojo/blob/7e2bab921aa71f76d07d0424e4bb4064e8b7c995/src/snapshot/patch_apply.rs#L246-L299It will also be worth investigating patch computation, to see if Ref properties specified via attributes are erroneously detected as removed there.