Migrate Notarius to credential lists
This commit is contained in:
@@ -146,7 +146,7 @@ func (extractStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (re
|
||||
chunkCache = "refresh"
|
||||
}
|
||||
request := notarius.RunRequest{
|
||||
Binary: resolvedBinary, LLMAPIKey: notariusConfig.LLMAPIKey, ConfigProfile: notariusConfig.ConfigProfile,
|
||||
Binary: resolvedBinary, Credentials: notariusConfig.Credentials, ConfigProfile: notariusConfig.ConfigProfile,
|
||||
ConfigPath: configPath, PipelineID: notariusConfig.PipelineID,
|
||||
InputPath: inputPath, OutputRoot: outputRoot, WorkingDirectory: workingDirectory,
|
||||
ReceiptPath: receiptPath, LogPath: logPath, Timeout: timeout, Resume: resume, ChunkCache: chunkCache, References: referenceBindings,
|
||||
|
||||
@@ -61,7 +61,7 @@ func TestExtractStageResolvesManifestInputAndBuildsExactRequest(t *testing.T) {
|
||||
transcribe_url: https://transcription.example.test/transcribe
|
||||
notarius:
|
||||
enabled: false
|
||||
llm_api_key: NARRATIO_EXTRACT_NOTARIUS_KEY
|
||||
credentials: [NARRATIO_EXTRACT_NOTARIUS_KEY]
|
||||
`), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -71,7 +71,7 @@ notarius:
|
||||
}
|
||||
|
||||
env, m, fake := setupExtractEnv(t)
|
||||
env.Config.Pipeline.Notarius.LLMAPIKey = loadedPipeline.Notarius.LLMAPIKey
|
||||
env.Config.Pipeline.Notarius.Credentials = loadedPipeline.Notarius.Credentials
|
||||
configProfile := "inexpensive"
|
||||
env.Config.Pipeline.Notarius.ConfigProfile = &configProfile
|
||||
result, err := (extractStage{}).Run(context.Background(), env, m)
|
||||
@@ -103,7 +103,7 @@ notarius:
|
||||
if req.Resume || req.ChunkCache != "" {
|
||||
t.Fatalf("default cache controls = resume %v, mode %q", req.Resume, req.ChunkCache)
|
||||
}
|
||||
if req.LLMAPIKey != loadedPipeline.Notarius.LLMAPIKey || req.LLMAPIKey.EnvName() != credentialName || !req.LLMAPIKey.IsResolved() {
|
||||
if len(req.Credentials) != 1 || req.Credentials[0].EnvName() != credentialName || !req.Credentials[0].IsResolved() {
|
||||
t.Fatal("request did not retain the loaded Notarius credential reference")
|
||||
}
|
||||
if req.ConfigProfile == nil || *req.ConfigProfile != configProfile {
|
||||
|
||||
@@ -194,7 +194,7 @@ func TestExtractSemanticConfigExcludesLoadedCredentialChanges(t *testing.T) {
|
||||
renamed := loadNotariusCredentialForSemanticTest(t, secondName, "second-value")
|
||||
|
||||
baseline := downstreamSemanticEnv()
|
||||
baseline.Config.Pipeline.Notarius.LLMAPIKey = first
|
||||
baseline.Config.Pipeline.Notarius.Credentials = []configkit.Secret{*first}
|
||||
want, err := (extractStage{}).SemanticConfigFingerprint(baseline)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -209,7 +209,9 @@ func TestExtractSemanticConfigExcludesLoadedCredentialChanges(t *testing.T) {
|
||||
} {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
env := downstreamSemanticEnv()
|
||||
env.Config.Pipeline.Notarius.LLMAPIKey = test.credential
|
||||
if test.credential != nil {
|
||||
env.Config.Pipeline.Notarius.Credentials = []configkit.Secret{*test.credential}
|
||||
}
|
||||
got, err := (extractStage{}).SemanticConfigFingerprint(env)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -225,14 +227,14 @@ func loadNotariusCredentialForSemanticTest(t *testing.T, name, value string) *co
|
||||
t.Helper()
|
||||
t.Setenv(name, value)
|
||||
path := filepath.Join(t.TempDir(), "pipeline.yml")
|
||||
if err := os.WriteFile(path, []byte("whisperx:\n transcribe_url: https://transcription.example.test/transcribe\nnotarius:\n enabled: false\n llm_api_key: "+name+"\n"), 0o644); err != nil {
|
||||
if err := os.WriteFile(path, []byte("whisperx:\n transcribe_url: https://transcription.example.test/transcribe\nnotarius:\n enabled: false\n credentials: ["+name+"]\n"), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
pipeline, err := config.LoadPipeline(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return pipeline.Notarius.LLMAPIKey
|
||||
return &pipeline.Notarius.Credentials[0]
|
||||
}
|
||||
|
||||
func TestPublishSemanticConfigSensitivityAndOperationalExclusions(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user