Implement fixes and enhancements from audit pass 2

- Introduced a new plan addressing critical bugs, correctness issues, and refactors identified during the audit, including improvements to metadata handling and slugification logic.
- Replaced inline removal logic in `handle_api_write` with a new `remove_instance_at_path` method to ensure correct deletion of instances.
- Updated pre-seeding logic in `dir.rs` and `project.rs` to derive deduplication keys from actual filesystem paths instead of slugified names.
- Enhanced rename handling in `change_processor.rs` to prevent collisions by deduplicating names against existing siblings.
- Added tests for various scenarios, including handling of forbidden characters and ensuring correct deduplication behavior.
- Refactored child iteration in `dir.rs` and `project.rs` to sort children alphabetically for deterministic deduplication ordering.
This commit is contained in:
Joe 2026-02-10 21:35:26 -06:00
parent baf05dcb3d
commit 2ff5c3936c
30 changed files with 871 additions and 229 deletions

View file

@ -0,0 +1,25 @@
---
source: tests/tests/build.rs
expression: contents
---
<roblox version="4">
<Item class="Folder" referent="0">
<Properties>
<string name="Name">dedup_suffix_with_meta</string>
</Properties>
<Item class="ModuleScript" referent="1">
<Properties>
<string name="Name">A/B</string>
<string name="Source"><![CDATA[return "first"
]]></string>
</Properties>
</Item>
<Item class="ModuleScript" referent="2">
<Properties>
<string name="Name">A_B</string>
<string name="Source"><![CDATA[return "second"
]]></string>
</Properties>
</Item>
</Item>
</roblox>

View file

@ -0,0 +1,18 @@
---
source: tests/tests/build.rs
expression: contents
---
<roblox version="4">
<Item class="Folder" referent="0">
<Properties>
<string name="Name">init_meta_name_override</string>
</Properties>
<Item class="ModuleScript" referent="1">
<Properties>
<string name="Name">Real:Name</string>
<string name="Source"><![CDATA[return "init module"
]]></string>
</Properties>
</Item>
</Item>
</roblox>

View file

@ -0,0 +1,18 @@
---
source: tests/tests/build.rs
expression: contents
---
<roblox version="4">
<Item class="Folder" referent="0">
<Properties>
<string name="Name">meta_name_override</string>
</Properties>
<Item class="ModuleScript" referent="1">
<Properties>
<string name="Name">Hey/Bro</string>
<string name="Source"><![CDATA[return "module"
]]></string>
</Properties>
</Item>
</Item>
</roblox>

View file

@ -0,0 +1,16 @@
---
source: tests/tests/build.rs
expression: contents
---
<roblox version="4">
<Item class="Folder" referent="0">
<Properties>
<string name="Name">model_json_name_override</string>
</Properties>
<Item class="Configuration" referent="1">
<Properties>
<string name="Name">Hey/Bro</string>
</Properties>
</Item>
</Item>
</roblox>

View file

@ -0,0 +1,6 @@
{
"name": "dedup_suffix_with_meta",
"tree": {
"$path": "src"
}
}

View file

@ -0,0 +1 @@
return "first"

View file

@ -0,0 +1,3 @@
{
"name": "A/B"
}

View file

@ -0,0 +1 @@
return "second"

View file

@ -0,0 +1,3 @@
{
"name": "A_B"
}

View file

@ -0,0 +1,6 @@
{
"name": "init_meta_name_override",
"tree": {
"$path": "src"
}
}

View file

@ -0,0 +1 @@
return "init module"

View file

@ -0,0 +1,3 @@
{
"name": "Real:Name"
}

View file

@ -0,0 +1,6 @@
{
"name": "meta_name_override",
"tree": {
"$path": "src"
}
}

View file

@ -0,0 +1 @@
return "module"

View file

@ -0,0 +1,3 @@
{
"name": "Hey/Bro"
}

View file

@ -0,0 +1,6 @@
{
"name": "model_json_name_override",
"tree": {
"$path": "src"
}
}

View file

@ -0,0 +1,4 @@
{
"name": "Hey/Bro",
"className": "Configuration"
}