Improve project-namespace sync: Add before_save callback for ensure_project_namespace_in_sync

The normal flow, Projects::TransferService#proceed_to_transfer, sets project.namespace = to_namespace and calls project.save! with validations. Project has a before_validation :ensure_project_namespace_in_sync (project.rb:148), which syncs namespace_id → the project namespace's parent_id (it's in SYNCED_ATTRIBUTES), which in turn triggers the traversal callbacks that recompute traversal_ids. If that had run, none of this would have happened.

But ensure_project_namespace_in_sync is registered only as before_validation. Compare that to Routable#prepare_route, which is registered on both before_validation and before_save, with the comment "in case validation is skipped" (routable.rb:60-61). Any write that changes namespace_id and saves with validate: false — or does an update_column plus a route touch — will update the route and projects.namespace_id correctly (route callbacks still fire, so redirects get created) while silently skipping the project-namespace sync.

Edited by 🤖 GitLab Bot 🤖