feat(rotation): per-device image-selection preferences
CI / test (push) Has been cancelled

Adds two settings exposed in the PWA frame-settings sheet:

- rotationMode (enum: random | least_recently_shown | oldest_upload |
  newest_upload). Default oldest_upload preserves the legacy
  hard-coded sort, so existing devices behave identically until the
  user changes it.
- prioritizeNeverShown (bool). When set, the candidate set is narrowed
  to never-shown images first (if any exist) before the mode runs —
  useful for "burn through new uploads before re-shuffling the catalog."

RotationService pipeline:
  1. Pull approved/ready pool.
  2. Drop the last `uniquenessWindow` served (existing).
  3. If prioritizeNeverShown AND any candidates have never been served,
     narrow to those.
  4. Apply the selection mode.

Backend: enum, entity columns + accessors, migration, serializer,
PATCH validator. Frontend: types, stores, settings sheet section
(dropdown + checkbox), test fixtures, save-flow test.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-07 16:37:14 -04:00
parent ba9625d45d
commit cf6623de67
26 changed files with 320 additions and 31 deletions
+26
View File
@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace App\Enum;
/**
* Selection strategy for the next image to serve to a device. The chosen mode
* runs *after* the uniqueness-window filter (don't repeat the last N) and
* *after* the optional "prioritize never-shown" narrowing — so it only ever
* sees the surviving candidate set.
*/
enum RotationMode: string
{
/** Uniform random pick from the candidates. */
case Random = 'random';
/** Image with the oldest most-recent served-at timestamp first; never-shown sorts first. */
case LeastRecentlyShown = 'least_recently_shown';
/** Sort by upload time ascending — oldest photo first. The legacy default. */
case OldestUpload = 'oldest_upload';
/** Sort by upload time descending — newest photo first. */
case NewestUpload = 'newest_upload';
}