fix(android): dedupe duplicate shadowed entries in exclusions timeline #1381

Merged
chris merged 1 commit from fix/exclusions-shadow-dedup into main 2026-10-25 16:11:16 +01:00
Owner

Bug (0.10.9, user device): "Nicht in Memories" showed 18 entries for 6 images — the device held each image 3x (byte-identical copies → 3 state rows with distinct mediaStoreIds, same contentHash, all permanently_deleted), and rebuildSections mapped each shadowed row to its own ServerRemovedEntry.

Fix: shadowed rows now group by (contentHash, serverLifecycleState) into ONE entry per image.

  • Hash groups byte-identical duplicates; lifecycle in the key keeps entries homogeneous (a trashed twin never mixes with a purged one).
  • Rows with blank/null contentHash fall back to (serverMediaItemId, lifecycle) — unknown-hash items never merge.
  • Per group: excludedAt = newest updatedAtEpochMillis; NEW copies: Int (rendered "· N Kopie(n)" on the state line, new string exclusions_copies_fmt de/en/da); NEW serverMediaItemIds: List (serverMediaItemId stays the first id for compat); thumbnail/displayName/mediaStoreId from the group's first resolvable row, else the first row.
  • restore(entry) records one idempotent "restore" intent per server id in the group — restoring the image restores all its server twins.

Tests: ExclusionsViewModelTest extended with 4 cases (3 identical purged copies → ONE entry copies=3 no restore; trashed pair → TWO intents; mixed lifecycle same hash → two entries, copies summing to 3; null-hash rows stay unmerged). All 16 existing tests untouched and green.

Validation: rtk ./gradlew :app:testDebugUnitTest :core:test — app 703 tests / 64 classes, core 172 tests / 13 classes, 0 failures.

KNOWN_ISSUES: ISSUE-205 med/resolved/area:android.

Bug (0.10.9, user device): "Nicht in Memories" showed 18 entries for 6 images — the device held each image 3x (byte-identical copies → 3 state rows with distinct mediaStoreIds, same contentHash, all permanently_deleted), and rebuildSections mapped each shadowed row to its own ServerRemovedEntry. Fix: shadowed rows now group by (contentHash, serverLifecycleState) into ONE entry per image. - Hash groups byte-identical duplicates; lifecycle in the key keeps entries homogeneous (a trashed twin never mixes with a purged one). - Rows with blank/null contentHash fall back to (serverMediaItemId, lifecycle) — unknown-hash items never merge. - Per group: excludedAt = newest updatedAtEpochMillis; NEW copies: Int (rendered "· N Kopie(n)" on the state line, new string exclusions_copies_fmt de/en/da); NEW serverMediaItemIds: List<String> (serverMediaItemId stays the first id for compat); thumbnail/displayName/mediaStoreId from the group's first resolvable row, else the first row. - restore(entry) records one idempotent "restore" intent per server id in the group — restoring the image restores all its server twins. Tests: ExclusionsViewModelTest extended with 4 cases (3 identical purged copies → ONE entry copies=3 no restore; trashed pair → TWO intents; mixed lifecycle same hash → two entries, copies summing to 3; null-hash rows stay unmerged). All 16 existing tests untouched and green. Validation: rtk ./gradlew :app:testDebugUnitTest :core:test — app 703 tests / 64 classes, core 172 tests / 13 classes, 0 failures. KNOWN_ISSUES: ISSUE-205 med/resolved/area:android.
fix(android): one Nicht-in-Memories entry per image — group duplicate shadowed rows
All checks were successful
Wiki Sync / Sync wiki from docs (push) Has been skipped
Build and Deploy / Detect changed services and test scopes (push) Successful in 3s
Build and Deploy / Smoke API and media worker (push) Has been skipped
Build and Deploy / Smoke web (push) Has been skipped
Build and Deploy / Smoke ML worker (push) Has been skipped
Build and Deploy / Smoke people worker (push) Has been skipped
Build and Deploy / Build postgres image (push) Has been skipped
Build and Deploy / Build Android CI image (push) Has been skipped
Build and Deploy / Build plants worker image (push) Has been skipped
Build and Deploy / Build converter worker image (push) Has been skipped
Build and Deploy / Deploy postgres (push) Has been skipped
Build and Deploy / Build API image (push) Has been skipped
Build and Deploy / Build media worker image (push) Has been skipped
Build and Deploy / Build ML worker image (push) Has been skipped
Build and Deploy / Build people worker image (push) Has been skipped
Build and Deploy / Build web image (push) Has been skipped
Build and Deploy / Deploy API (push) Has been skipped
Build and Deploy / Deploy web (push) Has been skipped
Build and Deploy / Deploy media worker (push) Has been skipped
Build and Deploy / Deploy ML worker (push) Has been skipped
Build and Deploy / Deploy plants worker (push) Has been skipped
Build and Deploy / Deploy people worker (push) Has been skipped
Build and Deploy / Deploy converter worker (push) Has been skipped
Build and Deploy / Deploy review instance (push) Has been skipped
Build and Deploy / Clean Docker build artifacts (push) Has been skipped
Build and Deploy / Run scoped PR tests (push) Successful in 8s
Build and Deploy / Android unit tests and debug APK (push) Successful in 3m55s
080a923c00
chris merged commit 8a600b1641 into main 2026-10-25 16:11:16 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
chris/memories!1381
No description provided.