Publish products without execution ledgers
This commit is contained in:
@@ -32,7 +32,7 @@ func TestResolveUsesExactCommittedDeclaration(t *testing.T) {
|
||||
t.Fatalf("PreviousRunID = %q, want previous-run", plan.PreviousRunID)
|
||||
}
|
||||
got := recordRelPaths(plan.Records)
|
||||
want := []string{"inputs/previous/artifacts/session_recap.md", "inputs/previous/manifest.json"}
|
||||
want := []string{"inputs/previous/artifacts/session_recap.md"}
|
||||
if strings.Join(got, ",") != strings.Join(want, ",") {
|
||||
t.Fatalf("record rel paths = %#v, want %#v", got, want)
|
||||
}
|
||||
@@ -70,8 +70,8 @@ func TestResolveDerivesLocalPathFromCommittedDestination(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("Resolve() error = %v", err)
|
||||
}
|
||||
if len(plan.Records) != 2 {
|
||||
t.Fatalf("records len = %d, want 2", len(plan.Records))
|
||||
if len(plan.Records) != 1 {
|
||||
t.Fatalf("records len = %d, want 1", len(plan.Records))
|
||||
}
|
||||
if plan.Records[0].LocalRelativePath != "inputs/previous/artifacts/session_recap.md" {
|
||||
t.Fatalf("artifact local relative path = %q", plan.Records[0].LocalRelativePath)
|
||||
@@ -103,11 +103,8 @@ func TestResolveUsesCommittedSourceMappingForCustomDestination(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("Resolve() error = %v", err)
|
||||
}
|
||||
if len(plan.Records) != 2 {
|
||||
t.Fatalf("records = %#v, want manifest and artifact", plan.Records)
|
||||
}
|
||||
if manifestRecord := findRecord(plan.Records, InputKindManifest); manifestRecord == nil || len(manifestRecord.VerifiedContent) == 0 {
|
||||
t.Fatalf("manifest record = %#v, want retained verified content", manifestRecord)
|
||||
if len(plan.Records) != 1 {
|
||||
t.Fatalf("records = %#v, want artifact only", plan.Records)
|
||||
}
|
||||
artifact := findRecord(plan.Records, InputKindArtifact)
|
||||
if artifact == nil {
|
||||
@@ -174,8 +171,8 @@ func TestResolveSkipsMissingOptionalPreviousArtifact(t *testing.T) {
|
||||
if strings.Join(plan.SkippedMissing, ",") != "session_recap" {
|
||||
t.Fatalf("SkippedMissing = %#v, want session_recap", plan.SkippedMissing)
|
||||
}
|
||||
if len(plan.Records) != 1 || plan.Records[0].Kind != InputKindManifest {
|
||||
t.Fatalf("records = %#v, want manifest only", plan.Records)
|
||||
if len(plan.Records) != 0 {
|
||||
t.Fatalf("records = %#v, want none", plan.Records)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,21 +189,6 @@ func TestResolveMissingRequiredPreviousArtifactFails(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolveValidatesPreviousManifestIdentity(t *testing.T) {
|
||||
cfg, paths := previousCacheTestConfig(t)
|
||||
store := &storage.FakeBackend{}
|
||||
manifest := previousManifestWithOutput(t, cfg, "artifacts/session_recap.md", nil)
|
||||
manifest.SessionID = "wrong-session"
|
||||
seedPreviousCurrent(t, store, cfg, manifest)
|
||||
|
||||
_, err := Resolve(context.Background(), cfg, paths, []artifacts.PreviousArtifactRequirement{
|
||||
{Name: "session_recap", Required: true},
|
||||
}, store)
|
||||
if err == nil || !strings.Contains(err.Error(), "identity does not match") {
|
||||
t.Fatalf("Resolve() error = %v, want identity validation error", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolveMissingCurrentRunPointerSkipsOptionalRequirements(t *testing.T) {
|
||||
cfg, paths := previousCacheTestConfig(t)
|
||||
store := &storage.FakeBackend{}
|
||||
@@ -434,3 +416,26 @@ func sha256ForPreviousCacheTest(data []byte) string {
|
||||
sum := sha256.Sum256(data)
|
||||
return hex.EncodeToString(sum[:])
|
||||
}
|
||||
|
||||
func TestResolvePreviousProductWithoutExecutionSnapshot(t *testing.T) {
|
||||
cfg, paths := previousCacheTestConfig(t)
|
||||
store := &storage.FakeBackend{}
|
||||
previous := previousManifestWithOutput(t, cfg, "artifacts/session_recap.md", nil)
|
||||
expectedKey := seedCommittedPreviousState(t, store, cfg, previous, []artifacts.RemoteArtifact{committedPublishedArtifactForTest("narratio.artifact.session_recap", "artifacts/session_recap.md", []byte("recap"), "product-generation")})
|
||||
prefix := artifacts.S3SessionPrefix("dnd", cfg.Session.Campaign, cfg.Session.PreviousSessionID)
|
||||
manifestKey := artifacts.S3RunSessionManifestKey(prefix, "previous-run")
|
||||
delete(store.Objects, manifestKey)
|
||||
store.Reads = nil
|
||||
plan, err := Resolve(context.Background(), cfg, paths, []artifacts.PreviousArtifactRequirement{{Name: "session_recap", Required: true}}, store)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(plan.Records) != 1 || plan.Records[0].RemoteKey != expectedKey {
|
||||
t.Fatalf("plan %+v", plan)
|
||||
}
|
||||
for _, read := range store.Reads {
|
||||
if read.Key == manifestKey {
|
||||
t.Fatal("execution snapshot was read")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user