Fix screenshot bug bash: badges, update flow, logs, opener
Keep selected-row badges in their own colors, report preparing-updates progress per item, lock and cancel the checking phase, drop the redundant review badge, warn-style conflict reasons, defer busy-manifest reconciliation silently, share log level colors, filter log levels, page without snap-back scrolling, drag-to-copy log lines, and surface opener failures with the missing logs shortcut.
This commit is contained in:
1 parent
65edd0b31b
commit
9c54e8f321
23 files changed
+1178
-104
No files matched your search
@@ -9,8 +9,8 @@ use super::local::{current_fingerprint, directory_fingerprint_metadata, relative
|
||||
use crate::feedback::progress::{ProgressTask, ProgressTaskHandle};
|
||||
use crate::instance::InstanceConfig;
|
||||
use crate::instance::content::manifest::{
|
||||
ContentFileRecord, ContentKind, ContentLock, ContentManifest, ProviderProject, Resolution,
|
||||
fingerprint, fingerprint_metadata,
|
||||
ContentFileRecord, ContentKind, ContentLock, ContentManifest, ManifestError, ProviderProject,
|
||||
Resolution, fingerprint, fingerprint_metadata,
|
||||
};
|
||||
use crate::instance::content::provider::{FingerprintQuery, ProviderRegistry};
|
||||
use crate::storage::InstancePaths;
|
||||
@@ -224,6 +224,22 @@ pub(crate) async fn reconcile(
|
||||
.unwrap_or_else(|error| {
|
||||
Err(std::io::Error::other(format!("Content save task failed: {error}")).into())
|
||||
});
|
||||
if matches!(saved, Err(ManifestError::Busy(_))) {
|
||||
// Another operation (for example a reinstall commit) holds the
|
||||
// manifest lock. It triggers its own reconciliation when done,
|
||||
// so stay silent instead of warning on every reinstall.
|
||||
tracing::debug!(
|
||||
"Content reconciliation for {instance_name} deferred: manifest busy"
|
||||
);
|
||||
let manifest = ContentManifest::load(&paths.content_manifest()).unwrap_or_default();
|
||||
return ReconcileResult {
|
||||
instance_name,
|
||||
instance_created,
|
||||
manifest,
|
||||
complete: true,
|
||||
error: None,
|
||||
};
|
||||
}
|
||||
let error = match (resolution_result, &saved) {
|
||||
(Ok(()), Ok(_)) => None,
|
||||
(Err(error), Ok(_)) => Some(error.to_string()),
|
||||
@@ -240,13 +256,31 @@ pub(crate) async fn reconcile(
|
||||
error,
|
||||
}
|
||||
}
|
||||
Ok(Err(error)) => ReconcileResult {
|
||||
instance_name,
|
||||
instance_created,
|
||||
manifest: ContentManifest::default(),
|
||||
complete: true,
|
||||
error: Some(error.to_string()),
|
||||
},
|
||||
Ok(Err(error)) => {
|
||||
if error
|
||||
.downcast_ref::<ManifestError>()
|
||||
.is_some_and(|error| matches!(error, ManifestError::Busy(_)))
|
||||
{
|
||||
tracing::debug!(
|
||||
"Content reconciliation for {instance_name} deferred: manifest busy"
|
||||
);
|
||||
let manifest = ContentManifest::load(&paths.content_manifest()).unwrap_or_default();
|
||||
return ReconcileResult {
|
||||
instance_name,
|
||||
instance_created,
|
||||
manifest,
|
||||
complete: true,
|
||||
error: None,
|
||||
};
|
||||
}
|
||||
ReconcileResult {
|
||||
instance_name,
|
||||
instance_created,
|
||||
manifest: ContentManifest::default(),
|
||||
complete: true,
|
||||
error: Some(error.to_string()),
|
||||
}
|
||||
}
|
||||
Err(error) => ReconcileResult {
|
||||
instance_name,
|
||||
instance_created,
|
||||
|
||||
@@ -471,6 +471,7 @@ pub async fn plan_bulk(
|
||||
minecraft_dir: &std::path::Path,
|
||||
requests: Vec<UpdateRequest>,
|
||||
conflicts: Vec<UpdateConflict>,
|
||||
progress: Option<&crate::feedback::progress::ProgressTaskHandle>,
|
||||
) -> BulkUpdatePlan {
|
||||
let registry = crate::instance::content::provider::ProviderRegistry::configured(
|
||||
crate::net::HttpClient::new(),
|
||||
@@ -482,6 +483,7 @@ pub async fn plan_bulk(
|
||||
minecraft_dir,
|
||||
requests,
|
||||
conflicts,
|
||||
progress,
|
||||
)
|
||||
.await
|
||||
}
|
||||
@@ -493,9 +495,16 @@ pub(super) async fn plan_bulk_with_registry(
|
||||
minecraft_dir: &std::path::Path,
|
||||
mut requests: Vec<UpdateRequest>,
|
||||
mut conflicts: Vec<UpdateConflict>,
|
||||
progress: Option<&crate::feedback::progress::ProgressTaskHandle>,
|
||||
) -> BulkUpdatePlan {
|
||||
loop {
|
||||
let request_count = requests.len();
|
||||
if let Some(progress) = progress
|
||||
&& request_count > 0
|
||||
{
|
||||
progress.set_progress(0, request_count as u64);
|
||||
}
|
||||
let mut completed = 0;
|
||||
let projected_manifest = project_updates(manifest, minecraft_dir, &requests);
|
||||
let mut accepted = Vec::new();
|
||||
let mut survivors = Vec::new();
|
||||
@@ -505,6 +514,13 @@ pub(super) async fn plan_bulk_with_registry(
|
||||
optional_dependencies: 0,
|
||||
};
|
||||
for request in requests {
|
||||
if let Some(progress) = progress {
|
||||
progress.set_sub_action(format!(
|
||||
"Checking {} ({}/{request_count})",
|
||||
request.title,
|
||||
completed + 1
|
||||
));
|
||||
}
|
||||
let root = InstallRoot {
|
||||
provider: request.update.installed.provider.clone(),
|
||||
project_id: request.update.installed.project_id.clone(),
|
||||
@@ -541,6 +557,10 @@ pub(super) async fn plan_bulk_with_registry(
|
||||
installed_path: request.installed_path,
|
||||
reason: error.to_string(),
|
||||
});
|
||||
completed += 1;
|
||||
if let Some(progress) = progress {
|
||||
progress.set_progress(completed, request_count as u64);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
};
|
||||
@@ -562,11 +582,19 @@ pub(super) async fn plan_bulk_with_registry(
|
||||
installed_path: request.installed_path,
|
||||
reason: error.to_string(),
|
||||
});
|
||||
completed += 1;
|
||||
if let Some(progress) = progress {
|
||||
progress.set_progress(completed, request_count as u64);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
accepted.push(plan);
|
||||
survivors.push(request);
|
||||
completed += 1;
|
||||
if let Some(progress) = progress {
|
||||
progress.set_progress(completed, request_count as u64);
|
||||
}
|
||||
}
|
||||
if survivors.len() != request_count {
|
||||
requests = survivors;
|
||||
|
||||
@@ -1709,6 +1709,7 @@ async fn rejected_bulk_roots_are_removed_from_survivor_projections() {
|
||||
minecraft,
|
||||
requests,
|
||||
Vec::new(),
|
||||
None,
|
||||
)
|
||||
.await;
|
||||
assert_eq!(plan.roots.len(), 1);
|
||||
@@ -1763,6 +1764,7 @@ async fn accepted_bulk_dependencies_keep_actual_old_ownership_and_replace_files(
|
||||
&minecraft,
|
||||
requests,
|
||||
Vec::new(),
|
||||
None,
|
||||
)
|
||||
.await;
|
||||
assert!(plan.conflicts.is_empty());
|
||||
|
||||
@@ -144,6 +144,51 @@ fn job(name: &str) -> ReconcileJob {
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn busy_manifest_defers_reconciliation_without_an_error() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let instances_dir = temp.path().join("instances");
|
||||
let paths = crate::storage::InstancePaths::new(instances_dir.join("Busy"));
|
||||
let path = paths.minecraft().join("mods/example.jar");
|
||||
std::fs::create_dir_all(path.parent().unwrap()).unwrap();
|
||||
std::fs::write(&path, b"example").unwrap();
|
||||
let mut record = resolved_record();
|
||||
record.relative_path = PathBuf::from("mods/example.jar");
|
||||
record.fingerprint = fingerprint(&path).unwrap();
|
||||
ContentManifest {
|
||||
version: 1,
|
||||
files: vec![record],
|
||||
}
|
||||
.save(&paths.content_manifest())
|
||||
.unwrap();
|
||||
// Hold the manifest lock the way an install commit does.
|
||||
let _lock = ContentLock::acquire(&paths.content_manifest()).unwrap();
|
||||
assert!(
|
||||
reconcile_inventory(
|
||||
&paths.content_manifest(),
|
||||
&paths.minecraft(),
|
||||
24,
|
||||
512,
|
||||
&NoopProgress,
|
||||
)
|
||||
.is_err()
|
||||
);
|
||||
|
||||
let task = crate::feedback::progress::ProgressTask::start("test reconcile");
|
||||
let result = super::reconcile(
|
||||
job("Busy").instance,
|
||||
instances_dir,
|
||||
crate::net::HttpClient::new(),
|
||||
&task,
|
||||
|_| {},
|
||||
)
|
||||
.await;
|
||||
|
||||
assert!(result.complete);
|
||||
assert!(result.error.is_none());
|
||||
assert_eq!(result.manifest.files.len(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn coordinator_queues_instances_once_and_preserves_order() {
|
||||
let mut coordinator = ReconcileCoordinator::default();
|
||||
|
||||
Reference in new issue
Block a user