address argus: 422 from migrate is a validation error, not 'exists'

ensure_mirror_repo treated 409|422 as success (copied from ensure_org, where
422 *does* mean 'org exists'). For the migrate endpoint 422 is a validation
error (bad clone_addr/service); the GET-first check is the real idempotency
guard, so 409 stays as a race guard but 422 now falls through to the bail arm
(→ caller warns) instead of silently dropping a misconfigured mirror.
This commit is contained in:
atlas 2026-06-29 00:19:25 +02:00 committed by mara
commit 64e51fe3bf

View file

@ -991,8 +991,12 @@ async fn ensure_mirror_repo(
tracing::info!(%owner, %repo, %upstream, "forge: created pull-mirror");
Ok(())
}
409 | 422 => {
tracing::debug!(%owner, %repo, "forge: pull-mirror already exists");
// 409 = a race created it between our GET check and here (the GET
// is the real idempotency guard). NOT 422: for the migrate endpoint
// 422 is a validation error (bad clone_addr / service), so it must
// surface via the bail arm, not be swallowed as "already exists".
409 => {
tracing::debug!(%owner, %repo, "forge: pull-mirror already exists (race)");
Ok(())
}
other => {