Repository navigation
fix(browser): safely clean up IdsFile - #22283
Merged
Merged
Conversation
This is very heavily documented as there are subtle issues, such as `ViewModel.onCleared` not necessarily being a permanent dismissal. As part of our IdsFile changes, where we want to keep a file on disk and reference this in our activity state, but also allow multiple concurrent files on disk in case an activity exists twice in the task graph. Part of 19572 Assisted-by: GPT-6
* Delete only after the replacement is written * Delete the final snapshot via `onPermanentDismissal` Part of 19572 Assisted-by: Claude Fable 5.1 Assisted-by: GPT-6
david-allison
force-pushed
the
19572-10
branch
from
October 3, 2026 21:46
70caebe to
4062d81
Compare
mikehardy
approved these changes
Oct 4, 2026
mikehardy
left a comment
Member
There was a problem hiding this comment.
Hey David 👋
Thanks for documenting why onCleared is the wrong cleanup hook here. I walked the CardBrowser save/restore path: the replacement IdsFile is written before the previous snapshot is deleted, and onPermanentDismissal only runs when isFinishing, so rotation / "Don't keep activities" still leave the file for restore. The tests pin that, including the missing-cacheDir write failure.
This is correctly Part of #19572 — process-death cache eviction can still ENOENT, and that path is still caught and silent-reported.
LGTM
This was referenced Oct 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Assisted-by: GPT-6
Purpose / Description
This is a special-case, where we modify the IdsFile inside the class as state, rather than just passing it as an argument, so it needs a little more delicate handling.
Fixes
/data/user/0/com.ichi2.anki/cache/multiselect-values...(IdsFileissue) #19572Approach
onPermanentDismissalHow Has This Been Tested?
Tests added
Checklist