Separate readiness from identity
A gallery asset can be absent, preparing, ready, or failed, but those states are not enough to identify which request produced it. Give each requested revision a generation value and retain the currently published owner while a replacement is prepared.
An old job may finish after a newer request. It can be a perfectly successful computation and still be irrelevant to the current asset. Cancellation can reduce wasted work, but a generation check is still needed at publication because completion and stop requests can race.
Keep asset identity and generation as values, not pointers into a mutable map entry. If handles can be recycled, include a policy that prevents an old handle from naming a different asset. For a bounded first gallery, a monotonic checked generation and a stable asset identifier are enough.
Draw request A, request B, completion B, completion A. Mark which completion may replace the published asset and why.
