fixed: review findings - robustness, dead code, missing tests

several smaller fixes from the code review:
 - add os_version to RuleContext + OsCondition for mojang rules that
   constrain natives selection by host version (rare, but in the spec).
 - factor mojang_os_name/arch/version into a shared launch_profile::system
   module instead of duplicating between net/mojang.rs and launch/mod.rs.
 - get_json and get_bytes now retry transient failures (5xx, connect,
   body decode) via a shared get_with_retry envelope; previously only
   download_file had retry logic.
 - migrate_legacy_meta_if_needed falls back to the stale cached profile
   with a warn log on network failure instead of erroring out (offline
   launches now work).
 - tightened legacy-loader detection by requiring the unique-to-rmcl
   gameArguments field; clearer error when loader_version is absent.
 - forge legacy versionInfo write uses compact serialization (no
   pretty-print key reorder).
 - deleted dead fetch_version_meta and save_profile_json.
 - documented quick-play templates omission in templates::lookup.
 - added end-to-end test that loads a vanilla profile from disk, loads a
   loader profile with inheritsFrom, resolves, renders, and snapshots.
This commit is contained in:
objz committed 2026-05-25 18:24:06 +02:00
1 parent 19887643bc
commit 412e6ff91a
12 files changed
+395 -74

No files matched your search

+7 -1
View File
@@ -56,6 +56,7 @@ pub fn merge_into(child: LaunchProfile, parent: LaunchProfile) -> LaunchProfile
downloads: child.downloads.or(parent.downloads),
release_time: child.release_time.or(parent.release_time),
time: child.time.or(parent.time),
game_arguments: None,
type_: child.type_.or(parent.type_),
}
}
@@ -88,7 +89,10 @@ fn merge_libraries(
parent: Vec<crate::launch_profile::model::Library>,
) -> Vec<crate::launch_profile::model::Library> {
use std::collections::HashSet;
let child_keys: HashSet<String> = child.iter().map(|l| coord_key(&l.name).to_string()).collect();
let child_keys: HashSet<String> = child
.iter()
.map(|l| coord_key(&l.name).to_string())
.collect();
let mut out: Vec<crate::launch_profile::model::Library> = parent
.into_iter()
@@ -171,6 +175,7 @@ mod tests {
downloads: None,
release_time: None,
time: None,
game_arguments: None,
type_: None,
}
}
@@ -190,6 +195,7 @@ mod tests {
os: Some(crate::launch_profile::rules::OsCondition {
name: Some("linux".into()),
arch: None,
version: None,
}),
features: None,
}