Refactor reference handling in Rojo system to prioritize path-based attributes

- Updated attribute prefixes to use REF_PATH_ATTRIBUTE_PREFIX for path-based references.
- Enhanced PatchApplyContext and related functions to support path-based linking, falling back to ID-based references when necessary.
- Implemented cleanup for legacy attributes to ensure they do not persist in the live game.
- Improved error handling and logging for reference resolution processes.
This commit is contained in:
Joe 2026-01-20 21:34:37 -06:00
parent 3cf452cb7b
commit 196cf7aed7
5 changed files with 275 additions and 165 deletions

View file

@ -8,7 +8,7 @@ use rbx_dom_weak::types::{
use rbx_reflection::{DataType, PropertyDescriptor};
use serde::{Deserialize, Serialize};
use crate::REF_POINTER_ATTRIBUTE_PREFIX;
use crate::REF_PATH_ATTRIBUTE_PREFIX;
/// A user-friendly version of `Variant` that supports specifying ambiguous
/// values. Ambiguous values need a reflection database to be resolved to a
@ -245,8 +245,8 @@ impl AmbiguousValue {
}
(VariantType::Ref, AmbiguousValue::String(_)) => Err(format_err!(
"Cannot resolve Ref properties as a String.\
Use an attribute named `{REF_POINTER_ATTRIBUTE_PREFIX}{prop_name}"
"Cannot resolve Ref properties as a String. \
Use an attribute named `{REF_PATH_ATTRIBUTE_PREFIX}{prop_name}` with the path to the target instance"
)),
(_, unresolved) => Err(format_err!(
"Wrong type of value for property {}.{}. Expected {:?}, got {}",