From ffbd8ae1e44ef054efd25e78d2c7cfbdc6b9b3ca Mon Sep 17 00:00:00 2001 From: Jason Hoku Date: Sun, 12 Apr 2026 16:19:00 -0700 Subject: [PATCH] fix: manifest merge uses correct field names for favorites preservation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- manifest_utils.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/manifest_utils.py b/manifest_utils.py index f204e97..afe8a99 100644 --- a/manifest_utils.py +++ b/manifest_utils.py @@ -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