Archive Audita reports as polish diagnostics
This commit is contained in:
@@ -87,7 +87,8 @@ func (polishStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (*St
|
||||
|
||||
res, err := env.Audita.Run(ctx, req)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("polish: audita polish failed: %w", err)
|
||||
return nil, fmt.Errorf("polish: audita polish failed (output_dir=%q, stdout_log=%q, stderr_log=%q): %w",
|
||||
filepath.Dir(processedPath), stdoutPath, stderrPath, err)
|
||||
}
|
||||
|
||||
finalProcessedPath, err := authoritativeOutputPath(processedPath, res.ProcessedTranscriptPath)
|
||||
@@ -97,6 +98,27 @@ func (polishStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (*St
|
||||
if err := validateProcessedTranscriptOutput(finalProcessedPath); err != nil {
|
||||
return nil, fmt.Errorf("polish: processed transcript %q invalid: %w", finalProcessedPath, err)
|
||||
}
|
||||
reportPaths := make([]string, 0, 3)
|
||||
reportMetadata := map[string]string{}
|
||||
for _, report := range []struct{ name, returned string }{
|
||||
{"errors.yml", res.Reports.ErrorsPath},
|
||||
{"recoveries.yml", res.Reports.RecoveriesPath},
|
||||
{"report.md", res.Reports.OverviewPath},
|
||||
} {
|
||||
if report.returned == "" {
|
||||
continue
|
||||
}
|
||||
expected := filepath.Join(filepath.Dir(processedPath), report.name)
|
||||
path, err := authoritativeOutputPath(expected, report.returned)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("polish: report %s: %w", report.name, err)
|
||||
}
|
||||
if err := requireRegularReadableFile(path, "audita report"); err != nil {
|
||||
return nil, fmt.Errorf("polish: %w", err)
|
||||
}
|
||||
reportPaths = append(reportPaths, path)
|
||||
reportMetadata[report.name] = path
|
||||
}
|
||||
|
||||
materializedProcessed, err := materializeRunLocalOutput(env.ArtifactStore, finalProcessedPath, canonicalProcessedPath, artifacts.Ref{
|
||||
Kind: "transcript_polished",
|
||||
@@ -133,6 +155,7 @@ func (polishStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (*St
|
||||
"adapter_generated_config_path": res.GeneratedConfigPath,
|
||||
"adapter_stdout_log_path": res.StdoutLogPath,
|
||||
"adapter_stderr_log_path": res.StderrLogPath,
|
||||
"report_paths": reportMetadata,
|
||||
}
|
||||
if res.Metadata != nil {
|
||||
meta["adapter_metadata"] = res.Metadata
|
||||
@@ -140,7 +163,7 @@ func (polishStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (*St
|
||||
|
||||
return &StageResult{
|
||||
Outputs: outputs,
|
||||
Logs: []string{stdoutPath, stderrPath},
|
||||
Logs: append([]string{stdoutPath, stderrPath}, reportPaths...),
|
||||
GeneratedConfigs: []string{generatedConfigPath},
|
||||
Metadata: meta,
|
||||
}, nil
|
||||
|
||||
Reference in New Issue
Block a user