Renders a saved image edit and swaps it in (see
PhoenixKit.Modules.Storage.ImageEditing).
"apply" (one per file at a time): renders file.edits from the unedited
original, stores the result, and in one transaction — the file row locked,
its storage directory locked — replaces the file's original with it. On a
first edit the file's existing instance rows move to a new hidden backup;
on later edits the previous edit's rows are dropped. edits: nil reverts:
the backup's rows move back and the backup goes. Then the variants are
generated from the new original, and edit_state is cleared.
Every save enqueues a run; runs that have not started yet are merged (the
job is unique per file while waiting, not while executing — a save that
lands as a run finishes must still get a run of its own). Two runs can
therefore overlap, so every step checks edit_revision: a result for an
older revision is thrown away and the run starts over with the current
one, and publishing a revision that is already published changes nothing.
After a few rounds a run snoozes, so a stream of saves cannot keep it busy
forever. A render that fails for good leaves edit_state: "failed" (for
that revision only) — the file keeps serving a placeholder rather than
bytes the edit was meant to change.
"copy": renders args["edits"] into a brand-new file (same owner and
folder, edited_from_uuid set).