fix(content): refresh installed provider metadata

This commit is contained in:
objz committed 2026-08-05 15:25:07 +02:00
1 parent 2d0007de52
commit ae7a2de19d
17 files changed
+310 -103

No files matched your search

@@ -278,6 +278,7 @@ fn installed_record(project_id: &str, version_id: &str, enabled: bool) -> Conten
},
},
provider_aliases: Vec::new(),
provider_checks: Vec::new(),
required_dependencies: Vec::new(),
automatic_dependency: false,
cleanup_eligible: false,
@@ -823,6 +824,7 @@ async fn exact_cross_provider_match_replaces_only_the_wrong_version() {
},
},
provider_aliases: Vec::new(),
provider_checks: Vec::new(),
required_dependencies: Vec::new(),
automatic_dependency: false,
cleanup_eligible: false,
@@ -946,6 +948,7 @@ async fn installed_incompatible_projects_block_the_plan() {
},
},
provider_aliases: Vec::new(),
provider_checks: Vec::new(),
required_dependencies: Vec::new(),
automatic_dependency: false,
cleanup_eligible: false,
+3
View File
@@ -36,6 +36,7 @@ fn manifest_round_trip_and_lookup_are_exact() {
},
},
provider_aliases: Vec::new(),
provider_checks: Vec::new(),
required_dependencies: Vec::new(),
automatic_dependency: false,
cleanup_eligible: false,
@@ -89,6 +90,7 @@ fn renaming_a_record_preserves_its_resolution() {
},
},
provider_aliases: Vec::new(),
provider_checks: Vec::new(),
required_dependencies: Vec::new(),
automatic_dependency: false,
cleanup_eligible: false,
@@ -129,6 +131,7 @@ fn managed_record(
},
},
provider_aliases: Vec::new(),
provider_checks: Vec::new(),
required_dependencies,
automatic_dependency,
cleanup_eligible: automatic_dependency,
+41 -8
View File
@@ -15,7 +15,7 @@ fn job(name: &str) -> ReconcileJob {
game_version: "1.21.1".to_owned(),
loader: crate::instance::ModLoader::Fabric,
loader_version: None,
created: chrono::Utc::now(),
created: chrono::DateTime::UNIX_EPOCH,
last_played: None,
java_path: None,
memory_max: None,
@@ -33,17 +33,30 @@ fn job(name: &str) -> ReconcileJob {
#[test]
fn coordinator_queues_instances_once_and_preserves_order() {
let mut coordinator = ReconcileCoordinator::default();
let one = ("one".to_owned(), chrono::DateTime::UNIX_EPOCH);
assert!(coordinator.enqueue(job("one"), false));
assert!(!coordinator.enqueue(job("two"), false));
assert!(!coordinator.enqueue(job("one"), false));
assert!(!coordinator.rerun.contains("one"));
assert!(!coordinator.rerun.contains(&one));
assert!(!coordinator.enqueue(job("one"), true));
assert_eq!(coordinator.queue.len(), 2);
assert!(coordinator.rerun.contains("one"));
assert!(coordinator.rerun.contains(&one));
assert_eq!(coordinator.queue.pop_front().unwrap().instance.name, "one");
assert_eq!(coordinator.queue.pop_front().unwrap().instance.name, "two");
}
#[test]
fn coordinator_does_not_merge_recreated_instances_with_the_same_name() {
let mut coordinator = ReconcileCoordinator::default();
let first = job("same");
let mut recreated = job("same");
recreated.instance.created += chrono::TimeDelta::seconds(1);
assert!(coordinator.enqueue(first, false));
assert!(!coordinator.enqueue(recreated, false));
assert_eq!(coordinator.queue.len(), 2);
}
#[test]
fn oversized_content_is_kept_without_hashing_or_provider_query() {
let temp = tempfile::tempdir().unwrap();
@@ -92,13 +105,33 @@ fn unchanged_saved_index_reuses_fingerprint_and_skips_provider_query() {
#[test]
fn newly_configured_provider_retries_an_unmatched_record() {
let resolution = Resolution::Unmatched {
checked_at: chrono::Utc::now().timestamp(),
providers: vec!["modrinth".to_owned()],
let mut record = ContentFileRecord {
relative_path: PathBuf::from("mods/example.jar"),
kind: ContentKind::Mod,
enabled: true,
fingerprint: FileFingerprint {
size: 1,
modified_ns: 1,
hashes: Default::default(),
},
resolution: Resolution::Resolved {
project: ProviderProject {
provider: "modrinth".to_owned(),
project_id: "example".to_owned(),
version_id: "1".to_owned(),
},
},
provider_aliases: Vec::new(),
provider_checks: Vec::new(),
required_dependencies: Vec::new(),
automatic_dependency: false,
cleanup_eligible: false,
};
assert!(provider_was_not_checked(&resolution, "curseforge"));
assert!(!provider_was_not_checked(&resolution, "modrinth"));
assert!(provider_was_not_checked(&record, "curseforge"));
assert!(!provider_was_not_checked(&record, "modrinth"));
record.provider_checks.push("curseforge".to_owned());
assert!(!provider_was_not_checked(&record, "curseforge"));
}
#[test]