rojo/plugin/src/ChangeBatcher/encodeProperty.lua
Joe 316d7ea70e Update logging levels in Rojo plugin and enhance test plans
- Promoted sync-related logging from Debug/Trace to Info level across multiple files, ensuring visibility of changes in the Studio output console.
- Added a new plan for expanding the connected mode test suite to cover multi-step scenarios and round-trip identity verification.
- Introduced a plan to fix stale tree desynchronization by implementing a validation mechanism on plugin connection.
- Created a plan to bump sync logging to Info level, detailing todos for various components in the plugin.

This update improves the clarity of logs and enhances testing coverage for connected mode scenarios.
2026-02-11 17:10:35 -06:00

28 lines
929 B
Lua

local Packages = script.Parent.Parent.Parent.Packages
local Log = require(Packages.Log)
local RbxDom = require(Packages.RbxDom)
return function(instance, propertyName, propertyDescriptor)
local readSuccess, readResult = propertyDescriptor:read(instance)
if not readSuccess then
Log.warn("Could not sync back property {:?}.{}: {}", instance, propertyName, readResult)
return false, nil
end
local dataType = propertyDescriptor.dataType
local pcallOk, encodeSuccess, encodeResult = pcall(RbxDom.EncodedValue.encode, readResult, dataType)
if not pcallOk then
-- Encoder threw an error (e.g., Ref, Region3, SharedString)
Log.warn("Could not sync back property {:?}.{}: {}", instance, propertyName, encodeSuccess)
return false, nil
end
if not encodeSuccess then
Log.warn("Could not sync back property {:?}.{}: {}", instance, propertyName, encodeResult)
return false, nil
end
return true, encodeResult
end