mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +00:00
Enhance audit documentation and address critical Ref property issues
- Updated the audit guide to clarify the workflow and prerequisites for conducting a production-grade sync feature audit. - Introduced a new plan file detailing fixes for critical issues identified in the two-way sync audit, including missing instance maps and stale paths after renames. - Enhanced `ServeSession.lua` to correctly pass the instance map in patch updates, ensuring accurate handling of unresolved Ref properties. - Implemented various fixes in `change_processor.rs` and `rojo_ref.rs` to address critical bugs related to Ref path handling and instance renaming. - Added tests to verify the correct behavior of Ref properties and ensure robustness against edge cases. These changes improve the reliability of the synchronization system and enhance the clarity of the audit process.
This commit is contained in:
parent
8f0df692d3
commit
ca2a938902
8 changed files with 811 additions and 90 deletions
|
|
@ -288,25 +288,33 @@ fn compute_ref_properties(
|
|||
};
|
||||
|
||||
for (attr_name, attr_value) in attributes.iter() {
|
||||
// Handle legacy ID-based refs (Rojo_Target_) FIRST -- lower priority.
|
||||
// If a Rojo_Ref_* attribute also exists for the same property, it will
|
||||
// overwrite this entry below (path-based system has priority).
|
||||
// Handle legacy ID-based refs (Rojo_Target_) -- lower priority.
|
||||
// BTreeMap iterates alphabetically, so Rojo_Ref_* ('R') is visited
|
||||
// BEFORE Rojo_Target_* ('T'). Without the contains_key guard,
|
||||
// Rojo_Target_* would silently overwrite Rojo_Ref_*. The guard
|
||||
// ensures path-based refs always win when both exist.
|
||||
if let Some(prop_name) = attr_name.strip_prefix(REF_POINTER_ATTRIBUTE_PREFIX) {
|
||||
let key = ustr(prop_name);
|
||||
// Skip if Rojo_Ref_* already set a value for this property
|
||||
if map.contains_key(&key) {
|
||||
continue;
|
||||
}
|
||||
let Some(id_str) = crate::variant_as_str(attr_value, attr_name) else {
|
||||
continue;
|
||||
};
|
||||
let rojo_ref = RojoRef::new(id_str.to_string());
|
||||
if let Some(target_id) = tree.get_specified_id(&rojo_ref) {
|
||||
map.insert(ustr(prop_name), Some(Variant::Ref(target_id)));
|
||||
map.insert(key, Some(Variant::Ref(target_id)));
|
||||
} else {
|
||||
map.insert(ustr(prop_name), None);
|
||||
map.insert(key, None);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// Handle path-based refs (Rojo_Ref_) SECOND -- higher priority.
|
||||
// Overwrites any Rojo_Target_* entry for the same property since
|
||||
// path-based is the preferred system.
|
||||
// Handle path-based refs (Rojo_Ref_) -- higher priority.
|
||||
// Always inserted unconditionally; if a Rojo_Target_* for the same
|
||||
// property was already visited (shouldn't happen due to BTreeMap
|
||||
// ordering, but defensive), this overwrites it.
|
||||
if let Some(prop_name) = attr_name.strip_prefix(REF_PATH_ATTRIBUTE_PREFIX) {
|
||||
let Some(path) = crate::variant_as_str(attr_value, attr_name) else {
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue