Route producer diagnostics to run directories

This commit is contained in:
2026-11-30 01:32:56 +00:00
parent 16c3d7d643
commit c07d4f24a2
19 changed files with 150 additions and 240 deletions

View File

@@ -122,12 +122,8 @@ func (trimStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (*Stag
if err != nil {
return nil, fmt.Errorf("trim: resolve run-local bounds output path: %w", err)
}
boundsStderrLogPath := filepath.Join(paths.LogsDir, "scriptorium.bounds.stderr.log")
boundsGeneratedConfigPath := filepath.Join(paths.ConfigDir, "scriptorium.bounds.generated.yml")
if runLayout.Enabled {
boundsStderrLogPath = filepath.Join(runLayout.LogsDir, "scriptorium.bounds.stderr.log")
boundsGeneratedConfigPath = filepath.Join(runLayout.ConfigDir, "scriptorium.bounds.generated.yml")
}
boundsStderrLogPath := filepath.Join(runLayout.LogsDir, "scriptorium.bounds.stderr.log")
boundsGeneratedConfigPath := filepath.Join(runLayout.LogsDir, "scriptorium.bounds.generated.yml")
requestContext, err := TrimScriptoriumContext(env.Config, sessionID)
if err != nil {
return nil, fmt.Errorf("trim: resolve bounds request: %w", err)
@@ -150,20 +146,13 @@ func (trimStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (*Stag
renderOutputPath := ""
if boundsCfg.RenderDebug {
canonicalRenderOutputPath, err := resolveScriptoriumOutputPath(paths, boundsCfg.RenderOutputPath)
if err != nil {
return nil, fmt.Errorf("trim: resolve bounds render output path: %w", err)
}
renderOutputPath, err = runLocalPathForCanonical(runLayout, paths, canonicalRenderOutputPath)
if err != nil {
return nil, fmt.Errorf("trim: resolve run-local bounds render output path: %w", err)
}
renderStderrLogPath := filepath.Join(paths.LogsDir, "scriptorium.bounds.render.stderr.log")
renderGeneratedConfigPath := filepath.Join(paths.ConfigDir, "scriptorium.bounds.render.generated.yml")
if runLayout.Enabled {
renderStderrLogPath = filepath.Join(runLayout.LogsDir, "scriptorium.bounds.render.stderr.log")
renderGeneratedConfigPath = filepath.Join(runLayout.ConfigDir, "scriptorium.bounds.render.generated.yml")
filename := filepath.Base(strings.TrimSpace(boundsCfg.RenderOutputPath))
if filename == "." || filename == ".." || strings.ContainsAny(filename, `/\\`) {
return nil, fmt.Errorf("trim: bounds render output must name a file")
}
renderOutputPath = filepath.Join(runLayout.DebugDir, filename)
renderStderrLogPath := filepath.Join(runLayout.LogsDir, "scriptorium.bounds.render.stderr.log")
renderGeneratedConfigPath := filepath.Join(runLayout.LogsDir, "scriptorium.bounds.render.generated.yml")
renderReq := scriptorium.RenderArtifactRequest{
Binary: requestContext.Binary,
@@ -196,7 +185,7 @@ func (trimStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (*Stag
return nil, fmt.Errorf("trim: bounds render diagnostics %q invalid json: %w", finalRenderOutputPath, err)
}
logPaths = append(logPaths, renderStderrLogPath)
logPaths = append(logPaths, renderStderrLogPath, finalRenderOutputPath)
generatedConfigs = append(generatedConfigs, renderGeneratedConfigPath)
metadata["bounds_render_output_path"] = finalRenderOutputPath
metadata["bounds_render_stderr_log_path"] = renderStderrLogPath
@@ -294,14 +283,9 @@ func (trimStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (*Stag
return nil, fmt.Errorf("trim: copy normalized transcript to trimmed output: %w", err)
}
} else {
trimStdoutLogPath := filepath.Join(paths.LogsDir, "seriatim.trim.stdout.log")
trimStderrLogPath := filepath.Join(paths.LogsDir, "seriatim.trim.stderr.log")
trimGeneratedConfigPath := filepath.Join(paths.ConfigDir, "seriatim.trim.generated.yml")
if runLayout.Enabled {
trimStdoutLogPath = filepath.Join(runLayout.LogsDir, "seriatim.trim.stdout.log")
trimStderrLogPath = filepath.Join(runLayout.LogsDir, "seriatim.trim.stderr.log")
trimGeneratedConfigPath = filepath.Join(runLayout.ConfigDir, "seriatim.trim.generated.yml")
}
trimStdoutLogPath := filepath.Join(runLayout.LogsDir, "seriatim.trim.stdout.log")
trimStderrLogPath := filepath.Join(runLayout.LogsDir, "seriatim.trim.stderr.log")
trimGeneratedConfigPath := filepath.Join(runLayout.LogsDir, "seriatim.trim.generated.yml")
trimTimeout, err := resolveSeriatimStageTimeout(env.Config.Pipeline.Seriatim.Timeout)
if err != nil {
return nil, fmt.Errorf("trim: resolve seriatim timeout: %w", err)