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,
)
| 598 | /// Returns `None` when credentials are usable, or `Some(issue)` describing the |
| 599 | /// problem. |
| 600 | fn evaluate_push_credentials( |
| 601 | explicit: bool, |
| 602 | inferred: Option<&str>, |
| 603 | resolved_name: Option<&str>, |
| 604 | keypair_loadable: impl Fn(&str) -> bool, |
| 605 | ) -> Option<CredentialIssue> { |
| 606 | match resolved_name { |
| 607 | Some(name) => { |
| 608 | if !keypair_loadable(name) { |
| 609 | return Some(CredentialIssue::KeypairUnavailable { |
| 610 | name: name.to_string(), |
| 611 | }); |
| 612 | } |
| 613 | None |
| 614 | } |
| 615 | None => { |
| 616 | // No usable identity. If --identity was explicit, name the missing |
| 617 | // identity so the user knows which input was wrong. Otherwise the |
| 618 | // fallback to default also failed (no default) — report that. |
| 619 | if explicit { |
| 620 | Some(CredentialIssue::ExplicitIdentityNotFound { |
| 621 | name: inferred.unwrap_or_default().to_string(), |
| 622 | }) |
| 623 | } else { |
| 624 | Some(CredentialIssue::NoIdentity) |
| 625 | } |
| 626 | } |
| 627 | } |
| 628 | } |
| 629 | |
| 630 | /// Derive the apex server URL (scheme + host without the leading subdomain |
| 631 | /// label + port) from a tenant-scoped remote URL. |
no outgoing calls