Bound restore and publication verification downloads

This commit is contained in:
2026-12-01 20:28:13 +00:00
parent 6f5464615e
commit 59813b72fa
15 changed files with 211 additions and 37 deletions

View File

@@ -58,6 +58,15 @@ type RestoreAction struct {
VerifiedContent []byte
}
// A committed identity declares its size even when it is zero. Legacy raw
// audio listings use zero for a missing size and retain unknown-size handling.
func restoreExpectedSize(action RestoreAction) *int64 {
if action.Size > 0 || action.SHA256 != "" || action.Generation != "" {
return &action.Size
}
return nil
}
// RestorePlan is the deterministic output of restore planning.
type RestorePlan struct {
Actions []RestoreAction
@@ -495,7 +504,7 @@ func classifyRestoreAction(
if err != nil {
return RestoreAction{}, fmt.Errorf("checksum local file: %w", err)
}
remotePath, err := storage.DownloadObjectToTemp(ctx, store, action.RemoteKey, "narratio-restore-plan-remote-*.tmp")
remotePath, err := storage.DownloadObjectToTemp(ctx, store, action.RemoteKey, "narratio-restore-plan-remote-*.tmp", restoreExpectedSize(action))
if err != nil {
return RestoreAction{}, fmt.Errorf("download remote object: %w", err)
}