Files
Dylan M. Taylor b8b09b5990 fix(db-cleanup): include concrete image types in anonymous image cleanup (#253)
## What was wrong
`db-cleanup`'s `delete_all_anonymous_user_images` listed only media
files with the legacy coarse `Image` type, then re-checked
`MediaFileType::Image` before deleting. Anonymous uploads made through
`POST /v1/media_files/upload/image` are stored with a MIME-derived type
(`Jpg`, `Png`, `Gif`, `Webp`), so the cleanup skipped them and they
never got the moderator-deletion marker.

## What changed
- The listing filter now includes every type `MediaFileType::is_image()`
accepts (`Image`, `Jpg`, `Png`, `Gif`, `Webp`).
- The per-record check uses `is_image()`, so the filter and the check
agree.
- Small unit test that the selected set matches `is_image()`.

## Blast radius
Operator CLI only. Running the command now also soft-deletes (as
moderator) anonymous images with concrete types, which is what the
command says it does. Files with a creator are still skipped.

## Checks
- Run: `SQLX_OFFLINE=true cargo check -p storyteller-web -p db-cleanup
--tests` (combined with the other fixes in this batch).
- Not run: the command itself against a database.

Addresses CodeRabbit security findings (data retention policy gap).


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Anonymous-image cleanup now recognizes JPEG, PNG, GIF, and WebP files
alongside legacy image files, so these formats are included when
cleaning up images without a creator token.
  * Non-image files are skipped during cleanup.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-11 11:22:39 -05:00
..