Pure decision core for [`check_push_credentials`], split out so it can be unit-tested without touching the on-disk identity store. `explicit` — whether `--identity` was passed. `inferred` — the name inferred from the URL/flag (before fallback); used only to name the missing identity in the error message. `resolved_name` — the identity name to use **after** the default fallback (`None` when nothin
(
explicit: bool,
inferred: Option<&str>,
resolved_name: Option<&str>,
keypair_loadable: impl Fn(&str) -> bool,
)
| 462 | /// Returns `None` when credentials are usable, or `Some(issue)` describing the |
| 463 | /// problem. |
| 464 | fn evaluate_push_credentials( |
| 465 | explicit: bool, |
| 466 | inferred: Option<&str>, |
| 467 | resolved_name: Option<&str>, |
| 468 | keypair_loadable: impl Fn(&str) -> bool, |
| 469 | ) -> Option<CredentialIssue> { |
| 470 | match resolved_name { |
| 471 | Some(name) => { |
| 472 | if !keypair_loadable(name) { |
| 473 | return Some(CredentialIssue::KeypairUnavailable { |
| 474 | name: name.to_string(), |
| 475 | }); |
| 476 | } |
| 477 | None |
| 478 | } |
| 479 | None => { |
| 480 | // No usable identity. If --identity was explicit, name the missing |
| 481 | // identity so the user knows which input was wrong. Otherwise the |
| 482 | // fallback to default also failed (no default) — report that. |
| 483 | if explicit { |
| 484 | Some(CredentialIssue::ExplicitIdentityNotFound { |
| 485 | name: inferred.unwrap_or_default().to_string(), |
| 486 | }) |
| 487 | } else { |
| 488 | Some(CredentialIssue::NoIdentity) |
| 489 | } |
| 490 | } |
| 491 | } |
| 492 | } |
| 493 | |
| 494 | /// Derive the apex server URL (scheme + host without the leading subdomain |
| 495 | /// label + port) from a tenant-scoped remote URL. |
no outgoing calls