Keep one verified copy of session audio
This commit is contained in:
@@ -2,13 +2,10 @@ package stage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"gitea.maximumdirect.net/eric/narratio/internal/fileops"
|
||||
"gitea.maximumdirect.net/eric/narratio/internal/manifest"
|
||||
)
|
||||
|
||||
@@ -20,10 +17,8 @@ const (
|
||||
type cleanupStage struct{}
|
||||
|
||||
type cleanupSemanticConfig struct {
|
||||
DeleteSpoolAudio bool `json:"delete_spool_audio"`
|
||||
SpoolRoot string `json:"spool_root"`
|
||||
DeleteWorkspace bool `json:"delete_workspace"`
|
||||
WorkspaceRoot string `json:"workspace_root"`
|
||||
DeleteWorkspace bool `json:"delete_workspace"`
|
||||
WorkspaceRoot string `json:"workspace_root"`
|
||||
}
|
||||
|
||||
func (cleanupStage) Name() string { return "cleanup" }
|
||||
@@ -47,12 +42,7 @@ func (cleanupStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (*S
|
||||
if err := ctx.Err(); err != nil {
|
||||
return nil, fmt.Errorf("cleanup canceled before %s: %w", target.policy, err)
|
||||
}
|
||||
var err error
|
||||
if target.policy == cleanupWorkspacePolicy {
|
||||
_, err = cleanRunWithRetainedBundle(target.root, target.target, true)
|
||||
} else {
|
||||
err = fileops.RemoveAllUnderRoot(target.root, target.target)
|
||||
}
|
||||
_, err := cleanRunWithRetainedBundle(target.root, target.target, true)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("apply %s: %w", target.policy, err)
|
||||
}
|
||||
@@ -72,10 +62,8 @@ func (cleanupStage) SemanticConfigFingerprint(env *Env) (manifest.SemanticConfig
|
||||
}
|
||||
pipeline := env.Config.Pipeline
|
||||
return FingerprintSemanticConfig(cleanupSemanticConfigVersion, cleanupSemanticConfig{
|
||||
DeleteSpoolAudio: pipeline.Spool.DeleteAudioAfterPublish,
|
||||
SpoolRoot: normalizedCleanupRoot(pipeline.Spool.Root),
|
||||
DeleteWorkspace: pipeline.Workspace.CleanupAfterPublish,
|
||||
WorkspaceRoot: normalizedCleanupRoot(pipeline.Workspace.Root),
|
||||
DeleteWorkspace: pipeline.Workspace.CleanupAfterPublish,
|
||||
WorkspaceRoot: normalizedCleanupRoot(pipeline.Workspace.Root),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -91,20 +79,12 @@ func (cleanupStage) ValidateResume(ctx context.Context, env *Env, m *manifest.Ma
|
||||
if err := ctx.Err(); err != nil {
|
||||
return ResumeValidation{}, fmt.Errorf("validate cleanup resume for %s: %w", target.policy, err)
|
||||
}
|
||||
if target.policy == cleanupWorkspacePolicy {
|
||||
pending, err := cleanRunWithRetainedBundle(target.root, target.target, false)
|
||||
if err != nil {
|
||||
return ResumeValidation{}, err
|
||||
}
|
||||
if pending {
|
||||
return NonResumable(fmt.Sprintf("cleanup target for %s exists", target.policy)), nil
|
||||
}
|
||||
continue
|
||||
pending, err := cleanRunWithRetainedBundle(target.root, target.target, false)
|
||||
if err != nil {
|
||||
return ResumeValidation{}, err
|
||||
}
|
||||
if _, err := os.Lstat(target.target); err == nil {
|
||||
if pending {
|
||||
return NonResumable(fmt.Sprintf("cleanup target for %s exists", target.policy)), nil
|
||||
} else if !errors.Is(err, os.ErrNotExist) {
|
||||
return ResumeValidation{}, fmt.Errorf("inspect cleanup target for %s: %w", target.policy, err)
|
||||
}
|
||||
}
|
||||
return Resumable(), nil
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
cleanupSpoolPolicy = "pipeline.spool.delete_audio_after_publish"
|
||||
cleanupWorkspacePolicy = "pipeline.workspace.cleanup_after_publish"
|
||||
)
|
||||
|
||||
@@ -31,9 +30,8 @@ func buildCleanupPlan(env *Env, m *manifest.Manifest) (cleanupPlan, error) {
|
||||
}
|
||||
|
||||
pipeline := env.Config.Pipeline
|
||||
spoolRequested := pipeline.Spool.DeleteAudioAfterPublish
|
||||
workspaceRequested := pipeline.Workspace.CleanupAfterPublish
|
||||
if !spoolRequested && !workspaceRequested {
|
||||
if !workspaceRequested {
|
||||
return cleanupPlan{}, nil
|
||||
}
|
||||
if m == nil {
|
||||
@@ -69,22 +67,6 @@ func buildCleanupPlan(env *Env, m *manifest.Manifest) (cleanupPlan, error) {
|
||||
}
|
||||
|
||||
plan := cleanupPlan{enabled: true, publishedRunID: publishedRunID}
|
||||
if spoolRequested {
|
||||
root := strings.TrimSpace(pipeline.Spool.Root)
|
||||
if root == "" {
|
||||
return cleanupPlan{}, fmt.Errorf("pipeline.spool.root is required for cleanup")
|
||||
}
|
||||
plan.targets = append(plan.targets, cleanupPlanTarget{
|
||||
root: root,
|
||||
target: artifacts.SessionSpoolAudioDir(
|
||||
root,
|
||||
campaign,
|
||||
sessionID,
|
||||
publishedRunID,
|
||||
),
|
||||
policy: cleanupSpoolPolicy,
|
||||
})
|
||||
}
|
||||
if workspaceRequested {
|
||||
root := strings.TrimSpace(pipeline.Workspace.Root)
|
||||
if root == "" {
|
||||
|
||||
@@ -20,83 +20,16 @@ func TestBuildCleanupPlanDisabledNeedsNoPublishEvidence(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildCleanupPlanSelectsCanonicalPublishedRunTargets(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
spool bool
|
||||
workspace bool
|
||||
wantPolicies []string
|
||||
wantTargetBuilder func(workspaceRoot, spoolRoot, campaign, sessionID, runID string) []string
|
||||
}{
|
||||
{
|
||||
name: "spool only",
|
||||
spool: true,
|
||||
wantPolicies: []string{cleanupSpoolPolicy},
|
||||
wantTargetBuilder: func(_, spoolRoot, campaign, sessionID, runID string) []string {
|
||||
return []string{artifacts.SessionSpoolAudioDir(spoolRoot, campaign, sessionID, runID)}
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "workspace only",
|
||||
workspace: true,
|
||||
wantPolicies: []string{cleanupWorkspacePolicy},
|
||||
wantTargetBuilder: func(workspaceRoot, _, campaign, sessionID, runID string) []string {
|
||||
return []string{artifacts.SessionRunRootForCampaign(workspaceRoot, campaign, sessionID, runID)}
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "spool precedes workspace",
|
||||
spool: true,
|
||||
workspace: true,
|
||||
wantPolicies: []string{cleanupSpoolPolicy, cleanupWorkspacePolicy},
|
||||
wantTargetBuilder: func(workspaceRoot, spoolRoot, campaign, sessionID, runID string) []string {
|
||||
return []string{
|
||||
artifacts.SessionSpoolAudioDir(spoolRoot, campaign, sessionID, runID),
|
||||
artifacts.SessionRunRootForCampaign(workspaceRoot, campaign, sessionID, runID),
|
||||
}
|
||||
},
|
||||
},
|
||||
func TestBuildCleanupPlanSelectsCanonicalPublishedRunTarget(t *testing.T) {
|
||||
env, m, runID := cleanupPlanningFixture(t)
|
||||
env.Config.Pipeline.Workspace.CleanupAfterPublish = true
|
||||
plan, err := buildCleanupPlan(env, m)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
env, m, publishedRunID := cleanupPlanningFixture(t)
|
||||
env.Config.Pipeline.Spool.DeleteAudioAfterPublish = test.spool
|
||||
env.Config.Pipeline.Workspace.CleanupAfterPublish = test.workspace
|
||||
|
||||
plan, err := buildCleanupPlan(env, m)
|
||||
if err != nil {
|
||||
t.Fatalf("buildCleanupPlan() error = %v", err)
|
||||
}
|
||||
if !plan.enabled || plan.publishedRunID != publishedRunID {
|
||||
t.Fatalf("cleanup plan identity = %#v", plan)
|
||||
}
|
||||
wantTargets := test.wantTargetBuilder(
|
||||
env.Config.Pipeline.Workspace.Root,
|
||||
env.Config.Pipeline.Spool.Root,
|
||||
m.Campaign,
|
||||
m.SessionID,
|
||||
publishedRunID,
|
||||
)
|
||||
if len(plan.targets) != len(wantTargets) {
|
||||
t.Fatalf("cleanup targets = %#v, want %d", plan.targets, len(wantTargets))
|
||||
}
|
||||
for index, target := range plan.targets {
|
||||
if target.policy != test.wantPolicies[index] || target.target != wantTargets[index] {
|
||||
t.Fatalf("cleanup target %d = %#v, want policy %q path %q", index, target, test.wantPolicies[index], wantTargets[index])
|
||||
}
|
||||
wantRoot := env.Config.Pipeline.Workspace.Root
|
||||
if target.policy == cleanupSpoolPolicy {
|
||||
wantRoot = env.Config.Pipeline.Spool.Root
|
||||
}
|
||||
if target.root != wantRoot {
|
||||
t.Fatalf("cleanup target %d root = %q, want %q", index, target.root, wantRoot)
|
||||
}
|
||||
if target.target == m.LocalWorkDir || target.target == m.LocalSpoolDir || filepath.Base(target.target) == m.RunID {
|
||||
t.Fatalf("cleanup target used current-invocation state: %#v", target)
|
||||
}
|
||||
}
|
||||
})
|
||||
want := artifacts.SessionRunRootForCampaign(env.Config.Pipeline.Workspace.Root, m.Campaign, m.SessionID, runID)
|
||||
if !plan.enabled || plan.publishedRunID != runID || len(plan.targets) != 1 || plan.targets[0].target != want || plan.targets[0].policy != cleanupWorkspacePolicy {
|
||||
t.Fatalf("cleanup plan = %#v", plan)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +64,6 @@ func TestBuildCleanupPlanRejectsInvalidPublishEvidenceWithoutExecutablePlan(t *t
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
env, m, _ := cleanupPlanningFixture(t)
|
||||
env.Config.Pipeline.Spool.DeleteAudioAfterPublish = true
|
||||
env.Config.Pipeline.Workspace.CleanupAfterPublish = true
|
||||
test.mutate(env, m)
|
||||
|
||||
@@ -157,8 +89,6 @@ func cleanupPlanningFixture(t *testing.T) (*Env, *manifest.Manifest, string) {
|
||||
env := &Env{Config: &config.Config{
|
||||
Pipeline: &config.PipelineConfig{
|
||||
Workspace: config.WorkspaceConfig{Root: filepath.Join(root, "workspace")},
|
||||
Spool: config.SpoolConfig{Root: filepath.Join(root, "spool")},
|
||||
Cache: config.CacheConfig{Root: filepath.Join(root, "cache")},
|
||||
},
|
||||
Session: &config.SessionConfig{Campaign: campaign, SessionID: sessionID},
|
||||
}}
|
||||
@@ -167,7 +97,6 @@ func cleanupPlanningFixture(t *testing.T) (*Env, *manifest.Manifest, string) {
|
||||
SessionID: sessionID,
|
||||
RunID: "current-invocation-run",
|
||||
LocalWorkDir: filepath.Join(root, "untrusted-workdir"),
|
||||
LocalSpoolDir: filepath.Join(root, "untrusted-spool"),
|
||||
S3SessionPrefix: sessionPrefix,
|
||||
Stages: map[string]*manifest.StageRecord{
|
||||
"publish": {
|
||||
|
||||
@@ -26,86 +26,30 @@ func TestCleanupStageDisabledSelfSkips(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCleanupStageRemovesOnlySelectedPublishedRunTargets(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
spool bool
|
||||
workspace bool
|
||||
}{
|
||||
{name: "spool only", spool: true},
|
||||
{name: "workspace only", workspace: true},
|
||||
{name: "both", spool: true, workspace: true},
|
||||
func TestCleanupStageRemovesOnlySelectedPublishedRunTarget(t *testing.T) {
|
||||
env, m, publishedRunID := cleanupPlanningFixture(t)
|
||||
env.Config.Pipeline.Workspace.CleanupAfterPublish = true
|
||||
target := artifacts.SessionRunRootForCampaign(env.Config.Pipeline.Workspace.Root, m.Campaign, m.SessionID, publishedRunID)
|
||||
session := artifacts.NewLocalStore(env.Config.Pipeline.Workspace.Root).SessionPathsFor(m.Campaign, m.SessionID)
|
||||
audio := filepath.Join(session.AudioDir, "alice.flac")
|
||||
other := artifacts.SessionRunRootForCampaign(env.Config.Pipeline.Workspace.Root, m.Campaign, m.SessionID, "other-run")
|
||||
writeStageTestFile(t, filepath.Join(target, "result.txt"), "result")
|
||||
writeStageTestFile(t, filepath.Join(other, "result.txt"), "other")
|
||||
writeStageTestFile(t, audio, "audio")
|
||||
result, err := (cleanupStage{}).Run(context.Background(), env, m)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
env, m, publishedRunID := cleanupPlanningFixture(t)
|
||||
env.Config.Pipeline.Spool.DeleteAudioAfterPublish = test.spool
|
||||
env.Config.Pipeline.Workspace.CleanupAfterPublish = test.workspace
|
||||
plan, err := buildCleanupPlan(env, m)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
publishedSpool := artifacts.SessionSpoolAudioDir(
|
||||
env.Config.Pipeline.Spool.Root, m.Campaign, m.SessionID, publishedRunID,
|
||||
)
|
||||
publishedWorkspace := artifacts.SessionRunRootForCampaign(
|
||||
env.Config.Pipeline.Workspace.Root, m.Campaign, m.SessionID, publishedRunID,
|
||||
)
|
||||
writeStageTestFile(t, filepath.Join(publishedSpool, "nested", "audio.wav"), "audio")
|
||||
writeStageTestFile(t, filepath.Join(publishedWorkspace, "nested", "result.txt"), "result")
|
||||
|
||||
otherSpool := filepath.Join(env.Config.Pipeline.Spool.Root, m.Campaign, m.SessionID, "other-run", "audio")
|
||||
otherWorkspace := filepath.Join(env.Config.Pipeline.Workspace.Root, "work", m.Campaign, m.SessionID, "runs", "other-run")
|
||||
cacheFile := filepath.Join(env.Config.Pipeline.Cache.Root, "s3", "audio.cache")
|
||||
sessionPaths := artifacts.NewLocalStore(env.Config.Pipeline.Workspace.Root).SessionPathsFor(m.Campaign, m.SessionID)
|
||||
referenceCacheFile := filepath.Join(artifacts.SessionNotariusReferenceCacheDir(sessionPaths), strings.Repeat("a", 64), "party.yml")
|
||||
writeStageTestFile(t, filepath.Join(otherSpool, "audio.wav"), "other spool")
|
||||
writeStageTestFile(t, filepath.Join(otherWorkspace, "result.txt"), "other workspace")
|
||||
writeStageTestFile(t, cacheFile, "cache")
|
||||
writeStageTestFile(t, referenceCacheFile, "reference cache")
|
||||
|
||||
result, err := (cleanupStage{}).Run(context.Background(), env, m)
|
||||
if err != nil {
|
||||
t.Fatalf("Run() error = %v", err)
|
||||
}
|
||||
for _, target := range plan.targets {
|
||||
if _, err := os.Lstat(target.target); !errors.Is(err, os.ErrNotExist) {
|
||||
t.Fatalf("cleanup target %q still exists: %v", target.target, err)
|
||||
}
|
||||
}
|
||||
if !test.spool {
|
||||
if _, err := os.Stat(publishedSpool); err != nil {
|
||||
t.Fatalf("unselected spool target changed: %v", err)
|
||||
}
|
||||
}
|
||||
if !test.workspace {
|
||||
if _, err := os.Stat(publishedWorkspace); err != nil {
|
||||
t.Fatalf("unselected workspace target changed: %v", err)
|
||||
}
|
||||
}
|
||||
for _, preserved := range []string{otherSpool, otherWorkspace, cacheFile, referenceCacheFile} {
|
||||
if _, err := os.Stat(preserved); err != nil {
|
||||
t.Fatalf("preserved path %q: %v", preserved, err)
|
||||
}
|
||||
}
|
||||
if len(result.Outputs) != 0 || len(result.Logs) != 0 || len(result.GeneratedConfigs) != 0 {
|
||||
t.Fatalf("cleanup returned canonical or diagnostic outputs: %#v", result)
|
||||
}
|
||||
if len(result.Metadata) != 3 || result.Metadata["stage"] != "cleanup" || result.Metadata["published_run_id"] != publishedRunID {
|
||||
t.Fatalf("cleanup metadata = %#v", result.Metadata)
|
||||
}
|
||||
wantPolicies := make([]string, 0, 2)
|
||||
if test.spool {
|
||||
wantPolicies = append(wantPolicies, cleanupSpoolPolicy)
|
||||
}
|
||||
if test.workspace {
|
||||
wantPolicies = append(wantPolicies, cleanupWorkspacePolicy)
|
||||
}
|
||||
if got := result.Metadata["completed_policies"]; !reflect.DeepEqual(got, wantPolicies) {
|
||||
t.Fatalf("completed policies = %#v, want %#v", got, wantPolicies)
|
||||
}
|
||||
})
|
||||
if _, err := os.Lstat(target); !errors.Is(err, os.ErrNotExist) {
|
||||
t.Fatalf("target still exists: %v", err)
|
||||
}
|
||||
for _, path := range []string{audio, filepath.Join(other, "result.txt")} {
|
||||
if _, err := os.Stat(path); err != nil {
|
||||
t.Fatalf("preserved %q: %v", path, err)
|
||||
}
|
||||
}
|
||||
if !reflect.DeepEqual(result.Metadata["completed_policies"], []string{cleanupWorkspacePolicy}) {
|
||||
t.Fatalf("metadata = %#v", result.Metadata)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,9 +64,9 @@ func TestCleanupStageAcceptsAlreadyAbsentRootAndTarget(t *testing.T) {
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
env, m, _ := cleanupPlanningFixture(t)
|
||||
env.Config.Pipeline.Spool.DeleteAudioAfterPublish = true
|
||||
env.Config.Pipeline.Workspace.CleanupAfterPublish = true
|
||||
if test.createRoot {
|
||||
if err := os.MkdirAll(env.Config.Pipeline.Spool.Root, 0o755); err != nil {
|
||||
if err := os.MkdirAll(env.Config.Pipeline.Workspace.Root, 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
@@ -135,7 +79,7 @@ func TestCleanupStageAcceptsAlreadyAbsentRootAndTarget(t *testing.T) {
|
||||
|
||||
func TestCleanupStageHonorsCancellationBeforeDeletion(t *testing.T) {
|
||||
env, m, _ := cleanupPlanningFixture(t)
|
||||
env.Config.Pipeline.Spool.DeleteAudioAfterPublish = true
|
||||
env.Config.Pipeline.Workspace.CleanupAfterPublish = true
|
||||
plan, err := buildCleanupPlan(env, m)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -154,8 +98,8 @@ func TestCleanupStageHonorsCancellationBeforeDeletion(t *testing.T) {
|
||||
|
||||
func TestCleanupStageRejectsUnsafeIdentityBeforeDeletion(t *testing.T) {
|
||||
env, m, _ := cleanupPlanningFixture(t)
|
||||
env.Config.Pipeline.Spool.DeleteAudioAfterPublish = true
|
||||
sentinel := filepath.Join(env.Config.Pipeline.Spool.Root, "sentinel.txt")
|
||||
env.Config.Pipeline.Workspace.CleanupAfterPublish = true
|
||||
sentinel := filepath.Join(env.Config.Pipeline.Workspace.Root, "sentinel.txt")
|
||||
writeStageTestFile(t, sentinel, "keep")
|
||||
m.Campaign = ".."
|
||||
env.Config.Session.Campaign = ".."
|
||||
@@ -168,43 +112,6 @@ func TestCleanupStageRejectsUnsafeIdentityBeforeDeletion(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCleanupStageRetriesAfterPartialDeletion(t *testing.T) {
|
||||
env, m, _ := cleanupPlanningFixture(t)
|
||||
env.Config.Pipeline.Spool.DeleteAudioAfterPublish = true
|
||||
env.Config.Pipeline.Workspace.CleanupAfterPublish = true
|
||||
plan, err := buildCleanupPlan(env, m)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
spoolTarget := plan.targets[0].target
|
||||
workspaceTarget := plan.targets[1].target
|
||||
writeStageTestFile(t, filepath.Join(spoolTarget, "audio.wav"), "audio")
|
||||
if err := os.MkdirAll(filepath.Dir(env.Config.Pipeline.Workspace.Root), 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.WriteFile(env.Config.Pipeline.Workspace.Root, []byte("not a directory"), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if _, err := (cleanupStage{}).Run(context.Background(), env, m); err == nil {
|
||||
t.Fatal("Run() error = nil with invalid workspace root")
|
||||
}
|
||||
if _, err := os.Lstat(spoolTarget); !errors.Is(err, os.ErrNotExist) {
|
||||
t.Fatalf("first target remains after partial cleanup: %v", err)
|
||||
}
|
||||
if err := os.Remove(env.Config.Pipeline.Workspace.Root); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
writeStageTestFile(t, filepath.Join(workspaceTarget, "result.txt"), "result")
|
||||
|
||||
if _, err := (cleanupStage{}).Run(context.Background(), env, m); err != nil {
|
||||
t.Fatalf("retry Run() error = %v", err)
|
||||
}
|
||||
if _, err := os.Lstat(workspaceTarget); !errors.Is(err, os.ErrNotExist) {
|
||||
t.Fatalf("second target remains after retry: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCleanupSemanticConfigFingerprintTracksPoliciesAndNormalizedRoots(t *testing.T) {
|
||||
env, _, _ := cleanupPlanningFixture(t)
|
||||
base, err := (cleanupStage{}).SemanticConfigFingerprint(env)
|
||||
@@ -217,23 +124,11 @@ func TestCleanupSemanticConfigFingerprintTracksPoliciesAndNormalizedRoots(t *tes
|
||||
mutate func()
|
||||
restore func()
|
||||
}{
|
||||
{
|
||||
name: "spool policy",
|
||||
mutate: func() { env.Config.Pipeline.Spool.DeleteAudioAfterPublish = true },
|
||||
restore: func() { env.Config.Pipeline.Spool.DeleteAudioAfterPublish = false },
|
||||
},
|
||||
{
|
||||
name: "workspace policy",
|
||||
mutate: func() { env.Config.Pipeline.Workspace.CleanupAfterPublish = true },
|
||||
restore: func() { env.Config.Pipeline.Workspace.CleanupAfterPublish = false },
|
||||
},
|
||||
{
|
||||
name: "spool root",
|
||||
mutate: func() { env.Config.Pipeline.Spool.Root += "-changed" },
|
||||
restore: func() {
|
||||
env.Config.Pipeline.Spool.Root = strings.TrimSuffix(env.Config.Pipeline.Spool.Root, "-changed")
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "workspace root",
|
||||
mutate: func() { env.Config.Pipeline.Workspace.Root += "-changed" },
|
||||
|
||||
@@ -197,13 +197,13 @@ func (prepareStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (*S
|
||||
}
|
||||
inputs = append(inputs, partyInputs...)
|
||||
|
||||
var audioCacheStats s3AudioMaterializationStats
|
||||
var audioStats s3AudioMaterializationStats
|
||||
if useS3Audio {
|
||||
stats, err := materializeS3AudioInputs(ctx, env, m, sessionID, &inputs)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("prepare: materialize s3 audio: %w", err)
|
||||
}
|
||||
audioCacheStats = stats
|
||||
audioStats = stats
|
||||
} else {
|
||||
if err := materializeLocalAudioInputs(env, paths, resolvedLocalAudio, registerInput); err != nil {
|
||||
return nil, fmt.Errorf("prepare: %w", err)
|
||||
@@ -242,9 +242,8 @@ func (prepareStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (*S
|
||||
"audio_files_resolved": countAudioInputs(inputs),
|
||||
}
|
||||
if useS3Audio {
|
||||
metadata["audio_cache_hits"] = audioCacheStats.CacheHits
|
||||
metadata["audio_cache_misses"] = audioCacheStats.CacheMisses
|
||||
metadata["audio_s3_downloads"] = audioCacheStats.Downloads
|
||||
metadata["audio_reused"] = audioStats.Reused
|
||||
metadata["audio_s3_downloads"] = audioStats.Downloads
|
||||
}
|
||||
if len(previousRequirements) > 0 {
|
||||
metadata["previous_requirements_count"] = len(previousRequirements)
|
||||
@@ -403,9 +402,8 @@ func localAudioDestinations(audioPaths []string) map[string]string {
|
||||
}
|
||||
|
||||
type s3AudioMaterializationStats struct {
|
||||
CacheHits int
|
||||
CacheMisses int
|
||||
Downloads int
|
||||
Reused int
|
||||
Downloads int
|
||||
}
|
||||
|
||||
func materializeS3AudioInputs(ctx context.Context, env *Env, m *manifest.Manifest, sessionID string, inputs *[]manifest.InputRecord) (s3AudioMaterializationStats, error) {
|
||||
@@ -430,58 +428,37 @@ func materializeS3AudioInputs(ctx context.Context, env *Env, m *manifest.Manifes
|
||||
return s3AudioMaterializationStats{}, err
|
||||
}
|
||||
|
||||
spoolAudioDir := strings.TrimSpace(m.LocalSpoolDir)
|
||||
if spoolAudioDir == "" {
|
||||
spoolAudioDir = artifacts.SessionSpoolAudioDir(env.Config.Pipeline.Spool.Root, campaign, sessionID, runID)
|
||||
}
|
||||
workAudioDir := filepath.Join(pathsWorkDirForManifest(env, m, sessionID), "audio")
|
||||
|
||||
if err := fileops.EnsureWorkspaceDirectory(spoolAudioDir); err != nil {
|
||||
return s3AudioMaterializationStats{}, fmt.Errorf("create spool audio directory %q: %w", spoolAudioDir, err)
|
||||
}
|
||||
workAudioDir := sessionPathsForEnv(env, sessionID).AudioDir
|
||||
if err := fileops.EnsureWorkspaceDirectory(workAudioDir); err != nil {
|
||||
return s3AudioMaterializationStats{}, fmt.Errorf("create work audio directory %q: %w", workAudioDir, err)
|
||||
}
|
||||
|
||||
stats := s3AudioMaterializationStats{}
|
||||
cacheEnabled := env.Config.Pipeline.Cache.S3Audio == nil || *env.Config.Pipeline.Cache.S3Audio
|
||||
for _, obj := range audioObjects {
|
||||
base := path.Base(obj.Key)
|
||||
spoolPath := filepath.Join(spoolAudioDir, base)
|
||||
workPath := filepath.Join(workAudioDir, base)
|
||||
workPath := filepath.Join(workAudioDir, path.Base(obj.Key))
|
||||
var prior *manifest.InputRecord
|
||||
for i := range m.Inputs {
|
||||
if m.Inputs[i].Kind == "audio" && filepath.Clean(m.Inputs[i].Path) == filepath.Clean(workPath) {
|
||||
prior = &m.Inputs[i]
|
||||
break
|
||||
}
|
||||
}
|
||||
result, err := audio.MaterializeS3Audio(ctx, audio.S3MaterializeRequest{
|
||||
Reporter: env.Reporter,
|
||||
Store: env.ObjectStore,
|
||||
Object: obj,
|
||||
Bucket: strings.TrimSpace(env.Config.Pipeline.Storage.S3.Bucket),
|
||||
CacheRoot: strings.TrimSpace(env.Config.Pipeline.Cache.Root),
|
||||
CacheEnabled: cacheEnabled,
|
||||
SpoolPath: spoolPath,
|
||||
DestPath: workPath,
|
||||
Reporter: env.Reporter, Store: env.ObjectStore, Object: obj,
|
||||
Bucket: strings.TrimSpace(env.Config.Pipeline.Storage.S3.Bucket), DestPath: workPath, Prior: prior,
|
||||
})
|
||||
if err != nil {
|
||||
return s3AudioMaterializationStats{}, err
|
||||
}
|
||||
if result.CacheHit {
|
||||
stats.CacheHits++
|
||||
} else {
|
||||
stats.CacheMisses++
|
||||
if result.Reused {
|
||||
stats.Reused++
|
||||
}
|
||||
if result.Downloaded {
|
||||
stats.Downloads++
|
||||
}
|
||||
|
||||
*inputs = append(*inputs, manifest.InputRecord{
|
||||
Kind: "audio",
|
||||
Path: workPath,
|
||||
Checksum: result.Checksum,
|
||||
Source: "s3",
|
||||
S3Bucket: strings.TrimSpace(env.Config.Pipeline.Storage.S3.Bucket),
|
||||
S3Key: obj.Key,
|
||||
S3Size: obj.Size,
|
||||
S3ETag: obj.ETag,
|
||||
SpoolPath: result.SpoolPath,
|
||||
CachePath: result.CachePath,
|
||||
Kind: "audio", Path: workPath, Checksum: result.Checksum, Source: "s3",
|
||||
S3Bucket: strings.TrimSpace(env.Config.Pipeline.Storage.S3.Bucket), S3Key: obj.Key,
|
||||
S3Size: obj.Size, S3ETag: obj.ETag,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -573,27 +550,6 @@ func clearManagedPreviousState(paths artifacts.SessionPaths) error {
|
||||
return fileops.EnsureWorkspaceDirectory(previousDir)
|
||||
}
|
||||
|
||||
func pathsWorkDirForManifest(env *Env, m *manifest.Manifest, sessionID string) string {
|
||||
if env == nil || env.Config == nil || env.Config.Pipeline == nil || env.Config.Session == nil {
|
||||
return ""
|
||||
}
|
||||
campaign := strings.TrimSpace(env.Config.Session.Campaign)
|
||||
if campaign == "" {
|
||||
return ""
|
||||
}
|
||||
if m != nil && strings.TrimSpace(m.LocalWorkDir) != "" {
|
||||
return strings.TrimSpace(m.LocalWorkDir)
|
||||
}
|
||||
runID := ""
|
||||
if m != nil {
|
||||
runID = strings.TrimSpace(m.RunID)
|
||||
}
|
||||
if runID != "" {
|
||||
return artifacts.SessionRunRootForCampaign(env.Config.Pipeline.Workspace.Root, campaign, sessionID, runID)
|
||||
}
|
||||
return artifacts.SessionWorkDirForCampaign(env.Config.Pipeline.Workspace.Root, campaign, sessionID)
|
||||
}
|
||||
|
||||
func resolvePath(baseDir, p string) (string, error) {
|
||||
trimmed := strings.TrimSpace(p)
|
||||
if trimmed == "" {
|
||||
|
||||
@@ -318,11 +318,9 @@ func TestPrepareResumeValidatesCurrentS3ObjectIdentity(t *testing.T) {
|
||||
env.Config.Session.Campaign = "forsaken"
|
||||
env.Config.Session.Inputs.AudioDir = ""
|
||||
env.Config.Session.Inputs.AudioS3 = &config.SessionAudioS3Input{Prefix: "audio/"}
|
||||
env.Config.Pipeline.Spool = config.SpoolConfig{Root: filepath.Join(t.TempDir(), "spool")}
|
||||
env.Config.Pipeline.Storage.S3 = &config.StorageS3Config{Bucket: "archive", RootPrefix: "dnd"}
|
||||
m.RunID = "20260515T031522Z-a1b2c3d4"
|
||||
m.LocalWorkDir = artifacts.SessionRunRootForCampaign(env.Config.Pipeline.Workspace.Root, "forsaken", m.SessionID, m.RunID)
|
||||
m.LocalSpoolDir = artifacts.SessionSpoolAudioDir(env.Config.Pipeline.Spool.Root, "forsaken", m.SessionID, m.RunID)
|
||||
key := "dnd/campaigns/forsaken/sessions/2026-05-03/audio/alice.flac"
|
||||
fake := &storage.FakeBackend{}
|
||||
fake.SeedObject(storage.FakeObject{Key: key, Data: []byte("alice")})
|
||||
|
||||
@@ -242,7 +242,7 @@ func TestPrepareStageRecordsLocalSessionProvenance(t *testing.T) {
|
||||
if sessionInput.Source != "session_config" {
|
||||
t.Fatalf("session source = %q, want session_config", sessionInput.Source)
|
||||
}
|
||||
if sessionInput.S3Bucket != "" || sessionInput.S3Key != "" || sessionInput.SpoolPath != "" {
|
||||
if sessionInput.S3Bucket != "" || sessionInput.S3Key != "" {
|
||||
t.Fatalf("local session input has unexpected remote provenance: %#v", sessionInput)
|
||||
}
|
||||
}
|
||||
@@ -262,11 +262,9 @@ func TestPrepareStageRecordsRemoteSessionProvenance(t *testing.T) {
|
||||
S3Size: 58,
|
||||
S3ETag: "session-etag",
|
||||
}
|
||||
env.Config.Pipeline.Spool = config.SpoolConfig{Root: filepath.Join(t.TempDir(), "spool")}
|
||||
env.Config.Pipeline.Storage.S3 = &config.StorageS3Config{Bucket: "my-dnd-archive", RootPrefix: "dnd"}
|
||||
m.RunID = "20260515T031522Z-a1b2c3d4"
|
||||
m.LocalWorkDir = artifacts.SessionRunRootForCampaign(env.Config.Pipeline.Workspace.Root, "sample-campaign", m.SessionID, m.RunID)
|
||||
m.LocalSpoolDir = artifacts.SessionSpoolAudioDir(env.Config.Pipeline.Spool.Root, "sample-campaign", m.SessionID, m.RunID)
|
||||
fake := &storage.FakeBackend{}
|
||||
fake.SeedObject(storage.FakeObject{Key: "dnd/campaigns/sample-campaign/sessions/2026-05-03/audio/alice.flac", Data: []byte("alice")})
|
||||
env.ObjectStore = fake
|
||||
@@ -281,7 +279,7 @@ func TestPrepareStageRecordsRemoteSessionProvenance(t *testing.T) {
|
||||
if sessionInput.S3Bucket != "my-dnd-archive" || sessionInput.S3Key != "dnd/campaigns/sample-campaign/sessions/2026-05-03/session.yml" {
|
||||
t.Fatalf("remote session input missing bucket/key: %#v", sessionInput)
|
||||
}
|
||||
if sessionInput.S3Size != 58 || sessionInput.S3ETag != "session-etag" || sessionInput.SpoolPath != "" {
|
||||
if sessionInput.S3Size != 58 || sessionInput.S3ETag != "session-etag" {
|
||||
t.Fatalf("remote session input missing metadata: %#v", sessionInput)
|
||||
}
|
||||
}
|
||||
@@ -292,11 +290,9 @@ func TestPrepareStageS3AudioDownloadAndMaterialization(t *testing.T) {
|
||||
env.Config.Session.Inputs.AudioDir = ""
|
||||
env.Config.Session.Inputs.AudioFiles = nil
|
||||
env.Config.Session.Inputs.AudioS3 = &config.SessionAudioS3Input{Prefix: "audio/"}
|
||||
env.Config.Pipeline.Spool = config.SpoolConfig{Root: filepath.Join(t.TempDir(), "spool")}
|
||||
env.Config.Pipeline.Storage.S3 = &config.StorageS3Config{Bucket: "my-dnd-archive", RootPrefix: "dnd"}
|
||||
m.RunID = "20260515T031522Z-a1b2c3d4"
|
||||
m.LocalWorkDir = artifacts.SessionRunRootForCampaign(env.Config.Pipeline.Workspace.Root, "forsaken", m.SessionID, m.RunID)
|
||||
m.LocalSpoolDir = artifacts.SessionSpoolAudioDir(env.Config.Pipeline.Spool.Root, "forsaken", m.SessionID, m.RunID)
|
||||
|
||||
fake := &storage.FakeBackend{}
|
||||
fake.SeedObject(storage.FakeObject{Key: "dnd/campaigns/forsaken/sessions/2026-05-03/audio/alice.flac", Data: []byte("alice")})
|
||||
@@ -312,20 +308,15 @@ func TestPrepareStageS3AudioDownloadAndMaterialization(t *testing.T) {
|
||||
t.Fatalf("result metadata = %#v, want audio_files_resolved=2", result)
|
||||
}
|
||||
|
||||
aliceWork := filepath.Join(m.LocalWorkDir, "audio", "alice.flac")
|
||||
bobWork := filepath.Join(m.LocalWorkDir, "audio", "bob.FLAC")
|
||||
aliceSpool := filepath.Join(m.LocalSpoolDir, "alice.flac")
|
||||
bobSpool := filepath.Join(m.LocalSpoolDir, "bob.FLAC")
|
||||
for _, p := range []string{aliceWork, bobWork, aliceSpool, bobSpool} {
|
||||
aliceWork := filepath.Join(sessionPathsForEnv(env, m.SessionID).AudioDir, "alice.flac")
|
||||
bobWork := filepath.Join(sessionPathsForEnv(env, m.SessionID).AudioDir, "bob.FLAC")
|
||||
for _, p := range []string{aliceWork, bobWork} {
|
||||
if _, err := os.Stat(p); err != nil {
|
||||
t.Fatalf("expected file %q: %v", p, err)
|
||||
}
|
||||
}
|
||||
if got := result.Metadata["audio_cache_hits"]; got != 0 {
|
||||
t.Fatalf("audio_cache_hits = %#v, want 0", got)
|
||||
}
|
||||
if got := result.Metadata["audio_cache_misses"]; got != 2 {
|
||||
t.Fatalf("audio_cache_misses = %#v, want 2", got)
|
||||
if got := result.Metadata["audio_reused"]; got != 0 {
|
||||
t.Fatalf("audio_reused = %#v, want 0", got)
|
||||
}
|
||||
if got := result.Metadata["audio_s3_downloads"]; got != 2 {
|
||||
t.Fatalf("audio_s3_downloads = %#v, want 2", got)
|
||||
@@ -343,73 +334,47 @@ func TestPrepareStageS3AudioDownloadAndMaterialization(t *testing.T) {
|
||||
if in.S3Bucket != "my-dnd-archive" {
|
||||
t.Fatalf("audio input bucket = %q", in.S3Bucket)
|
||||
}
|
||||
if in.S3Key == "" || in.SpoolPath == "" || in.CachePath == "" || in.Checksum == "" {
|
||||
if in.S3Key == "" || in.Checksum == "" {
|
||||
t.Fatalf("audio input missing provenance: %#v", in)
|
||||
}
|
||||
if _, err := os.Stat(in.CachePath); err != nil {
|
||||
t.Fatalf("expected cache path %q: %v", in.CachePath, err)
|
||||
}
|
||||
|
||||
}
|
||||
if audioInputs != 2 {
|
||||
t.Fatalf("audio input count = %d, want 2", audioInputs)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPrepareStageS3AudioUsesCacheOnRerun(t *testing.T) {
|
||||
func TestPrepareStageS3AudioReusesPreparedCopy(t *testing.T) {
|
||||
env, m := setupPrepareEnv(t)
|
||||
env.Config.Session.Campaign = "forsaken"
|
||||
env.Config.Session.Inputs.AudioDir = ""
|
||||
env.Config.Session.Inputs.AudioFiles = nil
|
||||
env.Config.Session.Inputs.AudioS3 = &config.SessionAudioS3Input{Prefix: "audio/"}
|
||||
env.Config.Pipeline.Spool = config.SpoolConfig{Root: filepath.Join(t.TempDir(), "spool")}
|
||||
env.Config.Pipeline.Storage.S3 = &config.StorageS3Config{Bucket: "my-dnd-archive", RootPrefix: "dnd"}
|
||||
m.RunID = "20260515T031522Z-a1b2c3d4"
|
||||
m.LocalWorkDir = artifacts.SessionRunRootForCampaign(env.Config.Pipeline.Workspace.Root, "forsaken", m.SessionID, m.RunID)
|
||||
m.LocalSpoolDir = artifacts.SessionSpoolAudioDir(env.Config.Pipeline.Spool.Root, "forsaken", m.SessionID, m.RunID)
|
||||
|
||||
fake := &storage.FakeBackend{}
|
||||
fake.SeedObject(storage.FakeObject{Key: "dnd/campaigns/forsaken/sessions/2026-05-03/audio/alice.flac", Data: []byte("alice")})
|
||||
fake.SeedObject(storage.FakeObject{Key: "dnd/campaigns/forsaken/sessions/2026-05-03/audio/alice.flac", Data: []byte("alice"), ETag: "generation"})
|
||||
env.ObjectStore = fake
|
||||
if _, err := (prepareStage{}).Run(context.Background(), env, m); err != nil {
|
||||
t.Fatalf("first prepare.Run() error = %v", err)
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(fake.Downloads) != 1 {
|
||||
t.Fatalf("downloads = %d, want 1", len(fake.Downloads))
|
||||
}
|
||||
|
||||
if err := os.RemoveAll(filepath.Join(m.LocalWorkDir, "audio")); err != nil {
|
||||
t.Fatalf("remove work audio: %v", err)
|
||||
}
|
||||
if err := os.RemoveAll(m.LocalSpoolDir); err != nil {
|
||||
t.Fatalf("remove spool audio: %v", err)
|
||||
}
|
||||
fake.DownloadErr = os.ErrPermission
|
||||
|
||||
m2 := manifest.New("2026-05-03", time.Now().UTC())
|
||||
m2.RunID = "20260515T041522Z-a1b2c3d4"
|
||||
m2.LocalWorkDir = artifacts.SessionRunRootForCampaign(env.Config.Pipeline.Workspace.Root, "forsaken", m2.SessionID, m2.RunID)
|
||||
m2.LocalSpoolDir = artifacts.SessionSpoolAudioDir(env.Config.Pipeline.Spool.Root, "forsaken", m2.SessionID, m2.RunID)
|
||||
result, err := (prepareStage{}).Run(context.Background(), env, m2)
|
||||
m.RunID = "20260515T041522Z-a1b2c3d4"
|
||||
result, err := (prepareStage{}).Run(context.Background(), env, m)
|
||||
if err != nil {
|
||||
t.Fatalf("cached prepare.Run() error = %v", err)
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(fake.Downloads) != 1 {
|
||||
t.Fatalf("downloads = %d, want cached rerun to avoid new download", len(fake.Downloads))
|
||||
if result.Metadata["audio_reused"] != 1 || len(fake.Downloads) != 1 {
|
||||
t.Fatalf("result=%#v downloads=%d", result.Metadata, len(fake.Downloads))
|
||||
}
|
||||
if got := result.Metadata["audio_cache_hits"]; got != 1 {
|
||||
t.Fatalf("audio_cache_hits = %#v, want 1", got)
|
||||
dest := filepath.Join(sessionPathsForEnv(env, m.SessionID).AudioDir, "alice.flac")
|
||||
mustReadFileEquals(t, dest, "alice")
|
||||
if err := os.Remove(dest); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got := result.Metadata["audio_s3_downloads"]; got != 0 {
|
||||
t.Fatalf("audio_s3_downloads = %#v, want 0", got)
|
||||
result, err = (prepareStage{}).Run(context.Background(), env, m)
|
||||
if err != nil || result.Metadata["audio_s3_downloads"] != 1 || len(fake.Downloads) != 2 {
|
||||
t.Fatalf("result=%#v downloads=%d error=%v", result, len(fake.Downloads), err)
|
||||
}
|
||||
audioInput := findManifestInput(t, m2.Inputs, "audio")
|
||||
if audioInput.CachePath == "" {
|
||||
t.Fatalf("audio input missing cache path: %#v", audioInput)
|
||||
}
|
||||
if audioInput.SpoolPath != "" {
|
||||
t.Fatalf("audio input spool path = %q, want empty on cache hit", audioInput.SpoolPath)
|
||||
}
|
||||
mustReadFileEquals(t, filepath.Join(m2.LocalWorkDir, "audio", "alice.flac"), "alice")
|
||||
}
|
||||
|
||||
func TestPrepareStageS3AudioFailures(t *testing.T) {
|
||||
@@ -457,11 +422,9 @@ func TestPrepareStageS3AudioFailures(t *testing.T) {
|
||||
env.Config.Session.Inputs.AudioDir = ""
|
||||
env.Config.Session.Inputs.AudioFiles = nil
|
||||
env.Config.Session.Inputs.AudioS3 = &config.SessionAudioS3Input{Prefix: "audio/"}
|
||||
env.Config.Pipeline.Spool = config.SpoolConfig{Root: filepath.Join(t.TempDir(), "spool")}
|
||||
env.Config.Pipeline.Storage.S3 = &config.StorageS3Config{Bucket: "my-dnd-archive", RootPrefix: "dnd"}
|
||||
m.RunID = "20260515T031522Z-a1b2c3d4"
|
||||
m.LocalWorkDir = artifacts.SessionRunRootForCampaign(env.Config.Pipeline.Workspace.Root, "forsaken", m.SessionID, m.RunID)
|
||||
m.LocalSpoolDir = artifacts.SessionSpoolAudioDir(env.Config.Pipeline.Spool.Root, "forsaken", m.SessionID, m.RunID)
|
||||
|
||||
fake := &storage.FakeBackend{}
|
||||
tt.setup(env, m, fake)
|
||||
@@ -725,7 +688,6 @@ inputs:
|
||||
cfg := &config.Config{
|
||||
Pipeline: &config.PipelineConfig{
|
||||
Workspace: config.WorkspaceConfig{Root: workspace},
|
||||
Cache: config.CacheConfig{Root: filepath.Join(t.TempDir(), "cache"), S3Audio: boolPtr(true)},
|
||||
},
|
||||
Campaign: &config.CampaignConfig{CampaignID: "sample-campaign", Inputs: config.CampaignInputsConfig{SpeakersFile: "./speakers.yml", PartyFile: "./party.yml"}},
|
||||
SessionPath: sessionPath,
|
||||
|
||||
@@ -29,10 +29,8 @@ func TestPrepareSemanticConfigSensitivity(t *testing.T) {
|
||||
name string
|
||||
mutate func(*Env)
|
||||
}{
|
||||
{name: "workspace and spool", mutate: func(env *Env) {
|
||||
{name: "workspace", mutate: func(env *Env) {
|
||||
env.Config.Pipeline.Workspace.Root = "/different/work"
|
||||
env.Config.Pipeline.Spool.Root = "/different/spool"
|
||||
env.Config.Pipeline.Cache.Root = "/different/cache"
|
||||
}},
|
||||
{name: "stable input owner", mutate: func(env *Env) {
|
||||
env.Config.StableInputs.PartyFile.Source = "party_file"
|
||||
@@ -105,8 +103,6 @@ func initialSemanticEnv() *Env {
|
||||
return &Env{Config: &config.Config{
|
||||
Pipeline: &config.PipelineConfig{
|
||||
Workspace: config.WorkspaceConfig{Root: "/work"},
|
||||
Spool: config.SpoolConfig{Root: "/spool"},
|
||||
Cache: config.CacheConfig{Root: "/cache"},
|
||||
WhisperX: config.WhisperXConfig{
|
||||
TranscribeURL: "https://whisper.example/transcribe", Language: "en",
|
||||
Timeout: "10m", Retries: intPointer(3), RetryDelay: "1s", Concurrency: intPointer(2),
|
||||
|
||||
Reference in New Issue
Block a user