Fix orphaned job artifacts deletion order

What does this MR do and why?

Move destroy_orphaned_ci_job_artifacts! before delete_commit_statuses to ensure artifacts are properly cleaned up before their associated commit statuses are deleted. This prevents orphaned artifacts from being left behind when a project is destroyed.

Changelog: fixed

Issue: Prevent orphaned job artifacts (#545050 - closed)

How to set up and validate locally

There's no way to validate this fix locally or test the bug behavior in a spec. The solution we have was proposed by Drew in #545050 (comment 2597662378) and validated by the reporter of the bug in #545050 (comment 2597976360)

Merge request reports

Loading