Migrate inspection consumers to resource values

This commit is contained in:
2026-11-06 15:23:59 +00:00
parent dfe9d6566f
commit 129959b24c
18 changed files with 76 additions and 419 deletions

View File

@@ -39,7 +39,7 @@ func TestInspectProfileUsesLiteralFileKeyForPreparation(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if inspected.ProfileID != " literal " || prepared.SelectedProfileID != inspected.ProfileID || prepared.EffectiveModelParams.Model != inspected.EffectiveModelParams.Model {
if inspected.ProfileID != " literal " || inspected.Model == nil || prepared.SelectedProfileID != inspected.ProfileID || prepared.EffectiveModelParams.Model != *inspected.Model {
t.Fatalf("inspection=%+v preparation=%+v", inspected, prepared)
}
if _, err := engine.InspectProfile(context.Background(), "literal"); !errors.Is(err, promptkit.ErrProfileNotFound) {
@@ -61,12 +61,12 @@ func TestInspectProfileIsIndependentAndDoesNotInvokeProvider(t *testing.T) {
t.Fatal(err)
}
first, err := engine.InspectProfile(context.Background(), "profile")
if err != nil || first == nil || !first.APIKeyRequired {
if err != nil || first == nil || first.APIKeyRequired == nil || !*first.APIKeyRequired || first.ExtraParams == nil {
t.Fatalf("first inspection=(%+v, %v)", first, err)
}
first.EffectiveModelParams.ExtraParams["nested"].(map[string]any)["value"] = "changed"
(*first.ExtraParams)["nested"].(map[string]any)["value"] = "changed"
second, err := engine.InspectProfile(context.Background(), "profile")
if err != nil || second == nil || second.EffectiveModelParams.ExtraParams["nested"].(map[string]any)["value"] != "original" || len(client.requests) != 0 {
if err != nil || second == nil || second.ExtraParams == nil || (*second.ExtraParams)["nested"].(map[string]any)["value"] != "original" || len(client.requests) != 0 {
t.Fatalf("inspection changed snapshot or invoked provider: (%+v, %v), calls=%d", second, err, len(client.requests))
}
}
@@ -94,7 +94,7 @@ func TestInspectProfilePublicErrorsAndPartialTarget(t *testing.T) {
t.Fatalf("canceled inspection: %v", err)
}
partial, err := engine.InspectProfile(context.Background(), "profile")
if err != nil || partial == nil || partial.EffectiveModelParams.Endpoint != "" || partial.EffectiveModelParams.Model != "model" {
if err != nil || partial == nil || partial.Endpoint != nil || partial.Model == nil || *partial.Model != "model" {
t.Fatalf("partial inspection=(%+v, %v)", partial, err)
}
}