inspect_instances fails the entire list when one instance has malformed metadata
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Start in crates/driver/src/inspect/installed.rs at InstalledInstance::detect_all, where the ? inside the loop aborts the scan, then follow InstanceProbe::collect in crates/driver/src/inspect/probe.rs and the wrapper Launcher::inspect_instances in crates/launcher/src/launcher.rs. Done means one malformed instance no longer hides the others and each failure carries the instance name or path; the API shape (report struct or per-item Result) needs a maintainer decision first, and inspect_instance(name) stays fail-fast.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
Launcher::inspect_instances() is all-or-nothing. A single unreadable or malformed instance metadata file makes the whole call return Err, so callers cannot list the remaining healthy instances or identify which instance is broken.
Where
-
crates/launcher/src/launcher.rs:114—Launcher::inspect_instancescollectsResult<Vec<InstalledInstance>>. -
crates/driver/src/inspect/installed.rs:43—InstalledInstance::detect_alluses?inside the loop:for instance in storage.instances(version_layout)? { if let Some(installed) = Self::detect(instance, drivers).await? { instances.push(installed); } } -
crates/driver/src/inspect/probe.rs:23—InstanceProbe::collectopens and parses the version JSON:Ok(serde_json::from_reader(File::open(path)?)?)
A truncated or invalid <version>.json, an unreadable file, or a read_dir failure aborts the whole scan.
Impact
A launcher UI typically calls inspect_instances to render the installed-instance list. One corrupt instance file in .minecraft/versions hides every other instance. The user cannot select a healthy instance, nor see which entry needs repair or removal. The returned error also has no instance name or path attached, so the caller cannot tell which directory caused it.
Reproduction
- Create two valid instances (
a,b). - Truncate or corrupt
versions/a/a.json(or otherwise make it invalid JSON). - Call
Launcher::inspect_instances().await. - Observe
Err(...);bis not returned.
Proposal
Make the aggregate scan report per-instance failures instead of aborting, for example:
pub struct InspectReport {
pub instances: Vec<Instance>,
pub failures: Vec<InstanceInspectionFailure>,
}
pub struct InstanceInspectionFailure {
pub instance_name: String,
pub path: PathBuf,
pub error: Error,
}
Alternatively, return Vec<Result<Instance, InstanceInspectionError>>. The important part is that one bad instance does not hide the rest, and the failure includes the instance name or path. Skipping invalid entries with only a log is less useful for a UI that wants to offer repair or delete actions.
inspect_instance(name) can remain fail-fast because it targets one known instance.
Version
main at b4d6e84.
- Lingua principale
- Rust
- Stelle
- 11
- Fork
- 1
- Merge medio
- 3h 32m
- PR unite (30g)
- 52
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ElectronicWave/Elemental
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ElectronicWave/Elemental#265 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
ElectronicWave/Elemental#261 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
ElectronicWave/Elemental#266 ·
I maintainer di solito rispondono entro 1 giorno
-
docs: CommentsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 34/100
ElectronicWave/Elemental#230 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 38/100
ElectronicWave/Elemental#227 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di ElectronicWave/Elemental
Issue simili
-
benchmark-review
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
I maintainer di solito rispondono entro 1 giorno
-
area:filesystem bug need-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Captions panel does not offer to show an existing transcriptForse già presa @thedavidweng l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
CapSoftware/Cap#4276 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
libracoder/kiri#364 ·
I maintainer di solito rispondono entro 1 giorno