Review transcript trim architecture

This commit is contained in:
2026-05-08 17:18:47 +00:00
parent a5e665455d
commit 5565ced3d3
6 changed files with 32 additions and 11 deletions

View File

@@ -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.

View File

@@ -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`.

View File

@@ -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)

View File

@@ -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"`

View File

@@ -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,

View File

@@ -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)