mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +00:00
Complete audit plan updates and enhance deduplication processes
- Updated the audit plan for the ambiguous paths follow-up, marking all critical fixes as completed, including dedup cleanup, added paths, and ref path finalization. - Introduced a new `atlas-dedup.mdc` file detailing the deduplication system, including matching algorithms, suffix cleanup, and integration for duplicate-named instances. - Enhanced the `syncback` process to ensure proper handling of ref paths and deduplication, improving metadata consistency and overall system reliability. - Implemented attribute-scoped path fixes in the `FsSnapshot` to ensure only relevant lines are modified during ref path updates. These changes improve the clarity and effectiveness of the audit process while enhancing the deduplication and synchronization mechanisms within the project.
This commit is contained in:
parent
ff48e05914
commit
ed1f61c093
11 changed files with 1226 additions and 123 deletions
|
|
@ -619,6 +619,9 @@ impl ApiService {
|
|||
// Build a path map for instances added in this same request.
|
||||
// This allows Ref properties in updates to reference just-added
|
||||
// instances that aren't in the tree yet (VFS watcher is async).
|
||||
// The segment includes the middleware extension (e.g. .server.luau,
|
||||
// .model.json5) so that Rojo_Ref_* paths match what the filesystem
|
||||
// will actually contain.
|
||||
let added_paths: HashMap<Ref, String> = {
|
||||
let tree = self.serve_session.tree();
|
||||
request
|
||||
|
|
@ -631,14 +634,7 @@ impl ApiService {
|
|||
} else {
|
||||
return None;
|
||||
};
|
||||
// Use slugified name (matching filesystem conventions) instead of
|
||||
// escape_ref_path_segment (which uses legacy \/ escaping that
|
||||
// get_instance_by_path cannot resolve).
|
||||
let fs_name = if crate::syncback::name_needs_slugify(&added.name) {
|
||||
crate::syncback::slugify_name(&added.name)
|
||||
} else {
|
||||
added.name.clone()
|
||||
};
|
||||
let fs_name = added_instance_fs_segment(added);
|
||||
let path = if parent_path.is_empty() {
|
||||
fs_name
|
||||
} else {
|
||||
|
|
@ -3562,6 +3558,91 @@ fn instance_for_scripts_only<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
/// Compute the tentative filesystem name segment for an `AddedInstance`.
|
||||
///
|
||||
/// Mirrors the logic of `tentative_fs_name` in `ref_properties.rs` but
|
||||
/// operates on `AddedInstance` fields instead of `rbx_dom_weak::Instance`.
|
||||
/// Used by `added_paths` to build correct same-batch Ref target paths.
|
||||
fn added_instance_fs_segment(added: &crate::web::interface::AddedInstance) -> String {
|
||||
let slug = if crate::syncback::name_needs_slugify(&added.name) {
|
||||
crate::syncback::slugify_name(&added.name)
|
||||
} else {
|
||||
added.name.clone()
|
||||
};
|
||||
|
||||
let has_children = !added.children.is_empty();
|
||||
|
||||
let is_container = matches!(
|
||||
added.class_name.as_str(),
|
||||
"Folder"
|
||||
| "Configuration"
|
||||
| "Tool"
|
||||
| "ScreenGui"
|
||||
| "SurfaceGui"
|
||||
| "BillboardGui"
|
||||
| "AdGui"
|
||||
);
|
||||
|
||||
let is_script = matches!(
|
||||
added.class_name.as_str(),
|
||||
"Script" | "LocalScript" | "ModuleScript"
|
||||
);
|
||||
|
||||
if is_container || (has_children && is_script) {
|
||||
return slug;
|
||||
}
|
||||
|
||||
let extension = match added.class_name.as_str() {
|
||||
"Script" => {
|
||||
if has_children {
|
||||
return slug;
|
||||
}
|
||||
match added.properties.get("RunContext") {
|
||||
Some(Variant::Enum(e)) => match e.to_u32() {
|
||||
0 => "legacy.luau",
|
||||
1 => "server.luau",
|
||||
2 => "client.luau",
|
||||
3 => "plugin.luau",
|
||||
_ => "legacy.luau",
|
||||
},
|
||||
_ => "legacy.luau",
|
||||
}
|
||||
}
|
||||
"LocalScript" => {
|
||||
if has_children {
|
||||
return slug;
|
||||
}
|
||||
"local.luau"
|
||||
}
|
||||
"ModuleScript" => {
|
||||
if has_children {
|
||||
return slug;
|
||||
}
|
||||
"luau"
|
||||
}
|
||||
"StringValue" => {
|
||||
if has_children {
|
||||
return slug;
|
||||
}
|
||||
"txt"
|
||||
}
|
||||
"LocalizationTable" => {
|
||||
if has_children {
|
||||
return slug;
|
||||
}
|
||||
"csv"
|
||||
}
|
||||
_ => {
|
||||
if has_children {
|
||||
return slug;
|
||||
}
|
||||
"model.json5"
|
||||
}
|
||||
};
|
||||
|
||||
format!("{slug}.{extension}")
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue