Short IDs become the canonical identifier in URLs (/i/:short_id), MinIO/R2 storage keys, and all API responses. Hash-based deduplication is preserved. Includes two-phase Alembic migration (003 adds nullable column, 004 enforces NOT NULL) with a backfill script to copy storage objects and populate short_id for existing images. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2.5 KiB
2.5 KiB
Quickstart: Short Image IDs
Scenario 1 — Happy Path: New Upload Gets Short ID
- Log in and navigate to Upload.
- Upload any image.
- Observe: browser navigates to
/i/AbCdEfGh(8-char short ID, not a UUID). - Copy the URL from the address bar and paste in a new tab — image loads correctly.
- Open the URL in a private/incognito window (not logged in) — image still loads.
Pass criteria: URL is /i/{8 alphanumeric chars}, image loads authenticated and unauthenticated.
Scenario 2 — Deduplication Still Works
- Upload any image — note the short ID in the URL.
- Upload the exact same file again.
- Observe: API returns
duplicate: true, browser navigates to the same short ID URL as step 1.
Pass criteria: No second record created, same short ID returned.
Scenario 3 — Library Navigation Uses Short IDs
- Open the library (
/). - Click any image card.
- Observe: navigated to
/i/{short_id}, not/images/{uuid}.
Pass criteria: All image card clicks navigate to /i/ routes.
Scenario 4 — Tag and Delete Operations Work via Short ID
- Open an image detail page at
/i/{short_id}. - If logged in: add a tag, remove a tag — confirm both succeed.
- If logged in: delete the image — confirm navigates back to library, image no longer appears.
Pass criteria: Tag updates and delete work correctly when the route uses a short ID.
Scenario 5 — Migration: All Existing Images Accessible
- After running the migration script: open the library.
- Click through several images from before the migration.
- Observe: all navigate to
/i/{short_id}URLs, all images and thumbnails load. - No broken image placeholders visible.
Pass criteria: 100% of pre-migration images accessible via short ID with no broken assets.
Scenario 6 — Migration Script Is Idempotent
- Run the migration script once — note how many images were migrated.
- Run the migration script a second time.
- Observe: script reports 0 images migrated (all already have short IDs), exits cleanly.
Pass criteria: Second run produces no DB changes, no storage operations, no errors.
Scenario 7 — Copy URL Button Copies Short Page URL
- Open any image detail page at
/i/{short_id}. - Click "Copy URL".
- Paste into a text editor.
- Observe: pasted value is the CDN file URL (e.g.
https://cdn.reactbin.juggalol.com/xK7mN2pQ), not a UUID-based URL.
Pass criteria: Copied URL contains the short_id, not a UUID.