Classify yt-dlp failures into actionable buckets (2.3)

When a job fails, today the user sees a raw stderr line — often
something like "ERROR: [youtube] dQw4w9WgXcQ: Sign in to confirm
you're not a bot" that doesn't tell a non-expert what to do.

New src/error_class.rs scans the failed job's log buffer for the
nine well-known yt-dlp fingerprints and returns:
- an ErrorClass enum (rate-limited, members-only, geo-blocked,
  not-found, codec-missing, disk-full, network-error, bad-cookies,
  other)
- a one-line human-readable suggested action paired with each class

Auto-populated in Job::drain when state transitions to Failed.
Exposed on JobSnapshot as error_class + error_hint. Rendered in
the web UI Downloads modal (red badge + hint box) and the desktop
downloads panel (colored label + hint text).

Other (no fingerprint matched) is filtered out of the badge so the
existing raw last_line keeps doing the talking for unknown failures.

Includes 10 unit tests covering each pattern + the walks-from-end
priority case.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Luna 2026-05-27 02:32:45 -07:00
parent a8b14f250a
commit d9a7007f34
6 changed files with 365 additions and 8 deletions

View file

@ -1486,6 +1486,24 @@ impl App {
if !last.is_empty() {
ui.label(egui::RichText::new(last).small().monospace());
}
// Failure classification hint. Drawn as a
// colored block so it visually separates
// from the raw stderr last-line above.
if let Some(cls) = job.failure_class {
if cls != crate::error_class::ErrorClass::Other {
ui.horizontal(|ui| {
ui.colored_label(
egui::Color32::from_rgb(220, 110, 110),
format!("{}", cls.label()),
);
ui.label(
egui::RichText::new(cls.hint())
.small()
.color(egui::Color32::from_rgb(240, 180, 180)),
);
});
}
}
ui.collapsing("output log", |ui| {
egui::ScrollArea::vertical()
.max_height(180.0)