fix: manifest merge uses correct field names for favorites preservation

merge_manifest_user_changes() was checking for wrong field names:
- "favorite" → should be "favorited" (how dashboard stores it)
- "notes" → should be "note" (singular)
- "rejected" was correct

This caused the merge to NEVER preserve favorites when the generation
pipeline saved the manifest. The race condition:
1. User favorites image → dashboard saves via /save_changes (100ms delay)
2. Pipeline saves manifest via save_manifest() before dashboard's save
3. Merge should preserve favorites from disk, but wrong key names meant
   it found nothing to preserve
4. Next pipeline save overwrites the manifest without the favorites

Now uses .get("favorited"), .get("rejected"), .get("note") matching
the actual field names in the manifest JSON.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jason Hoku
2026-04-12 16:19:00 -07:00
co-authored by Claude Opus 4.6
parent 1fc660ad78
commit ffbd8ae1e4
+11 -12
View File
@@ -46,18 +46,17 @@ def merge_manifest_user_changes(manifest_path, existing_data):
merged_count += 1
# Preserve user-modified fields from the version on disk
if "favorite" in current_item:
item["favorite"] = current_item["favorite"]
if current_item["favorite"]:
favorites_preserved += 1
if "rejected" in current_item:
item["rejected"] = current_item["rejected"]
if current_item["rejected"]:
rejected_preserved += 1
if "notes" in current_item:
item["notes"] = current_item["notes"]
# Field names: "favorited" (not "favorite"), "rejected", "note" (not "notes")
if current_item.get("favorited"):
item["favorited"] = True
favorites_preserved += 1
if current_item.get("rejected"):
item["rejected"] = True
rejected_preserved += 1
if current_item.get("note"):
item["note"] = current_item["note"]
notes_preserved += 1
# else: This is a new item, no merge needed