Propagate cancellation and preserve resumable state

This commit is contained in:
2026-11-20 05:53:49 +00:00
parent a6c6f1e4ab
commit c7a5ff316d
21 changed files with 356 additions and 27 deletions

View File

@@ -33,6 +33,9 @@ func executeRestorePlan(
report *RestoreReport,
store storage.ObjectStore,
) (*RestoreExecutionResult, error) {
if err := ctx.Err(); err != nil {
return nil, err
}
if cfg == nil || cfg.Pipeline == nil || cfg.Session == nil {
return nil, fmt.Errorf("resolved config with pipeline/session is required")
}
@@ -100,6 +103,9 @@ func executeRestoreDownloadAction(
action RestoreAction,
store storage.ObjectStore,
) error {
if err := ctx.Err(); err != nil {
return err
}
safeLocalPath, err := joinWithinSessionRoot(sessionRoot, action.LocalRelativePath)
if err != nil {
return fmt.Errorf("resolve safe local path: %w", err)
@@ -165,6 +171,9 @@ func executeRestoreDownloadAction(
if err := validateRestoreDestinationLeaf(parent, leaf); err != nil {
return err
}
if err := ctx.Err(); err != nil {
return err
}
if err := fileops.InstallSiblingTempFile(temporaryPath, safeLocalPath, fileops.WorkspaceFileMode); err != nil {
return fmt.Errorf("install file atomically: %w", err)
}