fix(review): harden write-back, confirmation gate, and edge cases

- write-back: call upsert_tag inside _apply_tag's try so a tag-create failure
  is caught per-asset and apply_all no longer aborts mid-batch (was P1)
- write-back: surface _pipeline/processed write failures in the result instead
  of discarding them (was reported as success)
- ui: add title to the high confidence badge so approve-high-confidence's
  pre-action count is non-zero; confirm() before single-cluster apply
- core: Store context manager; close DB connection even if a route raises;
  guard split_cluster against a first-member boundary (empty cluster); add
  writeback_log lookup index
- ingest: split thumbnail download/write error handling and clean up the
  .tmp file on a write failure
- tests: upsert/processed write-failure regression tests + split-guard test
This commit is contained in:
2026-06-27 17:54:38 +02:00
parent d67b677b6a
commit ae093881fa
8 changed files with 89 additions and 17 deletions
+4 -6
View File
@@ -113,9 +113,8 @@ def apply_one(cid):
# Lazy import: app.writeback is owned by a later task and may be absent
# at app-startup; importing here keeps the blueprint importable regardless.
from app.writeback import apply_cluster
s = _store()
res = apply_cluster(_client(), s, cid)
s.close()
with _store() as s: # close even if the Immich write-back raises
res = apply_cluster(_client(), s, cid)
return jsonify(res)
@@ -123,7 +122,6 @@ def apply_one(cid):
def apply_everything():
# Lazy import: see apply_one above.
from app.writeback import apply_all
s = _store()
results = apply_all(_client(), s)
s.close()
with _store() as s: # close even if the Immich write-back raises
results = apply_all(_client(), s)
return jsonify({"results": results})