Use effective artifact tag in update checks
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run

This commit is contained in:
DuProcess
2026-07-12 22:13:36 -04:00
parent 306a636e32
commit 6f055e9fc1
+41 -25
View File
@@ -4134,6 +4134,11 @@ fn update_binary_version_for_installer(local: &str, latest_tag: Option<&str>) ->
}
}
fn effective_update_artifact_tag(local: &str, latest_tag: Option<&str>) -> Option<String> {
update_binary_version_for_installer(local, latest_tag)
.or_else(|| latest_tag.map(ToOwned::to_owned))
}
fn compare_dotted_versions(left: &str, right: &str) -> std::cmp::Ordering {
let left = parse_comparable_version(left);
let right = parse_comparable_version(right);
@@ -4299,13 +4304,15 @@ fn run_update(config: &dosh::config::ClientConfig, options: UpdateOptions) -> Re
if let Some(latest_url) = latest_release_download_url(&repo, artifact) {
let mut status = "missing";
let mut display_url = latest_url.clone();
if let Some(tag_url) = latest_tag
if let Some(tag_url) =
effective_update_artifact_tag(local_version, latest_tag.as_deref())
.as_deref()
.and_then(|tag| release_tag_download_url(&repo, tag, artifact))
&& url_reachable(&tag_url)?
{
status = "available";
display_url = tag_url;
if url_reachable(&display_url)? {
status = "available";
}
} else if url_reachable(&latest_url)? {
status = "available";
}
@@ -9556,28 +9563,28 @@ mod tests {
PendingStreamOpen, PredictMode, Predictor, RESTART_STATUS_SCRIPT, RemoteForward,
STARTUP_INPUT_HOLD, SshConfig, SshPathTokenContext, StartupGateMode, StatusAction,
UpdateOptions, UpdateRole, auth_allows, cache_key, cache_server_prefix,
cleanup_stream_state, clear_cached_credentials, ensure_tui_safe_status_overlay,
expand_ssh_path_tokens, input_contains_focus_in, input_matches_escape,
is_local_status_target, is_resume_response_for_client, latest_release_download_url,
load_first_native_identity_with_prompt, native_proxy_udp_warning,
newest_client_trace_path_from, parse_dynamic_forward, parse_escape_key,
parse_local_forward, parse_remote_forward, parse_ssh_config, parse_trace_line,
parse_trace_options, parse_trace_report_options, parse_trace_summary, parse_update_options,
post_submit_hold_duration, queue_pending_user_input, queue_stale_pending_user_input,
raw_contains_host_table, recv_response_until, refresh_live_addr, release_tag_download_url,
release_tag_from_effective_url, release_version_from_tag, render_status_clear,
render_status_overlay, requested_env, resolved_startup_command, retire_stream_state,
retransmit_stream_opens, rewrite_forward_command, sanitize_trace_name,
selected_predict_mode, selected_udp_host, server_version_mismatch,
should_flush_terminal_input_after_contact, should_health_log_client_start,
should_hold_during_startup_gate, should_hold_post_submit_input,
should_reconnect_before_input_for_local_sleep, should_repaint_idle_terminal,
should_strip_unowned_terminal_reports, split_after_command_submit, split_trace_tokens,
ssh_command_target, ssh_config_uses_proxy, ssh_destination_host, ssh_username,
ssh_with_user, startup_command, status_ssh_target, strip_stale_mouse_reports,
strip_terminal_focus_reports, strip_unowned_terminal_reports, summarize_trace_file,
summarize_trace_file_with_mode, terminal_private_mode_transition, toml_bare_key_or_quoted,
top_trace_events, trace_report_warnings, unix_update_script,
cleanup_stream_state, clear_cached_credentials, effective_update_artifact_tag,
ensure_tui_safe_status_overlay, expand_ssh_path_tokens, input_contains_focus_in,
input_matches_escape, is_local_status_target, is_resume_response_for_client,
latest_release_download_url, load_first_native_identity_with_prompt,
native_proxy_udp_warning, newest_client_trace_path_from, parse_dynamic_forward,
parse_escape_key, parse_local_forward, parse_remote_forward, parse_ssh_config,
parse_trace_line, parse_trace_options, parse_trace_report_options, parse_trace_summary,
parse_update_options, post_submit_hold_duration, queue_pending_user_input,
queue_stale_pending_user_input, raw_contains_host_table, recv_response_until,
refresh_live_addr, release_tag_download_url, release_tag_from_effective_url,
release_version_from_tag, render_status_clear, render_status_overlay, requested_env,
resolved_startup_command, retire_stream_state, retransmit_stream_opens,
rewrite_forward_command, sanitize_trace_name, selected_predict_mode, selected_udp_host,
server_version_mismatch, should_flush_terminal_input_after_contact,
should_health_log_client_start, should_hold_during_startup_gate,
should_hold_post_submit_input, should_reconnect_before_input_for_local_sleep,
should_repaint_idle_terminal, should_strip_unowned_terminal_reports,
split_after_command_submit, split_trace_tokens, ssh_command_target, ssh_config_uses_proxy,
ssh_destination_host, ssh_username, ssh_with_user, startup_command, status_ssh_target,
strip_stale_mouse_reports, strip_terminal_focus_reports, strip_unowned_terminal_reports,
summarize_trace_file, summarize_trace_file_with_mode, terminal_private_mode_transition,
toml_bare_key_or_quoted, top_trace_events, trace_report_warnings, unix_update_script,
update_binary_version_for_installer, update_installer_url, update_version_status,
upsert_managed_block, valid_forward_host, vscode_safe_alias, wake_repaint_retry_deadline,
windows_update_script,
@@ -11296,6 +11303,15 @@ mod tests {
update_binary_version_for_installer("1.0.0-rc42", Some("v1.0.0")),
None
);
assert_eq!(
effective_update_artifact_tag("1.0.0-rc41", Some("v1.0.0-rc37")).as_deref(),
Some("v1.0.0-rc41")
);
assert_eq!(
effective_update_artifact_tag("1.0.0-rc41", Some("v1.0.0-rc42")).as_deref(),
Some("v1.0.0-rc42")
);
assert_eq!(effective_update_artifact_tag("1.0.0-rc41", None), None);
let config = ClientConfig::default();
let unix = unix_update_script(
&config,