feat(backup): re-backup purged entries from ignore list (ISSUE-190) #1382

Merged
chris merged 1 commit from feat/exclusions-purged-override into main 2026-10-25 16:54:59 +01:00
Owner

Resolves ISSUE-190 (the missing re-upload path for purged content). The „Nicht in Memories“ list is the client's ignore list; for permanently_deleted (purged) server-removed entries the user now gets „Trotzdem neu sichern“ (en "Back up again anyway", da "Tag backup alligevel") — a deliberate per-file INV-2 override behind a one-step confirm:

  • Local only: forgets the shadowed `media_item_state` rows (`MediaStateRepository.forgetMediaStates`, whole-row delete) so the next backup scan re-uploads the file as a FRESH server item. No server call, no restore intent; the purged twin stays `permanently_deleted` in the Entfernungs-Verlauf and server dedupe never merges the new upload with it (`findExistingOwnerMedia` excludes purged).
  • Path chosen: whole-row deletion, not shadow-column clearing — a merely unshadowed UPLOADED row would be skipped by Reconciler rule 5; deletion makes rule 2 (state==null → pending) fire. Engine test proves the forgotten row re-uploads with NO server binding inherited.
  • Duplicate groups: one entry per image carries ALL bound MediaStore ids (`groupMediaStoreIds`); the override clears every copy.
  • Trashed entries keep „Wiederherstellen“ (server restore), local entries keep „Wieder sichern“ — unchanged; INV-2 hint for local revert unchanged.

Specs (spec-query + official exporter, byte-identical vs clean-main export apart from 065/044): 065 S6 INV-2 RE-AMENDED (per-file user override; new server item; dedupe MUST NOT merge); 044 S3 reconcile order gains the per-file override bullet after the shadow rule.

Validation: `:app:testDebugUnitTest` 709 tests / 0 failed / 0 skipped, `:core:test` 173 / 0 / 0; `:app:assembleDebug` green. KNOWN_ISSUES: ISSUE-190 → resolved (archived).

Resolves ISSUE-190 (the missing re-upload path for purged content). The „Nicht in Memories“ list is the client's ignore list; for permanently_deleted (purged) server-removed entries the user now gets „Trotzdem neu sichern“ (en "Back up again anyway", da "Tag backup alligevel") — a deliberate per-file INV-2 override behind a one-step confirm: - **Local only**: forgets the shadowed \`media_item_state\` rows (\`MediaStateRepository.forgetMediaStates\`, whole-row delete) so the next backup scan re-uploads the file as a FRESH server item. No server call, no restore intent; the purged twin stays \`permanently_deleted\` in the Entfernungs-Verlauf and server dedupe never merges the new upload with it (\`findExistingOwnerMedia\` excludes purged). - **Path chosen**: whole-row deletion, not shadow-column clearing — a merely unshadowed UPLOADED row would be skipped by Reconciler rule 5; deletion makes rule 2 (state==null → pending) fire. Engine test proves the forgotten row re-uploads with NO server binding inherited. - **Duplicate groups**: one entry per image carries ALL bound MediaStore ids (\`groupMediaStoreIds\`); the override clears every copy. - Trashed entries keep „Wiederherstellen“ (server restore), local entries keep „Wieder sichern“ — unchanged; INV-2 hint for local revert unchanged. Specs (spec-query + official exporter, byte-identical vs clean-main export apart from 065/044): 065 S6 INV-2 RE-AMENDED (per-file user override; new server item; dedupe MUST NOT merge); 044 S3 reconcile order gains the per-file override bullet after the shadow rule. Validation: \`:app:testDebugUnitTest\` 709 tests / 0 failed / 0 skipped, \`:core:test\` 173 / 0 / 0; \`:app:assembleDebug\` green. KNOWN_ISSUES: ISSUE-190 → resolved (archived).
feat(backup): re-backup button for purged entries — per-file INV-2 override (ISSUE-190)
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 5s
Build and Deploy / Android unit tests and debug APK (push) Successful in 3m57s
2b62a94b0b
The "Nicht in Memories" list is the CLIENT's ignore list. For
permanently_deleted (purged) server-removed entries the user gets a
deliberate per-file override that lifts the local ignore so the file is
backed up again:

- New "Trotzdem neu sichern" (en "Back up again anyway", da "Tag backup
  alligevel") OutlinedButton on the purged branch of ServerRemovedEntry,
  replacing the hint-only dead end (ISSUE-193/PR #1364) — the honest
  hint stays as the secondary line with adjusted copy (what happens:
  backed up again as a new photo; what stays: the Entfernungs-Verlauf
  entry). One-step confirm dialog: this deliberately overrides the
  anti-resurrection protection, so it is never one-tap.
- ACTION = LOCAL ONLY: MediaStateRepository.forgetMediaStates deletes
  the whole media_item_state rows (Room DELETE via SyncDao
  .deleteMediaStates). Path choice verified against Reconciler:
  clearing only the shadow columns would leave status UPLOADED and
  reconcile rule 5 would SKIP the file forever; whole-row deletion
  makes rule 2 (state == null -> pending) fire and BackupEngine
  re-uploads fresh. No server call, no restore intent, no resurrect of
  the old purged item (findExistingOwnerMedia excludes
  permanently_deleted — the upload creates a genuinely new item).
- Duplicate-copy groups: ServerRemovedEntry now carries
  groupMediaStoreIds (ALL bound ids in the group; mediaStoreId stays
  the representative) and rebackup clears every copy — one image, one
  decision. Guarded by rebackupAvailable (purged only): trashed
  entries keep "Wiederherstellen", local entries keep "Wieder sichern".
- Reconciler/BackupEngine/ChangeBinder/FirstSyncPreBinder untouched:
  once the rows are gone, existing rules produce the clean re-upload.
- Tests: VM (5: clears all group ids locally + no server calls,
  refresh drops the entry, trashed guard, no-bound-id no-op, failure
  keeps rows + RevertFailed), Room DAO (delete + unknown ids), engine
  integration (forgotten shadowed row re-uploads as fresh item with NO
  server binding inherited).
- Specs via spec-query + official exporter (byte-identical vs
  clean-main export apart from 065/044): 065 S6 INV-2 RE-AMENDED — the
  block is the ignore-list default, not an absolute; a client MAY
  re-upload purged content ONLY on the user's explicit per-file
  re-inclusion from the exclusion UI; the upload creates a NEW server
  item, dedupe MUST NOT merge with the purged twin. 044 S3: the
  per-file user override flips the row to pending after the shadow
  rule. KNOWN_ISSUES: ISSUE-190 resolved (archived).

Validation: ANDROID_HOME=$HOME/Android/Sdk rtk ./gradlew
:app:testDebugUnitTest :core:test — 709 + 173 tests, 0 failed,
0 skipped. :app:assembleDebug green.
chris merged commit 83c5aa7902 into main 2026-10-25 16:54:59 +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!1382
No description provided.