Review transcript trim architecture
This commit is contained in:
@@ -105,6 +105,8 @@ Trim outputs and diagnostics:
|
||||
- `logs/scriptorium.bounds.render.stderr.log`
|
||||
- `config/scriptorium.bounds.render.generated.yml`
|
||||
|
||||
Render-debug files are diagnostics and are not treated as canonical stage output artifact refs.
|
||||
|
||||
## Scriptorium Configuration
|
||||
|
||||
`pipeline.scriptorium` is optional. When present, Narratio validates and uses it for analyze-stage artifact generation.
|
||||
|
||||
@@ -196,6 +196,8 @@ Expected trim outputs and diagnostics:
|
||||
- `logs/scriptorium.bounds.render.stderr.log`
|
||||
- `config/scriptorium.bounds.render.generated.yml`
|
||||
|
||||
Render-debug files are diagnostics. They are recorded in stage metadata/log/config refs and are not treated as canonical stage output artifact refs.
|
||||
|
||||
## 8. Analyze Stage (Current Implementation)
|
||||
|
||||
The current real analyze implementation supports only `scriptorium.artifacts.session_recap`.
|
||||
|
||||
@@ -6,8 +6,6 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// TODO: implement a real Seriatim subprocess adapter.
|
||||
|
||||
// Runner is the adapter boundary for seriatim merge/trim invocations.
|
||||
type Runner interface {
|
||||
Run(ctx context.Context, req MergeRequest) (MergeResult, error)
|
||||
|
||||
@@ -84,7 +84,7 @@ type AuditaConfig struct {
|
||||
Report *bool `yaml:"report"`
|
||||
}
|
||||
|
||||
// TrimConfig configures the future trim stage boundary.
|
||||
// TrimConfig configures trim-stage transcript boundary behavior.
|
||||
type TrimConfig struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
OutputPath string `yaml:"output_path"`
|
||||
|
||||
@@ -329,14 +329,6 @@ func (trimStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (*Stag
|
||||
AbsolutePath: finalBoundsOutputPath,
|
||||
},
|
||||
}
|
||||
if renderOutputPath != "" {
|
||||
outputs = append(outputs, artifacts.Ref{
|
||||
Kind: "session_bounds_render",
|
||||
Category: "artifacts",
|
||||
SessionID: sessionID,
|
||||
AbsolutePath: renderOutputPath,
|
||||
})
|
||||
}
|
||||
|
||||
return &StageResult{
|
||||
Outputs: outputs,
|
||||
|
||||
@@ -112,6 +112,33 @@ func TestTrimStageRecordsLogAndGeneratedConfigRefs(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestTrimStageRenderDebugDiagnosticsAreNotStageOutputs(t *testing.T) {
|
||||
env, m, scr, _ := setupTrimEnv(t)
|
||||
paths := env.ArtifactStore.SessionPaths(m.SessionID)
|
||||
writeFile(t, filepath.Join(paths.TranscriptsDir, "processed.json"), `{"segments":[{"id":1},{"id":2}]}`)
|
||||
scr.BoundsBody = `{"trim_action":"trim","start_segment_id":1,"end_segment_id":2}`
|
||||
|
||||
cfg := *env.Config.Pipeline.Trim
|
||||
cfg.Bounds.RenderDebug = true
|
||||
env.Config.Pipeline.Trim = &cfg
|
||||
|
||||
result, err := (trimStage{}).Run(context.Background(), env, m)
|
||||
if err != nil {
|
||||
t.Fatalf("trim.Run() error = %v", err)
|
||||
}
|
||||
if len(scr.RenderRequests) != 1 {
|
||||
t.Fatalf("scriptorium render requests = %d, want 1", len(scr.RenderRequests))
|
||||
}
|
||||
for _, out := range result.Outputs {
|
||||
if out.Kind == "session_bounds_render" {
|
||||
t.Fatalf("render diagnostics should not be stage outputs: %#v", result.Outputs)
|
||||
}
|
||||
}
|
||||
if result.Metadata["bounds_render_output_path"] == nil {
|
||||
t.Fatalf("bounds_render_output_path metadata missing: %#v", result.Metadata)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTrimStageFailsWhenProcessedTranscriptMissing(t *testing.T) {
|
||||
env, m, _, _ := setupTrimEnv(t)
|
||||
_, err := (trimStage{}).Run(context.Background(), env, m)
|
||||
|
||||
Reference in New Issue
Block a user