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,
)
| 509 | /// Returns `None` when credentials are usable, or `Some(issue)` describing the |
| 510 | /// problem. |
| 511 | fn evaluate_push_credentials( |
| 512 | explicit: bool, |
| 513 | inferred: Option<&str>, |
| 514 | resolved_name: Option<&str>, |
| 515 | keypair_loadable: impl Fn(&str) -> bool, |
| 516 | ) -> Option<CredentialIssue> { |
| 517 | match resolved_name { |
| 518 | Some(name) => { |
| 519 | if !keypair_loadable(name) { |
| 520 | return Some(CredentialIssue::KeypairUnavailable { |
| 521 | name: name.to_string(), |
| 522 | }); |
| 523 | } |
| 524 | None |
| 525 | } |
| 526 | None => { |
| 527 | // No usable identity. If --identity was explicit, name the missing |
| 528 | // identity so the user knows which input was wrong. Otherwise the |
| 529 | // fallback to default also failed (no default) — report that. |
| 530 | if explicit { |
| 531 | Some(CredentialIssue::ExplicitIdentityNotFound { |
| 532 | name: inferred.unwrap_or_default().to_string(), |
| 533 | }) |
| 534 | } else { |
| 535 | Some(CredentialIssue::NoIdentity) |
| 536 | } |
| 537 | } |
| 538 | } |
| 539 | } |
| 540 | |
| 541 | /// Derive the apex server URL (scheme + host without the leading subdomain |
| 542 | /// label + port) from a tenant-scoped remote URL. |
no outgoing calls