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>
74 lines
2.5 KiB
Markdown
74 lines
2.5 KiB
Markdown
# Quickstart: Short Image IDs
|
|
|
|
## Scenario 1 — Happy Path: New Upload Gets Short ID
|
|
|
|
1. Log in and navigate to Upload.
|
|
2. Upload any image.
|
|
3. Observe: browser navigates to `/i/AbCdEfGh` (8-char short ID, not a UUID).
|
|
4. Copy the URL from the address bar and paste in a new tab — image loads correctly.
|
|
5. 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
|
|
|
|
1. Upload any image — note the short ID in the URL.
|
|
2. Upload the exact same file again.
|
|
3. 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
|
|
|
|
1. Open the library (`/`).
|
|
2. Click any image card.
|
|
3. 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
|
|
|
|
1. Open an image detail page at `/i/{short_id}`.
|
|
2. If logged in: add a tag, remove a tag — confirm both succeed.
|
|
3. 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
|
|
|
|
1. After running the migration script: open the library.
|
|
2. Click through several images from before the migration.
|
|
3. Observe: all navigate to `/i/{short_id}` URLs, all images and thumbnails load.
|
|
4. 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
|
|
|
|
1. Run the migration script once — note how many images were migrated.
|
|
2. Run the migration script a second time.
|
|
3. 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
|
|
|
|
1. Open any image detail page at `/i/{short_id}`.
|
|
2. Click "Copy URL".
|
|
3. Paste into a text editor.
|
|
4. 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.
|