Skip to content

Commit 0d61fd5

Browse files
committed
chore(sdk/go): restore the frozen Go SDK snapshot
Drop the six Go SDK updates from this branch after the SDK moved to ai-openshell/sdk-go. Restore the generated protobuf bindings, profile types, converters, and tests together to keep the snapshot consistent. The Go SDK CI gate was removed in #5245 and replaced with a freeze check that rejects additions or modifications under sdk/go. Support for the new provider profile fields belongs in the standalone SDK repository. Validation: mise run go:test passed, including race detection and compatibility tests. Verified sdk/go matches the branch merge base and git diff --check passes. Signed-off-by: Philippe Martin <phmartin@redhat.com>
1 parent 7ac9c17 commit 0d61fd5

6 files changed

Lines changed: 1108 additions & 1272 deletions

File tree

‎sdk/go/openshell/v1/internal/converter/coverage_test.go‎

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -336,22 +336,20 @@ func TestConverterCoversAllProtoFields_SandboxPolicyRevision(t *testing.T) {
336336

337337
func TestConverterCoversAllProtoFields_ProviderProfile(t *testing.T) {
338338
handled := fieldSet{
339-
"id": true,
340-
"display_name": true,
341-
"description": true,
342-
"category": true,
343-
"credentials": true,
344-
"files": true,
345-
"endpoints": true,
346-
"binaries": true,
347-
"inference_capable": true,
348-
"discovery": true,
349-
"resource_version": true,
350-
"annotations": true,
351-
"source": true,
352-
"scope": true,
353-
"environment": true,
354-
"required_platform_adapter": true,
339+
"id": true,
340+
"display_name": true,
341+
"description": true,
342+
"category": true,
343+
"credentials": true,
344+
"files": true,
345+
"endpoints": true,
346+
"binaries": true,
347+
"inference_capable": true,
348+
"discovery": true,
349+
"resource_version": true,
350+
"annotations": true,
351+
"source": true,
352+
"scope": true,
355353
}
356354

357355
assertAllFieldsCovered(t, (&pb.ProviderProfile{}).ProtoReflect().Descriptor(), handled, nil)

‎sdk/go/openshell/v1/internal/converter/profile.go‎

Lines changed: 21 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -344,16 +344,15 @@ func ProviderProfileFromProto(p *pb.ProviderProfile) *types.ProviderProfile {
344344
}
345345

346346
result := &types.ProviderProfile{
347-
ID: p.GetId(),
348-
DisplayName: p.GetDisplayName(),
349-
Description: p.GetDescription(),
350-
Category: ProfileCategoryFromProto(p.GetCategory()),
351-
InferenceCapable: p.GetInferenceCapable(),
352-
ResourceVersion: p.GetResourceVersion(),
353-
Annotations: CopyStringMap(p.GetAnnotations()),
354-
Source: p.GetSource(),
355-
Scope: p.GetScope(),
356-
RequiredPlatformAdapter: p.GetRequiredPlatformAdapter(),
347+
ID: p.GetId(),
348+
DisplayName: p.GetDisplayName(),
349+
Description: p.GetDescription(),
350+
Category: ProfileCategoryFromProto(p.GetCategory()),
351+
InferenceCapable: p.GetInferenceCapable(),
352+
ResourceVersion: p.GetResourceVersion(),
353+
Annotations: CopyStringMap(p.GetAnnotations()),
354+
Source: p.GetSource(),
355+
Scope: p.GetScope(),
357356
}
358357

359358
// Credentials
@@ -401,14 +400,7 @@ func ProviderProfileFromProto(p *pb.ProviderProfile) *types.ProviderProfile {
401400
// Discovery
402401
if d := p.GetDiscovery(); d != nil {
403402
result.Discovery = types.ProfileDiscovery{
404-
Credentials: CopyStringSlice(d.GetCredentials()),
405-
ConfigEnvVars: CopyStringSlice(d.GetConfigEnvVars()),
406-
}
407-
}
408-
if e := p.GetEnvironment(); e != nil {
409-
result.Environment = &types.ProfileEnvironment{
410-
Config: CopyStringMap(e.GetConfig()),
411-
Fixed: CopyStringMap(e.GetFixed()),
403+
Credentials: CopyStringSlice(d.GetCredentials()),
412404
}
413405
}
414406

@@ -422,16 +414,15 @@ func ProviderProfileToProto(p *types.ProviderProfile) *pb.ProviderProfile {
422414
}
423415

424416
result := &pb.ProviderProfile{
425-
Id: p.ID,
426-
DisplayName: p.DisplayName,
427-
Description: p.Description,
428-
Category: ProfileCategoryToProto(p.Category),
429-
InferenceCapable: p.InferenceCapable,
430-
ResourceVersion: p.ResourceVersion,
431-
Annotations: CopyStringMap(p.Annotations),
432-
Source: p.Source,
433-
Scope: p.Scope,
434-
RequiredPlatformAdapter: p.RequiredPlatformAdapter,
417+
Id: p.ID,
418+
DisplayName: p.DisplayName,
419+
Description: p.Description,
420+
Category: ProfileCategoryToProto(p.Category),
421+
InferenceCapable: p.InferenceCapable,
422+
ResourceVersion: p.ResourceVersion,
423+
Annotations: CopyStringMap(p.Annotations),
424+
Source: p.Source,
425+
Scope: p.Scope,
435426
}
436427

437428
// Credentials
@@ -469,16 +460,9 @@ func ProviderProfileToProto(p *types.ProviderProfile) *pb.ProviderProfile {
469460
}
470461

471462
// Discovery
472-
if len(p.Discovery.Credentials) > 0 || len(p.Discovery.ConfigEnvVars) > 0 {
463+
if len(p.Discovery.Credentials) > 0 {
473464
result.Discovery = &pb.ProviderProfileDiscovery{
474-
Credentials: CopyStringSlice(p.Discovery.Credentials),
475-
ConfigEnvVars: CopyStringSlice(p.Discovery.ConfigEnvVars),
476-
}
477-
}
478-
if p.Environment != nil {
479-
result.Environment = &pb.ProviderProfileEnvironment{
480-
Config: CopyStringMap(p.Environment.Config),
481-
Fixed: CopyStringMap(p.Environment.Fixed),
465+
Credentials: CopyStringSlice(p.Discovery.Credentials),
482466
}
483467
}
484468

‎sdk/go/openshell/v1/internal/converter/profile_test.go‎

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -465,35 +465,6 @@ func TestProfileDiagnosticFromProto_Nil(t *testing.T) {
465465

466466
// --- ProviderProfile ---
467467

468-
func TestProviderProfileEnvironmentRoundTripAndCopies(t *testing.T) {
469-
profile := &v1.ProviderProfile{
470-
ID: "custom",
471-
RequiredPlatformAdapter: "gcp-metadata",
472-
Environment: &v1.ProfileEnvironment{
473-
Config: map[string]string{"CUSTOM_PROJECT": "project"},
474-
Fixed: map[string]string{"CUSTOM_MODE": "native"},
475-
},
476-
Discovery: v1.ProfileDiscovery{ConfigEnvVars: []string{"CUSTOM_PROJECT"}},
477-
}
478-
wire := ProviderProfileToProto(profile)
479-
restored := ProviderProfileFromProto(wire)
480-
assert.Equal(t, profile.Environment, restored.Environment)
481-
assert.Equal(t, profile.Discovery, restored.Discovery)
482-
assert.Equal(t, profile.RequiredPlatformAdapter, restored.RequiredPlatformAdapter)
483-
profile.Environment.Config["CUSTOM_PROJECT"] = "changed-source"
484-
profile.Environment.Fixed["CUSTOM_MODE"] = "changed-source"
485-
profile.Discovery.ConfigEnvVars[0] = "CHANGED_SOURCE"
486-
assert.Equal(t, "project", wire.Environment.Config["CUSTOM_PROJECT"])
487-
assert.Equal(t, "native", wire.Environment.Fixed["CUSTOM_MODE"])
488-
assert.Equal(t, "CUSTOM_PROJECT", wire.Discovery.ConfigEnvVars[0])
489-
wire.Environment.Config["CUSTOM_PROJECT"] = "changed-wire"
490-
wire.Environment.Fixed["CUSTOM_MODE"] = "changed-wire"
491-
wire.Discovery.ConfigEnvVars[0] = "CHANGED_WIRE"
492-
assert.Equal(t, "project", restored.Environment.Config["CUSTOM_PROJECT"])
493-
assert.Equal(t, "native", restored.Environment.Fixed["CUSTOM_MODE"])
494-
assert.Equal(t, "CUSTOM_PROJECT", restored.Discovery.ConfigEnvVars[0])
495-
}
496-
497468
func TestProviderProfileFromProto(t *testing.T) {
498469
proto := &pb.ProviderProfile{
499470
Id: "prof-1",

‎sdk/go/openshell/v1/profile.go‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ type NetworkBinary = types.NetworkBinary
2727
// ProfileDiscovery holds local discovery configuration for a profile.
2828
type ProfileDiscovery = types.ProfileDiscovery
2929

30-
// ProfileEnvironment declares non-secret workload environment defaults.
31-
type ProfileEnvironment = types.ProfileEnvironment
32-
3330
// ProfileImportItem is an item submitted for profile import or lint validation.
3431
type ProfileImportItem = types.ProfileImportItem
3532

‎sdk/go/openshell/v1/types/profile.go‎

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,15 @@ type ProviderProfile struct {
2626
Category ProfileCategory
2727
Credentials []ProfileCredential
2828
// Files is EXPERIMENTAL. This API and its behavior may change or be removed.
29-
Files []ProfileFile
30-
Endpoints []NetworkEndpoint
31-
Binaries []NetworkBinary
32-
InferenceCapable bool
33-
Discovery ProfileDiscovery
34-
ResourceVersion uint64
35-
Annotations map[string]string
36-
Source string
37-
Scope string
38-
Environment *ProfileEnvironment
39-
RequiredPlatformAdapter string
40-
}
41-
42-
// ProfileEnvironment declares non-secret workload environment defaults.
43-
type ProfileEnvironment struct {
44-
// Config maps destination environment keys to provider config keys.
45-
Config map[string]string
46-
// Fixed maps destination environment keys to literal values.
47-
Fixed map[string]string
29+
Files []ProfileFile
30+
Endpoints []NetworkEndpoint
31+
Binaries []NetworkBinary
32+
InferenceCapable bool
33+
Discovery ProfileDiscovery
34+
ResourceVersion uint64
35+
Annotations map[string]string
36+
Source string
37+
Scope string
4838
}
4939

5040
// ProfileFile declares non-secret content served at a virtual sandbox path.
@@ -163,8 +153,7 @@ type NetworkBinary struct {
163153

164154
// ProfileDiscovery holds local discovery configuration for a profile.
165155
type ProfileDiscovery struct {
166-
Credentials []string
167-
ConfigEnvVars []string
156+
Credentials []string
168157
}
169158

170159
// ProfileImportItem is an item submitted for profile import or lint validation.

0 commit comments

Comments
 (0)