Share typed publication completion evidence
This commit is contained in:
@@ -96,6 +96,10 @@ supports remote loading when no authored session override is available. The
|
|||||||
|
|
||||||
## Metadata Signals
|
## Metadata Signals
|
||||||
|
|
||||||
|
`internal/artifacts` owns the typed codecs for completion identity and output
|
||||||
|
outcomes. Cleanup applies strict authorization to decoded fields; inspection
|
||||||
|
skips malformed outcome rows independently.
|
||||||
|
|
||||||
Includes counts/lists for:
|
Includes counts/lists for:
|
||||||
- run uploads
|
- run uploads
|
||||||
- published output uploads
|
- published output uploads
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ Validation: `go test ./internal/stage ./internal/config ./internal/app`.
|
|||||||
|
|
||||||
## Stage 11: Type Publication Completion And Outcome Evidence
|
## Stage 11: Type Publication Completion And Outcome Evidence
|
||||||
|
|
||||||
CAT IDs: CAT-20, publication half. Status: Pending.
|
CAT IDs: CAT-20, publication half. Status: Complete.
|
||||||
|
|
||||||
Read [BN-03](audit/11-boundaries.md#bn-03--p3-machine-consumed-publication-metadata-lacks-a-shared-contract-owner)
|
Read [BN-03](audit/11-boundaries.md#bn-03--p3-machine-consumed-publication-metadata-lacks-a-shared-contract-owner)
|
||||||
and [CX-06](audit/03-complexity.md#cx-06--p3-unstructured-metadata-carries-cross-package-control-evidence).
|
and [CX-06](audit/03-complexity.md#cx-06--p3-unstructured-metadata-carries-cross-package-control-evidence).
|
||||||
|
|||||||
@@ -43,38 +43,12 @@ func committedPublishOutputOutcomes(m *manifest.Manifest) map[string]string {
|
|||||||
if m == nil || m.Stages["publish"] == nil {
|
if m == nil || m.Stages["publish"] == nil {
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
raw := m.Stages["publish"].Metadata["publish_output_outcomes"]
|
for _, outcome := range artifacts.DecodePublicationOutcomes(m.Stages["publish"].Metadata) {
|
||||||
appendOutcome := func(item map[string]any) {
|
out[outcome.Source] = string(outcome.Status)
|
||||||
source, sourceOK := item["source"].(string)
|
|
||||||
status, statusOK := item["status"].(string)
|
|
||||||
if sourceOK && statusOK && isPublishOutputOutcome(status) {
|
|
||||||
out[source] = status
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch items := raw.(type) {
|
|
||||||
case []any:
|
|
||||||
for _, rawItem := range items {
|
|
||||||
if item, ok := rawItem.(map[string]any); ok {
|
|
||||||
appendOutcome(item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case []map[string]any:
|
|
||||||
for _, item := range items {
|
|
||||||
appendOutcome(item)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
func isPublishOutputOutcome(status string) bool {
|
|
||||||
switch status {
|
|
||||||
case "published", "carried_locked", "locked_unpublished", "optional_missing", "unselected":
|
|
||||||
return true
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func committedPublishedOutputs(commit *artifacts.RemoteCommitManifest) map[string]artifacts.RemoteArtifact {
|
func committedPublishedOutputs(commit *artifacts.RemoteCommitManifest) map[string]artifacts.RemoteArtifact {
|
||||||
out := map[string]artifacts.RemoteArtifact{}
|
out := map[string]artifacts.RemoteArtifact{}
|
||||||
if commit == nil {
|
if commit == nil {
|
||||||
|
|||||||
@@ -208,11 +208,15 @@ func TestCommittedPublishOutputOutcomesRecognizesAllStates(t *testing.T) {
|
|||||||
for _, status := range statuses {
|
for _, status := range statuses {
|
||||||
items = append(items, map[string]any{"source": "source." + status, "status": status})
|
items = append(items, map[string]any{"source": "source." + status, "status": status})
|
||||||
}
|
}
|
||||||
|
items = append(items, "malformed", map[string]any{"source": "invalid", "status": "unknown"})
|
||||||
m := &manifest.Manifest{Stages: map[string]*manifest.StageRecord{
|
m := &manifest.Manifest{Stages: map[string]*manifest.StageRecord{
|
||||||
"publish": {Metadata: map[string]any{"publish_output_outcomes": items}},
|
"publish": {Metadata: map[string]any{"publish_output_outcomes": items}},
|
||||||
}}
|
}}
|
||||||
|
|
||||||
got := committedPublishOutputOutcomes(m)
|
got := committedPublishOutputOutcomes(m)
|
||||||
|
if len(got) != len(statuses) {
|
||||||
|
t.Fatalf("unexpected outcomes = %#v", got)
|
||||||
|
}
|
||||||
for _, status := range statuses {
|
for _, status := range statuses {
|
||||||
if got["source."+status] != status {
|
if got["source."+status] != status {
|
||||||
t.Fatalf("outcomes = %#v, missing %q", got, status)
|
t.Fatalf("outcomes = %#v, missing %q", got, status)
|
||||||
|
|||||||
125
internal/artifacts/publication_metadata.go
Normal file
125
internal/artifacts/publication_metadata.go
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
package artifacts
|
||||||
|
|
||||||
|
// PublicationOutcomeStatus is the publication decision for one source.
|
||||||
|
type PublicationOutcomeStatus string
|
||||||
|
|
||||||
|
const (
|
||||||
|
PublicationPublished PublicationOutcomeStatus = "published"
|
||||||
|
PublicationCarriedLocked PublicationOutcomeStatus = "carried_locked"
|
||||||
|
PublicationLockedUnpublished PublicationOutcomeStatus = "locked_unpublished"
|
||||||
|
PublicationOptionalMissing PublicationOutcomeStatus = "optional_missing"
|
||||||
|
PublicationUnselected PublicationOutcomeStatus = "unselected"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PublicationOutcome describes a source's published or skipped outcome.
|
||||||
|
type PublicationOutcome struct {
|
||||||
|
Source string
|
||||||
|
Status PublicationOutcomeStatus
|
||||||
|
Destination string
|
||||||
|
DeclaredKey string
|
||||||
|
OriginRun string
|
||||||
|
}
|
||||||
|
|
||||||
|
// PublicationBoolField preserves absence and invalid types independently.
|
||||||
|
type PublicationBoolField struct {
|
||||||
|
Value bool
|
||||||
|
Present, Valid bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// PublicationStringField preserves absence and invalid types independently.
|
||||||
|
type PublicationStringField struct {
|
||||||
|
Value string
|
||||||
|
Present, Valid bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// PublicationCompletion contains the fields used to authorize cleanup.
|
||||||
|
type PublicationCompletion struct {
|
||||||
|
Uploaded, Skipped PublicationBoolField
|
||||||
|
RunID, CommitKey, PointerKey PublicationStringField
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
PublicationUploadedKey = "uploaded"
|
||||||
|
PublicationSkippedKey = "skipped"
|
||||||
|
PublicationRunIDKey = "published_run_id"
|
||||||
|
PublicationCommitKey = "remote_commit_key"
|
||||||
|
PublicationPointerKey = "current_commit_pointer_key"
|
||||||
|
PublicationOutcomesKey = "publish_output_outcomes"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DecodePublicationCompletion reads individual fields without deciding policy.
|
||||||
|
func DecodePublicationCompletion(metadata map[string]any) PublicationCompletion {
|
||||||
|
readBool := func(key string) PublicationBoolField {
|
||||||
|
raw, present := metadata[key]
|
||||||
|
value, valid := raw.(bool)
|
||||||
|
return PublicationBoolField{Value: value, Present: present, Valid: valid}
|
||||||
|
}
|
||||||
|
readString := func(key string) PublicationStringField {
|
||||||
|
raw, present := metadata[key]
|
||||||
|
value, valid := raw.(string)
|
||||||
|
return PublicationStringField{Value: value, Present: present, Valid: valid}
|
||||||
|
}
|
||||||
|
return PublicationCompletion{Uploaded: readBool(PublicationUploadedKey), Skipped: readBool(PublicationSkippedKey), RunID: readString(PublicationRunIDKey), CommitKey: readString(PublicationCommitKey), PointerKey: readString(PublicationPointerKey)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PublicationIdentity identifies a successfully committed publication.
|
||||||
|
type PublicationIdentity struct{ RunID, CommitKey, PointerKey string }
|
||||||
|
|
||||||
|
// PublicationCompletionMetadata encodes successful publication control evidence.
|
||||||
|
func PublicationCompletionMetadata(identity PublicationIdentity) map[string]any {
|
||||||
|
return map[string]any{PublicationUploadedKey: true, PublicationRunIDKey: identity.RunID, PublicationCommitKey: identity.CommitKey, PublicationPointerKey: identity.PointerKey}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PublicationOutcomeMetadata preserves the existing per-source map shape.
|
||||||
|
func PublicationOutcomeMetadata(outcome PublicationOutcome) map[string]any {
|
||||||
|
item := map[string]any{"source": outcome.Source, "status": string(outcome.Status)}
|
||||||
|
if outcome.Destination != "" {
|
||||||
|
item["destination"] = outcome.Destination
|
||||||
|
}
|
||||||
|
if outcome.DeclaredKey != "" {
|
||||||
|
item["declared_key"] = outcome.DeclaredKey
|
||||||
|
}
|
||||||
|
if outcome.OriginRun != "" {
|
||||||
|
item["origin_run"] = outcome.OriginRun
|
||||||
|
}
|
||||||
|
return item
|
||||||
|
}
|
||||||
|
|
||||||
|
// DecodePublicationOutcomes skips malformed rows while retaining valid rows in order.
|
||||||
|
func DecodePublicationOutcomes(metadata map[string]any) []PublicationOutcome {
|
||||||
|
var result []PublicationOutcome
|
||||||
|
appendRow := func(item map[string]any) {
|
||||||
|
source, sourceOK := item["source"].(string)
|
||||||
|
status, statusOK := item["status"].(string)
|
||||||
|
if !sourceOK || !statusOK || !validPublicationOutcome(PublicationOutcomeStatus(status)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
outcome := PublicationOutcome{Source: source, Status: PublicationOutcomeStatus(status)}
|
||||||
|
outcome.Destination, _ = item["destination"].(string)
|
||||||
|
outcome.DeclaredKey, _ = item["declared_key"].(string)
|
||||||
|
outcome.OriginRun, _ = item["origin_run"].(string)
|
||||||
|
result = append(result, outcome)
|
||||||
|
}
|
||||||
|
switch rows := metadata[PublicationOutcomesKey].(type) {
|
||||||
|
case []map[string]any:
|
||||||
|
for _, row := range rows {
|
||||||
|
appendRow(row)
|
||||||
|
}
|
||||||
|
case []any:
|
||||||
|
for _, raw := range rows {
|
||||||
|
if row, ok := raw.(map[string]any); ok {
|
||||||
|
appendRow(row)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
func validPublicationOutcome(status PublicationOutcomeStatus) bool {
|
||||||
|
switch status {
|
||||||
|
case PublicationPublished, PublicationCarriedLocked, PublicationLockedUnpublished, PublicationOptionalMissing, PublicationUnselected:
|
||||||
|
return true
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
39
internal/artifacts/publication_metadata_test.go
Normal file
39
internal/artifacts/publication_metadata_test.go
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
package artifacts
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"reflect"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestPublicationMetadataRoundTrip(t *testing.T) {
|
||||||
|
metadata := PublicationCompletionMetadata(PublicationIdentity{RunID: "run", CommitKey: "commit", PointerKey: "pointer"})
|
||||||
|
metadata[PublicationOutcomesKey] = []map[string]any{
|
||||||
|
PublicationOutcomeMetadata(PublicationOutcome{Source: "one", Status: PublicationPublished, Destination: "a", DeclaredKey: "key", OriginRun: "run"}),
|
||||||
|
{"source": "bad", "status": "invalid"},
|
||||||
|
PublicationOutcomeMetadata(PublicationOutcome{Source: "two", Status: PublicationOptionalMissing}),
|
||||||
|
}
|
||||||
|
before := DecodePublicationCompletion(metadata)
|
||||||
|
outcomes := DecodePublicationOutcomes(metadata)
|
||||||
|
if !before.Uploaded.Valid || !before.Uploaded.Value || before.Skipped.Present || !before.RunID.Valid || len(outcomes) != 2 {
|
||||||
|
t.Fatalf("completion = %+v, outcomes = %+v", before, outcomes)
|
||||||
|
}
|
||||||
|
body, err := json.Marshal(metadata)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
var decoded map[string]any
|
||||||
|
if err := json.Unmarshal(body, &decoded); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if got := DecodePublicationCompletion(decoded); !reflect.DeepEqual(got, before) {
|
||||||
|
t.Fatalf("completion = %+v, want %+v", got, before)
|
||||||
|
}
|
||||||
|
if got := DecodePublicationOutcomes(decoded); !reflect.DeepEqual(got, outcomes) {
|
||||||
|
t.Fatalf("outcomes = %+v, want %+v", got, outcomes)
|
||||||
|
}
|
||||||
|
decoded[PublicationSkippedKey] = "false"
|
||||||
|
if field := DecodePublicationCompletion(decoded).Skipped; !field.Present || field.Valid {
|
||||||
|
t.Fatalf("malformed skipped = %+v", field)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -93,32 +93,30 @@ func validateCleanupPublishEvidence(m *manifest.Manifest, campaign, sessionID st
|
|||||||
return "", fmt.Errorf("cleanup requires publish completion metadata")
|
return "", fmt.Errorf("cleanup requires publish completion metadata")
|
||||||
}
|
}
|
||||||
|
|
||||||
uploaded, ok := publishRecord.Metadata["uploaded"].(bool)
|
completion := artifacts.DecodePublicationCompletion(publishRecord.Metadata)
|
||||||
if !ok || !uploaded {
|
if !completion.Uploaded.Valid || !completion.Uploaded.Value {
|
||||||
return "", fmt.Errorf("cleanup requires publish metadata uploaded=true")
|
return "", fmt.Errorf("cleanup requires publish metadata uploaded=true")
|
||||||
}
|
}
|
||||||
if skippedValue, exists := publishRecord.Metadata["skipped"]; exists {
|
if completion.Skipped.Present {
|
||||||
skipped, ok := skippedValue.(bool)
|
if !completion.Skipped.Valid {
|
||||||
if !ok {
|
|
||||||
return "", fmt.Errorf("cleanup publish metadata skipped must be boolean")
|
return "", fmt.Errorf("cleanup publish metadata skipped must be boolean")
|
||||||
}
|
}
|
||||||
if skipped {
|
if completion.Skipped.Value {
|
||||||
return "", fmt.Errorf("cleanup cannot use skipped publication evidence")
|
return "", fmt.Errorf("cleanup cannot use skipped publication evidence")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
publishedRunID, err := canonicalCleanupMetadataString(completion.RunID, artifacts.PublicationRunIDKey)
|
||||||
publishedRunID, err := canonicalCleanupMetadataString(publishRecord.Metadata, "published_run_id")
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
if err := artifacts.ValidateRunIdentity(publishedRunID); err != nil {
|
if err := artifacts.ValidateRunIdentity(publishedRunID); err != nil {
|
||||||
return "", fmt.Errorf("cleanup publish metadata published_run_id: %w", err)
|
return "", fmt.Errorf("cleanup publish metadata published_run_id: %w", err)
|
||||||
}
|
}
|
||||||
remoteCommitKey, err := canonicalCleanupMetadataString(publishRecord.Metadata, "remote_commit_key")
|
remoteCommitKey, err := canonicalCleanupMetadataString(completion.CommitKey, artifacts.PublicationCommitKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
pointerKey, err := canonicalCleanupMetadataString(publishRecord.Metadata, "current_commit_pointer_key")
|
pointerKey, err := canonicalCleanupMetadataString(completion.PointerKey, artifacts.PublicationPointerKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@@ -138,9 +136,9 @@ func validateCleanupPublishEvidence(m *manifest.Manifest, campaign, sessionID st
|
|||||||
return publishedRunID, nil
|
return publishedRunID, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func canonicalCleanupMetadataString(metadata map[string]any, key string) (string, error) {
|
func canonicalCleanupMetadataString(field artifacts.PublicationStringField, key string) (string, error) {
|
||||||
value, ok := metadata[key].(string)
|
value := field.Value
|
||||||
if !ok || value == "" || strings.TrimSpace(value) != value {
|
if !field.Valid || value == "" || strings.TrimSpace(value) != value {
|
||||||
return "", fmt.Errorf("cleanup publish metadata %s must be a canonical nonempty string", key)
|
return "", fmt.Errorf("cleanup publish metadata %s must be a canonical nonempty string", key)
|
||||||
}
|
}
|
||||||
return value, nil
|
return value, nil
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package stage
|
package stage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@@ -33,6 +34,28 @@ func TestBuildCleanupPlanSelectsCanonicalSessionRunsTarget(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestCleanupPublishEvidenceSurvivesJSONRoundTrip(t *testing.T) {
|
||||||
|
env, m, runID := cleanupPlanningFixture(t)
|
||||||
|
env.Config.Pipeline.Workspace.CleanupAfterPublish = true
|
||||||
|
for _, roundTrip := range []bool{false, true} {
|
||||||
|
if roundTrip {
|
||||||
|
data, err := json.Marshal(m.Stages["publish"].Metadata)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
var decoded map[string]any
|
||||||
|
if err := json.Unmarshal(data, &decoded); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
m.Stages["publish"].Metadata = decoded
|
||||||
|
}
|
||||||
|
plan, err := buildCleanupPlan(env, m)
|
||||||
|
if err != nil || !plan.enabled || plan.publishedRunID != runID {
|
||||||
|
t.Fatalf("plan = %+v, error = %v", plan, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestBuildCleanupPlanRejectsInvalidPublishEvidenceWithoutExecutablePlan(t *testing.T) {
|
func TestBuildCleanupPlanRejectsInvalidPublishEvidenceWithoutExecutablePlan(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
|
|||||||
@@ -311,21 +311,21 @@ func publishMetadata(
|
|||||||
commitKey string,
|
commitKey string,
|
||||||
pointerKey string,
|
pointerKey string,
|
||||||
) map[string]any {
|
) map[string]any {
|
||||||
return map[string]any{
|
metadata := map[string]any{
|
||||||
"stage": "publish",
|
"stage": "publish",
|
||||||
"uploaded": true,
|
|
||||||
"s3_bucket": bucket,
|
"s3_bucket": bucket,
|
||||||
"s3_run_prefix": runPrefix,
|
"s3_run_prefix": runPrefix,
|
||||||
"published_run_id": runID,
|
|
||||||
"run_files_uploaded": len(runUploaded),
|
"run_files_uploaded": len(runUploaded),
|
||||||
"run_uploaded_paths": append([]string(nil), runUploaded...),
|
"run_uploaded_paths": append([]string(nil), runUploaded...),
|
||||||
"published_files_uploaded": len(publishedUploaded),
|
"published_files_uploaded": len(publishedUploaded),
|
||||||
"published_paths": append([]string(nil), publishedUploaded...),
|
"published_paths": append([]string(nil), publishedUploaded...),
|
||||||
"previous_files_uploaded": len(previousUploaded),
|
"previous_files_uploaded": len(previousUploaded),
|
||||||
"previous_uploaded_paths": append([]string(nil), previousUploaded...),
|
"previous_uploaded_paths": append([]string(nil), previousUploaded...),
|
||||||
"publish_output_outcomes": publishOutputOutcomeMetadata(outputPlan),
|
artifacts.PublicationOutcomesKey: publishOutputOutcomeMetadata(outputPlan),
|
||||||
"remote_commit_key": commitKey,
|
|
||||||
"current_commit_pointer_key": pointerKey,
|
|
||||||
"audio_upload_skipped": true,
|
"audio_upload_skipped": true,
|
||||||
}
|
}
|
||||||
|
for key, value := range artifacts.PublicationCompletionMetadata(artifacts.PublicationIdentity{RunID: runID, CommitKey: commitKey, PointerKey: pointerKey}) {
|
||||||
|
metadata[key] = value
|
||||||
|
}
|
||||||
|
return metadata
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,14 +10,14 @@ import (
|
|||||||
"gitea.maximumdirect.net/eric/narratio/internal/pathsafe"
|
"gitea.maximumdirect.net/eric/narratio/internal/pathsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
type publishOutputStatus string
|
type publishOutputStatus = artifacts.PublicationOutcomeStatus
|
||||||
|
|
||||||
const (
|
const (
|
||||||
publishOutputPublished publishOutputStatus = "published"
|
publishOutputPublished = artifacts.PublicationPublished
|
||||||
publishOutputCarriedLocked publishOutputStatus = "carried_locked"
|
publishOutputCarriedLocked = artifacts.PublicationCarriedLocked
|
||||||
publishOutputLockedUnpublished publishOutputStatus = "locked_unpublished"
|
publishOutputLockedUnpublished = artifacts.PublicationLockedUnpublished
|
||||||
publishOutputOptionalMissing publishOutputStatus = "optional_missing"
|
publishOutputOptionalMissing = artifacts.PublicationOptionalMissing
|
||||||
publishOutputUnselected publishOutputStatus = "unselected"
|
publishOutputUnselected = artifacts.PublicationUnselected
|
||||||
)
|
)
|
||||||
|
|
||||||
// PublicationAction describes a selected output mapping before remote publication.
|
// PublicationAction describes a selected output mapping before remote publication.
|
||||||
@@ -251,19 +251,10 @@ func publishOutputOutcomeMetadata(plan *publishOutputPlan) []map[string]any {
|
|||||||
}
|
}
|
||||||
out := make([]map[string]any, 0, len(plan.Outcomes))
|
out := make([]map[string]any, 0, len(plan.Outcomes))
|
||||||
for _, outcome := range plan.Outcomes {
|
for _, outcome := range plan.Outcomes {
|
||||||
item := map[string]any{
|
item := artifacts.PublicationOutcomeMetadata(artifacts.PublicationOutcome{
|
||||||
"source": outcome.Source,
|
Source: outcome.Source, Status: outcome.Status, Destination: outcome.Destination,
|
||||||
"status": string(outcome.Status),
|
DeclaredKey: outcome.DeclaredKey, OriginRun: outcome.OriginRun,
|
||||||
}
|
})
|
||||||
if outcome.Destination != "" {
|
|
||||||
item["destination"] = outcome.Destination
|
|
||||||
}
|
|
||||||
if outcome.DeclaredKey != "" {
|
|
||||||
item["declared_key"] = outcome.DeclaredKey
|
|
||||||
}
|
|
||||||
if outcome.OriginRun != "" {
|
|
||||||
item["origin_run"] = outcome.OriginRun
|
|
||||||
}
|
|
||||||
out = append(out, item)
|
out = append(out, item)
|
||||||
}
|
}
|
||||||
return out
|
return out
|
||||||
|
|||||||
Reference in New Issue
Block a user