Fix: use stable GUIDs for Anki note matching on reimport

genanki's default GUID is computed from ALL fields, so adding audio to a
previously-empty Audio field changes the GUID — Anki can't match the old
note and skips the update.

Fix: explicitly set GUID from identity-only fields:
- Conjugation notes: guid_for(infinitive, pronoun, tense)
- Vocabulary notes:  guid_for(word)  [Hebrew word with nikkud]

With stable GUIDs, reimporting a rebuilt deck correctly updates existing
notes (audio, tags, corrected fields) without breaking study progress.

NOTE: users who imported a previous release will see new notes on first
reimport (old GUID → new GUID mismatch). They can delete the old untagged
notes via Browse → tag:v0.10 missing → delete.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Sochen 2026-03-05 05:21:45 +00:00
parent 4fcc5cff60
commit e66020628f

View file

@ -516,6 +516,9 @@ def build_vocab_deck(
note = genanki.Note(
model=VOCAB_MODEL,
# Stable GUID: identity = Hebrew word only, so audio/images/examples
# can be added on reimport without breaking note matching.
guid=genanki.guid_for(word),
fields=[
word,
root,
@ -576,6 +579,10 @@ def build_conj_deck(
return
note = genanki.Note(
model=CONJ_MODEL,
# Stable GUID: identity = (infinitive, pronoun, tense) so that
# audio and other content fields can be updated on reimport
# without Anki treating the note as a new/different note.
guid=genanki.guid_for(infinitive, pronoun, tense),
fields=[
infinitive,
ref_form,