10BC0 Feature: Database-backed Failed Updates Screen with mass migration by H1ghSyst3m · Pull Request #2714 · mihonapp/mihon · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@H1ghSyst3m
Copy link
@H1ghSyst3m H1ghSyst3m commented Nov 17, 2025

This is my first PR to the project, so feedback is definitely welcome.
I picked this up because the earlier attempt in #1381 hasn’t been updated in a long time, and I wanted to help move the feature forward.

This PR adds a dedicated Failed Updates screen and moves update error tracking into the database, while keeping the legacy log file for compatibility.
It aims to fully implement feature requests #132 and #2158.


Summary

New Failed Updates screen

A new composable FailedUpdatesScreen shows all failed library update entries in a proper UI instead of hiding them in a text file.

Key capabilities:

  • Displays all failed update entries from the database
  • Supports single and multi-selection
  • Allows migration for eligible items
  • Lets the user clear selected or all errors

At this stage, the screen does not support search or grouping. The goal is to land the core UX first; search/grouping can follow in a separate PR once this one is settled.


Database-backed error logging

LibraryUpdateJob now writes failures into the database through an InsertMangaUpdateError use case, making them:

  • Visible in the new Failed Updates screen
  • Countable
  • Easy to clear

The legacy log file is still written to maintain compatibility:

  • mihon_update_errors.txt remains unchanged in behavior
  • The View log notification action still opens this file

This makes the database the primary source for the UI while keeping the text file for anyone who prefers it.


Notifications → deep link

Failed update notifications now deep link directly into the new screen:

  • Tapping the notification opens Failed Updates
  • A secondary action still opens the legacy text log

To support this, NotificationReceiver now provides:

  • openFailedUpdatesPendingActivity(...) — an intent helper to navigate to the new screen

This makes failed updates visible for everyday users without breaking the old workflow.


User-facing behavior

  • When updates fail, the notification:
    • Opens Failed Updates on tap
    • Still offers View log to access the text file
  • In the Failed Updates screen, users can:
    • Inspect errors
    • Select multiple entries
    • Trigger migration when supported
    • Clear selected or all failures
  • Clearing affects only the database, not the legacy text file

Implementation notes

Main changes:

  • Added FailedUpdatesScreen and related UI logic
  • Added a database table + DAO + use cases for update errors
  • Modified LibraryUpdateJob to:
    • Insert/update failures via the new use case
    • Continue writing to the legacy text log
  • Updated navigation and notifications to deep link into the new screen
  • Added new Happy Face Emotes for the empty screen in Failed Updates, now with parameter isHappy = true it shows happy emotes

The design follows existing architecture patterns to keep everything consistent.


Testing

Executed manual testing on an emulator:

  • Triggered library updates with known failing entries
  • Confirmed:
    • Failed entries appear in the new screen
    • Notification deep link works
    • View log still opens mihon_update_errors.txt
    • Clearing entries updates the database and UI correctly

Current error coverage:

  • Verified with “Source not found” errors
  • Other error types are expected to behave identically since they follow the same pipeline

More scenarios can be tested later if needed.


Screenshots & video

Light mode

Updates screen Failed Updates (with entries) Selection mode
Updates screen in light mode Failed Updates screen with entries, light mode Failed Updates selection mode, light mode
Migration flow Empty Failed Updates screen
Migration process view in light mode Empty Failed Updates screen in light mode

Dark mode

Failed Updates (with entries) Selection mode
Failed Updates screen with entries, dark mode Failed Updates selection mode, dark mode

Video (full flow)

Demonstrates:

  • Notification
  • Opening Failed Updates
  • Inspecting entries
  • Multi-selection
  • Clearing entries
Screen.Recording.20251120.052535-done.webm

Issue links

Closes #132
Closes #2158

Introduces a new system for tracking manga update errors, including database schema, repository, domain models, and interactors. Adds a dedicated 'Failed Updates' screen and tab, integrates error count and navigation into the updates UI, and updates notification handling to link to the new screen. Cleans up errors for non-favorite manga and provides migration and clear-all actions for failed updates.
@MajorTanya
Copy link
Member
MajorTanya commented Nov 17, 2025

As general feedback: All strings must be proper i18n strings, otherwise the strings couldn't be translated into Mihon's many community-maintained languages.
You added one (label_failed_updates) but many others strings are untranslatable, like this: https://github.com/H1ghSyst3m/mihon/blob/fdc7b1430f6760d1c3e889eb897a095de0ad9545/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt#L166

I have not taken a look at the actual logic nor am I in a position to make decisions over this feature, but that is an important thing to keep in mind in this project. There may be pre-existing strings you can reuse, take a look around in the base strings file.

@H1ghSyst3m
Copy link
Author
H1ghSyst3m commented Nov 17, 2025

As general feedback: All strings must be proper i18n strings, otherwise the strings couldn't be translated into Mihon's many community-maintained languages. You added one (label_failed_updates) but many others strings are untranslatable, like this: https://github.com/H1ghSyst3m/mihon/blob/fdc7b1430f6760d1c3e889eb897a095de0ad9545/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt#L166

I have not taken a look at the actual logic nor am I in a position to make decisions over this feature, but that is an important thing to keep in mind in this project. There may be pre-existing strings you can reuse, take a look around in the base strings file.

Thanks for the information, I just also noticed them and was about to make a commit xD

Replaced hardcoded strings in FailedUpdatesScreen with localized resources for actions and error messages. Added new string resources for 'Migrate Selected' and confirmation dialog text to improve internationalization.
@H1ghSyst3m
Copy link
Author
H1ghSyst3m commented Nov 17, 2025

in commit 34dc31e also fixed "Migration Button" position when user has navigationbar

Corrected the indentation of section comments throughout the strings.xml how it was before

Thought I accidentally pushed them forward
… Failed Screen

Also replaced hardcoded strings with stringResource for 'Clear error' and 'Failed Updates' labels
Introduces the ability to delete selected failed update errors from the list. Adds a confirmation dialog, updates UI components, and provides necessary string resources for the new action.
Introduces a new plural string resource for failed updates and updates the UpdatesScreen to use it for displaying the failed updates count in a localized, pluralized format.
Replaces the custom formatTimestamp function with the already existing relativeDateText component for displaying error timestamps in FailedUpdatesScreen.
Introduces a new string resource for the failed updates empty state and updates FailedUpdatesScreen to use it instead of the library empty message.
Replaces 'return true' with 'null' when handling the failed updates shortcut, ensuring correct navigation behavior in MainActivity.
Replaces the hardcoded 'View Log' string in the LibraryUpdateNotifier notification action with a localized resource. Adds 'action_view_log' to the strings.xml for proper localization support.
Changed the app bar action title from 'Migrate' to 'Select All'
Replaced manual filtering and removal of invalid manga selections with a single retainAll call for improved clarity and efficiency.
Updated the comment to specify that non-favorite errors are cleaned up when the screen is opened, improving code clarity.
Refactored the deleteNonFavorites SQL statement to use a NOT IN clause for improved readability and efficiency. The new query deletes errors for manga that are not marked as favorites.
Deletes any previous update error for a manga after a successful update in LibraryUpdateJob. This ensures that resolved errors are removed and only current issues are tracked.
Introduces an onClickItem callback to FailedUpdatesScreen and its related components, allowing navigation to the migration config screen when an item is clicked. This enhances user interaction by providing direct access to migration for individual manga from the failed updates list.
Introduces an isHappy parameter to EmptyScreen, allowing it to display happy emoticons for positive empty states. Updates FailedUpdatesScreen to use this feature when showing an empty state for failed updates.
Ensured that the EmptyScreen is still backwards compatible.
@H1ghSyst3m H1ghSyst3m marked this pull request as ready for review November 19, 2025 01:42
@H1ghSyst3m H1ghSyst3m marked this pull request as draft November 19, 2025 01:56
@H1ghSyst3m
Copy link
Author
H1ghSyst3m commented Nov 19, 2025

Just noticed in the #1381 there was a problem where individual manga updates weren't weren't updated for errors, so I checked my code and I forgot to add deleteMangaUpdateError in MangaScreenModel.kt too. Will add it and hopefully should be complete and ready

Adds logic to insert update errors into the database when a manga update fails and the manga is favorited, and to delete previous errors when an update succeeds.
@H1ghSyst3m H1ghSyst3m marked this pull request as ready for review November 19, 2025 02:24
@H1ghSyst3m
Copy link
Author
H1ghSyst3m commented Nov 19, 2025

Updated PR at top

@H1ghSyst3m H1ghSyst3m marked this pull request as draft November 19, 2025 04:00
Swapped LazyColumn for FastScrollLazyColumn in FailedUpdatesList to enable fast scrolling functionality for the failed updates screen.
@H1ghSyst3m H1ghSyst3m marked this pull request as ready for review November 19, 2025 04:01
@H1ghSyst3m H1ghSyst3m marked this pull request as draft November 19, 2025 17:08
Replaces Card with Row for FailedUpdateItem, updates selection visuals to use alpha, and adjusts padding and arrangement. Improves consistency with app design and simplifies item interaction logic.
6855
@H1ghSyst3m H1ghSyst3m changed the title Add database-backed Failed Updates screen with mass migration Feature: Database-backed Failed Updates Screen with mass migration Nov 19, 2025
Changed the insert statement for manga_update_errors to only update existing records if the error_message has changed, preventing unnecessary overwrites and preserving correct timestamps
@H1ghSyst3m
Copy link
Author

Found no other issues and works stable now.

@H1ghSyst3m H1ghSyst3m marked this pull request as ready for review November 20, 2025 05:44
Added entries for the 'Failed Updates' screen and happy emotes on positive empty screens under the Unreleased section. These changes document recent feature additions and UI improvements.
@AntsyLich AntsyLich added this to the v0.21.0 milestone Nov 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option to migrate failed updates In app Error list for chapter update errors

4 participants

0