Merge imported products into local session state

This commit is contained in:
2026-12-02 16:24:33 +00:00
parent ad8a5df97b
commit e7fada4372
26 changed files with 638 additions and 1254 deletions

View File

@@ -19,8 +19,6 @@ func TestInventoryRestoreMapsSourceInsteadOfRemoteDestination(t *testing.T) {
cfg := restorePlanConfig(t)
fake := &storage.FakeBackend{}
current := seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", map[string][]byte{"transcripts/renamed.json": []byte(`{"segments":[]}`)})
current.Manifest = nil
current.ManifestData = nil
current.Commit.Artifacts[1].Source = artifacts.ArtifactTranscriptFinalTrimmed
plan, err := buildInventoryRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{})
if err != nil {
@@ -39,8 +37,6 @@ func TestInventoryRestoreProjectsSelectedTranscriptProducts(t *testing.T) {
"transcripts/one.json": []byte(`{"segments":[]}`),
"transcripts/two.md": []byte("synthetic transcript"),
})
current.Manifest = nil
current.ManifestData = nil
for i := range current.Commit.Artifacts {
item := &current.Commit.Artifacts[i]
switch filepath.Ext(item.DestinationKey) {
@@ -73,7 +69,6 @@ func TestInventoryRestoreConflictsDoNotContributeCoverage(t *testing.T) {
cfg := restorePlanConfig(t)
fake := &storage.FakeBackend{}
current := seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", map[string][]byte{"transcripts/remote.json": []byte(`{"segments":[]}`)})
current.Manifest = nil
current.Commit.Artifacts[1].Source = artifacts.ArtifactTranscriptFinalTrimmed
first, err := buildInventoryRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{})
if err != nil || len(first.Actions) != 1 {
@@ -103,7 +98,6 @@ func TestInventoryRestoreUsesCurrentConfiguredProductPath(t *testing.T) {
}}
fake := &storage.FakeBackend{}
current := seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", map[string][]byte{"artifacts/remote-name.md": []byte("synthetic recap")})
current.Manifest = nil
current.Commit.Artifacts[1].Source = artifacts.ConfiguredArtifactSourceID("recap")
plan, err := buildInventoryRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{})
if err != nil {
@@ -122,7 +116,6 @@ func TestInventoryRestoreRejectsCollidingProductPaths(t *testing.T) {
}}
fake := &storage.FakeBackend{}
current := seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", map[string][]byte{"artifacts/a.md": []byte("a"), "artifacts/b.md": []byte("b")})
current.Manifest = nil
current.Commit.Artifacts[1].Source = artifacts.ConfiguredArtifactSourceID("first")
current.Commit.Artifacts[2].Source = artifacts.ConfiguredArtifactSourceID("second")
if _, err := buildInventoryRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{}); err == nil {
@@ -149,7 +142,6 @@ func TestInventoryRestoreCandidatePreservesLocalProgress(t *testing.T) {
}
fake := &storage.FakeBackend{}
current := seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", map[string][]byte{"transcripts/remote.json": []byte(`{"segments":[]}`)})
current.Manifest = nil
current.Commit.Artifacts[1].Source = artifacts.ArtifactTranscriptFinalTrimmed
plan, err := buildInventoryRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{})
if err != nil {