Double-quotes in preset name - FSRS does not Optimize

Continuing the discussion from FSRS unable to optimize error… trying to fix it:

This came up while trying to troubleshoot FSRS Optimization for a user – @Alexsej spotted that one of the issues was a preset name with quotation marks.

We resolved things for the user, but they didn’t capture the answer we needed, so I reproduced it [on real data in an outdated backup of my collection]. This is the same preset with the same decks and review history each time, freshly renamed.

Control case

Preset name without quotation marks Default, FSRS optimizes successfully on 22K reviews.

Images

image

Error case A

Preset name with leading quotation mark "De"fault, FSRS builds an invalid default query, so optimization fails with a search error. Similar error for an odd number of quotation marks.

Images

image


image

Error case B

Preset name with internal quotation marks Def"au"lt, FSRS returns as currently optimal. I suspect that the search query is now valid but it is looking for something that doesn’t exist. A search for preset Def, string au, string lt returns no matching review history.

Images

image


Solution

FSRS needs to build a viable default search query, including necessary escape characters.

Alternate Solution

Anki needs to disallow preset names with quotation marks.


Yes, I’m back on 24.06, but I don’t see any indication that this has been fixed since then. Anyone using a Beta or RC want to check that it reproduces there?

Anki 24.06.2 (33a92379) (ao)
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1
Platform: Windows-10-10.0.22621

1 Like

Hmm… I thought we were already stripping straight double quotes from deck names. Cannot Add Quotation Marks in Deck Name · Issue #3252 · ankitects/anki · GitHub

You’ll have to do more to explain how that’s related. Even if quotation marks are currently being stripped out of deck or tag names [which according to the merged fix won’t be the case going forward] – they aren’t being stripped out of preset names.

I’ve logged this on Double-quotes in preset name - FSRS does not Optimize · Issue #3549 · ankitects/anki · GitHub

2 Likes