@@ -12,11 +12,10 @@ use vite_task_plan::{
1212 SpawnExecution ,
1313} ;
1414
15- use self :: glob_inputs:: compute_globbed_inputs;
16-
1715use self :: {
1816 fingerprint:: PostRunFingerprint ,
19- spawn:: { SpawnResult , spawn_with_tracking} ,
17+ glob_inputs:: compute_globbed_inputs,
18+ spawn:: { SpawnResult , TrackedPathAccesses , spawn_with_tracking} ,
2019} ;
2120use super :: {
2221 cache:: { CommandCacheValue , ExecutionCache } ,
@@ -30,7 +29,6 @@ use super::{
3029 } ,
3130} ;
3231use crate :: Session ;
33- use self :: spawn:: TrackedPathAccesses ;
3432
3533/// Outcome of a spawned execution.
3634///
@@ -353,55 +351,54 @@ pub async fn execute_spawn(
353351
354352 // 6. Update cache if successful and determine cache update status.
355353 // Errors during cache update are terminal (reported through finish).
356- let ( cache_update_status, cache_error) =
357- if let Some ( ( cache_metadata, globbed_inputs) ) = cache_metadata_and_inputs {
358- if result. exit_status . success ( ) {
359- // path_reads is empty when inference is disabled (path_accesses is None)
360- let empty_path_reads = Default :: default ( ) ;
361- let path_reads = path_accesses
362- . as_ref ( )
363- . map ( |pa| & pa. path_reads )
364- . unwrap_or ( & empty_path_reads) ;
365-
366- // Execution succeeded — attempt to create fingerprint and update cache
367- match PostRunFingerprint :: create (
368- path_reads,
369- cache_base_path,
370- & cache_metadata. input_config ,
371- ) {
372- Ok ( post_run_fingerprint) => {
373- let new_cache_value = CommandCacheValue {
374- post_run_fingerprint,
375- std_outputs : std_outputs. unwrap_or_default ( ) . into ( ) ,
376- duration : result. duration ,
377- } ;
378- match cache
379- . update ( cache_metadata, globbed_inputs, cache_base_path, new_cache_value)
380- . await
381- {
382- Ok ( ( ) ) => ( CacheUpdateStatus :: Updated , None ) ,
383- Err ( err) => (
384- CacheUpdateStatus :: NotUpdated ( CacheNotUpdatedReason :: CacheDisabled ) ,
385- Some ( ExecutionError :: Cache {
386- kind : CacheErrorKind :: Update ,
387- source : err,
388- } ) ,
389- ) ,
390- }
354+ let ( cache_update_status, cache_error) = if let Some ( ( cache_metadata, globbed_inputs) ) =
355+ cache_metadata_and_inputs
356+ {
357+ if result. exit_status . success ( ) {
358+ // path_reads is empty when inference is disabled (path_accesses is None)
359+ let empty_path_reads = Default :: default ( ) ;
360+ let path_reads =
361+ path_accesses. as_ref ( ) . map ( |pa| & pa. path_reads ) . unwrap_or ( & empty_path_reads) ;
362+
363+ // Execution succeeded — attempt to create fingerprint and update cache
364+ match PostRunFingerprint :: create (
365+ path_reads,
366+ cache_base_path,
367+ & cache_metadata. input_config ,
368+ ) {
369+ Ok ( post_run_fingerprint) => {
370+ let new_cache_value = CommandCacheValue {
371+ post_run_fingerprint,
372+ std_outputs : std_outputs. unwrap_or_default ( ) . into ( ) ,
373+ duration : result. duration ,
374+ } ;
375+ match cache
376+ . update ( cache_metadata, globbed_inputs, cache_base_path, new_cache_value)
377+ . await
378+ {
379+ Ok ( ( ) ) => ( CacheUpdateStatus :: Updated , None ) ,
380+ Err ( err) => (
381+ CacheUpdateStatus :: NotUpdated ( CacheNotUpdatedReason :: CacheDisabled ) ,
382+ Some ( ExecutionError :: Cache {
383+ kind : CacheErrorKind :: Update ,
384+ source : err,
385+ } ) ,
386+ ) ,
391387 }
392- Err ( err) => (
393- CacheUpdateStatus :: NotUpdated ( CacheNotUpdatedReason :: CacheDisabled ) ,
394- Some ( ExecutionError :: PostRunFingerprint ( err) ) ,
395- ) ,
396388 }
397- } else {
398- // Execution failed with non-zero exit status — don't update cache
399- ( CacheUpdateStatus :: NotUpdated ( CacheNotUpdatedReason :: NonZeroExitStatus ) , None )
389+ Err ( err) => (
390+ CacheUpdateStatus :: NotUpdated ( CacheNotUpdatedReason :: CacheDisabled ) ,
391+ Some ( ExecutionError :: PostRunFingerprint ( err) ) ,
392+ ) ,
400393 }
401394 } else {
402- // Caching was disabled for this task
403- ( CacheUpdateStatus :: NotUpdated ( CacheNotUpdatedReason :: CacheDisabled ) , None )
404- } ;
395+ // Execution failed with non-zero exit status — don't update cache
396+ ( CacheUpdateStatus :: NotUpdated ( CacheNotUpdatedReason :: NonZeroExitStatus ) , None )
397+ }
398+ } else {
399+ // Caching was disabled for this task
400+ ( CacheUpdateStatus :: NotUpdated ( CacheNotUpdatedReason :: CacheDisabled ) , None )
401+ } ;
405402
406403 // 7. Finish the leaf execution with the result and optional cache error.
407404 // Cache update/fingerprint failures are reported but do not affect the outcome —
0 commit comments