-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for the V3 scheduler; drop support for V1 #11808
Conversation
🤯 😄 |
Ready for rebase and hopefully I'll have time for a review tomorrow (nearly dinner time here in New Orleans 😁) |
|
(made a trivial change to re-trigger the flaky emulator test) Edit: new failure appears to have been introduced in the move to the latest backend. Investigating. I didn't catch this in local tests because I had an older API emulator active. Edit 2: should be fixed now (though this code will presumably be dropped in favour of the backend importer anyway) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only had enough time to look at the first commit 😩 - but had a couple things worth posting about it now
// TODO: add translatable string | ||
message: String = "Processing...", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm concerned about both this string and relying on new backend's tr
method below, we haven't (I haven't?) fully analyzed translation language sets to see how compatible they are etc, and I don't have the time to do that right now. I fear it'll hang up this PR unless we just use AnkiDroid-level translation strings for the moment or we (where "we" is someone other than me at the moment, and through mid-August) can harmonize the languages and update AnkiDroid docs to point at Anki's translation service as well for people that want to translate non-crowdin strings etc etc and kick off that whole process
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the "processing..." string, I figured you'd want to do that in a follow-up commit after an i18n sync.
I've gone through and checked the languages mappings, and they should all be ok now. For any languages that the backend doesn't currently support, it will just fall back on the English strings like if it hadn't been translated yet. New languages can be added when users follow the instructions on https://translating.ankiweb.net/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the "processing..." string, I figured you'd want to do that in a follow-up commit after an i18n sync.
Historically, user-visible strings are always added into strings file at time of first usage, and I just label the PR with the strings label so I remember to do the sync action / PR after - we never let user-visible stuff through with hard-coded strings in PRs, or at least not intentionally
I've gone through and checked the languages mappings, and they should all be ok now.
Thank you!
For any languages that the backend doesn't currently support, it will just fall back on the English strings like if it hadn't been translated yet. New languages can be added when users follow the instructions on https://translating.ankiweb.net/
I think this is a pretty solid start - and I am biased towards action, so let's go with it. I guess all that's left is an edit to the translation page to give people a handle to the new-to-us system you've got with Pontoon - I just did that https://github.com/ankidroid/Anki-Android/wiki/Translating-AnkiDroid/_compare/7c0ba5c393040654691f8ed44d2d44c3617d845e...002935cd2bc07effc17b8f3a409a846bde79e2be
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String added
// Open collection | ||
Context context = AnkiDroidApp.getInstance(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice one - thanks - hopefully avoids the semi-false positives I was seeing with LeakCanary which were making me think things were crashing
AnkiDroid/src/androidTest/java/com/ichi2/anki/tests/ContentProviderTest.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all seems great to me - nothing seems to jump out and be obviously off. Just need the user-visible string extracted to something (03-dialogs maybe?) and I'm +1. V3 scheduler support, this is huge
Oh, and it took a conflict but I am assuming (hopefully not naively) that it'll be trivial |
All other reviewers: I really want to maintain momentum in this connected chain of anki/Anki-Android-Backend/Anki-Android work, and it threatens to stall all the time because of my poor availability and the pushing it needs between the components. So I'd like to set a 1-2 day timer on this one before I merge by default. If you want to review and need more time just say so! No problem. Otherwise if it's quiet on this PR I'm going to merge it as soon as the string + de-conflict are in |
Studying with the V1 scheduler enabled is no longer possible on recent Anki, AnkiMobile or AnkiWeb versions, so AnkiDroid is the last one still supporting it. Pushing users to upgrade will save them from some of the footguns V1 had, and will allow AnkiDroid to cut out some code and tests. Many users have likely already upgraded due to the use of the other clients. This commit adds support for the backend upgrade code, so that learning cards will not be reset on upgrade. To make use of this, users will be automatically updated to the latest schema version, the scheduler upgrade will be performed, and then they're moved back to the legacy schema. I've also added a helper to more ergonomically deal with schema changes.
- Mirrors the code layout of the desktop version, where routines like buryCard(), that are not specific to V2 or V3, are stored in a separate file. This leaves AbstractSched containing only the methods that will need to be implemented separately for V3. - Moves some methods from SchedV2 into BaseSched, as V3 will want to use them as well for now. - Some of the routines in BaseSched will only work with a schema upgrade. For now, SchedV2 overrides these so they continue to work with the legacy schema.
Like the desktop, this works by using a single set of tests that alter some of the checks depending on the active scheduler version, so that code duplication is avoided.
I expect this fixes ankidroid#9368 Bumps the backend version, since the API changed. Closes ankidroid#11881
- Move logic from backend into frontend, so a new backend release is not required - Fix mapping of Chinese languages and Hindi; check others - Don't require a restart after changing language in prefs
After discarding the backend, Preferences was calling getCol and passing itself in as the context. This caused the preferences screen to be retained as the backend lives on. By switching to AnkiDroidApp, a leak can be avoided.
Some were irrelevant; the ones in ContentProviderTest need investigating.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
timer expired + string extracted == let's go!
This is a feature I've been checking daily for. Will it will show up in the next alpha? |
AFAIK it's already in the latest alpha, but it requires opting in to the new backend, which is a big change that has not received any user testing so far, so you may be exposing yourself to bugs in unrelated functionality. If you're happy to live life on the edge and make lots of backups, you can opt in for a session by tapping on the V16 option in the developer options in the preferences screen. Please report any issues you encounter. |
@dae unfortunately this is not 100% accurate:
That "developer options" screen is dynamically added only to "debug" builds, that is when you build from source. So it's not generally accessible to users yet. The next step in progression of V16+ schema testing is to make that specific option a toggle with state stored/used in/from preferences, and to move it to advanced menu. I'd love to see that soon as folks like @SnipeAT are (assuming they understand the risk) a really really really valuable source of testing since they are motivated to try it. Whatever we can do to get to this state where end users can get a warning but then try V16 would be a big step forward IMHO |
@mikehardy, actually with the new About screen, users on RELEASE build can use developer options as well. Tap the logo 6 times and a big warning will show asking if the user wants to enable it or not. And FWIW, I'm in favor of out adding the V16 option to the alpha/beta releases on |
Just wanted to report that I've been using the new backend and the v3 scheduler for a week or so and it's been working out pretty great. The app might crash in a couple situations but reports seem to be being sent back home. Just updated to the alpha released today and will continue using (after making another backup of my collection). |
Thanks for letting us know! Please note that there's currently a bug where review times are being saved incorrectly. Until the next alpha, I recommend you set your maximum answer time in the deck options to your average answer time, and/or adjust the previous review records using something like this in the debug console of the desktop version (5000 is 5 seconds), which will reset 60s answers in the last month: mw.col.modSchema(check=True) https://docs.ankiweb.net/misc.html#debug-console Also the bug reports are kind of hard to search, so if you are able to reproduce a bug, it would be helpful if you could describe the steps you're taking on a ticket here, and optionally include the acra ID if it's not easy to reproduce. |
complementing: You get the Acra ID together with the debug info on |
@dae follow-up on this one: I attempted to document it here for early testers, did I get all the information correct? #10411 (comment) Secondly, seems we may need an "enable v3 scheduler" switch? Or do we have one already and I missed it? That's my main doubt but I could be wrong on any of it of course |
We don't have a v3 Scheduler switch. I have a draft branch for it here https://github.com/BrayanDSO/Anki-Android/tree/v3pref, but it has a bug that the preference is always re-enabled, both here and Anki desktop, after sync |
No worries - it will be needed in the future yes - but right now as a way to feed new testers into new backend / v3, having it be a requirement that the collection is v3-enabled on desktop perhaps feeds them in at a measured pace. Not a bad thing - I'm not looking for ease of use, just the possibility of use, and real testing. I think our current state fits that |
LGTM. There's a bug where the scheduler version is not updated after a sync (will fix), so recommend you tell people to restart the app after they have synced the setting from the desktop. |
@dae thanks for the review, I updated the comment with a link the PR you just posted for the same. I see a fair bit of traffic today on V3/new-backend related items but it doesn't seem overwhelming? Do you get the same feeling? Like, there are issues but it is at capacity and not over-capacity? I ask because I'm gradually widening my audience where I publicize this and right now it feels like "no more new testers for a few days" but maybe by end of week I can start mentioning it's available again. Perhaps in a week or so we can make a real call for testers but that's not a decision now |
#12157 should address the crashes I'm aware of. No particular preference on timing on my end. |
Includes #11740 and #11802
Will compile and pass legacy schema tests without a backend update, so this can be merged before updating. It does require backend changes to pass the tests when legacy_schema is false.
I think this closes #7127, due to the backend code being much faster.
Closes #10694
Closes #10411