Honor remote session authoring updates after publication

This commit is contained in:
2026-11-18 04:08:43 +00:00
parent 435ec79185
commit 97a93d3393
5 changed files with 56 additions and 19 deletions

View File

@@ -192,23 +192,29 @@ func loadPipelineConfigWithDependencies(pipelineFlag string, opts config.Pipelin
}
func findRemoteSessionConfig(ctx context.Context, store storage.ObjectStore, sessionPrefix, remoteKey, campaign, sessionID string) (storage.ObjectInfo, string, error) {
current, err := artifacts.LoadCurrentState(ctx, store, sessionPrefix, artifacts.CurrentStateValidation{ExpectedCampaign: campaign, ExpectedSessionID: sessionID, ValidateRunID: true})
authored, err := store.Exists(ctx, remoteKey)
if err != nil {
return storage.ObjectInfo{}, "", fmt.Errorf("check authored session %q: %w", remoteKey, err)
}
var selected *artifacts.RemoteArtifact
if err == nil {
for _, item := range current.Commit.Artifacts {
if item.Type == artifacts.RemoteArtifactTypeRunFile && item.Source == "run:prepare/inputs/session.yml" {
identity, err := artifacts.ParseImmutableRunObjectKey(sessionPrefix, item.DestinationKey)
if err != nil || "run:"+identity.RelativePath != item.Source {
return storage.ObjectInfo{}, "", fmt.Errorf("committed session source does not match its object key")
if !authored {
current, err := artifacts.LoadCurrentState(ctx, store, sessionPrefix, artifacts.CurrentStateValidation{ExpectedCampaign: campaign, ExpectedSessionID: sessionID, ValidateRunID: true})
if err == nil {
for _, item := range current.Commit.Artifacts {
if item.Type == artifacts.RemoteArtifactTypeRunFile && item.Source == "run:prepare/inputs/session.yml" {
identity, err := artifacts.ParseImmutableRunObjectKey(sessionPrefix, item.DestinationKey)
if err != nil || "run:"+identity.RelativePath != item.Source {
return storage.ObjectInfo{}, "", fmt.Errorf("committed session source does not match its object key")
}
copy := item
selected = &copy
remoteKey = item.DestinationKey
break
}
copy := item
selected = &copy
remoteKey = item.DestinationKey
break
}
} else if !errors.Is(err, artifacts.ErrCurrentCommitPointerMissing) {
return storage.ObjectInfo{}, "", fmt.Errorf("load remote session selection: %w", err)
}
} else if !errors.Is(err, artifacts.ErrCurrentCommitPointerMissing) {
return storage.ObjectInfo{}, "", fmt.Errorf("load remote session selection: %w", err)
}
objects, err := store.List(ctx, sessionPrefix)
if err != nil {