Add CI pipeline documentation and enhance syncback architecture

- Introduced a new CI pipeline documentation file outlining steps for auto-fixing formatting, running linters, building, and testing.
- Documented the Rojo syncback architecture, detailing improvements to prevent duplicate file creation and format mismatches.
- Updated syncback logic to ensure existing instances are updated instead of creating duplicates, enhancing project file management.
- Added tests for encoding instances and handling nested children to improve reliability in syncback operations.
This commit is contained in:
Joe 2026-02-01 18:18:31 -06:00
parent edc09741bf
commit b368eb2401
46 changed files with 3688 additions and 112 deletions

View file

@ -156,5 +156,154 @@ return function()
folder:Destroy()
end)
end)
describe("children encoding", function()
it("should include children array even when empty", function()
local moduleScript = Instance.new("ModuleScript")
moduleScript.Name = "TestModule"
moduleScript.Source = "return {}"
local encoded = encodeInstance(moduleScript, "PARENT_ID")
expect(encoded).to.be.ok()
expect(encoded.children).to.be.ok()
expect(type(encoded.children)).to.equal("table")
expect(#encoded.children).to.equal(0)
moduleScript:Destroy()
end)
it("should encode ModuleScript with children", function()
local parent = Instance.new("ModuleScript")
parent.Name = "ParentModule"
parent.Source = "return {}"
local child1 = Instance.new("ModuleScript")
child1.Name = "ChildModule1"
child1.Source = "return 1"
child1.Parent = parent
local child2 = Instance.new("ModuleScript")
child2.Name = "ChildModule2"
child2.Source = "return 2"
child2.Parent = parent
local encoded = encodeInstance(parent, "PARENT_ID")
expect(encoded).to.be.ok()
expect(encoded.children).to.be.ok()
expect(#encoded.children).to.equal(2)
-- Verify children are properly encoded
local childNames = {}
for _, child in encoded.children do
childNames[child.name] = true
expect(child.className).to.equal("ModuleScript")
expect(child.properties.Source).to.be.ok()
end
expect(childNames["ChildModule1"]).to.equal(true)
expect(childNames["ChildModule2"]).to.equal(true)
parent:Destroy()
end)
it("should encode nested children recursively", function()
local root = Instance.new("Folder")
root.Name = "Root"
local level1 = Instance.new("Folder")
level1.Name = "Level1"
level1.Parent = root
local level2 = Instance.new("ModuleScript")
level2.Name = "Level2"
level2.Source = "return 'nested'"
level2.Parent = level1
local encoded = encodeInstance(root, "PARENT_ID")
expect(encoded).to.be.ok()
expect(#encoded.children).to.equal(1)
expect(encoded.children[1].name).to.equal("Level1")
expect(#encoded.children[1].children).to.equal(1)
expect(encoded.children[1].children[1].name).to.equal("Level2")
expect(encoded.children[1].children[1].className).to.equal("ModuleScript")
root:Destroy()
end)
it("should skip children with duplicate names", function()
local parent = Instance.new("Folder")
parent.Name = "Parent"
local child1 = Instance.new("ModuleScript")
child1.Name = "DuplicateName"
child1.Source = "return 1"
child1.Parent = parent
local child2 = Instance.new("ModuleScript")
child2.Name = "DuplicateName" -- Same name!
child2.Source = "return 2"
child2.Parent = parent
local child3 = Instance.new("ModuleScript")
child3.Name = "UniqueName"
child3.Source = "return 3"
child3.Parent = parent
local encoded = encodeInstance(parent, "PARENT_ID")
expect(encoded).to.be.ok()
-- Should only have 1 child (UniqueName), duplicates skipped
expect(#encoded.children).to.equal(1)
expect(encoded.children[1].name).to.equal("UniqueName")
parent:Destroy()
end)
it("should return empty children array when all children deleted", function()
-- Simulate: parent had children, now they're all gone
local parent = Instance.new("ModuleScript")
parent.Name = "ParentModule"
parent.Source = "return {}"
-- No children parented
local encoded = encodeInstance(parent, "PARENT_ID")
expect(encoded).to.be.ok()
expect(encoded.children).to.be.ok()
expect(#encoded.children).to.equal(0)
parent:Destroy()
end)
it("should encode Script with Folder child", function()
-- This tests the init.server.luau + child directory scenario
local script = Instance.new("Script")
script.Name = "EventService"
script.Source = "-- Event service"
local events = Instance.new("Folder")
events.Name = "Events"
events.Parent = script
local event1 = Instance.new("ModuleScript")
event1.Name = "AcidRainEvent"
event1.Source = "return {}"
event1.Parent = events
local encoded = encodeInstance(script, "PARENT_ID")
expect(encoded).to.be.ok()
expect(encoded.className).to.equal("Script")
expect(#encoded.children).to.equal(1)
expect(encoded.children[1].name).to.equal("Events")
expect(encoded.children[1].className).to.equal("Folder")
expect(#encoded.children[1].children).to.equal(1)
expect(encoded.children[1].children[1].name).to.equal("AcidRainEvent")
script:Destroy()
end)
end)
end)
end