Migrate lock commands to independent objects

This commit is contained in:
2026-09-05 13:11:11 +00:00
parent 4bc33773fa
commit 610eaefb27
13 changed files with 368 additions and 156 deletions

View File

@@ -149,10 +149,16 @@ func TestCommittedStatusReportsCarriedOutputOriginAndChecksExactKey(t *testing.T
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.Stages["publish"] = &manifest.StageRecord{
Name: "publish", Status: manifest.StatusSucceeded,
Metadata: map[string]any{"publish_output_outcomes": []any{map[string]any{
"source": "narratio.transcript.final_trimmed", "status": "carried_locked",
}}},
}
availability := remotePublishedOutputAvailabilityForCurrent(context.Background(), cfg, fake, nil, current)
key := publishedOutputRemoteStateKey("narratio.transcript.final_trimmed", "transcripts/full.json")
want := "remote=published origin_run=" + originRun
want := "outcome=carried_locked remote=published origin_run=" + originRun
if availability[key] != want {
t.Fatalf("availability = %#v, want %q", availability, want)
}
@@ -161,6 +167,24 @@ func TestCommittedStatusReportsCarriedOutputOriginAndChecksExactKey(t *testing.T
}
}
func TestCommittedPublishOutputOutcomesRecognizesAllStates(t *testing.T) {
statuses := []string{"published", "carried_locked", "locked_unpublished", "optional_missing", "unselected"}
items := make([]any, 0, len(statuses))
for _, status := range statuses {
items = append(items, map[string]any{"source": "source." + status, "status": status})
}
m := &manifest.Manifest{Stages: map[string]*manifest.StageRecord{
"publish": {Metadata: map[string]any{"publish_output_outcomes": items}},
}}
got := committedPublishOutputOutcomes(m)
for _, status := range statuses {
if got["source."+status] != status {
t.Fatalf("outcomes = %#v, missing %q", got, status)
}
}
}
func TestCommittedRestoreKeepsSelectedSnapshotWhenPointerChanges(t *testing.T) {
cfg := restorePlanConfig(t)
fake := &storage.FakeBackend{}