Hand checked processing selections to execution
This commit is contained in:
@@ -21,6 +21,7 @@ import (
|
||||
"go.maximumdirect.net/ckconfig"
|
||||
commandkit "go.maximumdirect.net/commandkit"
|
||||
ck "go.maximumdirect.net/configkit"
|
||||
pk "go.maximumdirect.net/promptkit"
|
||||
)
|
||||
|
||||
type processInputs struct {
|
||||
@@ -130,13 +131,25 @@ func prepareProcess(ctx context.Context, input processInput, loaded *processInpu
|
||||
}
|
||||
debug = &preflight.DebugInput{WorkDir: cfg.Diagnostics.WorkDir, RunID: runID, EffectiveConfig: effective.Bytes(), Metadata: diagnostics.InvocationMetadata{Operation: "process", TranscriptPath: input.Transcript, OutputPath: input.Output.Value, Overlay: input.Overlay.Value, ConfigVersion: &cfg.Version, RunID: runID, StartedAt: started}}
|
||||
}
|
||||
checkedBackends := make(map[string]struct{})
|
||||
prepared, err := preflight.Prepare(ctx, preflight.Input{InspectProfile: func(ctx context.Context, id string) error {
|
||||
profile, err := loaded.Runtime.Engine.InspectProfile(ctx, id)
|
||||
if err != nil {
|
||||
if errors.Is(err, pk.ErrProfileNotFound) {
|
||||
return &preflight.SelectionError{Cause: err}
|
||||
}
|
||||
if err != nil || profile.Backend == nil {
|
||||
return err
|
||||
}
|
||||
if profile.Backend != nil {
|
||||
_, err = loaded.Runtime.Engine.InspectBackend(ctx, *profile.Backend)
|
||||
backend := *profile.Backend
|
||||
if _, ok := checkedBackends[backend]; ok {
|
||||
return nil
|
||||
}
|
||||
_, err = loaded.Runtime.Engine.InspectBackend(ctx, backend)
|
||||
if errors.Is(err, pk.ErrBackendNotFound) {
|
||||
return &preflight.SelectionError{Cause: err}
|
||||
}
|
||||
if err == nil {
|
||||
checkedBackends[backend] = struct{}{}
|
||||
}
|
||||
return err
|
||||
}, Config: cfg, Transcript: loaded.Source, Output: diagnostics.OutputSelection{InputTranscriptPath: input.Transcript, TranscriptPath: input.Output.Value, ReportDir: reportDir, ReportingEnabled: cfg.Reporting.Enabled, ProtectedPaths: loaded.ProtectedPaths, Stdout: stdout}, InitialReports: initial, FailedReports: failed, Debug: debug})
|
||||
|
||||
Reference in New Issue
Block a user