Write reports to operator-selected outputs
This commit is contained in:
@@ -141,7 +141,7 @@ func TestGeneratePromptReportReturnsOnlyReachedArtifactPaths(t *testing.T) {
|
||||
name string
|
||||
failOperation string
|
||||
failMetadataCall int
|
||||
outputCopy bool
|
||||
output bool
|
||||
notify bool
|
||||
want reachedPromptArtifacts
|
||||
}{
|
||||
@@ -151,7 +151,7 @@ func TestGeneratePromptReportReturnsOnlyReachedArtifactPaths(t *testing.T) {
|
||||
{name: "normalized output then metadata", failOperation: failMetadata, failMetadataCall: 3, want: reachedPromptArtifacts{preparation: true, execution: true, metadata: true, raw: true, normalized: true}},
|
||||
{name: "render context then metadata", failOperation: failMetadata, failMetadataCall: 4, want: reachedPromptArtifacts{preparation: true, execution: true, metadata: true, raw: true, normalized: true, renderContext: true}},
|
||||
{name: "managed report then metadata", failOperation: failMetadata, failMetadataCall: 5, want: reachedPromptArtifacts{preparation: true, execution: true, metadata: true, raw: true, normalized: true, renderContext: true, report: true}},
|
||||
{name: "output copy then metadata", failOperation: failMetadata, failMetadataCall: 5, outputCopy: true, want: reachedPromptArtifacts{preparation: true, execution: true, metadata: true, raw: true, normalized: true, renderContext: true, report: true, output: true}},
|
||||
{name: "output then metadata", failOperation: failMetadata, failMetadataCall: 5, output: true, want: reachedPromptArtifacts{preparation: true, execution: true, metadata: true, raw: true, normalized: true, renderContext: true, report: true, output: true}},
|
||||
{name: "notification then metadata", failOperation: failMetadata, failMetadataCall: 6, notify: true, want: reachedPromptArtifacts{preparation: true, execution: true, metadata: true, raw: true, normalized: true, renderContext: true, report: true, notification: true}},
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ func TestGeneratePromptReportReturnsOnlyReachedArtifactPaths(t *testing.T) {
|
||||
req, paths := promptArtifactRequest(t, artifactPathExecutor{})
|
||||
store := &failingPersistenceStore{Store: req.Store, failOperation: test.failOperation, failMetadataCall: test.failMetadataCall}
|
||||
req.Store = store
|
||||
if test.outputCopy {
|
||||
if test.output {
|
||||
req.OutputPath = filepath.Join(t.TempDir(), "daily.md")
|
||||
paths.output = req.OutputPath
|
||||
}
|
||||
@@ -276,7 +276,7 @@ func TestCompletedExecutionArtifactRetainsLastPersistedCheckpoint(t *testing.T)
|
||||
failExecutionCall int
|
||||
failMetadataCall int
|
||||
requestOutput bool
|
||||
failOutputCopy bool
|
||||
failOutput bool
|
||||
notify bool
|
||||
notificationFailure bool
|
||||
wantExecution reachedExecutionArtifacts
|
||||
@@ -323,17 +323,17 @@ func TestCompletedExecutionArtifactRetainsLastPersistedCheckpoint(t *testing.T)
|
||||
wantResult: reachedPromptArtifacts{preparation: true, execution: true, metadata: true, raw: true, normalized: true, renderContext: true, report: true},
|
||||
},
|
||||
{
|
||||
name: "output copy write", requestOutput: true, failOutputCopy: true,
|
||||
name: "output write", requestOutput: true, failOutput: true,
|
||||
wantExecution: reachedExecutionArtifacts{raw: true, normalized: true, renderContext: true, report: true},
|
||||
wantResult: reachedPromptArtifacts{preparation: true, execution: true, metadata: true, raw: true, normalized: true, renderContext: true, report: true},
|
||||
},
|
||||
{
|
||||
name: "output copy checkpoint", failOperation: failPromptExecution, failExecutionCall: 5, requestOutput: true,
|
||||
name: "output checkpoint", failOperation: failPromptExecution, failExecutionCall: 5, requestOutput: true,
|
||||
wantExecution: reachedExecutionArtifacts{raw: true, normalized: true, renderContext: true, report: true},
|
||||
wantResult: reachedPromptArtifacts{preparation: true, execution: true, metadata: true, raw: true, normalized: true, renderContext: true, report: true, output: true},
|
||||
},
|
||||
{
|
||||
name: "output copy metadata", failOperation: failMetadata, failMetadataCall: 5, requestOutput: true,
|
||||
name: "output metadata", failOperation: failMetadata, failMetadataCall: 5, requestOutput: true,
|
||||
wantExecution: reachedExecutionArtifacts{raw: true, normalized: true, renderContext: true, report: true, output: true},
|
||||
wantResult: reachedPromptArtifacts{preparation: true, execution: true, metadata: true, raw: true, normalized: true, renderContext: true, report: true, output: true},
|
||||
},
|
||||
@@ -374,7 +374,7 @@ func TestCompletedExecutionArtifactRetainsLastPersistedCheckpoint(t *testing.T)
|
||||
req.OutputPath = filepath.Join(t.TempDir(), "daily.md")
|
||||
paths.output = req.OutputPath
|
||||
}
|
||||
if test.failOutputCopy {
|
||||
if test.failOutput {
|
||||
blocker := filepath.Join(t.TempDir(), "not-a-directory")
|
||||
if err := os.WriteFile(blocker, []byte("block"), 0o600); err != nil {
|
||||
t.Fatalf("write output blocker: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user