Merge imported products into local session state
This commit is contained in:
@@ -23,17 +23,17 @@ func TestCommittedRestorePlanUsesOnlyDeclaredObjects(t *testing.T) {
|
||||
cfg := restorePlanConfig(t)
|
||||
fake := &storage.FakeBackend{}
|
||||
current := seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", map[string][]byte{
|
||||
"transcripts/full.json": []byte(`{"segments":[1]}`),
|
||||
"transcripts/final.trimmed.json": []byte(`{"segments":[1]}`),
|
||||
})
|
||||
fake.SeedObject(storage.FakeObject{Key: current.SessionPrefix + "artifacts/stale.md", Data: []byte("stale")})
|
||||
fake.SeedObject(storage.FakeObject{Key: artifacts.S3RunRelativeDestinationKey(artifacts.S3RunPrefix(current.SessionPrefix, "20260519T010204Z-e5f6a7b8"), "transcripts/other.json"), Data: []byte("other")})
|
||||
|
||||
plan, err := buildRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{})
|
||||
plan, err := buildInventoryRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("buildRestorePlan() error = %v", err)
|
||||
t.Fatalf("buildInventoryRestorePlan() error = %v", err)
|
||||
}
|
||||
got := actionRelPaths(plan.Actions)
|
||||
want := []string{"manifest.json", "transcripts/full.json"}
|
||||
want := []string{"transcripts/final.trimmed.json"}
|
||||
if len(got) != len(want) {
|
||||
t.Fatalf("action paths = %#v, want %#v", got, want)
|
||||
}
|
||||
@@ -64,7 +64,7 @@ func TestCommittedRestoreInstallsPreparedInputsAndFlatProducts(t *testing.T) {
|
||||
item.DestinationKey, item.Generation = key, fake.Objects[key].ETag
|
||||
}
|
||||
}
|
||||
plan, err := buildRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{})
|
||||
plan, err := buildInventoryRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -88,7 +88,7 @@ func TestCommittedRestoreUsesAbsoluteConfiguredProductDestination(t *testing.T)
|
||||
current := seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", map[string][]byte{
|
||||
"artifacts/session_recap.md": []byte("recap"),
|
||||
})
|
||||
plan, err := buildRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{})
|
||||
plan, err := buildInventoryRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -102,16 +102,14 @@ func TestCommittedRestoreDoesNotRequirePolishRunDiagnostics(t *testing.T) {
|
||||
cfg := restorePlanConfig(t)
|
||||
fake := &storage.FakeBackend{}
|
||||
current := seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", map[string][]byte{
|
||||
"transcripts/full.json": []byte(`{"segments":[]}`),
|
||||
"transcripts/final.trimmed.json": []byte(`{"segments":[]}`),
|
||||
})
|
||||
diagnostic := filepath.Join(cfg.Pipeline.Workspace.Root, "runs", current.RunID, "polish", "outputs", "transcripts", "errors.yml")
|
||||
current.Manifest.Stages["polish"] = &manifest.StageRecord{
|
||||
Name: "polish", Status: manifest.StatusSucceeded,
|
||||
Logs: []string{diagnostic},
|
||||
}
|
||||
plan, err := buildRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{})
|
||||
diagnosticKey := artifacts.S3RunRelativeDestinationKey(artifacts.S3RunPrefix(current.SessionPrefix, current.RunID), "polish/logs/errors.yml")
|
||||
fake.SeedObject(storage.FakeObject{Key: diagnosticKey, Data: []byte("diagnostic")})
|
||||
current.Commit.Artifacts = append(current.Commit.Artifacts, remoteRestoreArtifact(fake, artifacts.RemoteArtifactTypeRunFile, "run:polish/logs/errors.yml", diagnosticKey))
|
||||
plan, err := buildInventoryRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("buildRestorePlan() error = %v", err)
|
||||
t.Fatalf("buildInventoryRestorePlan() error = %v", err)
|
||||
}
|
||||
for _, action := range plan.Actions {
|
||||
if strings.Contains(action.LocalRelativePath, "errors.yml") {
|
||||
@@ -124,7 +122,7 @@ func TestCommittedRestoreDownloadsCarriedOutputFromDeclaredRun(t *testing.T) {
|
||||
cfg := restorePlanConfig(t)
|
||||
fake := &storage.FakeBackend{}
|
||||
current := seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", map[string][]byte{
|
||||
"transcripts/full.json": []byte("carried\n"),
|
||||
"transcripts/final.trimmed.json": []byte("carried\n"),
|
||||
})
|
||||
declaration := ¤t.Commit.Artifacts[1]
|
||||
oldKey := artifacts.S3RunRelativeDestinationKey(artifacts.S3RunPrefix(current.SessionPrefix, "20260512T010203Z-11223344"), "published/transcripts/full.json")
|
||||
@@ -136,11 +134,11 @@ func TestCommittedRestoreDownloadsCarriedOutputFromDeclaredRun(t *testing.T) {
|
||||
t.Fatalf("carried commit validation: %v", err)
|
||||
}
|
||||
|
||||
plan, err := buildRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{})
|
||||
plan, err := buildInventoryRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("buildRestorePlan() error = %v", err)
|
||||
t.Fatalf("buildInventoryRestorePlan() error = %v", err)
|
||||
}
|
||||
action := restoreActionForPath(t, plan, "transcripts/full.json")
|
||||
action := restoreActionForPath(t, plan, "transcripts/final.trimmed.json")
|
||||
if action.RemoteKey != oldKey {
|
||||
t.Fatalf("restore remote key = %q, want exact carried key %q", action.RemoteKey, oldKey)
|
||||
}
|
||||
@@ -152,54 +150,18 @@ func TestCommittedRestoreDownloadsCarriedOutputFromDeclaredRun(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCommittedRestoreReusesVerifiedManifestCandidate(t *testing.T) {
|
||||
cfg := restorePlanConfig(t)
|
||||
fake := &storage.FakeBackend{}
|
||||
current := seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", nil)
|
||||
|
||||
plan, err := buildRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("buildRestorePlan() error = %v", err)
|
||||
}
|
||||
if _, err := executeRestorePlan(context.Background(), cfg, current, plan, nil, fake); err != nil {
|
||||
t.Fatalf("executeRestorePlan() error = %v", err)
|
||||
}
|
||||
if got := fakeReadCount(fake, current.CurrentManifestKey); got != 1 {
|
||||
t.Fatalf("manifest reads = %d, want one discovery read reused by restore", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCommittedRestoreRejectsChangedGenerationForVerifiedManifestCandidate(t *testing.T) {
|
||||
cfg := restorePlanConfig(t)
|
||||
fake := &storage.FakeBackend{}
|
||||
current := seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", nil)
|
||||
plan, err := buildRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("buildRestorePlan() error = %v", err)
|
||||
}
|
||||
fake.SeedObject(storage.FakeObject{Key: current.CurrentManifestKey, Data: []byte("changed manifest"), ETag: "changed-generation"})
|
||||
|
||||
_, err = executeRestorePlan(context.Background(), cfg, current, plan, nil, fake)
|
||||
if err == nil || !strings.Contains(err.Error(), "generation mismatch") {
|
||||
t.Fatalf("executeRestorePlan() error = %v, want generation mismatch", err)
|
||||
}
|
||||
if got := fakeReadCount(fake, current.CurrentManifestKey); got != 1 {
|
||||
t.Fatalf("manifest reads = %d, want no second transfer for rejected candidate", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCommittedStatusReportsOnlyDeclaredPublishedOutputs(t *testing.T) {
|
||||
cfg := restorePlanConfig(t)
|
||||
cfg.Pipeline.Publish = &config.PublishConfig{Outputs: []config.PublishOutputRule{{
|
||||
Source: "narratio.transcript.final_trimmed",
|
||||
Dest: "transcripts/full.json",
|
||||
Dest: "transcripts/final.trimmed.json",
|
||||
}}}
|
||||
fake := &storage.FakeBackend{}
|
||||
current := seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", map[string][]byte{
|
||||
"transcripts/full.json": []byte("declared\n"),
|
||||
"transcripts/final.trimmed.json": []byte("declared\n"),
|
||||
})
|
||||
current.Commit.Artifacts[1].Source = "narratio.transcript.final_trimmed"
|
||||
fake.SeedObject(storage.FakeObject{Key: current.SessionPrefix + "transcripts/full.json", Data: []byte("mutable stale copy\n")})
|
||||
fake.SeedObject(storage.FakeObject{Key: current.SessionPrefix + "transcripts/final.trimmed.json", Data: []byte("mutable stale copy\n")})
|
||||
|
||||
cfg.ArtifactCatalog = &config.ArtifactCatalog{PublishOutputs: cfg.Pipeline.Publish.Outputs}
|
||||
outputs, err := inspectPublishedOutputs(context.Background(), cfg, fake, nil, current, nil, true, "available")
|
||||
@@ -213,26 +175,25 @@ func TestCommittedStatusReportsCarriedOutputOriginAndChecksExactKey(t *testing.T
|
||||
cfg := restorePlanConfig(t)
|
||||
cfg.Pipeline.Publish = &config.PublishConfig{Outputs: []config.PublishOutputRule{{
|
||||
Source: "narratio.transcript.final_trimmed",
|
||||
Dest: "transcripts/full.json",
|
||||
Dest: "transcripts/final.trimmed.json",
|
||||
}}}
|
||||
cfg.ArtifactCatalog = &config.ArtifactCatalog{PublishOutputs: cfg.Pipeline.Publish.Outputs}
|
||||
fake := &storage.FakeBackend{}
|
||||
current := seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", map[string][]byte{
|
||||
"transcripts/full.json": []byte("carried\n"),
|
||||
"transcripts/final.trimmed.json": []byte("carried\n"),
|
||||
})
|
||||
const originRun = "20260512T010203Z-11223344"
|
||||
oldKey := artifacts.S3RunRelativeDestinationKey(artifacts.S3RunPrefix(current.SessionPrefix, originRun), "published/transcripts/original.json")
|
||||
fake.SeedObject(storage.FakeObject{Key: oldKey, Data: []byte("carried\n")})
|
||||
current.Commit.Artifacts[1].Source = "narratio.transcript.final_trimmed"
|
||||
current.Commit.Artifacts[1].DestinationKey = oldKey
|
||||
current.Manifest = nil
|
||||
|
||||
outputs, err := inspectPublishedOutputs(context.Background(), cfg, fake, nil, current, nil, true, "available")
|
||||
if err != nil || len(outputs) != 1 {
|
||||
t.Fatalf("outputs=%#v err=%v", outputs, err)
|
||||
}
|
||||
output := outputs[0]
|
||||
if output.State != "published" || output.Destination != "transcripts/full.json" || output.DeclaredDestination != "transcripts/original.json" || output.DeclaredKey != oldKey || output.OriginRun != originRun {
|
||||
if output.State != "published" || output.Destination != "transcripts/final.trimmed.json" || output.DeclaredDestination != "transcripts/original.json" || output.DeclaredKey != oldKey || output.OriginRun != originRun {
|
||||
t.Fatalf("carried output=%#v", output)
|
||||
}
|
||||
if len(fake.ExistsKeys) == 0 || fake.ExistsKeys[len(fake.ExistsKeys)-1] != oldKey {
|
||||
@@ -259,31 +220,27 @@ func TestCommittedPublishOutputOutcomesRecognizesAllStates(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCommittedRestoreKeepsSelectedSnapshotWhenPointerChanges(t *testing.T) {
|
||||
func TestCommittedRestoreKeepsSelectedInventoryWhenPointerChanges(t *testing.T) {
|
||||
cfg := restorePlanConfig(t)
|
||||
fake := &storage.FakeBackend{}
|
||||
first := seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", map[string][]byte{
|
||||
"transcripts/full.json": []byte("from first commit\n"),
|
||||
"transcripts/final.trimmed.json": []byte("from first commit\n"),
|
||||
})
|
||||
plan, err := buildRestorePlan(context.Background(), cfg, first, fake, RestorePlanOptions{})
|
||||
plan, err := buildInventoryRestorePlan(context.Background(), cfg, first, fake, RestorePlanOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("buildRestorePlan() error = %v", err)
|
||||
t.Fatalf("buildInventoryRestorePlan() error = %v", err)
|
||||
}
|
||||
_ = seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010204Z-e5f6a7b8", map[string][]byte{
|
||||
"transcripts/full.json": []byte("from second commit\n"),
|
||||
"transcripts/final.trimmed.json": []byte("from second commit\n"),
|
||||
})
|
||||
|
||||
if _, err := executeRestorePlan(context.Background(), cfg, first, plan, nil, fake); err != nil {
|
||||
t.Fatalf("executeRestorePlan() error = %v", err)
|
||||
}
|
||||
root := artifacts.SessionWorkDirForCampaign(cfg.Pipeline.Workspace.Root, cfg.Session.Campaign, cfg.Session.SessionID)
|
||||
mustReadEquals(t, filepath.Join(root, "transcripts", "full.json"), "from first commit\n")
|
||||
restored, err := (&manifest.LocalStore{}).Load(context.Background(), filepath.Join(root, "manifest.json"))
|
||||
if err != nil {
|
||||
t.Fatalf("load restored manifest: %v", err)
|
||||
}
|
||||
if restored.RunID != first.RunID {
|
||||
t.Fatalf("restored run id = %q, want %q", restored.RunID, first.RunID)
|
||||
mustReadEquals(t, filepath.Join(root, "transcripts", "final.trimmed.json"), "from first commit\n")
|
||||
if _, err := os.Stat(filepath.Join(root, "manifest.json")); !os.IsNotExist(err) {
|
||||
t.Fatalf("transfer unexpectedly installed a remote manifest: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,13 +248,13 @@ func TestCommittedRestoreRejectsChangedDeclaredObjectBeforeManifestInstall(t *te
|
||||
cfg := restorePlanConfig(t)
|
||||
fake := &storage.FakeBackend{}
|
||||
current := seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", map[string][]byte{
|
||||
"transcripts/full.json": []byte("committed bytes\n"),
|
||||
"transcripts/final.trimmed.json": []byte("committed bytes\n"),
|
||||
})
|
||||
plan, err := buildRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{})
|
||||
plan, err := buildInventoryRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("buildRestorePlan() error = %v", err)
|
||||
t.Fatalf("buildInventoryRestorePlan() error = %v", err)
|
||||
}
|
||||
key := artifacts.S3RunRelativeDestinationKey(artifacts.S3RunPrefix(current.SessionPrefix, current.RunID), "published/transcripts/full.json")
|
||||
key := artifacts.S3RunRelativeDestinationKey(artifacts.S3RunPrefix(current.SessionPrefix, current.RunID), "published/transcripts/final.trimmed.json")
|
||||
fake.SeedObject(storage.FakeObject{Key: key, Data: []byte("changed bytes\n")})
|
||||
|
||||
if _, err := executeRestorePlan(context.Background(), cfg, current, plan, nil, fake); err == nil {
|
||||
@@ -313,13 +270,13 @@ func TestCommittedRestoreRejectsChangedDeclaredObjectGeneration(t *testing.T) {
|
||||
cfg := restorePlanConfig(t)
|
||||
fake := &storage.FakeBackend{}
|
||||
current := seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", map[string][]byte{
|
||||
"transcripts/full.json": []byte("committed bytes\n"),
|
||||
"transcripts/final.trimmed.json": []byte("committed bytes\n"),
|
||||
})
|
||||
plan, err := buildRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{})
|
||||
plan, err := buildInventoryRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("buildRestorePlan() error = %v", err)
|
||||
t.Fatalf("buildInventoryRestorePlan() error = %v", err)
|
||||
}
|
||||
key := artifacts.S3RunRelativeDestinationKey(artifacts.S3RunPrefix(current.SessionPrefix, current.RunID), "published/transcripts/full.json")
|
||||
key := artifacts.S3RunRelativeDestinationKey(artifacts.S3RunPrefix(current.SessionPrefix, current.RunID), "published/transcripts/final.trimmed.json")
|
||||
fake.SeedObject(storage.FakeObject{Key: key, Data: []byte("committed bytes\n"), ETag: "replacement-generation"})
|
||||
|
||||
if _, err := executeRestorePlan(context.Background(), cfg, current, plan, nil, fake); err == nil {
|
||||
@@ -348,9 +305,9 @@ func TestCommittedRestoreRejectsChangedAudioBeforeInstall(t *testing.T) {
|
||||
current := seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", map[string][]byte{
|
||||
"audio/alice.flac": []byte("original-audio"),
|
||||
})
|
||||
plan, err := buildRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{IncludeAudio: true})
|
||||
plan, err := buildInventoryRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{IncludeAudio: true})
|
||||
if err != nil {
|
||||
t.Fatalf("buildRestorePlan() error = %v", err)
|
||||
t.Fatalf("buildInventoryRestorePlan() error = %v", err)
|
||||
}
|
||||
key := artifacts.S3RunRelativeDestinationKey(artifacts.S3RunPrefix(current.SessionPrefix, current.RunID), "published/audio/alice.flac")
|
||||
generation := test.generation
|
||||
@@ -384,13 +341,13 @@ func TestCommittedRestoreRejectsMissingDeclaredObjectBeforeManifestInstall(t *te
|
||||
cfg := restorePlanConfig(t)
|
||||
fake := &storage.FakeBackend{}
|
||||
current := seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", map[string][]byte{
|
||||
"transcripts/full.json": []byte("committed bytes\n"),
|
||||
"transcripts/final.trimmed.json": []byte("committed bytes\n"),
|
||||
})
|
||||
plan, err := buildRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{})
|
||||
plan, err := buildInventoryRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("buildRestorePlan() error = %v", err)
|
||||
t.Fatalf("buildInventoryRestorePlan() error = %v", err)
|
||||
}
|
||||
missingKey := artifacts.S3RunRelativeDestinationKey(artifacts.S3RunPrefix(current.SessionPrefix, current.RunID), "published/transcripts/full.json")
|
||||
missingKey := artifacts.S3RunRelativeDestinationKey(artifacts.S3RunPrefix(current.SessionPrefix, current.RunID), "published/transcripts/final.trimmed.json")
|
||||
fake.ReadHook = func(call storage.FakeReadCall) error {
|
||||
if call.Key == missingKey {
|
||||
return os.ErrNotExist
|
||||
@@ -411,22 +368,22 @@ func TestCommittedRestoreForceRetainsDirectoryConflict(t *testing.T) {
|
||||
cfg := restorePlanConfig(t)
|
||||
fake := &storage.FakeBackend{}
|
||||
current := seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", map[string][]byte{
|
||||
"transcripts/full.json": []byte("committed bytes\n"),
|
||||
"transcripts/final.trimmed.json": []byte("committed bytes\n"),
|
||||
})
|
||||
root := artifacts.SessionWorkDirForCampaign(cfg.Pipeline.Workspace.Root, cfg.Session.Campaign, cfg.Session.SessionID)
|
||||
if err := os.MkdirAll(filepath.Join(root, "transcripts", "full.json"), 0o755); err != nil {
|
||||
if err := os.MkdirAll(filepath.Join(root, "transcripts", "final.trimmed.json"), 0o755); err != nil {
|
||||
t.Fatalf("MkdirAll() error = %v", err)
|
||||
}
|
||||
|
||||
plan, err := buildRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{Force: true})
|
||||
plan, err := buildInventoryRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{Force: true})
|
||||
if err != nil {
|
||||
t.Fatalf("buildRestorePlan() error = %v", err)
|
||||
t.Fatalf("buildInventoryRestorePlan() error = %v", err)
|
||||
}
|
||||
if plan.ConflictCount != 1 {
|
||||
t.Fatalf("ConflictCount = %d, want 1", plan.ConflictCount)
|
||||
}
|
||||
for _, action := range plan.Actions {
|
||||
if action.LocalRelativePath == "transcripts/full.json" && action.ConflictKind != RestoreConflictDirectory {
|
||||
if action.LocalRelativePath == "transcripts/final.trimmed.json" && action.ConflictKind != RestoreConflictDirectory {
|
||||
t.Fatalf("ConflictKind = %q, want %q", action.ConflictKind, RestoreConflictDirectory)
|
||||
}
|
||||
}
|
||||
@@ -469,7 +426,14 @@ func seedCommittedRestoreSnapshot(t *testing.T, cfg *config.Config, fake *storag
|
||||
key := artifacts.S3RunRelativeDestinationKey(artifacts.S3RunPrefix(sessionPrefix, runID), "published/"+relative)
|
||||
fake.SeedObject(storage.FakeObject{Key: key, Data: outputs[relative]})
|
||||
sourceKey := strings.NewReplacer("/", "_", ".", "_", "-", "_").Replace(relative)
|
||||
artifactsByKey = append(artifactsByKey, remoteRestoreArtifact(fake, artifacts.RemoteArtifactTypePublishedOutput, artifacts.ConfiguredArtifactSourceID(sourceKey), key))
|
||||
source := artifacts.ConfiguredArtifactSourceID(sourceKey)
|
||||
if relative == "transcripts/final.trimmed.json" {
|
||||
source = artifacts.ArtifactTranscriptFinalTrimmed
|
||||
}
|
||||
if relative == "artifacts/session_recap.md" {
|
||||
source = artifacts.ConfiguredArtifactSourceID("session_recap")
|
||||
}
|
||||
artifactsByKey = append(artifactsByKey, remoteRestoreArtifact(fake, artifacts.RemoteArtifactTypePublishedOutput, source, key))
|
||||
}
|
||||
commit := artifacts.RemoteCommitManifest{
|
||||
FormatVersion: artifacts.RemoteCommitFormatVersion,
|
||||
@@ -499,9 +463,9 @@ func seedCommittedRestoreSnapshot(t *testing.T, cfg *config.Config, fake *storag
|
||||
t.Fatalf("encode current pointer: %v", err)
|
||||
}
|
||||
fake.SeedObject(storage.FakeObject{Key: artifacts.S3CurrentCommitPointerKey(sessionPrefix), Data: pointerData})
|
||||
current, err := discoverRemoteCurrentState(context.Background(), cfg, fake)
|
||||
current, err := discoverRemotePublication(context.Background(), cfg, fake)
|
||||
if err != nil {
|
||||
t.Fatalf("discoverRemoteCurrentState() error = %v", err)
|
||||
t.Fatalf("discoverRemotePublication() error = %v", err)
|
||||
}
|
||||
return current
|
||||
}
|
||||
@@ -555,13 +519,13 @@ func (s *oversizedRestoreStore) Read(ctx context.Context, key string) (storage.O
|
||||
}
|
||||
|
||||
func TestRestoreStopsOversizedResponsesBeforeInstallation(t *testing.T) {
|
||||
for _, path := range []string{"transcripts/full.json", "audio/alice.flac"} {
|
||||
for _, path := range []string{"transcripts/final.trimmed.json", "audio/alice.flac"} {
|
||||
t.Run(path, func(t *testing.T) {
|
||||
cfg := restorePlanConfig(t)
|
||||
fake := &storage.FakeBackend{}
|
||||
const content = "committed data"
|
||||
current := seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", map[string][]byte{path: []byte(content)})
|
||||
plan, err := buildRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{IncludeAudio: true})
|
||||
plan, err := buildInventoryRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{IncludeAudio: true})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user