Commit 7ca0704
committed
fix(vocabulary): refuse an .apkg LWT can only half-read
Ran the round-trip against real Anki (pylib 26.08.1) instead of against
our own reader: LWT export -> Anki import -> answered with Anki's own
v3/FSRS scheduler -> Anki export -> LWT import.
The data crosses intact. Stability 100.3036 and difficulty 2.1043 arrive
in Anki as 100.303596 / 2.104, due dates and intervals match, revlog
survives, suspension is preserved; coming back, a Good raised stability
100.30 -> 161.81 and an Again dropped 18.50 -> 1.88 with the lapse
counted, replaying only the two new reviews and not the three already
ours. That also settles the "nobody has yet opened one of these decks in
a real Anki install" caveat in the FSRS doc.
What does not survive is Anki's defaults, in both directions, quietly.
Exporting from Anki, "Support older Anki versions" is off by default, so
the collection is written zstd-compressed as collection.anki21b and
collection.anki2 is left behind as a stub holding one note: "Please
update to the latest Anki version, then import the .colpkg/.apkg file
again." Reading that stub succeeds. So a user who exported with Anki's
defaults got "notes read: 1, not created by LWT: 1" and a green success
box, having lost every review. ApkgReader now refuses a package
containing collection.anki21b and names the setting; reading it properly
would need zstd, which PHP has no bundled extension for.
Importing into Anki, "Import any learning progress" is also off by
default, and without it every card arrives new -- ivl 0, no revlog, no
memory state, suspension dropped. Nothing to fix on our side, so the
import page now says which two boxes to tick, in Anki's own wording.1 parent 9664899 commit 7ca0704
5 files changed
Lines changed: 94 additions & 4 deletions
File tree
- docs-src/developer
- src/Modules/Vocabulary
- Http
- Infrastructure/Anki
- tests/backend/Modules/Vocabulary/Infrastructure/Anki
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
56 | 65 | | |
57 | 66 | | |
58 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
288 | | - | |
289 | | - | |
290 | | - | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
291 | 309 | | |
292 | 310 | | |
293 | 311 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
| 175 | + | |
| 176 | + | |
176 | 177 | | |
177 | 178 | | |
178 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
179 | 194 | | |
180 | 195 | | |
181 | 196 | | |
| |||
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
53 | 71 | | |
54 | 72 | | |
55 | 73 | | |
| |||
Lines changed: 30 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
446 | 476 | | |
447 | 477 | | |
448 | 478 | | |
| |||
0 commit comments