Stream daemon executable hashing off the async runtime (#47591)

## Why

Debug executables can be hundreds of megabytes. Computing their identity previously loaded the entire file into memory and hashed it on an async runtime thread.

## What changed

Stream executable contents into the BLAKE3 hasher using `tokio::task::spawn_blocking`, preserving the existing digest format while avoiding whole-file allocation and moving hashing off the async runtime.

## Testing

Expand the executable identity test to verify compatibility with whole-file hashing for a file spanning multiple reads with a partial final buffer and for an empty file, and to confirm that changing a byte changes the identity.

GitOrigin-RevId: 528103397395313d170ec720fefc8c5ab3676956
This commit is contained in:
Eric Traut
2026-09-23 17:08:29 +00:00
committed by copyberry
parent ae132dc50a
commit 8f1490eabe
3 changed files with 49 additions and 20 deletions
@@ -21,7 +21,7 @@ use crate::UpdateStatus;
#[cfg(unix)]
use crate::managed_install::executable_identity;
#[cfg(unix)]
use crate::managed_install::executable_identity_from_bytes;
use crate::managed_install::executable_identity_from_reader;
#[tokio::test]
async fn installer_fetch_uses_exact_url_and_preserves_bytes() {
@@ -772,7 +772,7 @@ async fn check_manual_update_restart(package_directory: &str) {
super::run_with_http(
&http,
&updater_daemon,
&executable_identity_from_bytes(b"updater"),
&executable_identity_from_reader(&b"updater"[..]).expect("updater identity"),
restore_release,
)
.await
@@ -849,7 +849,7 @@ async fn check_manual_update_restart(package_directory: &str) {
let output = manual_update_once(
&no_op,
&daemon,
&executable_identity_from_bytes(b"updater"),
&executable_identity_from_reader(&b"updater"[..]).expect("updater identity"),
&mut test_terminate(),
super::UpdateTrigger::Manual,
)