fix: #3591584 Auto-save should not re-create entities, but set the fields of them: otherwise translations get lost
Closes #3591584
AI-Generated: Yes (Used Claude Code to rework the fix and to write the kernel test coverage).
What this MR does
Reworks ApiAutoSaveController::post() so that publishing an auto-save no longer rebuilds the entity from the auto-save snapshot and saves that. The snapshot only ever contains the translation that was edited, so saving it directly dropped every other translation.
Instead, post() now loads the stored entity and applies the auto-saved changes onto the translation the snapshot belongs to (getTranslation() / addTranslation()), copying only the changed, editable fields. All other translations are preserved because the stored entity is never discarded. As a bonus, the loaded entity keeps a valid loaded revision ID — which content_translation's field synchronizer relies on to choose the correct synchronization source for untranslatable ("symmetric") columns; without it, publishing a structural change could be silently reverted from a stale translation.
Testing steps
- Create a
canvas_pagewith a non-default-language translation (e.g. Spanish). - Edit the page in the Canvas editor (auto-save runs in the background) and click Publish.
- Confirm the Spanish translation still exists on the published page, and that a structural edit made on the default language is preserved.
Automated coverage (ApiAutoSaveControllerTranslationTest):