Include prompt requirements in session validation
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
"gitea.maximumdirect.net/eric/narratio/internal/artifacts"
|
||||
"gitea.maximumdirect.net/eric/narratio/internal/config"
|
||||
"gitea.maximumdirect.net/eric/narratio/internal/preflight"
|
||||
"go.maximumdirect.net/commandkit"
|
||||
)
|
||||
|
||||
@@ -68,6 +69,7 @@ func validateSelectedSession(ctx context.Context, input *sessionInspectionInput,
|
||||
}
|
||||
|
||||
func inspectSessionValidation(ctx context.Context, cfg *config.Config, deps commandDependencies) (*sessionValidationReport, error) {
|
||||
deps = normalizeCommandDependencies(deps)
|
||||
report := &sessionValidationReport{Campaign: cfg.Session.Campaign, SessionID: cfg.Session.SessionID, SessionSource: sessionSourceSummary(cfg), Findings: []finding{}}
|
||||
var resultErr error
|
||||
fail := func(category string, err error) {
|
||||
@@ -76,8 +78,9 @@ func inspectSessionValidation(ctx context.Context, cfg *config.Config, deps comm
|
||||
resultErr = errors.Join(resultErr, err)
|
||||
}
|
||||
}
|
||||
if err := config.Validate(cfg); err != nil {
|
||||
fail("config", err)
|
||||
configErr := config.Validate(cfg)
|
||||
if configErr != nil {
|
||||
fail("config", configErr)
|
||||
} else {
|
||||
report.Findings = append(report.Findings, okFinding("config", "resolved pipeline, campaign, and session config"))
|
||||
}
|
||||
@@ -112,6 +115,34 @@ func inspectSessionValidation(ctx context.Context, cfg *config.Config, deps comm
|
||||
}
|
||||
effective, effectiveErr := resolveEffectiveArtifacts(cfg, nil)
|
||||
fail("config", effectiveErr)
|
||||
if configErr == nil && effectiveErr == nil {
|
||||
targets, targetErr := validationInspectionTargets(cfg, cfg.Session.SessionID)
|
||||
if targetErr != nil {
|
||||
fail("scriptorium", targetErr)
|
||||
} else if len(targets) > 0 {
|
||||
runner := deps.newScriptorium()
|
||||
checked, checkErr := preflight.Check(ctx, runner, targets)
|
||||
hasInspectionError := false
|
||||
for _, item := range checked.Findings {
|
||||
message := formatPromptFinding(item)
|
||||
switch item.Severity {
|
||||
case preflight.SeverityError:
|
||||
hasInspectionError = true
|
||||
report.Findings = append(report.Findings, errorFinding("scriptorium", message))
|
||||
case preflight.SeverityWarning:
|
||||
report.Findings = append(report.Findings, warnFinding("scriptorium", message))
|
||||
default:
|
||||
report.Findings = append(report.Findings, infoFinding("scriptorium", message))
|
||||
}
|
||||
}
|
||||
if checkErr != nil {
|
||||
resultErr = errors.Join(resultErr, checkErr)
|
||||
if !hasInspectionError {
|
||||
report.Findings = append(report.Findings, errorFinding("scriptorium", checkErr.Error()))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if effectiveErr == nil {
|
||||
previous := inspectPreviousArtifactReadiness(ctx, cfg, store, artifacts.CollectPreviousArtifactRequirements(configuredScriptoriumArtifacts(cfg), effective))
|
||||
if len(previous.Requirements) == 0 {
|
||||
|
||||
Reference in New Issue
Block a user