Restore prepared inputs and flat session products

This commit is contained in:
2026-11-30 01:53:11 +00:00
parent e19ba81406
commit 3118bc35ba
12 changed files with 282 additions and 62 deletions

View File

@@ -3,6 +3,7 @@ package app
import (
"encoding/json"
"fmt"
"strings"
"path/filepath"
@@ -71,8 +72,7 @@ func newRestoreReport(current *RemoteCurrentState, plan *RestorePlan, opts Resto
SkipSame: plan.SkipSameCount,
Conflicts: plan.ConflictCount,
},
Actions: make([]RestoreReportAction, 0, len(plan.Actions)),
reportPathRel: filepath.ToSlash(filepath.Join(config.PathReportsDirSegment, "restore-latest.json")),
Actions: make([]RestoreReportAction, 0, len(plan.Actions)),
}
for _, action := range plan.Actions {
r.Actions = append(r.Actions, RestoreReportAction{
@@ -163,6 +163,9 @@ func persistRestoreReport(store artifacts.Store, cfg *config.Config, report *Res
if report == nil {
return "", fmt.Errorf("restore report is required")
}
if strings.TrimSpace(report.reportPathRel) == "" {
return "", fmt.Errorf("restore report path is required")
}
sessionRoot := artifacts.SessionWorkDirForCampaign(cfg.Pipeline.Workspace.Root, cfg.Session.Campaign, cfg.Session.SessionID)
reportPath := filepath.Join(sessionRoot, filepath.FromSlash(report.reportPathRel))
payload, err := json.MarshalIndent(report, "", " ")