BUG: Replacing an image at the same path retains stale AI metadata

オープン
#1,753 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 4 日以内に返信

@risingsamurai がすでに取り組んでいます。

2026年11月20日 から。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python
領域
backend, database

調査の方向性

Start from the folder-synchronization code that detects a changed file and prepares the updated image record, then follow it into the database upsert keyed on the image path. Check which fields the upsert preserves — particularly isTagged, isEmbedded, GPS and the related tag/face/embedding records — and decide what must be reset or deleted when content changes. Reproduce by adding an image, letting AI processing finish, replacing the file at the same path, and re-running sync; done means fresh processing is scheduled and a regression test covers the same-path replacement.

索引モデルが issue の本文から書いたものです。

説明

bug enhancement
Is there an existing issue for this?
  • I have searched the existing issues
What happened?

When an existing image is replaced with different image content at the same filesystem path, PictoPy may retain the previous image's AI-generated metadata and processing state.

The synchronization logic detects the changed file and prepares an updated image record. However, when the database performs an upsert using the existing image path, the existing record's ID and AI-processing flags may be retained instead of being reset for the new content.

Consequently, the replacement image may continue using the previous image's tags, embeddings, face information, or semantic metadata, and may not be scheduled for fresh AI processing.

Steps to Reproduce

  1. Add an image to PictoPy.
  2. Allow AI tagging and embedding generation to finish.
  3. Record the image's existing AI tags and processing state.
  4. Replace the image file with completely different content while keeping the same filename and filesystem path.
  5. Trigger folder synchronization.
  6. Inspect the updated image record and its associated AI data.
  7. Verify whether the replacement image receives fresh AI processing.

Expected Behavior

When PictoPy detects that image content has changed:

  • The previous content's AI-generated metadata should not be associated with the replacement image.
  • Relevant AI-processing flags should be reset.
  • Old tags, face records, and embeddings associated with the previous content should be invalidated or replaced.
  • The replacement image should be scheduled for fresh AI processing.
  • Metadata such as GPS coordinates should reflect the replacement file rather than retain stale values.

Actual Behavior

The database upsert appears to preserve the existing image identity and AI-processing flags when a record with the same path already exists.

In particular, existing isTagged and isEmbedded values may remain true even when the image content has changed.

This can prevent the replacement image from entering normal AI-processing pipelines, while existing AI-generated metadata and related records remain associated with the image's database identity.

As a result, the gallery, tagging, face-related data, or semantic search may continue reflecting the original image instead of the replacement content.

Impact

  • Incorrect AI tags may remain attached to replaced images.
  • Face-related metadata may describe the previous image.
  • Image embeddings may represent outdated content.
  • Semantic search may return results based on the previous image.
  • Replacement images may be skipped by AI-processing queues if their flags indicate that processing has already completed.

Suggested Fix

When a same-path image replacement is detected:

  • Update or invalidate content-dependent AI metadata.
  • Reset AI-processing flags so the replacement is processed again.
  • Remove or regenerate stale embeddings, face records, and semantic metadata.
  • Ensure GPS and other file-derived metadata are updated correctly, including clearing values that are no longer present.
  • Add regression tests for replacing an already-processed image with different content at the same path.
Record
  • I agree to follow this project's Code of Conduct
主要言語
Python
スター
322
フォーク
793
平均マージ
6日 9時間
マージ済み PR(30日)
20

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

AOSSIE-Org/PictoPy のほかの issue

AOSSIE-Org/PictoPy の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。