Photo selection and publication
Photo publication turns ready, cataloged Media Assets into an ordered public photo experience. An owner edits a Draft Photo Selection, publishes a checked snapshot, and can later revise the source asset or withdraw it without exposing private media data or bypassing the publication cutover rules. This page is a child of Media management platform; read Media ingestion and storage for how assets become ready and Media administration and retention for wider asset operations.
Selection model
Draft Photo Selection
The Draft Photo Selection is the owner's editable ordered list. It changes when the owner adds, removes, or reorders Media Assets, but those changes do not reach visitors until a publish action succeeds. Each save uses the current revision, so an older admin view cannot silently replace a newer draft. References: lib/…/service.ts• L3-42, lib/…/repository.ts• L240-349, app/…/PhotoCuration.tsx• L101-231
Published Photo Selection
The Published Photo Selection is an immutable snapshot of one successful publication. It stores the selected order together with the public Rendition references, approved bilingual Alt Text, Focal Points, and allowed Display Metadata that belong to that release. Later edits to a Media Asset do not change this snapshot. References: lib/…/CONTEXT.md• L99-107, lib/…/repository.ts• L197-225, lib/…/repository.ts• L427-490, db/…/0006_photo_selection.sql• L27-110
The active publication is one shared pointer to the snapshot shown by public readers. A new publication replaces that pointer in the same database transaction that creates the snapshot, which gives the public system one clear cutover from the old selection to the new one. References: lib/…/repository.ts• L351-515, db/…/0006_photo_selection.sql• L1-6
Curation workflow
Asset eligibility
Only an owned Media Asset that is active and ready can enter a selection. It must have approved Chinese and English Alt Text plus the three baseline public Rendition profiles: 640, 1024, and 1600 pixels. New processing may also provide a 2560-pixel Rendition, while older three-profile publications remain valid. References: lib/…/repository.ts• L33-36, lib/…/repository.ts• L126-145, lib/…/eligibility.ts• L3-19
The admin picker mirrors the main eligibility rules so that it can guide the owner toward usable assets. The server checks eligibility again when it saves the Draft and again immediately before publication. This second check matters because processing, Alt Text approval, or catalog state can change after the owner first selects a photo. References: app/…/PhotoCuration.tsx• L136-142, app/…/PhotoCuration.tsx• L609-675, lib/…/repository.ts• L278-289, lib/…/repository.ts• L416-425
Draft revision
The curation view presents the selected photos as an ordered set. The owner can append archive photos, move a photo, remove a photo, or publish an intentionally empty selection. The view saves changes before publication and refuses to publish when a save failed or another page changed the Draft. References: app/…/PhotoCuration.tsx• L154-221, app/…/PhotoCuration.tsx• L223-266, app/…/PhotoCuration.tsx• L527-591
The selection endpoints are owner-protected mutation interfaces. A save carries the expected Draft revision, and a publish carries both the expected revision and an idempotency key. A stale revision returns a conflict instead of overwriting another edit. Repeating the same publish request is safe when its key and revision match the committed publication. References: app/…/route.ts• L1-14, app/…/route.ts• L1-14, lib/…/http.ts• L88-180, lib/…/repository.ts• L351-397
The following flow shows how a cataloged asset moves from owner curation to one public snapshot.
flowchart LR
A[Ready Media Assets] --> B[Owner curates Draft Photo Selection]
B --> C{Revision and eligibility checks}
C -- fail --> D[Keep Draft or show conflict]
C -- pass --> E[Create immutable Published Photo Selection]
E --> F[Advance active publication pointer]
F --> G[Refresh public selection cache]
G --> H[Photos page and homepage preview]
Publication cutover
Snapshot boundary
Publication is the boundary between private catalog state and public photo state. Before the boundary, the owner can change membership and source metadata. At the boundary, the system copies only the selected public fields and Rendition references into a new immutable snapshot. A failed validation leaves the previous active snapshot in place. References: lib/…/repository.ts• L399-425, lib/…/repository.ts• L427-515, lib/…/repository.test.ts• L451-491
The public projection never includes Originals, checksums, Capture Locations, Alt Text Suggestions, processing state, owner identity, or publication request keys. It exposes only public Rendition URLs and approved photo information. This preserves the cutover rule that visitors receive derived Renditions rather than protected source objects. References: lib/…/repository.ts• L562-681, lib/…/repository.test.ts• L206-280, docs/…/photo-release-cutover.md• L34-40
Cache transition
After the database commits a new active snapshot, the selection service invalidates the public selection cache. If invalidation fails, the publication is still committed and the result identifies that the cache step failed; a repeated publish is safe and can complete the refresh. This separates the database cutover from cache freshness without creating a second publication. References: lib/…/service.ts• L154-187, lib/…/server.ts• L44-58, lib/…/http.ts• L144-179
Historical cutover
The public photo routes use the active Published Photo Selection as their only photo source. The former static six-photo fallback was removed during the July 2026 cutover, so a missing or empty publication produces an empty public state rather than old static content. The historical runbook records the migration inputs; it is not a current operating procedure. References: docs/…/photo-release-cutover.md• L1-8, docs/…/photo-release-cutover.md• L21-40, lib/…/server.ts• L101-111
Public photo experience
Public selection read
The public read loads the active snapshot and checks that its entry and Rendition data are complete before returning it. The result is cached under one public selection tag and restored to normal date values after cache serialization. Development can show fixture cards when no real selection is available, but production does not fall back to the retired static photos. References: lib/…/repository.ts• L568-625, lib/…/server.ts• L30-48, lib/…/server.ts• L71-111
Photos page
The localized /photos and /en/photos routes share one public view. That view renders the selected order as a responsive photo wall, uses localized Alt Text, and opens a photo detail interaction for available location and camera Display Metadata. The image surface uses a public Rendition rather than an Original. References: app/…/page.tsx• L1-18, app/…/page.tsx• L1-18, app/…/photos-page.tsx• L11-29, components/published-photo-wall.tsx• L86-145
Homepage preview
The homepage reads the same active selection as the Photos page, so both surfaces cut over to the same revision. It keeps the full published count but uses only the first three items as the preview. References: lib/…/repository.ts• L227-235, app/…/home-page.tsx• L199-207, lib/…/public-ui.test.tsx• L112-130
Withdrawal and revision behavior
Metadata revision
An owner can revise approved Alt Text, Location Labels, and Focal Points through Media administration. These changes affect future Draft saves and publications. They do not mutate an existing Published Photo Selection, so the owner must publish again when the public snapshot should carry the revision. References: lib/…/service.ts• L214-265, lib/…/repository.ts• L224-271, lib/…/repository.test.ts• L391-415
Archive withdrawal
Archiving a Media Asset withdraws it from both the Draft and the active Published Photo Selection when it belongs to either. The public result therefore changes at once for that withdrawal, while unrelated Draft changes remain unpublished. The archive operation records the prior membership and order so a short-lived Undo can restore them if no newer selection change has replaced the affected state. References: lib/…/repository.ts• L273-343, lib/…/withdrawal.ts• L246-259, lib/…/withdrawal.ts• L261-332, lib/…/CONTEXT.md• L79-87
Purge withdrawal
Purge is irreversible and removes the Media Asset and its stored objects. Before that removal, it withdraws the asset from Draft and Published Photo Selections so no active publication points at media that the retention flow is deleting. A later Restore is different from Undo: it returns an archived asset to the library and does not restore old selection membership. References: lib/…/repository.ts• L83-121, lib/…/withdrawal.ts• L246-258, lib/…/CONTEXT.md• L88-96
The withdrawal path creates a new immutable publication containing the retained entries rather than editing the current snapshot. This keeps every published revision auditable and makes the active pointer the only value that changes at the cutover. References: lib/…/withdrawal.ts• L109-243, db/…/0006_photo_selection.sql• L94-110
Change checklist
When these files or sections are changed, remember to consider these:
- If the eligibility rule changes, update both the admin pre-filter and the server-side save and publish checks. Keep the public snapshot reader aligned with the Rendition profiles that a publication may contain.
- If the Published Photo Selection shape changes, update the snapshot write, public projection, cache read, Photos wall, and homepage preview together. Do not expose catalog-only fields through the public projection.
- If publication or withdrawal changes, preserve the order of the active pointer update and cache invalidation. A committed publication must remain safe to replay when cache refresh fails.
- If archive or purge behavior changes, preserve the withdrawal and restore checks that prevent an old Undo from restoring over a newer Draft or publication.
- If the public photo source changes, re-check the historical cutover contract. Public pages must not regain a static fallback or direct Original delivery.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| An admin page saves with an old Draft revision | A newer curation order could be lost | Expected-revision checks return a conflict and the page reloads the Draft |
| A selected asset becomes unready, archived, or loses approved bilingual Alt Text before publish | The requested release is rejected | The server rechecks ownership, catalog state, processing state, Alt Text, and baseline Renditions at publication time |
| Cache invalidation fails after publication commits | Visitors can see the old cached snapshot for a time | The committed publication is reported separately and the same idempotent publish request can be retried |
| A published snapshot is incomplete | Public reading must not render a partial selection | The reader checks item count and required Rendition profiles before returning data |
| An archived or purged asset remains in a selection | A public publication could point at media that is no longer available | Asset lifecycle changes withdraw the asset before the catalog state or stored objects are removed |
| A source asset is edited after publication | The public page could silently differ from the released snapshot | Published entries copy public metadata and Rendition references and are immutable |
Key files
| File | Why to read it |
|---|---|
| lib/…/service.ts | Defines the Draft save and publication contracts, revision checks, idempotency behavior, and cache failure result. |
| lib/…/repository.ts | Shows eligibility, immutable snapshot creation, active publication selection, and the public-only projection. |
| lib/…/withdrawal.ts | Explains how archive and purge remove membership while preserving publication history and safe Undo checks. |
| app/…/PhotoCuration.tsx | Shows the owner's curation model, save-before-publish behavior, conflict recovery, and publication feedback. |
| components/published-photo-wall.tsx | Shows how one public snapshot becomes the localized photo wall and expanded photo details. |
| app/…/home-page.tsx | Shows how the same active publication supplies the first three homepage preview items and the full count. |
| lib/…/repository.ts | Connects asset metadata changes and catalog state changes to selection revision and withdrawal. |
| docs/…/photo-release-cutover.md | Records the historical boundary that removed static photos and established the current public delivery rules. |