Use S3 source evidence when planning preparation reuse

This commit is contained in:
2026-12-02 13:10:28 +00:00
parent c0c8a95f7c
commit 11de2262a0
8 changed files with 191 additions and 12 deletions

View File

@@ -5,8 +5,10 @@ import (
"errors"
"fmt"
"gitea.maximumdirect.net/eric/narratio/internal/adapters/storage"
"gitea.maximumdirect.net/eric/narratio/internal/artifacts"
"gitea.maximumdirect.net/eric/narratio/internal/config"
"gitea.maximumdirect.net/eric/narratio/internal/manifest"
"gitea.maximumdirect.net/eric/narratio/internal/stage"
"go.maximumdirect.net/commandkit"
)
@@ -87,10 +89,10 @@ func planSelectedPipeline(ctx context.Context, input *executionInput, deps comma
if err != nil {
return nil, &inputError{message: err.Error(), cause: err}
}
return buildSessionPlan(ctx, cfg, input, selected, effective)
return buildSessionPlan(ctx, cfg, input, selected, effective, deps)
}
func buildSessionPlan(ctx context.Context, cfg *config.Config, input *executionInput, selectedArtifacts []string, effective artifacts.EffectiveArtifactSet) (*sessionPlanReport, error) {
func buildSessionPlan(ctx context.Context, cfg *config.Config, input *executionInput, selectedArtifacts []string, effective artifacts.EffectiveArtifactSet, deps commandDependencies) (*sessionPlanReport, error) {
if err := ctx.Err(); err != nil {
return nil, err
}
@@ -101,8 +103,15 @@ func buildSessionPlan(ctx context.Context, cfg *config.Config, input *executionI
if err := validateBoundedPrerequisites(input.plan, m); err != nil {
return nil, fmt.Errorf("plan: %w", err)
}
var objectStore storage.ObjectStore
if input.plan.Contains("prepare") && !input.Force.Value && cfg.Session.Inputs.AudioS3 != nil && recordedStageStatus(m, "prepare") == manifest.StatusSucceeded {
objectStore, err = newCommandObjectStoreWithDependencies(ctx, cfg, deps)
if err != nil {
return nil, fmt.Errorf("plan: %w", err)
}
}
store := artifacts.NewLocalStore(cfg.Pipeline.Workspace.Root)
projection, err := projectSelectedWork(ctx, cfg, input.plan, input.Force.Value, selectedArtifacts, effective, store, m)
projection, err := projectSelectedWork(ctx, cfg, input.plan, input.Force.Value, selectedArtifacts, effective, store, objectStore, m)
if projection == nil {
return nil, err
}