Preserve derived publication and preparation evidence
This commit is contained in:
@@ -66,7 +66,7 @@ func writeArtifactList(out io.Writer, cfg *config.Config, catalog *artifacts.Art
|
||||
}
|
||||
}
|
||||
fmt.Fprintln(out, "Published:")
|
||||
for _, rule := range cfg.Pipeline.Publish.Outputs {
|
||||
for _, rule := range cfg.PublicationOutputs() {
|
||||
writePublishedOutputLine(out, rule, catalog, lockSet, publishedRemoteState)
|
||||
}
|
||||
}
|
||||
@@ -137,7 +137,7 @@ func remoteLockSourceSet(locks []artifacts.RemoteLock) map[string]struct{} {
|
||||
|
||||
func unresolvedRemotePublishedOutputAvailability(cfg *config.Config, catalog *artifacts.ArtifactCatalog, state string) map[string]string {
|
||||
out := map[string]string{}
|
||||
for _, rule := range cfg.Pipeline.Publish.Outputs {
|
||||
for _, rule := range cfg.PublicationOutputs() {
|
||||
source := strings.TrimSpace(rule.Source)
|
||||
dest, _, err := helperPublishedOutputDest(rule, catalog)
|
||||
if err != nil {
|
||||
@@ -161,7 +161,7 @@ func remotePublishedOutputAvailabilityForCurrent(
|
||||
}
|
||||
outcomes := committedPublishOutputOutcomes(current.Manifest)
|
||||
out := map[string]string{}
|
||||
for _, rule := range cfg.Pipeline.Publish.Outputs {
|
||||
for _, rule := range cfg.PublicationOutputs() {
|
||||
source := strings.TrimSpace(rule.Source)
|
||||
dest, _, err := helperPublishedOutputDest(rule, catalog)
|
||||
if err != nil {
|
||||
|
||||
@@ -165,7 +165,7 @@ func writeLocks(out io.Writer, cfg *config.Config, locks []artifacts.RemoteLock)
|
||||
fmt.Fprintln(out, "Publish locks:")
|
||||
published := map[string]config.PublishOutputRule{}
|
||||
if cfg != nil && cfg.Pipeline != nil && cfg.Pipeline.Publish != nil {
|
||||
for _, rule := range cfg.Pipeline.Publish.Outputs {
|
||||
for _, rule := range cfg.PublicationOutputs() {
|
||||
published[strings.TrimSpace(rule.Source)] = rule
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ func TestPreparedSessionPublishAndRemoteLoad(t *testing.T) {
|
||||
enabled := true
|
||||
cfg.Pipeline.Publish.Enabled = &enabled
|
||||
cfg.Pipeline.Publish.UploadRun = &enabled
|
||||
cfg.Pipeline.Publish.Outputs = nil
|
||||
cfg.ArtifactCatalog.PublishOutputs = nil
|
||||
fake := &storage.FakeBackend{}
|
||||
store := artifacts.NewLocalStore(cfg.Pipeline.Workspace.Root)
|
||||
env := &stage.Env{Config: cfg, ArtifactStore: store, ObjectStore: fake}
|
||||
@@ -65,7 +65,7 @@ func TestPreparedSessionPublishAndRemoteLoad(t *testing.T) {
|
||||
}
|
||||
prefix := artifacts.S3SessionPrefix("dnd", m.Campaign, m.SessionID)
|
||||
key := artifacts.S3RunRelativeDestinationKey(artifacts.S3RunPrefix(prefix, m.RunID), "prepare/inputs/session.yml")
|
||||
if got := string(fake.Objects[key].Data); !strings.Contains(got, "Published title") || strings.Contains(got, "imports:") || strings.Contains(got, "speakers_file:") {
|
||||
if got := string(fake.Objects[key].Data); !strings.Contains(got, "Published title") || strings.Contains(got, "imports:") || !strings.Contains(got, "speakers_file:") {
|
||||
t.Fatalf("published session = %q", got)
|
||||
}
|
||||
for _, name := range []string{"campaign.yml", "party.yml"} {
|
||||
@@ -84,7 +84,7 @@ func TestPreparedSessionPublishAndRemoteLoad(t *testing.T) {
|
||||
if loaded.Config.Session.Title != "Published title" || loaded.Config.SessionSource.S3Key != key {
|
||||
t.Fatalf("remote session = %#v, source=%#v", loaded.Config.Session, loaded.Config.SessionSource)
|
||||
}
|
||||
if got := loaded.Config.StableInputs.SpeakersFile; got.Source != "campaign_config" || got.Path != filepath.Join(filepath.Dir(campaignPath), "speakers.yml") {
|
||||
if got := loaded.Config.StableInputs.SpeakersFile; got.Source != "session_config" || got.Path != filepath.Join(filepath.Dir(campaignPath), "speakers.yml") {
|
||||
t.Fatalf("receiving campaign speakers = %#v", got)
|
||||
}
|
||||
current, err := discoverRemoteCurrentState(ctx, loaded.Config, fake)
|
||||
|
||||
@@ -163,6 +163,7 @@ func TestCommittedStatusReportsCarriedOutputOriginAndChecksExactKey(t *testing.T
|
||||
Source: "narratio.transcript.final_trimmed",
|
||||
Dest: "transcripts/full.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"),
|
||||
@@ -189,7 +190,7 @@ func TestCommittedStatusReportsCarriedOutputOriginAndChecksExactKey(t *testing.T
|
||||
t.Fatalf("exists keys = %#v, want final exact declaration key %q", fake.ExistsKeys, oldKey)
|
||||
}
|
||||
var rendered bytes.Buffer
|
||||
writePublishedOutputLine(&rendered, cfg.Pipeline.Publish.Outputs[0], nil, nil, availability)
|
||||
writePublishedOutputLine(&rendered, cfg.ArtifactCatalog.PublishOutputs[0], nil, nil, availability)
|
||||
for _, fragment := range []string{"dest=transcripts/full.json", "declared_dest=transcripts/original.json", "declared_key=" + oldKey, "origin_run=" + originRun} {
|
||||
if !strings.Contains(rendered.String(), fragment) {
|
||||
t.Fatalf("rendered output = %q, want %q", rendered.String(), fragment)
|
||||
|
||||
@@ -1402,7 +1402,7 @@ func testConfig(t *testing.T) *config.Config {
|
||||
CampaignPath: campaignPath,
|
||||
SessionPath: sessionPath,
|
||||
Party: config.ResolvedParty{
|
||||
Canonical: partyDocument,
|
||||
Canonical: partyDocument, Players: projectedTestPlayers(t, partyDocument),
|
||||
Source: config.PartySource{
|
||||
Path: filepath.Join(cfgDir, "party.yml"),
|
||||
ConfigPath: campaignPath,
|
||||
@@ -1515,3 +1515,12 @@ func boolPtr(v bool) *bool {
|
||||
p := v
|
||||
return &p
|
||||
}
|
||||
|
||||
func projectedTestPlayers(t *testing.T, party *config.CanonicalParty) []byte {
|
||||
t.Helper()
|
||||
data, err := party.PlayersYAML()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
@@ -532,7 +532,7 @@ func TestDeliverySemanticChangesInvalidateOnlyTheirFixedDependents(t *testing.T)
|
||||
wantRuns [2]int
|
||||
}{
|
||||
{name: "publish destination", mutate: func(cfg *config.Config) {
|
||||
cfg.Pipeline.Publish.Outputs[0].Dest = "published/alternate.json"
|
||||
cfg.ArtifactCatalog.PublishOutputs[0].Dest = "published/alternate.json"
|
||||
}, wantRuns: [2]int{1, 1}},
|
||||
{name: "publish credentials", mutate: func(cfg *config.Config) {
|
||||
cfg.Pipeline.Storage.S3.AccessKeyID = testSecretReference("OTHER_ACCESS_KEY")
|
||||
@@ -602,6 +602,7 @@ func configureDeliverySemanticConfig(cfg *config.Config) {
|
||||
},
|
||||
}
|
||||
cfg.Pipeline.Notification.Mode = config.DefaultNotificationMode
|
||||
cfg.ArtifactCatalog = &config.ArtifactCatalog{PublishOutputs: cfg.Pipeline.Publish.Outputs}
|
||||
}
|
||||
|
||||
func canonicalSemanticProvider(t *testing.T, name string) stage.SemanticConfigFingerprinter {
|
||||
|
||||
Reference in New Issue
Block a user