Upload completion can arrive out of order
A user may choose portrait A, then replace it with B before A finishes uploading. If A completes last and writes the shared input_image_id field, the generation can use a different reference from the one shown in the current preview.
What to do next
- 01
Bind file and preview identity
Create a local selection revision when the user chooses a file. Associate its preview, validation result and upload operation with that revision, so the displayed image and eventual remote file ID share one identity.
- 02
Check before attaching the ID
When an upload finishes, compare its captured revision with the current slot revision. Attach only a match; retain or clean up the unused application record according to your policy without claiming a provider deletion capability.
- 03
Block mismatched approval
Require the chosen preview, successful validation and attached file ID to match the same slot revision before approval. Test two uploads whose completion order is deliberately reversed, including a failed newer upload.
A concrete example
Illustrative example: A starts first, B replaces it, and B uploads first. A later finishes but its revision is obsolete. The slot keeps B's preview and file ID, so the approved H3 request cannot silently revert to A.
Before you call it ready
- Preview and file ID share one revision.
- Stale uploads cannot alter the current slot.
- Failed new uploads do not revive old choices.
When to stop or choose another method
Stop enabling approval when the visible reference and attached uploaded file ID cannot be proven to belong to the same selection.
