Preserve public error categories from collaborators
This commit is contained in:
@@ -915,6 +915,12 @@ func TestArtifactReaderFailuresPreserveArtifactLoadErrors(t *testing.T) {
|
||||
}},
|
||||
wantNested: context.Canceled,
|
||||
},
|
||||
{
|
||||
name: "public reader error",
|
||||
ctx: context.Background(),
|
||||
reader: &recordingArtifactReader{err: scriptorium.ErrInvalidRequest},
|
||||
wantNested: scriptorium.ErrInvalidRequest,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
@@ -936,6 +942,26 @@ func TestArtifactReaderFailuresPreserveArtifactLoadErrors(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunAddsLLMGenerateToCollaboratorPublicError(t *testing.T) {
|
||||
engine := newContractEngineWithOptions(t, frameworkSchemaDir,
|
||||
scriptorium.WithLLMClient(&fakeLLMClient{err: scriptorium.ErrArtifactLoad}),
|
||||
)
|
||||
|
||||
_, err := engine.Run(context.Background(), scriptorium.RunRequest{
|
||||
PromptID: frameworkMarkdownSummaryPromptID,
|
||||
Inputs: map[string]scriptorium.ArtifactRef{
|
||||
"transcript": scriptorium.Inline("Rin opens the gate."),
|
||||
"glossary": scriptorium.Inline("gate: A guarded passage."),
|
||||
},
|
||||
})
|
||||
if !errors.Is(err, scriptorium.ErrLLMGenerate) {
|
||||
t.Fatalf("expected ErrLLMGenerate, got %v", err)
|
||||
}
|
||||
if !errors.Is(err, scriptorium.ErrArtifactLoad) {
|
||||
t.Fatalf("expected preserved ErrArtifactLoad, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPrepareWithoutProfileMatchesSpecificPublicError(t *testing.T) {
|
||||
promptDir := t.TempDir()
|
||||
writePublicPromptFile(t, promptDir, "profile-required", "")
|
||||
|
||||
Reference in New Issue
Block a user