Skip to content

fix: error on profile load - #22880

Open
criticalAY wants to merge 1 commit into
ankidroid:mainfrom
criticalAY:profiles/load-failure-message
Open

criticalAY wants to merge 1 commit into
ankidroid:mainfrom
criticalAY:profiles/load-failure-message

Conversation

@criticalAY

Copy link
Copy Markdown
Contributor

Note

Assisted-by: Opus 5.5

Purpose / Description

If the selected profile couldn't be opened at startup, AnkiDroid quietly opened Default instead, kept retrying the broken profile on every start, and the Switch profile screen stopped working. The Deck Picker now says which profile couldn't be opened, and offers to use Default from the next start so a profile that keeps failing can't trap the user.

Fixes

Approach

check commit message

How Has This Been Tested?

added tests

Learning (optional, can help others)

NA

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

@criticalAY criticalAY added the Multi Profile Anything that is related to AnkiDroid multiple profiles label Oct 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Important

Maintainers: This PR contains Strings changes

  1. Sync Translations before merging this PR and wait for the action to complete
  2. Review and merge the auto-generated PR in order to sync all user-submitted translations
  3. Sync Translations again and merge the PR so the huge automated string changes caused by merging this PR are by themselves and easy to review

@criticalAY criticalAY mentioned this pull request Oct 30, 2026
3 of 5 tasks
@criticalAY
criticalAY force-pushed the profiles/load-failure-message branch from 60a0096 to 820d993 Compare October 31, 2026 17:21
@david-allison

Copy link
Copy Markdown
Member

Please add a screenshot test

@criticalAY
criticalAY force-pushed the profiles/load-failure-message branch from 820d993 to 03a5b30 Compare October 31, 2026 18:09
@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Snapshot diff report vs main. Open screenshot-diff for diffs.

  • ProfileLoadFailureScreenshotTest: 2 changes
All 2 changed screenshots

ProfileLoadFailureScreenshotTest

  • profile_load_failure_dialog_compare.png
  • profile_load_failure_dialog_long_names_compare.png

@david-allison

Copy link
Copy Markdown
Member

The screenshot doesn't give a hint that it's a profile load failure

@criticalAY
criticalAY force-pushed the profiles/load-failure-message branch from 03a5b30 to d0a28b8 Compare October 31, 2026 18:44
@mikehardy

Copy link
Copy Markdown
Member

Assisted-by: grok-4.7
strings_pass@d0a28b81e75833c3d69998cb4fd09c635364d24e

Thank you — naming the failed profile on the Deck Picker and offering “Use …” to set Default for the next start is a clear fix for the old silent fallback. I rebased locally onto current main without pushing; lint (lintAll, ktlintCheck, lint-rules:test), unit (jacocoUnitTestReport), and emulator (TEST_RELEASE_BUILD=true, emulator-5556 / API35_GAPI) passed. GitHub CI on this tip is green.

showProfileLoadFailure runs at the start of showStartupScreensAndDialogs before disk-space, fresh-install, and upgrade branches. consumeLoadFailure clears the static before the fragment-tag check; configuration change and process-restore tests keep a single dialog. selectDefaultProfile writes profiles_prefs on the application context while profileManager is null, matching the base context Default storage. The three new strings are profile_load_failed_title, profile_load_failed_message, and profile_load_failed_use_default; screenshot tests cover Work and long profile names.

  1. Sync Translations before merging this PR and wait for the action to complete
  2. Review and merge the auto-generated PR in order to sync all user-submitted translations
  3. Sync Translations again and merge the PR so the huge automated string changes caused by merging this PR are by themselves and easy to review

some acceptable findings, no action required, just leaving for posterity: readLoadFailure swallows a registry read exception and returns null; an upgrade path can recreate() after the failure was already consumed.

Screenshot changes have been detected, so leaving this for a good manual look.

@david-allison david-allison added the Needs Author Reply Waiting for a reply from the original author label Nov 2, 2026
david-allison

This comment was marked as resolved.

@criticalAY
criticalAY force-pushed the profiles/load-failure-message branch from d0a28b8 to 8894961 Compare November 2, 2026 16:13
@criticalAY criticalAY removed the Needs Author Reply Waiting for a reply from the original author label Nov 2, 2026
david-allison

This comment was marked as resolved.

@david-allison david-allison added the Needs Author Reply Waiting for a reply from the original author label Nov 2, 2026
@criticalAY
criticalAY force-pushed the profiles/load-failure-message branch from 8894961 to f647184 Compare November 2, 2026 21:34
@criticalAY criticalAY removed the Needs Author Reply Waiting for a reply from the original author label Nov 2, 2026
@david-allison
david-allison self-requested a review November 2, 2026 21:54

@david-allison david-allison left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥳 🥳 🥳

LGTM, pick the ones you feel you want to handle. Nitpicks only

If the selected profile failed to load at startup, AnkiDroid quietly
opened Default instead. The Deck Picker now says so, and offers to use
Default from the next start so a profile that keeps failing can't trap
the user.

Co-authored-by: David Allison <62114487+david-allison@users.noreply.github.com>
Assisted-by: Claude Opus 5.5
@criticalAY
criticalAY force-pushed the profiles/load-failure-message branch from f647184 to a6d0ceb Compare November 3, 2026 04:48
@mikehardy

Copy link
Copy Markdown
Member

Assisted-by: Grok 4.7
strings_pass@a6d0cebb0f047c7be328b349ef4936f98ab05775

Thank you — naming the failed profile on the Deck Picker and offering “Use …” to commit Default for the next launch fixes the silent base-context fallback. I rebased locally onto current main without pushing; lint (lintAll, ktlintCheck, lint-rules:test), unit (jacocoUnitTestReport), and emulator (TEST_RELEASE_BUILD=true, emulator-5556 / API35_GAPI) passed. GitHub CI on this tip is green.

createOrNull clears attach/load failure state, then on exception records readLoadFailure; consumeLoadFailure is one-shot while loadFailure survives for restore matching. DeckPicker.showProfileLoadFailureIfAny avoids stacking dialogs and defers fatal startup until the dialog closes. The neutral button uses commit() on last_active_profile_id without auto-dismiss on failure. Tests cover copy, z-order, fatal-error gating, SD-card finish, registry id after Use vs OK, failed commit retry, configuration change, process restore, recovery with disk full / DB error, and Roborazzi for the dialog strings.

  1. Sync Translations before merging this PR and wait for the action to complete
  2. Review and merge the auto-generated PR in order to sync all user-submitted translations
  3. Sync Translations again and merge the PR so the huge automated string changes caused by merging this PR are by themselves and easy to review

some acceptable findings, no action required, just leaving for posterity: readLoadFailure catches every exception and returns null with no log; an upgrade branch can recreate() after the failure was already consumed.

Screenshot changes have been detected, so leaving this for a good manual look.

@david-allison david-allison left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@david-allison david-allison left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@criticalAY Could you ping on Discord (design channel) for a string review - I think we could tighten these up a little

Change LGTM.

Timebox max 3 days for feedback, then merge

@david-allison david-allison added Needs Author Reply Waiting for a reply from the original author and removed Needs Review labels Nov 3, 2026
@david-allison david-allison added the Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) label Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Multi Profile Anything that is related to AnkiDroid multiple profiles Needs Author Reply Waiting for a reply from the original author Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) Strings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants