Updated transcript artifact names and canonical paths to use a consistent, role-based nomenclature
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package config
|
||||
|
||||
import "gitea.maximumdirect.net/eric/narratio/internal/artifactmodel"
|
||||
|
||||
// Default filesystem locations for config lookup when config path flags are
|
||||
// omitted. Order is highest to lowest precedence.
|
||||
const (
|
||||
@@ -40,32 +42,32 @@ const (
|
||||
DefaultTrimBoundsTimeout = "10m"
|
||||
DefaultTrimSeriatimReport = false
|
||||
|
||||
DefaultNormalizeOutputPath = "transcripts/normalized.json"
|
||||
DefaultNormalizeOutputPath = artifactmodel.TranscriptPathFinal
|
||||
DefaultNormalizeOutputSchema = "seriatim-intermediate"
|
||||
DefaultNormalizeReport = true
|
||||
|
||||
DefaultArchiveEnabled = true
|
||||
DefaultArchiveUploadRun = true
|
||||
|
||||
PathWorkDirSegment = "work"
|
||||
PathInputsDirSegment = "inputs"
|
||||
PathAudioDirSegment = "audio"
|
||||
PathTranscriptsSegment = "transcripts"
|
||||
PathTranscriptsRaw = "transcripts/raw"
|
||||
PathTranscriptsTrimmed = "transcripts/trimmed"
|
||||
PathArtifactsDirSegment = "artifacts"
|
||||
PathReportsDirSegment = "reports"
|
||||
PathConfigDirSegment = "config"
|
||||
PathLogsDirSegment = "logs"
|
||||
PathCurrentDirSegment = "current"
|
||||
PathRunsDirSegment = "runs"
|
||||
PathPreviousDirSegment = "previous"
|
||||
PathManifestFile = "manifest.json"
|
||||
PathLockFile = ".lock"
|
||||
PathTranscriptMerged = "transcripts/merged.json"
|
||||
PathTranscriptProcessed = "transcripts/processed.json"
|
||||
PathTranscriptNormalized = "transcripts/normalized.json"
|
||||
PathTranscriptTrimmed = "transcripts/trimmed.json"
|
||||
PathWorkDirSegment = "work"
|
||||
PathInputsDirSegment = "inputs"
|
||||
PathAudioDirSegment = "audio"
|
||||
PathTranscriptsSegment = "transcripts"
|
||||
PathTranscriptsRaw = "transcripts/raw"
|
||||
PathTranscriptsTrimmed = "transcripts/trimmed"
|
||||
PathArtifactsDirSegment = "artifacts"
|
||||
PathReportsDirSegment = "reports"
|
||||
PathConfigDirSegment = "config"
|
||||
PathLogsDirSegment = "logs"
|
||||
PathCurrentDirSegment = "current"
|
||||
PathRunsDirSegment = "runs"
|
||||
PathPreviousDirSegment = "previous"
|
||||
PathManifestFile = "manifest.json"
|
||||
PathLockFile = ".lock"
|
||||
PathTranscriptBase = artifactmodel.TranscriptPathBase
|
||||
PathTranscriptPolished = artifactmodel.TranscriptPathPolished
|
||||
PathTranscriptFinal = artifactmodel.TranscriptPathFinal
|
||||
PathTranscriptFinalTrimmed = artifactmodel.TranscriptPathFinalTrimmed
|
||||
|
||||
S3CampaignsSegment = "campaigns"
|
||||
S3SessionsSegment = "sessions"
|
||||
@@ -78,7 +80,7 @@ const (
|
||||
// DefaultArchivePromoteArtifacts defines the default archive promotion rules.
|
||||
// Callers should copy this slice before mutating.
|
||||
var DefaultArchivePromoteArtifacts = []ArchivePromotionRule{
|
||||
{Source: "narratio.transcript.trimmed", Dest: PathTranscriptTrimmed},
|
||||
{Source: artifactmodel.SourceTranscriptFinalTrimmed, Dest: PathTranscriptFinalTrimmed},
|
||||
}
|
||||
|
||||
// DefaultPipelineConfigSearchPaths defines the default search order for
|
||||
|
||||
@@ -853,8 +853,8 @@ inputs:
|
||||
if cfg.Pipeline.Normalize == nil {
|
||||
t.Fatal("normalize config should be present via defaults")
|
||||
}
|
||||
if cfg.Pipeline.Normalize.OutputPath != "transcripts/normalized.json" {
|
||||
t.Fatalf("normalize.output_path = %q, want %q", cfg.Pipeline.Normalize.OutputPath, "transcripts/normalized.json")
|
||||
if cfg.Pipeline.Normalize.OutputPath != "transcripts/final.json" {
|
||||
t.Fatalf("normalize.output_path = %q, want %q", cfg.Pipeline.Normalize.OutputPath, "transcripts/final.json")
|
||||
}
|
||||
if cfg.Pipeline.Normalize.OutputSchema != "seriatim-intermediate" {
|
||||
t.Fatalf("normalize.output_schema = %q, want %q", cfg.Pipeline.Normalize.OutputSchema, "seriatim-intermediate")
|
||||
|
||||
@@ -21,8 +21,8 @@ func TestNormalizeLoadAndValidate(t *testing.T) {
|
||||
if cfg.Pipeline.Normalize == nil {
|
||||
t.Fatal("normalize config should be present via defaults")
|
||||
}
|
||||
if cfg.Pipeline.Normalize.OutputPath != "transcripts/normalized.json" {
|
||||
t.Fatalf("normalize.output_path = %q, want %q", cfg.Pipeline.Normalize.OutputPath, "transcripts/normalized.json")
|
||||
if cfg.Pipeline.Normalize.OutputPath != "transcripts/final.json" {
|
||||
t.Fatalf("normalize.output_path = %q, want %q", cfg.Pipeline.Normalize.OutputPath, "transcripts/final.json")
|
||||
}
|
||||
if cfg.Pipeline.Normalize.OutputSchema != "seriatim-intermediate" {
|
||||
t.Fatalf("normalize.output_schema = %q, want %q", cfg.Pipeline.Normalize.OutputSchema, "seriatim-intermediate")
|
||||
@@ -58,7 +58,7 @@ func TestNormalizeLoadAndValidate(t *testing.T) {
|
||||
{
|
||||
name: "invalid normalize output schema fails",
|
||||
normalizeYAML: `normalize:
|
||||
output_path: transcripts/normalized.json
|
||||
output_path: transcripts/final.json
|
||||
output_schema: not-a-schema
|
||||
report: true
|
||||
`,
|
||||
@@ -76,7 +76,7 @@ func TestNormalizeLoadAndValidate(t *testing.T) {
|
||||
{
|
||||
name: "unknown normalize field fails strict decoding",
|
||||
normalizeYAML: `normalize:
|
||||
output_path: transcripts/normalized.json
|
||||
output_path: transcripts/final.json
|
||||
output_schema: seriatim-intermediate
|
||||
report: true
|
||||
bogus: true
|
||||
|
||||
@@ -198,7 +198,7 @@ func TestScriptoriumLoadAndValidate(t *testing.T) {
|
||||
output_path: artifacts/session_recap.md
|
||||
inputs:
|
||||
transcript:
|
||||
source: narratio.transcript.trimmed
|
||||
source: narratio.transcript.final_trimmed
|
||||
required: true
|
||||
`,
|
||||
},
|
||||
@@ -287,7 +287,7 @@ func TestScriptoriumLoadAndValidate(t *testing.T) {
|
||||
output_path: artifacts/session_recap.md
|
||||
inputs:
|
||||
transcript:
|
||||
source: narratio.transcript.trimmed
|
||||
source: narratio.transcript.final_trimmed
|
||||
required: true
|
||||
player_handout:
|
||||
enabled: true
|
||||
@@ -507,6 +507,42 @@ func TestScriptoriumLoadAndValidate(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestScriptoriumLegacyTranscriptSourcesRejected(t *testing.T) {
|
||||
legacyTranscriptSources := []string{
|
||||
"narratio.transcript." + "merged",
|
||||
"narratio.transcript." + "full",
|
||||
"narratio.transcript." + "trimmed",
|
||||
}
|
||||
|
||||
for _, source := range legacyTranscriptSources {
|
||||
t.Run(source, func(t *testing.T) {
|
||||
pipelineYAML := testPipelineBaseYAML + `
|
||||
scriptorium:
|
||||
binary: scriptorium
|
||||
artifacts:
|
||||
session_recap:
|
||||
enabled: true
|
||||
prompt_id: dnd.session_recap
|
||||
output_path: artifacts/session_recap.md
|
||||
inputs:
|
||||
transcript:
|
||||
source: ` + source + `
|
||||
required: true
|
||||
`
|
||||
pipelinePath, sessionPath := writeConfigFiles(t, pipelineYAML, testSessionBaseYAML)
|
||||
cfg, err := Load(pipelinePath, sessionPath)
|
||||
if err != nil {
|
||||
t.Fatalf("Load() error = %v", err)
|
||||
}
|
||||
err = Validate(cfg)
|
||||
wantErr := `pipeline.scriptorium.artifacts.session_recap.inputs.transcript.source "` + source + `" is unsupported`
|
||||
if err == nil || !strings.Contains(err.Error(), wantErr) {
|
||||
t.Fatalf("Validate() error = %v, want to contain %q", err, wantErr)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const testPipelineBaseYAML = `workspace:
|
||||
root: /tmp/narratio
|
||||
whisperx:
|
||||
|
||||
@@ -186,11 +186,11 @@ func TestSpoolAndArchiveDefaults(t *testing.T) {
|
||||
if item.Required == nil || !*item.Required {
|
||||
t.Fatalf("archive.promote_artifacts[0].required = %#v, want true", item.Required)
|
||||
}
|
||||
if item.Source != "narratio.transcript.trimmed" {
|
||||
t.Fatalf("archive.promote_artifacts[0].source = %q, want narratio.transcript.trimmed", item.Source)
|
||||
if item.Source != "narratio.transcript.final_trimmed" {
|
||||
t.Fatalf("archive.promote_artifacts[0].source = %q, want narratio.transcript.final_trimmed", item.Source)
|
||||
}
|
||||
if item.Dest != "transcripts/trimmed.json" {
|
||||
t.Fatalf("archive.promote_artifacts[0].dest = %q, want transcripts/trimmed.json", item.Dest)
|
||||
if item.Dest != "transcripts/final.trimmed.json" {
|
||||
t.Fatalf("archive.promote_artifacts[0].dest = %q, want transcripts/final.trimmed.json", item.Dest)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,8 +204,8 @@ func TestArchivePromotionValidation(t *testing.T) {
|
||||
name: "absolute dest path rejected",
|
||||
ruleYML: `archive:
|
||||
promote_artifacts:
|
||||
- source: "narratio.transcript.trimmed"
|
||||
dest: "/transcripts/trimmed.json"
|
||||
- source: "narratio.transcript.final_trimmed"
|
||||
dest: "/transcripts/final.trimmed.json"
|
||||
`,
|
||||
wantErr: "must be a relative path",
|
||||
},
|
||||
@@ -213,7 +213,7 @@ func TestArchivePromotionValidation(t *testing.T) {
|
||||
name: "traversal dest path rejected",
|
||||
ruleYML: `archive:
|
||||
promote_artifacts:
|
||||
- source: "narratio.transcript.trimmed"
|
||||
- source: "narratio.transcript.final_trimmed"
|
||||
dest: "../trimmed.json"
|
||||
`,
|
||||
wantErr: "must not contain path traversal",
|
||||
@@ -223,7 +223,7 @@ func TestArchivePromotionValidation(t *testing.T) {
|
||||
ruleYML: `archive:
|
||||
promote_artifacts:
|
||||
- source: "narratio.unknown"
|
||||
dest: "transcripts/trimmed.json"
|
||||
dest: "transcripts/final.trimmed.json"
|
||||
`,
|
||||
wantErr: "source \"narratio.unknown\" is unsupported",
|
||||
},
|
||||
@@ -231,9 +231,9 @@ func TestArchivePromotionValidation(t *testing.T) {
|
||||
name: "duplicate destination rejected",
|
||||
ruleYML: `archive:
|
||||
promote_artifacts:
|
||||
- source: "narratio.transcript.trimmed"
|
||||
- source: "narratio.transcript.final_trimmed"
|
||||
dest: "artifacts/shared.md"
|
||||
- source: "narratio.transcript.full"
|
||||
- source: "narratio.transcript.final"
|
||||
dest: "artifacts/shared.md"
|
||||
`,
|
||||
wantErr: "duplicates another archive promotion destination",
|
||||
@@ -278,6 +278,35 @@ archive:
|
||||
}
|
||||
}
|
||||
|
||||
func TestArchivePromotionLegacyTranscriptSourcesRejected(t *testing.T) {
|
||||
legacyTranscriptSources := []string{
|
||||
"narratio.transcript." + "merged",
|
||||
"narratio.transcript." + "full",
|
||||
"narratio.transcript." + "trimmed",
|
||||
}
|
||||
|
||||
for _, source := range legacyTranscriptSources {
|
||||
t.Run(source, func(t *testing.T) {
|
||||
pipelineYAML := testPipelineBaseYAML + `
|
||||
archive:
|
||||
promote_artifacts:
|
||||
- source: ` + source + `
|
||||
dest: transcripts/final.trimmed.json
|
||||
`
|
||||
pipelinePath, sessionPath := writeConfigFiles(t, pipelineYAML, testSessionBaseYAML)
|
||||
cfg, err := Load(pipelinePath, sessionPath)
|
||||
if err != nil {
|
||||
t.Fatalf("Load() error = %v", err)
|
||||
}
|
||||
err = Validate(cfg)
|
||||
wantErr := `source "` + source + `" is unsupported`
|
||||
if err == nil || !strings.Contains(err.Error(), wantErr) {
|
||||
t.Fatalf("Validate() error = %v, want to contain %q", err, wantErr)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestArchivePromotionDerivesDestinationWhenOmitted(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -289,9 +318,9 @@ func TestArchivePromotionDerivesDestinationWhenOmitted(t *testing.T) {
|
||||
pipelineYML: testPipelineBaseYAML + `
|
||||
archive:
|
||||
promote_artifacts:
|
||||
- source: narratio.transcript.full
|
||||
- source: narratio.transcript.final
|
||||
`,
|
||||
wantDest: "transcripts/normalized.json",
|
||||
wantDest: "transcripts/final.json",
|
||||
},
|
||||
{
|
||||
name: "configured source derives configured output path",
|
||||
@@ -341,7 +370,7 @@ func TestArchiveLockValidation(t *testing.T) {
|
||||
pipelineYML: testPipelineBaseYAML + `
|
||||
archive:
|
||||
locks:
|
||||
- source: narratio.transcript.trimmed
|
||||
- source: narratio.transcript.final_trimmed
|
||||
reason: reviewed transcript
|
||||
`,
|
||||
},
|
||||
@@ -382,8 +411,8 @@ archive:
|
||||
pipelineYML: testPipelineBaseYAML + `
|
||||
archive:
|
||||
locks:
|
||||
- source: narratio.transcript.trimmed
|
||||
- source: " narratio.transcript.trimmed "
|
||||
- source: narratio.transcript.final_trimmed
|
||||
- source: " narratio.transcript.final_trimmed "
|
||||
`,
|
||||
wantErr: "duplicates another archive lock source",
|
||||
},
|
||||
@@ -410,12 +439,40 @@ archive:
|
||||
}
|
||||
}
|
||||
|
||||
func TestArchiveLockLegacyTranscriptSourcesRejected(t *testing.T) {
|
||||
legacyTranscriptSources := []string{
|
||||
"narratio.transcript." + "merged",
|
||||
"narratio.transcript." + "full",
|
||||
"narratio.transcript." + "trimmed",
|
||||
}
|
||||
|
||||
for _, source := range legacyTranscriptSources {
|
||||
t.Run(source, func(t *testing.T) {
|
||||
pipelineYAML := testPipelineBaseYAML + `
|
||||
archive:
|
||||
locks:
|
||||
- source: ` + source + `
|
||||
`
|
||||
pipelinePath, sessionPath := writeConfigFiles(t, pipelineYAML, testSessionBaseYAML)
|
||||
cfg, err := Load(pipelinePath, sessionPath)
|
||||
if err != nil {
|
||||
t.Fatalf("Load() error = %v", err)
|
||||
}
|
||||
err = Validate(cfg)
|
||||
wantErr := `source "` + source + `" is unsupported`
|
||||
if err == nil || !strings.Contains(err.Error(), wantErr) {
|
||||
t.Fatalf("Validate() error = %v, want to contain %q", err, wantErr)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestArchiveLockUnknownFieldFailsStrictDecode(t *testing.T) {
|
||||
pipelineYAML := testPipelineBaseYAML + `
|
||||
archive:
|
||||
locks:
|
||||
- source: narratio.transcript.trimmed
|
||||
dest: transcripts/trimmed.json
|
||||
- source: narratio.transcript.final_trimmed
|
||||
dest: transcripts/final.trimmed.json
|
||||
`
|
||||
pipelinePath, sessionPath := writeConfigFiles(t, pipelineYAML, testSessionBaseYAML)
|
||||
_, err := Load(pipelinePath, sessionPath)
|
||||
@@ -428,8 +485,8 @@ func TestArchiveLegacyFromToFailsStrictDecode(t *testing.T) {
|
||||
pipelineYAML := testPipelineBaseYAML + `
|
||||
archive:
|
||||
promote_artifacts:
|
||||
- from: transcripts/trimmed.json
|
||||
to: transcripts/trimmed.json
|
||||
- from: transcripts/final.trimmed.json
|
||||
to: transcripts/final.trimmed.json
|
||||
`
|
||||
pipelinePath, sessionPath := writeConfigFiles(t, pipelineYAML, testSessionBaseYAML)
|
||||
_, err := Load(pipelinePath, sessionPath)
|
||||
@@ -440,27 +497,27 @@ archive:
|
||||
|
||||
func TestArchiveLockStoreBytesStrictDecodeAndValidation(t *testing.T) {
|
||||
store, err := LoadArchiveLockStoreBytes("locks.yml", []byte(`locks:
|
||||
- source: narratio.transcript.trimmed
|
||||
- source: narratio.transcript.final_trimmed
|
||||
reason: reviewed
|
||||
`), nil)
|
||||
if err != nil {
|
||||
t.Fatalf("LoadArchiveLockStoreBytes() error = %v", err)
|
||||
}
|
||||
if len(store.Locks) != 1 || store.Locks[0].Source != "narratio.transcript.trimmed" || store.Locks[0].Reason != "reviewed" {
|
||||
if len(store.Locks) != 1 || store.Locks[0].Source != "narratio.transcript.final_trimmed" || store.Locks[0].Reason != "reviewed" {
|
||||
t.Fatalf("locks = %#v", store.Locks)
|
||||
}
|
||||
|
||||
_, err = LoadArchiveLockStoreBytes("locks.yml", []byte(`locks:
|
||||
- source: narratio.transcript.trimmed
|
||||
dest: transcripts/trimmed.json
|
||||
- source: narratio.transcript.final_trimmed
|
||||
dest: transcripts/final.trimmed.json
|
||||
`), nil)
|
||||
if err == nil || !strings.Contains(err.Error(), "strict decode failed") {
|
||||
t.Fatalf("unknown field error = %v, want strict decode failed", err)
|
||||
}
|
||||
|
||||
_, err = LoadArchiveLockStoreBytes("locks.yml", []byte(`locks:
|
||||
- source: narratio.transcript.trimmed
|
||||
- source: narratio.transcript.trimmed
|
||||
- source: narratio.transcript.final_trimmed
|
||||
- source: narratio.transcript.final_trimmed
|
||||
`), nil)
|
||||
if err == nil || !strings.Contains(err.Error(), "duplicates another archive lock source") {
|
||||
t.Fatalf("duplicate error = %v", err)
|
||||
@@ -469,19 +526,19 @@ func TestArchiveLockStoreBytesStrictDecodeAndValidation(t *testing.T) {
|
||||
|
||||
func TestMergeArchiveLockRulesStaticWins(t *testing.T) {
|
||||
merged := MergeArchiveLockRules(
|
||||
[]ArchiveLockRule{{Source: "narratio.transcript.trimmed", Reason: "static"}},
|
||||
[]ArchiveLockRule{{Source: "narratio.transcript.final_trimmed", Reason: "static"}},
|
||||
[]ArchiveLockRule{
|
||||
{Source: "narratio.transcript.trimmed", Reason: "remote"},
|
||||
{Source: "narratio.transcript.full", Reason: "remote full"},
|
||||
{Source: "narratio.transcript.final_trimmed", Reason: "remote"},
|
||||
{Source: "narratio.transcript.final", Reason: "remote full"},
|
||||
},
|
||||
)
|
||||
if len(merged) != 2 {
|
||||
t.Fatalf("merged len = %d, want 2: %#v", len(merged), merged)
|
||||
}
|
||||
if merged[0].Source != "narratio.transcript.trimmed" || merged[0].Reason != "static" {
|
||||
if merged[0].Source != "narratio.transcript.final_trimmed" || merged[0].Reason != "static" {
|
||||
t.Fatalf("merged[0] = %#v, want static lock", merged[0])
|
||||
}
|
||||
if merged[1].Source != "narratio.transcript.full" {
|
||||
if merged[1].Source != "narratio.transcript.final" {
|
||||
t.Fatalf("merged[1] = %#v, want remote full lock", merged[1])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ func TestTrimLoadAndValidate(t *testing.T) {
|
||||
name: "valid trim config",
|
||||
trimYAML: `trim:
|
||||
enabled: true
|
||||
output_path: transcripts/trimmed.json
|
||||
output_path: transcripts/final.trimmed.json
|
||||
bounds:
|
||||
prompt_id: dnd_session.bounds
|
||||
profile_id: ""
|
||||
@@ -45,7 +45,7 @@ func TestTrimLoadAndValidate(t *testing.T) {
|
||||
{
|
||||
name: "enabled omitted defaults disabled",
|
||||
trimYAML: `trim:
|
||||
output_path: transcripts/trimmed.json
|
||||
output_path: transcripts/final.trimmed.json
|
||||
bounds:
|
||||
prompt_id: dnd_session.bounds
|
||||
transcript_input_name: transcript
|
||||
@@ -65,7 +65,7 @@ func TestTrimLoadAndValidate(t *testing.T) {
|
||||
name: "missing prompt id fails when enabled",
|
||||
trimYAML: `trim:
|
||||
enabled: true
|
||||
output_path: transcripts/trimmed.json
|
||||
output_path: transcripts/final.trimmed.json
|
||||
bounds:
|
||||
transcript_input_name: transcript
|
||||
output_path: artifacts/session_bounds.json
|
||||
@@ -76,7 +76,7 @@ func TestTrimLoadAndValidate(t *testing.T) {
|
||||
name: "missing transcript input name fails when enabled",
|
||||
trimYAML: `trim:
|
||||
enabled: true
|
||||
output_path: transcripts/trimmed.json
|
||||
output_path: transcripts/final.trimmed.json
|
||||
bounds:
|
||||
prompt_id: dnd_session.bounds
|
||||
output_path: artifacts/session_bounds.json
|
||||
@@ -87,7 +87,7 @@ func TestTrimLoadAndValidate(t *testing.T) {
|
||||
name: "missing bounds output path fails when enabled",
|
||||
trimYAML: `trim:
|
||||
enabled: true
|
||||
output_path: transcripts/trimmed.json
|
||||
output_path: transcripts/final.trimmed.json
|
||||
bounds:
|
||||
prompt_id: dnd_session.bounds
|
||||
transcript_input_name: transcript
|
||||
@@ -109,7 +109,7 @@ func TestTrimLoadAndValidate(t *testing.T) {
|
||||
name: "invalid timeout fails",
|
||||
trimYAML: `trim:
|
||||
enabled: true
|
||||
output_path: transcripts/trimmed.json
|
||||
output_path: transcripts/final.trimmed.json
|
||||
bounds:
|
||||
prompt_id: dnd_session.bounds
|
||||
transcript_input_name: transcript
|
||||
@@ -122,7 +122,7 @@ func TestTrimLoadAndValidate(t *testing.T) {
|
||||
name: "render debug true requires render output path",
|
||||
trimYAML: `trim:
|
||||
enabled: true
|
||||
output_path: transcripts/trimmed.json
|
||||
output_path: transcripts/final.trimmed.json
|
||||
bounds:
|
||||
prompt_id: dnd_session.bounds
|
||||
transcript_input_name: transcript
|
||||
@@ -135,7 +135,7 @@ func TestTrimLoadAndValidate(t *testing.T) {
|
||||
name: "unknown trim field fails strict decoding",
|
||||
trimYAML: `trim:
|
||||
enabled: true
|
||||
output_path: transcripts/trimmed.json
|
||||
output_path: transcripts/final.trimmed.json
|
||||
bounds:
|
||||
prompt_id: dnd_session.bounds
|
||||
transcript_input_name: transcript
|
||||
|
||||
@@ -7,6 +7,8 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gitea.maximumdirect.net/eric/narratio/internal/artifactmodel"
|
||||
)
|
||||
|
||||
// Validate checks resolved configuration for required fields and parseable durations.
|
||||
@@ -224,12 +226,11 @@ func MergeArchiveLockRules(staticLocks, remoteLocks []ArchiveLockRule) []Archive
|
||||
|
||||
func archiveSourceKnown(source string, scriptorium *ScriptoriumConfig) (string, error) {
|
||||
trimmed := strings.TrimSpace(source)
|
||||
if _, ok := artifactmodel.LookupRuntimeTranscriptArtifact(trimmed); ok {
|
||||
return "", nil
|
||||
}
|
||||
switch trimmed {
|
||||
case "narratio.transcript.merged",
|
||||
"narratio.transcript.polished",
|
||||
"narratio.transcript.full",
|
||||
"narratio.transcript.trimmed",
|
||||
"narratio.bounds.session":
|
||||
case "narratio.bounds.session":
|
||||
return "", nil
|
||||
}
|
||||
matches := narratioArtifactSourceRE.FindStringSubmatch(trimmed)
|
||||
@@ -248,15 +249,10 @@ func archiveSourceKnown(source string, scriptorium *ScriptoriumConfig) (string,
|
||||
|
||||
func deriveArchivePromotionDest(source string, scriptorium *ScriptoriumConfig) (string, error) {
|
||||
trimmed := strings.TrimSpace(source)
|
||||
if spec, ok := artifactmodel.LookupRuntimeTranscriptArtifact(trimmed); ok {
|
||||
return spec.CanonicalRelPath, nil
|
||||
}
|
||||
switch trimmed {
|
||||
case "narratio.transcript.merged":
|
||||
return PathTranscriptMerged, nil
|
||||
case "narratio.transcript.polished":
|
||||
return PathTranscriptProcessed, nil
|
||||
case "narratio.transcript.full":
|
||||
return PathTranscriptNormalized, nil
|
||||
case "narratio.transcript.trimmed":
|
||||
return PathTranscriptTrimmed, nil
|
||||
case "narratio.bounds.session":
|
||||
return filepath.ToSlash(filepath.Join(PathArtifactsDirSegment, "session_bounds.json")), nil
|
||||
}
|
||||
@@ -716,15 +712,10 @@ func validateScriptoriumInputSource(artifactName, inputName, source string, conf
|
||||
}
|
||||
|
||||
func isStaticSupportedScriptoriumInputSource(source string) bool {
|
||||
if _, ok := artifactmodel.LookupRuntimeTranscriptArtifact(source); ok {
|
||||
return true
|
||||
}
|
||||
switch source {
|
||||
case "narratio.transcript.merged":
|
||||
return true
|
||||
case "narratio.transcript.polished":
|
||||
return true
|
||||
case "narratio.transcript.full":
|
||||
return true
|
||||
case "narratio.transcript.trimmed":
|
||||
return true
|
||||
case "narratio.bounds.session":
|
||||
return true
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user