Plan imports from published product inventories

This commit is contained in:
2026-12-02 16:02:48 +00:00
parent 4f50a57a38
commit ad8a5df97b
9 changed files with 414 additions and 37 deletions

View File

@@ -33,13 +33,15 @@ func TestRestoreCommandDryRunLeavesMissingWorkspaceAbsent(t *testing.T) {
pipeline, campaign, session := writeValidConfigFiles(t, t.TempDir())
fake := &storage.FakeBackend{}
cfg, _, _, _ := seedRestoreCommittedState(t, fake, pipeline, campaign, session)
seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", map[string][]byte{"artifacts/recap.md": []byte("synthetic recap\n")})
current := seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", map[string][]byte{"audio/speaker.flac": []byte("synthetic audio\n")})
delete(fake.Objects, current.CurrentManifestKey)
fake.Reads = nil
paths := artifacts.NewLocalStore(cfg.Pipeline.Workspace.Root).SessionPathsFor(cfg.Session.Campaign, cfg.Session.SessionID)
if _, err := os.Stat(paths.Root); !os.IsNotExist(err) {
t.Fatalf("fixture session root=%v", err)
}
var out, diagnostic bytes.Buffer
code := restoreCommandExecutor(fake)([]string{"session", "restore", cfg.Session.SessionID, "--config", pipeline, "--campaign-file", campaign, "--session-file", session, "--dry-run"}, &out, &diagnostic)
code := restoreCommandExecutor(fake)([]string{"session", "restore", cfg.Session.SessionID, "--config", pipeline, "--campaign-file", campaign, "--session-file", session, "--dry-run", "--include-audio"}, &out, &diagnostic)
if code != 0 {
t.Fatalf("status=%d diagnostics=%s", code, diagnostic.String())
}
@@ -47,6 +49,11 @@ func TestRestoreCommandDryRunLeavesMissingWorkspaceAbsent(t *testing.T) {
if !report.DryRun || report.Complete || len(report.Actions) == 0 {
t.Fatalf("report=%#v", report)
}
for _, read := range fake.Reads {
if read.Key == current.CurrentManifestKey {
t.Fatalf("dry run read obsolete execution snapshot %q", read.Key)
}
}
if _, err := os.Stat(paths.Root); !os.IsNotExist(err) {
t.Fatalf("dry run created workspace: %v", err)
}