Separate readiness checks from report presentation
This commit is contained in:
@@ -40,41 +40,14 @@ func checkDownstreamReadiness(runtime *invocationRuntime, targets preflight.Targ
|
||||
result.Checks = append(result.Checks, readinessCheck{Group: group, Outcome: "blocked", Message: "prepared inputs are unavailable"})
|
||||
}
|
||||
if len(targets.Scriptorium) > 0 && runtime.ctx.Err() == nil {
|
||||
runtime.env.Progress("checking prompt requirements")
|
||||
if runtime.env.Scriptorium == nil {
|
||||
runtime.env.Scriptorium = runtime.dependencies.newScriptorium()
|
||||
}
|
||||
checked, err := preflight.Check(runtime.ctx, runtime.env.Scriptorium, targets.Scriptorium)
|
||||
checked, err := checkScriptoriumReadiness(runtime, targets.Scriptorium)
|
||||
record("prompt requirements", checked, err)
|
||||
}
|
||||
if targets.Polish && runtime.ctx.Err() == nil {
|
||||
if !prepared {
|
||||
blocked("audita")
|
||||
} else {
|
||||
runtime.env.Progress("checking Audita readiness")
|
||||
var err error
|
||||
if runtime.env.Audita == nil {
|
||||
runtime.env.Audita, err = runtime.dependencies.newAudita(runtime.cfg)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("initialize audita runner: %w", err)
|
||||
}
|
||||
}
|
||||
var checked preflight.Result
|
||||
if err == nil {
|
||||
checker, ok := runtime.env.Audita.(preflight.AuditaChecker)
|
||||
if !ok || checker == nil {
|
||||
err = fmt.Errorf("audita runner does not support preflight")
|
||||
} else {
|
||||
root := artifacts.SessionInvocationProbeDir(runtime.paths, runtime.identity.RunID, "audita")
|
||||
request, _, buildErr := stage.BuildPolishRequest(runtime.paths, runtime.manifest, "", filepath.Join(root, "outputs", "transcripts", "polished.json"), filepath.Join(root, "logs"), filepath.Join(root, "debug"))
|
||||
if buildErr != nil {
|
||||
err = fmt.Errorf("build audita preflight: %w", buildErr)
|
||||
} else {
|
||||
checked, err = preflight.CheckAudita(runtime.ctx, checker, request)
|
||||
checked.Findings = append([]preflight.Finding{{Severity: preflight.SeverityInfo, Stage: "polish", Message: "Audita checks a synthetic transcript and may contact providers"}}, checked.Findings...)
|
||||
}
|
||||
}
|
||||
}
|
||||
checked, err := checkAuditaReadiness(runtime)
|
||||
record("audita", checked, err)
|
||||
}
|
||||
}
|
||||
@@ -82,29 +55,62 @@ func checkDownstreamReadiness(runtime *invocationRuntime, targets preflight.Targ
|
||||
if !prepared {
|
||||
blocked("notarius")
|
||||
} else {
|
||||
runtime.env.Progress("checking Notarius readiness")
|
||||
if runtime.env.Notarius == nil {
|
||||
runtime.env.Notarius = runtime.dependencies.newNotarius()
|
||||
}
|
||||
var checked preflight.Result
|
||||
var err error
|
||||
native, ok := runtime.env.Notarius.(notarius.ReadinessChecker)
|
||||
if !ok || native == nil {
|
||||
err = fmt.Errorf("notarius runner does not support preflight")
|
||||
} else {
|
||||
root := artifacts.SessionInvocationProbeDir(runtime.paths, runtime.identity.RunID, "notarius")
|
||||
probe, buildErr := stage.BuildNotariusReadiness(runtime.cfg, runtime.paths, runtime.manifest, root, useCurrent, force)
|
||||
if buildErr != nil {
|
||||
err = fmt.Errorf("build notarius preflight: %w", buildErr)
|
||||
} else {
|
||||
checked, err = preflight.CheckNotarius(runtime.ctx, native, probe.Request)
|
||||
if verifyErr := probe.VerifyReferences(); verifyErr != nil {
|
||||
err = errors.Join(err, fmt.Errorf("verify Notarius probe references: %w", verifyErr))
|
||||
}
|
||||
}
|
||||
}
|
||||
checked, err := checkNotariusReadiness(runtime, useCurrent, force)
|
||||
record("notarius", checked, err)
|
||||
}
|
||||
}
|
||||
|
||||
return result, errors.Join(append(failures, runtime.ctx.Err())...)
|
||||
}
|
||||
|
||||
func checkScriptoriumReadiness(runtime *invocationRuntime, targets []preflight.Target) (preflight.Result, error) {
|
||||
runtime.env.Progress("checking prompt requirements")
|
||||
if runtime.env.Scriptorium == nil {
|
||||
runtime.env.Scriptorium = runtime.dependencies.newScriptorium()
|
||||
}
|
||||
return preflight.Check(runtime.ctx, runtime.env.Scriptorium, targets)
|
||||
}
|
||||
|
||||
func checkAuditaReadiness(runtime *invocationRuntime) (preflight.Result, error) {
|
||||
runtime.env.Progress("checking Audita readiness")
|
||||
if runtime.env.Audita == nil {
|
||||
var err error
|
||||
runtime.env.Audita, err = runtime.dependencies.newAudita(runtime.cfg)
|
||||
if err != nil {
|
||||
return preflight.Result{}, fmt.Errorf("initialize audita runner: %w", err)
|
||||
}
|
||||
}
|
||||
checker, ok := runtime.env.Audita.(preflight.AuditaChecker)
|
||||
if !ok || checker == nil {
|
||||
return preflight.Result{}, fmt.Errorf("audita runner does not support preflight")
|
||||
}
|
||||
root := artifacts.SessionInvocationProbeDir(runtime.paths, runtime.identity.RunID, "audita")
|
||||
request, _, err := stage.BuildPolishRequest(runtime.paths, runtime.manifest, "", filepath.Join(root, "outputs", "transcripts", "polished.json"), filepath.Join(root, "logs"), filepath.Join(root, "debug"))
|
||||
if err != nil {
|
||||
return preflight.Result{}, fmt.Errorf("build audita preflight: %w", err)
|
||||
}
|
||||
checked, err := preflight.CheckAudita(runtime.ctx, checker, request)
|
||||
checked.Findings = append([]preflight.Finding{{Severity: preflight.SeverityInfo, Stage: "polish", Message: "Audita checks a synthetic transcript and may contact providers"}}, checked.Findings...)
|
||||
return checked, err
|
||||
}
|
||||
|
||||
func checkNotariusReadiness(runtime *invocationRuntime, useCurrent, force bool) (preflight.Result, error) {
|
||||
runtime.env.Progress("checking Notarius readiness")
|
||||
if runtime.env.Notarius == nil {
|
||||
runtime.env.Notarius = runtime.dependencies.newNotarius()
|
||||
}
|
||||
native, ok := runtime.env.Notarius.(notarius.ReadinessChecker)
|
||||
if !ok || native == nil {
|
||||
return preflight.Result{}, fmt.Errorf("notarius runner does not support preflight")
|
||||
}
|
||||
root := artifacts.SessionInvocationProbeDir(runtime.paths, runtime.identity.RunID, "notarius")
|
||||
probe, err := stage.BuildNotariusReadiness(runtime.cfg, runtime.paths, runtime.manifest, root, useCurrent, force)
|
||||
if err != nil {
|
||||
return preflight.Result{}, fmt.Errorf("build notarius preflight: %w", err)
|
||||
}
|
||||
checked, err := preflight.CheckNotarius(runtime.ctx, native, probe.Request)
|
||||
if verifyErr := probe.VerifyReferences(); verifyErr != nil {
|
||||
err = errors.Join(err, fmt.Errorf("verify Notarius probe references: %w", verifyErr))
|
||||
}
|
||||
return checked, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user