feat(anki): import modern .apkg exports directly (native zstd decode) #764
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority/Critical
Priority/High
Priority/Low
Priority/Medium
Reviewed/Confirmed
Reviewed/Duplicate
Reviewed/Invalid
Reviewed/Won't Fix
Status/Abandoned
Status/Blocked
Status/Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
project-halkyon/halkyon-learn!764
Loading…
Reference in a new issue
No description provided.
Delete branch "refs/pull/764/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A modern Anki export stores the real deck in a zstd-compressed
collection.anki21b; Phase 1 could only tell the user to re-export with
"Support older Anki versions". Now the collection is decoded in-app on
native platforms (Android/iOS/desktop) via libzstd — compiled from
source by zstd_dart's Dart build hook — so a modern .apkg imports
directly, with the subdeck chooser and all.
has no zstd decoder and throws, so the caller falls back to the
re-export prompt (web behaviour unchanged).
(preferring it over the sibling stub collection.anki2), then downgrade
the WAL header (bytes 18/19: 02 -> 01) so the checkpointed database
opens in the in-memory VFS. On a decode failure or on the web, fall
back to re-export guidance.
Verified end-to-end on a real 2386-card modern export: decodes, flips,
and reads 2338 notes across 121 subdecks.
Requires
flutter config --enable-native-assets(experimental, globalFlutter flag) on every build machine and in CI. Known limitation: a
collection compressing better than ~8x overflows zstd_dart's heuristic
output buffer and falls back to re-export guidance; full coverage would
need a streaming decode (follow-up).