mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Enhance service visibility configuration in snapshot tests
- Added `ignoreHiddenServices: true` and a comprehensive list of `visibleServices` to multiple snapshot test files to improve service visibility management during testing. - Refactored logging in the `diff.lua` file to streamline the trace output for hidden services, enhancing clarity in the sync process.
This commit is contained in:
parent
b368eb2401
commit
0eb135ee15
26 changed files with 487 additions and 54 deletions
|
|
@ -417,10 +417,7 @@ local function diff(instanceMap, virtualInstances, rootId, serverInfo)
|
|||
-- so we shouldn't mark them for deletion during forward sync.
|
||||
if serverInfo and serverInfo.ignoreHiddenServices and instance == game then
|
||||
if not visibleServicesSet[childInstance.Name] then
|
||||
Log.trace(
|
||||
"Skipping hidden service {} (ignoreHiddenServices is enabled)",
|
||||
childInstance.Name
|
||||
)
|
||||
Log.trace("Skipping hidden service {} (ignoreHiddenServices is enabled)", childInstance.Name)
|
||||
continue
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,9 +2,26 @@
|
|||
source: tests/tests/serve.rs
|
||||
expression: redactions.redacted_yaml(info)
|
||||
---
|
||||
ignoreHiddenServices: true
|
||||
projectName: add_folder
|
||||
protocolVersion: 5
|
||||
rootInstanceId: id-2
|
||||
serverVersion: "[server-version]"
|
||||
sessionId: id-1
|
||||
syncSourceOnly: true
|
||||
visibleServices:
|
||||
- Lighting
|
||||
- MaterialService
|
||||
- NetworkClient
|
||||
- ReplicatedFirst
|
||||
- ReplicatedStorage
|
||||
- ServerScriptService
|
||||
- ServerStorage
|
||||
- SoundService
|
||||
- StarterGui
|
||||
- StarterPack
|
||||
- StarterPlayer
|
||||
- Teams
|
||||
- TextChatService
|
||||
- VoiceChatService
|
||||
- Workspace
|
||||
|
|
|
|||
|
|
@ -2,9 +2,26 @@
|
|||
source: tests/tests/serve.rs
|
||||
expression: redactions.redacted_yaml(info)
|
||||
---
|
||||
ignoreHiddenServices: true
|
||||
projectName: edit_init
|
||||
protocolVersion: 5
|
||||
rootInstanceId: id-2
|
||||
serverVersion: "[server-version]"
|
||||
sessionId: id-1
|
||||
syncSourceOnly: true
|
||||
visibleServices:
|
||||
- Lighting
|
||||
- MaterialService
|
||||
- NetworkClient
|
||||
- ReplicatedFirst
|
||||
- ReplicatedStorage
|
||||
- ServerScriptService
|
||||
- ServerStorage
|
||||
- SoundService
|
||||
- StarterGui
|
||||
- StarterPack
|
||||
- StarterPlayer
|
||||
- Teams
|
||||
- TextChatService
|
||||
- VoiceChatService
|
||||
- Workspace
|
||||
|
|
|
|||
|
|
@ -2,9 +2,26 @@
|
|||
source: tests/tests/serve.rs
|
||||
expression: redactions.redacted_yaml(info)
|
||||
---
|
||||
ignoreHiddenServices: true
|
||||
projectName: empty
|
||||
protocolVersion: 5
|
||||
rootInstanceId: id-2
|
||||
serverVersion: "[server-version]"
|
||||
sessionId: id-1
|
||||
syncSourceOnly: true
|
||||
visibleServices:
|
||||
- Lighting
|
||||
- MaterialService
|
||||
- NetworkClient
|
||||
- ReplicatedFirst
|
||||
- ReplicatedStorage
|
||||
- ServerScriptService
|
||||
- ServerStorage
|
||||
- SoundService
|
||||
- StarterGui
|
||||
- StarterPack
|
||||
- StarterPlayer
|
||||
- Teams
|
||||
- TextChatService
|
||||
- VoiceChatService
|
||||
- Workspace
|
||||
|
|
|
|||
|
|
@ -2,9 +2,26 @@
|
|||
source: tests/tests/serve.rs
|
||||
expression: redactions.redacted_yaml(info)
|
||||
---
|
||||
ignoreHiddenServices: true
|
||||
projectName: empty_folder
|
||||
protocolVersion: 5
|
||||
rootInstanceId: id-2
|
||||
serverVersion: "[server-version]"
|
||||
sessionId: id-1
|
||||
syncSourceOnly: true
|
||||
visibleServices:
|
||||
- Lighting
|
||||
- MaterialService
|
||||
- NetworkClient
|
||||
- ReplicatedFirst
|
||||
- ReplicatedStorage
|
||||
- ServerScriptService
|
||||
- ServerStorage
|
||||
- SoundService
|
||||
- StarterGui
|
||||
- StarterPack
|
||||
- StarterPlayer
|
||||
- Teams
|
||||
- TextChatService
|
||||
- VoiceChatService
|
||||
- Workspace
|
||||
|
|
|
|||
|
|
@ -2,9 +2,26 @@
|
|||
source: tests/tests/serve.rs
|
||||
expression: redactions.redacted_yaml(&info)
|
||||
---
|
||||
ignoreHiddenServices: true
|
||||
projectName: forced_parent
|
||||
protocolVersion: 5
|
||||
rootInstanceId: id-2
|
||||
serverVersion: "[server-version]"
|
||||
sessionId: id-1
|
||||
syncSourceOnly: true
|
||||
visibleServices:
|
||||
- Lighting
|
||||
- MaterialService
|
||||
- NetworkClient
|
||||
- ReplicatedFirst
|
||||
- ReplicatedStorage
|
||||
- ServerScriptService
|
||||
- ServerStorage
|
||||
- SoundService
|
||||
- StarterGui
|
||||
- StarterPack
|
||||
- StarterPlayer
|
||||
- Teams
|
||||
- TextChatService
|
||||
- VoiceChatService
|
||||
- Workspace
|
||||
|
|
|
|||
|
|
@ -2,9 +2,26 @@
|
|||
source: tests/tests/serve.rs
|
||||
expression: redactions.redacted_yaml(&info)
|
||||
---
|
||||
ignoreHiddenServices: true
|
||||
projectName: meshpart
|
||||
protocolVersion: 5
|
||||
rootInstanceId: id-2
|
||||
serverVersion: "[server-version]"
|
||||
sessionId: id-1
|
||||
syncSourceOnly: true
|
||||
visibleServices:
|
||||
- Lighting
|
||||
- MaterialService
|
||||
- NetworkClient
|
||||
- ReplicatedFirst
|
||||
- ReplicatedStorage
|
||||
- ServerScriptService
|
||||
- ServerStorage
|
||||
- SoundService
|
||||
- StarterGui
|
||||
- StarterPack
|
||||
- StarterPlayer
|
||||
- Teams
|
||||
- TextChatService
|
||||
- VoiceChatService
|
||||
- Workspace
|
||||
|
|
|
|||
|
|
@ -2,9 +2,26 @@
|
|||
source: tests/tests/serve.rs
|
||||
expression: redactions.redacted_yaml(info)
|
||||
---
|
||||
ignoreHiddenServices: true
|
||||
projectName: move_folder_of_stuff
|
||||
protocolVersion: 5
|
||||
rootInstanceId: id-2
|
||||
serverVersion: "[server-version]"
|
||||
sessionId: id-1
|
||||
syncSourceOnly: true
|
||||
visibleServices:
|
||||
- Lighting
|
||||
- MaterialService
|
||||
- NetworkClient
|
||||
- ReplicatedFirst
|
||||
- ReplicatedStorage
|
||||
- ServerScriptService
|
||||
- ServerStorage
|
||||
- SoundService
|
||||
- StarterGui
|
||||
- StarterPack
|
||||
- StarterPlayer
|
||||
- Teams
|
||||
- TextChatService
|
||||
- VoiceChatService
|
||||
- Workspace
|
||||
|
|
|
|||
|
|
@ -2,9 +2,26 @@
|
|||
source: tests/tests/serve.rs
|
||||
expression: redactions.redacted_yaml(info)
|
||||
---
|
||||
ignoreHiddenServices: true
|
||||
projectName: top-level
|
||||
protocolVersion: 5
|
||||
rootInstanceId: id-2
|
||||
serverVersion: "[server-version]"
|
||||
sessionId: id-1
|
||||
syncSourceOnly: true
|
||||
visibleServices:
|
||||
- Lighting
|
||||
- MaterialService
|
||||
- NetworkClient
|
||||
- ReplicatedFirst
|
||||
- ReplicatedStorage
|
||||
- ServerScriptService
|
||||
- ServerStorage
|
||||
- SoundService
|
||||
- StarterGui
|
||||
- StarterPack
|
||||
- StarterPlayer
|
||||
- Teams
|
||||
- TextChatService
|
||||
- VoiceChatService
|
||||
- Workspace
|
||||
|
|
|
|||
|
|
@ -2,9 +2,26 @@
|
|||
source: tests/tests/serve.rs
|
||||
expression: redactions.redacted_yaml(info)
|
||||
---
|
||||
ignoreHiddenServices: true
|
||||
projectName: no_name_project
|
||||
protocolVersion: 5
|
||||
rootInstanceId: id-2
|
||||
serverVersion: "[server-version]"
|
||||
sessionId: id-1
|
||||
syncSourceOnly: true
|
||||
visibleServices:
|
||||
- Lighting
|
||||
- MaterialService
|
||||
- NetworkClient
|
||||
- ReplicatedFirst
|
||||
- ReplicatedStorage
|
||||
- ServerScriptService
|
||||
- ServerStorage
|
||||
- SoundService
|
||||
- StarterGui
|
||||
- StarterPack
|
||||
- StarterPlayer
|
||||
- Teams
|
||||
- TextChatService
|
||||
- VoiceChatService
|
||||
- Workspace
|
||||
|
|
|
|||
|
|
@ -2,9 +2,26 @@
|
|||
source: tests/tests/serve.rs
|
||||
expression: redactions.redacted_yaml(info)
|
||||
---
|
||||
ignoreHiddenServices: true
|
||||
projectName: no_name_top_level_project
|
||||
protocolVersion: 5
|
||||
rootInstanceId: id-2
|
||||
serverVersion: "[server-version]"
|
||||
sessionId: id-1
|
||||
syncSourceOnly: true
|
||||
visibleServices:
|
||||
- Lighting
|
||||
- MaterialService
|
||||
- NetworkClient
|
||||
- ReplicatedFirst
|
||||
- ReplicatedStorage
|
||||
- ServerScriptService
|
||||
- ServerStorage
|
||||
- SoundService
|
||||
- StarterGui
|
||||
- StarterPack
|
||||
- StarterPlayer
|
||||
- Teams
|
||||
- TextChatService
|
||||
- VoiceChatService
|
||||
- Workspace
|
||||
|
|
|
|||
|
|
@ -2,9 +2,26 @@
|
|||
source: tests/tests/serve.rs
|
||||
expression: redactions.redacted_yaml(info)
|
||||
---
|
||||
ignoreHiddenServices: true
|
||||
projectName: pivot_migration
|
||||
protocolVersion: 5
|
||||
rootInstanceId: id-2
|
||||
serverVersion: "[server-version]"
|
||||
sessionId: id-1
|
||||
syncSourceOnly: true
|
||||
visibleServices:
|
||||
- Lighting
|
||||
- MaterialService
|
||||
- NetworkClient
|
||||
- ReplicatedFirst
|
||||
- ReplicatedStorage
|
||||
- ServerScriptService
|
||||
- ServerStorage
|
||||
- SoundService
|
||||
- StarterGui
|
||||
- StarterPack
|
||||
- StarterPlayer
|
||||
- Teams
|
||||
- TextChatService
|
||||
- VoiceChatService
|
||||
- Workspace
|
||||
|
|
|
|||
|
|
@ -2,9 +2,26 @@
|
|||
source: tests/tests/serve.rs
|
||||
expression: redactions.redacted_yaml(info)
|
||||
---
|
||||
ignoreHiddenServices: true
|
||||
projectName: ref_properties
|
||||
protocolVersion: 5
|
||||
rootInstanceId: id-2
|
||||
serverVersion: "[server-version]"
|
||||
sessionId: id-1
|
||||
syncSourceOnly: true
|
||||
visibleServices:
|
||||
- Lighting
|
||||
- MaterialService
|
||||
- NetworkClient
|
||||
- ReplicatedFirst
|
||||
- ReplicatedStorage
|
||||
- ServerScriptService
|
||||
- ServerStorage
|
||||
- SoundService
|
||||
- StarterGui
|
||||
- StarterPack
|
||||
- StarterPlayer
|
||||
- Teams
|
||||
- TextChatService
|
||||
- VoiceChatService
|
||||
- Workspace
|
||||
|
|
|
|||
|
|
@ -2,9 +2,26 @@
|
|||
source: tests/tests/serve.rs
|
||||
expression: redactions.redacted_yaml(info)
|
||||
---
|
||||
ignoreHiddenServices: true
|
||||
projectName: ref_properties
|
||||
protocolVersion: 5
|
||||
rootInstanceId: id-2
|
||||
serverVersion: "[server-version]"
|
||||
sessionId: id-1
|
||||
syncSourceOnly: true
|
||||
visibleServices:
|
||||
- Lighting
|
||||
- MaterialService
|
||||
- NetworkClient
|
||||
- ReplicatedFirst
|
||||
- ReplicatedStorage
|
||||
- ServerScriptService
|
||||
- ServerStorage
|
||||
- SoundService
|
||||
- StarterGui
|
||||
- StarterPack
|
||||
- StarterPlayer
|
||||
- Teams
|
||||
- TextChatService
|
||||
- VoiceChatService
|
||||
- Workspace
|
||||
|
|
|
|||
|
|
@ -2,9 +2,26 @@
|
|||
source: tests/tests/serve.rs
|
||||
expression: redactions.redacted_yaml(info)
|
||||
---
|
||||
ignoreHiddenServices: true
|
||||
projectName: ref_properties_remove
|
||||
protocolVersion: 5
|
||||
rootInstanceId: id-2
|
||||
serverVersion: "[server-version]"
|
||||
sessionId: id-1
|
||||
syncSourceOnly: true
|
||||
visibleServices:
|
||||
- Lighting
|
||||
- MaterialService
|
||||
- NetworkClient
|
||||
- ReplicatedFirst
|
||||
- ReplicatedStorage
|
||||
- ServerScriptService
|
||||
- ServerStorage
|
||||
- SoundService
|
||||
- StarterGui
|
||||
- StarterPack
|
||||
- StarterPlayer
|
||||
- Teams
|
||||
- TextChatService
|
||||
- VoiceChatService
|
||||
- Workspace
|
||||
|
|
|
|||
|
|
@ -2,9 +2,26 @@
|
|||
source: tests/tests/serve.rs
|
||||
expression: redactions.redacted_yaml(info)
|
||||
---
|
||||
ignoreHiddenServices: true
|
||||
projectName: remove_file
|
||||
protocolVersion: 5
|
||||
rootInstanceId: id-2
|
||||
serverVersion: "[server-version]"
|
||||
sessionId: id-1
|
||||
syncSourceOnly: true
|
||||
visibleServices:
|
||||
- Lighting
|
||||
- MaterialService
|
||||
- NetworkClient
|
||||
- ReplicatedFirst
|
||||
- ReplicatedStorage
|
||||
- ServerScriptService
|
||||
- ServerStorage
|
||||
- SoundService
|
||||
- StarterGui
|
||||
- StarterPack
|
||||
- StarterPlayer
|
||||
- Teams
|
||||
- TextChatService
|
||||
- VoiceChatService
|
||||
- Workspace
|
||||
|
|
|
|||
|
|
@ -2,9 +2,26 @@
|
|||
source: tests/tests/serve.rs
|
||||
expression: redactions.redacted_yaml(info)
|
||||
---
|
||||
ignoreHiddenServices: true
|
||||
projectName: scripts
|
||||
protocolVersion: 5
|
||||
rootInstanceId: id-2
|
||||
serverVersion: "[server-version]"
|
||||
sessionId: id-1
|
||||
syncSourceOnly: true
|
||||
visibleServices:
|
||||
- Lighting
|
||||
- MaterialService
|
||||
- NetworkClient
|
||||
- ReplicatedFirst
|
||||
- ReplicatedStorage
|
||||
- ServerScriptService
|
||||
- ServerStorage
|
||||
- SoundService
|
||||
- StarterGui
|
||||
- StarterPack
|
||||
- StarterPlayer
|
||||
- Teams
|
||||
- TextChatService
|
||||
- VoiceChatService
|
||||
- Workspace
|
||||
|
|
|
|||
|
|
@ -2,9 +2,26 @@
|
|||
source: tests/tests/serve.rs
|
||||
expression: redactions.redacted_yaml(info)
|
||||
---
|
||||
ignoreHiddenServices: true
|
||||
projectName: sync_rule_alone
|
||||
protocolVersion: 5
|
||||
rootInstanceId: id-2
|
||||
serverVersion: "[server-version]"
|
||||
sessionId: id-1
|
||||
syncSourceOnly: true
|
||||
visibleServices:
|
||||
- Lighting
|
||||
- MaterialService
|
||||
- NetworkClient
|
||||
- ReplicatedFirst
|
||||
- ReplicatedStorage
|
||||
- ServerScriptService
|
||||
- ServerStorage
|
||||
- SoundService
|
||||
- StarterGui
|
||||
- StarterPack
|
||||
- StarterPlayer
|
||||
- Teams
|
||||
- TextChatService
|
||||
- VoiceChatService
|
||||
- Workspace
|
||||
|
|
|
|||
|
|
@ -2,9 +2,26 @@
|
|||
source: tests/tests/serve.rs
|
||||
expression: redactions.redacted_yaml(info)
|
||||
---
|
||||
ignoreHiddenServices: true
|
||||
projectName: sync_rule_complex
|
||||
protocolVersion: 5
|
||||
rootInstanceId: id-2
|
||||
serverVersion: "[server-version]"
|
||||
sessionId: id-1
|
||||
syncSourceOnly: true
|
||||
visibleServices:
|
||||
- Lighting
|
||||
- MaterialService
|
||||
- NetworkClient
|
||||
- ReplicatedFirst
|
||||
- ReplicatedStorage
|
||||
- ServerScriptService
|
||||
- ServerStorage
|
||||
- SoundService
|
||||
- StarterGui
|
||||
- StarterPack
|
||||
- StarterPlayer
|
||||
- Teams
|
||||
- TextChatService
|
||||
- VoiceChatService
|
||||
- Workspace
|
||||
|
|
|
|||
|
|
@ -2,9 +2,26 @@
|
|||
source: tests/tests/serve.rs
|
||||
expression: redactions.redacted_yaml(info)
|
||||
---
|
||||
ignoreHiddenServices: true
|
||||
projectName: sync_rule_no_extension
|
||||
protocolVersion: 5
|
||||
rootInstanceId: id-2
|
||||
serverVersion: "[server-version]"
|
||||
sessionId: id-1
|
||||
syncSourceOnly: true
|
||||
visibleServices:
|
||||
- Lighting
|
||||
- MaterialService
|
||||
- NetworkClient
|
||||
- ReplicatedFirst
|
||||
- ReplicatedStorage
|
||||
- ServerScriptService
|
||||
- ServerStorage
|
||||
- SoundService
|
||||
- StarterGui
|
||||
- StarterPack
|
||||
- StarterPlayer
|
||||
- Teams
|
||||
- TextChatService
|
||||
- VoiceChatService
|
||||
- Workspace
|
||||
|
|
|
|||
|
|
@ -2,9 +2,26 @@
|
|||
source: tests/tests/serve.rs
|
||||
expression: redactions.redacted_yaml(info)
|
||||
---
|
||||
ignoreHiddenServices: true
|
||||
projectName: sync_rule_no_name_project
|
||||
protocolVersion: 5
|
||||
rootInstanceId: id-2
|
||||
serverVersion: "[server-version]"
|
||||
sessionId: id-1
|
||||
syncSourceOnly: true
|
||||
visibleServices:
|
||||
- Lighting
|
||||
- MaterialService
|
||||
- NetworkClient
|
||||
- ReplicatedFirst
|
||||
- ReplicatedStorage
|
||||
- ServerScriptService
|
||||
- ServerStorage
|
||||
- SoundService
|
||||
- StarterGui
|
||||
- StarterPack
|
||||
- StarterPlayer
|
||||
- Teams
|
||||
- TextChatService
|
||||
- VoiceChatService
|
||||
- Workspace
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
source: tests/rojo_test/syncback_util.rs
|
||||
expression: normalized_stdout
|
||||
---
|
||||
Removing src
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,11 @@ impl ServeCommand {
|
|||
|
||||
let server = LiveServer::new(session);
|
||||
|
||||
let host = if ip.is_loopback() { "localhost".to_owned() } else { ip.to_string() };
|
||||
let host = if ip.is_loopback() {
|
||||
"localhost".to_owned()
|
||||
} else {
|
||||
ip.to_string()
|
||||
};
|
||||
log::info!("Listening: http://{}:{}", host, port);
|
||||
server.start((ip, port).into());
|
||||
|
||||
|
|
|
|||
|
|
@ -586,14 +586,17 @@ impl ApiService {
|
|||
}
|
||||
}
|
||||
"LocalScript" => {
|
||||
if existing_path.join("init.client.luau").exists() {
|
||||
"init.client.luau"
|
||||
} else if existing_path.join("init.local.luau").exists() {
|
||||
// Modern: init.local.luau produces LocalScript
|
||||
// Legacy: init.client.lua produces LocalScript (without 'u')
|
||||
// Note: init.client.luau produces Script with Client RunContext, NOT LocalScript!
|
||||
if existing_path.join("init.local.luau").exists() {
|
||||
"init.local.luau"
|
||||
} else if existing_path.join("init.client.lua").exists() {
|
||||
"init.client.lua"
|
||||
} else if existing_path.join("init.local.lua").exists() {
|
||||
"init.local.lua"
|
||||
} else {
|
||||
"init.client.luau" // Default
|
||||
"init.local.luau" // Default for LocalScript
|
||||
}
|
||||
}
|
||||
_ => unreachable!(),
|
||||
|
|
@ -604,9 +607,8 @@ impl ApiService {
|
|||
existing_path.to_path_buf()
|
||||
};
|
||||
|
||||
fs::write(&file_path, source.as_bytes()).with_context(|| {
|
||||
format!("Failed to write file: {}", file_path.display())
|
||||
})?;
|
||||
fs::write(&file_path, source.as_bytes())
|
||||
.with_context(|| format!("Failed to write file: {}", file_path.display()))?;
|
||||
|
||||
log::info!(
|
||||
"Syncback: Updated existing {} at {}",
|
||||
|
|
@ -660,11 +662,7 @@ impl ApiService {
|
|||
self.filter_duplicate_children(&added.children, &inst_path, stats);
|
||||
|
||||
for child in &unique_children {
|
||||
self.syncback_instance_to_path_with_stats(
|
||||
child,
|
||||
existing_path,
|
||||
stats,
|
||||
)?;
|
||||
self.syncback_instance_to_path_with_stats(child, existing_path, stats)?;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -842,10 +840,12 @@ impl ApiService {
|
|||
"init.client.lua",
|
||||
],
|
||||
"LocalScript" => vec![
|
||||
"init.client.luau",
|
||||
"init.client.lua",
|
||||
// Modern: init.local.luau produces LocalScript
|
||||
// Legacy: init.client.lua produces LocalScript (without 'u')
|
||||
// Note: init.client.luau produces Script with Client RunContext, NOT LocalScript!
|
||||
"init.local.luau",
|
||||
"init.local.lua",
|
||||
"init.client.lua", // Legacy only (no .luau!)
|
||||
],
|
||||
// For non-scripts, check for init.model.json5 or similar
|
||||
_ => vec!["init.model.json5", "init.model.json", "init.meta.json5"],
|
||||
|
|
@ -868,10 +868,12 @@ impl ApiService {
|
|||
format!("{}.client.lua", name),
|
||||
],
|
||||
"LocalScript" => vec![
|
||||
format!("{}.client.luau", name),
|
||||
format!("{}.client.lua", name),
|
||||
// Modern: .local.luau produces LocalScript
|
||||
// Legacy: .client.lua produces LocalScript (without 'u')
|
||||
// Note: .client.luau produces Script with Client RunContext, NOT LocalScript!
|
||||
format!("{}.local.luau", name),
|
||||
format!("{}.local.lua", name),
|
||||
format!("{}.client.lua", name), // Legacy only (no .luau!)
|
||||
],
|
||||
// For non-scripts, check for model files
|
||||
_ => vec![
|
||||
|
|
@ -1004,10 +1006,7 @@ impl ApiService {
|
|||
format!("Failed to write file: {}", init_path.display())
|
||||
})?;
|
||||
self.write_script_meta_json_if_needed(&dir_path, added)?;
|
||||
log::info!(
|
||||
"Syncback: Updated ModuleScript at {}",
|
||||
init_path.display()
|
||||
);
|
||||
log::info!("Syncback: Updated ModuleScript at {}", init_path.display());
|
||||
// Recurse into children if any were provided
|
||||
for child in &unique_children {
|
||||
self.syncback_instance_to_path_with_stats(child, &dir_path, stats)?;
|
||||
|
|
|
|||
|
|
@ -766,7 +766,7 @@ fn api_write_existing_instance() {
|
|||
added_map.insert(instance_ref, added_instance);
|
||||
|
||||
let write_request = WriteRequest {
|
||||
session_id: info.session_id.clone(),
|
||||
session_id: info.session_id,
|
||||
removed: vec![],
|
||||
added: added_map,
|
||||
updated: vec![],
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ fn send_write_request(
|
|||
added_map.insert(instance_ref, added);
|
||||
|
||||
let write_request = WriteRequest {
|
||||
session_id: session_id.clone(),
|
||||
session_id: *session_id,
|
||||
removed: vec![],
|
||||
added: added_map,
|
||||
updated: vec![],
|
||||
|
|
@ -131,7 +131,10 @@ fn dir_module_sync_removing_children_preserves_directory() {
|
|||
|
||||
assert_directory_exists(&dir_path, "DirModuleWithChildren directory");
|
||||
assert_file_exists(&init_file, "init.luau");
|
||||
assert_not_exists(&standalone_file, "standalone file should not exist initially");
|
||||
assert_not_exists(
|
||||
&standalone_file,
|
||||
"standalone file should not exist initially",
|
||||
);
|
||||
|
||||
// Send sync with NO children (simulating children deletion in Studio)
|
||||
let added = make_added_instance(
|
||||
|
|
@ -272,7 +275,8 @@ fn dir_model_sync_removing_children_preserves_directory() {
|
|||
assert_file_exists(&meta_file, "init.meta.json5");
|
||||
|
||||
// Send sync with NO children
|
||||
let added = make_added_instance(rs_id, "DirModelWithChildren", "Configuration", None, vec![]);
|
||||
let added =
|
||||
make_added_instance(rs_id, "DirModelWithChildren", "Configuration", None, vec![]);
|
||||
send_write_request(&session, &info.session_id, rs_id, added);
|
||||
|
||||
// No standalone model file should be created
|
||||
|
|
@ -463,7 +467,8 @@ fn standalone_model_sync_adding_children_preserves_standalone() {
|
|||
|
||||
// Send sync WITH children
|
||||
let child = make_child_instance("ChildValue", "StringValue", None, vec![]);
|
||||
let added = make_added_instance(rs_id, "StandaloneModel", "Configuration", None, vec![child]);
|
||||
let added =
|
||||
make_added_instance(rs_id, "StandaloneModel", "Configuration", None, vec![child]);
|
||||
send_write_request(&session, &info.session_id, rs_id, added);
|
||||
|
||||
// Standalone file should still exist
|
||||
|
|
@ -544,7 +549,12 @@ fn sync_with_mixed_children_types() {
|
|||
|
||||
// Send sync with various child types
|
||||
let children = vec![
|
||||
make_child_instance("ChildModule", "ModuleScript", Some("return 'module'"), vec![]),
|
||||
make_child_instance(
|
||||
"ChildModule",
|
||||
"ModuleScript",
|
||||
Some("return 'module'"),
|
||||
vec![],
|
||||
),
|
||||
make_child_instance("ChildScript", "Script", Some("print('script')"), vec![]),
|
||||
make_child_instance("ChildFolder", "Folder", None, vec![]),
|
||||
make_child_instance("ChildValue", "StringValue", None, vec![]),
|
||||
|
|
@ -636,9 +646,24 @@ fn sync_handles_children_with_special_names() {
|
|||
|
||||
// Send sync with children that have special names
|
||||
let children = vec![
|
||||
make_child_instance("Child With Spaces", "ModuleScript", Some("return 1"), vec![]),
|
||||
make_child_instance("Child-With-Dashes", "ModuleScript", Some("return 2"), vec![]),
|
||||
make_child_instance("Child_With_Underscores", "ModuleScript", Some("return 3"), vec![]),
|
||||
make_child_instance(
|
||||
"Child With Spaces",
|
||||
"ModuleScript",
|
||||
Some("return 1"),
|
||||
vec![],
|
||||
),
|
||||
make_child_instance(
|
||||
"Child-With-Dashes",
|
||||
"ModuleScript",
|
||||
Some("return 2"),
|
||||
vec![],
|
||||
),
|
||||
make_child_instance(
|
||||
"Child_With_Underscores",
|
||||
"ModuleScript",
|
||||
Some("return 3"),
|
||||
vec![],
|
||||
),
|
||||
];
|
||||
|
||||
let added = make_added_instance(
|
||||
|
|
@ -844,7 +869,7 @@ fn rapid_syncs_dont_create_duplicates() {
|
|||
added_map.insert(instance_ref, added);
|
||||
|
||||
let write_request = WriteRequest {
|
||||
session_id: info.session_id.clone(),
|
||||
session_id: info.session_id,
|
||||
removed: vec![],
|
||||
added: added_map,
|
||||
updated: vec![],
|
||||
|
|
@ -923,7 +948,9 @@ fn class_change_preserves_existing_format() {
|
|||
|
||||
let src_path = session.path().join("src");
|
||||
|
||||
let server_file = src_path.join("DirScriptWithChildren").join("init.server.luau");
|
||||
let server_file = src_path
|
||||
.join("DirScriptWithChildren")
|
||||
.join("init.server.luau");
|
||||
|
||||
assert_file_exists(&server_file, "init.server.luau should exist");
|
||||
|
||||
|
|
@ -1101,7 +1128,10 @@ fn scripts_only_mode_rapid_syncs() {
|
|||
sss_id,
|
||||
"ScriptWithChildren",
|
||||
"Script",
|
||||
Some(&format!("-- Rapid sync {} in scriptsOnlyMode\nprint({})", i, i)),
|
||||
Some(&format!(
|
||||
"-- Rapid sync {} in scriptsOnlyMode\nprint({})",
|
||||
i, i
|
||||
)),
|
||||
vec![],
|
||||
);
|
||||
|
||||
|
|
@ -1110,7 +1140,7 @@ fn scripts_only_mode_rapid_syncs() {
|
|||
added_map.insert(instance_ref, added);
|
||||
|
||||
let write_request = WriteRequest {
|
||||
session_id: info.session_id.clone(),
|
||||
session_id: info.session_id,
|
||||
removed: vec![],
|
||||
added: added_map,
|
||||
updated: vec![],
|
||||
|
|
@ -1155,7 +1185,12 @@ fn module_with_script_children() {
|
|||
|
||||
// Send sync with Script as child (unusual but valid)
|
||||
let children = vec![
|
||||
make_child_instance("ChildScript", "Script", Some("print('server child')"), vec![]),
|
||||
make_child_instance(
|
||||
"ChildScript",
|
||||
"Script",
|
||||
Some("print('server child')"),
|
||||
vec![],
|
||||
),
|
||||
make_child_instance(
|
||||
"ChildLocalScript",
|
||||
"LocalScript",
|
||||
|
|
@ -1198,8 +1233,18 @@ fn script_with_module_children() {
|
|||
|
||||
// Send sync with multiple ModuleScript children
|
||||
let children = vec![
|
||||
make_child_instance("Config", "ModuleScript", Some("return { config = true }"), vec![]),
|
||||
make_child_instance("Utils", "ModuleScript", Some("return { utils = true }"), vec![]),
|
||||
make_child_instance(
|
||||
"Config",
|
||||
"ModuleScript",
|
||||
Some("return { config = true }"),
|
||||
vec![],
|
||||
),
|
||||
make_child_instance(
|
||||
"Utils",
|
||||
"ModuleScript",
|
||||
Some("return { utils = true }"),
|
||||
vec![],
|
||||
),
|
||||
make_child_instance("Types", "ModuleScript", Some("return {}"), vec![]),
|
||||
];
|
||||
|
||||
|
|
@ -1369,7 +1414,13 @@ fn sync_with_empty_source() {
|
|||
let dir_path = src_path.join("DirModuleWithChildren");
|
||||
|
||||
// Empty source string
|
||||
let added = make_added_instance(rs_id, "DirModuleWithChildren", "ModuleScript", Some(""), vec![]);
|
||||
let added = make_added_instance(
|
||||
rs_id,
|
||||
"DirModuleWithChildren",
|
||||
"ModuleScript",
|
||||
Some(""),
|
||||
vec![],
|
||||
);
|
||||
send_write_request(&session, &info.session_id, rs_id, added);
|
||||
|
||||
assert_directory_exists(&dir_path, "Directory preserved with empty source");
|
||||
|
|
@ -1458,7 +1509,12 @@ fn sync_with_very_long_source() {
|
|||
|
||||
// Generate a very long source (10KB of comments)
|
||||
let long_source: String = (0..500)
|
||||
.map(|i| format!("-- Line {} of extremely verbose and pointless commentary\n", i))
|
||||
.map(|i| {
|
||||
format!(
|
||||
"-- Line {} of extremely verbose and pointless commentary\n",
|
||||
i
|
||||
)
|
||||
})
|
||||
.collect::<String>()
|
||||
+ "return {}";
|
||||
|
||||
|
|
@ -1573,9 +1629,19 @@ fn sync_all_script_types_as_children() {
|
|||
let dir_path = src_path.join("DirModuleWithChildren");
|
||||
|
||||
let children = vec![
|
||||
make_child_instance("ChildModule", "ModuleScript", Some("return 'module'"), vec![]),
|
||||
make_child_instance(
|
||||
"ChildModule",
|
||||
"ModuleScript",
|
||||
Some("return 'module'"),
|
||||
vec![],
|
||||
),
|
||||
make_child_instance("ChildServer", "Script", Some("print('server')"), vec![]),
|
||||
make_child_instance("ChildClient", "LocalScript", Some("print('client')"), vec![]),
|
||||
make_child_instance(
|
||||
"ChildClient",
|
||||
"LocalScript",
|
||||
Some("print('client')"),
|
||||
vec![],
|
||||
),
|
||||
];
|
||||
|
||||
let added = make_added_instance(
|
||||
|
|
@ -1697,7 +1763,7 @@ fn sync_immediate_double_sync() {
|
|||
let mut added_map = HashMap::new();
|
||||
added_map.insert(instance_ref, added1);
|
||||
let write_request = WriteRequest {
|
||||
session_id: info.session_id.clone(),
|
||||
session_id: info.session_id,
|
||||
removed: vec![],
|
||||
added: added_map,
|
||||
updated: vec![],
|
||||
|
|
@ -1710,13 +1776,18 @@ fn sync_immediate_double_sync() {
|
|||
"DirModuleWithChildren",
|
||||
"ModuleScript",
|
||||
Some("return 2"),
|
||||
vec![make_child_instance("QuickChild", "ModuleScript", Some("return 'quick'"), vec![])],
|
||||
vec![make_child_instance(
|
||||
"QuickChild",
|
||||
"ModuleScript",
|
||||
Some("return 'quick'"),
|
||||
vec![],
|
||||
)],
|
||||
);
|
||||
let instance_ref2 = Ref::new();
|
||||
let mut added_map2 = HashMap::new();
|
||||
added_map2.insert(instance_ref2, added2);
|
||||
let write_request2 = WriteRequest {
|
||||
session_id: info.session_id.clone(),
|
||||
session_id: info.session_id,
|
||||
removed: vec![],
|
||||
added: added_map2,
|
||||
updated: vec![],
|
||||
|
|
@ -1761,7 +1832,7 @@ fn stress_test_50_rapid_syncs() {
|
|||
let mut added_map = HashMap::new();
|
||||
added_map.insert(instance_ref, added);
|
||||
let write_request = WriteRequest {
|
||||
session_id: info.session_id.clone(),
|
||||
session_id: info.session_id,
|
||||
removed: vec![],
|
||||
added: added_map,
|
||||
updated: vec![],
|
||||
|
|
@ -1918,8 +1989,18 @@ fn sync_name_with_dots() {
|
|||
|
||||
// Child with dots in name
|
||||
let children = vec![
|
||||
make_child_instance("config.dev.local", "ModuleScript", Some("return 'dev'"), vec![]),
|
||||
make_child_instance("data.v2.backup", "ModuleScript", Some("return 'backup'"), vec![]),
|
||||
make_child_instance(
|
||||
"config.dev.local",
|
||||
"ModuleScript",
|
||||
Some("return 'dev'"),
|
||||
vec![],
|
||||
),
|
||||
make_child_instance(
|
||||
"data.v2.backup",
|
||||
"ModuleScript",
|
||||
Some("return 'backup'"),
|
||||
vec![],
|
||||
),
|
||||
];
|
||||
|
||||
let added = make_added_instance(
|
||||
|
|
@ -1971,7 +2052,12 @@ fn sync_standalone_then_directory_format() {
|
|||
"StandaloneModule",
|
||||
"ModuleScript",
|
||||
Some("return 'with children'"),
|
||||
vec![make_child_instance("Child", "ModuleScript", Some("return 'child'"), vec![])],
|
||||
vec![make_child_instance(
|
||||
"Child",
|
||||
"ModuleScript",
|
||||
Some("return 'child'"),
|
||||
vec![],
|
||||
)],
|
||||
);
|
||||
send_write_request(&session, &info.session_id, rs_id, added2);
|
||||
|
||||
|
|
@ -2099,7 +2185,14 @@ fn sync_varying_children_counts() {
|
|||
|
||||
for count in child_counts {
|
||||
let children: Vec<AddedInstance> = (0..count)
|
||||
.map(|i| make_child_instance(&format!("Child{}", i), "ModuleScript", Some("return 1"), vec![]))
|
||||
.map(|i| {
|
||||
make_child_instance(
|
||||
&format!("Child{}", i),
|
||||
"ModuleScript",
|
||||
Some("return 1"),
|
||||
vec![],
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
|
||||
let added = make_added_instance(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue