From 8dbf9bebeaaad1dd3d9848841638442d8eb6b979 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 22 Aug 2026 16:48:50 +0000 Subject: [PATCH 1/2] Initial plan From 8c252ae0e4279ec838f38579ed824bf7bdec13fe Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 22 Aug 2026 16:51:15 +0000 Subject: [PATCH 2/2] Remove deprecated DIFC resource API Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> --- internal/config/validation_server.go | 5 +++++ internal/config/validation_shared.go | 10 +-------- internal/difc/resource.go | 25 ---------------------- internal/difc/resource_test.go | 31 ---------------------------- 4 files changed, 6 insertions(+), 65 deletions(-) diff --git a/internal/config/validation_server.go b/internal/config/validation_server.go index 658239cdd..3ccc22064 100644 --- a/internal/config/validation_server.go +++ b/internal/config/validation_server.go @@ -6,6 +6,7 @@ import ( "fmt" "os" "strings" + "sync" "github.com/github/gh-aw-mcpg/internal/jqutil" "github.com/github/gh-aw-mcpg/internal/oidc" @@ -13,6 +14,10 @@ import ( "github.com/santhosh-tekuri/jsonschema/v6" ) +// customSchemaCache stores compiled custom schemas by schema URL to avoid +// repeated fetch + compile work across validations. +var customSchemaCache sync.Map + func logValidationFail(name, serverType, reason string, err error) error { logValidation.Printf("Validation failed: %s, name=%s, type=%s", reason, name, serverType) return err diff --git a/internal/config/validation_shared.go b/internal/config/validation_shared.go index d76cc1b59..bec72f432 100644 --- a/internal/config/validation_shared.go +++ b/internal/config/validation_shared.go @@ -1,13 +1,5 @@ package config -import ( - "sync" - - "github.com/github/gh-aw-mcpg/internal/logger" -) +import "github.com/github/gh-aw-mcpg/internal/logger" var logValidation = logger.ForFile() - -// customSchemaCache stores compiled custom schemas by schema URL to avoid -// repeated fetch + compile work across validations. -var customSchemaCache sync.Map diff --git a/internal/difc/resource.go b/internal/difc/resource.go index f264ce644..2dba7ad93 100644 --- a/internal/difc/resource.go +++ b/internal/difc/resource.go @@ -4,31 +4,6 @@ import "github.com/github/gh-aw-mcpg/internal/logger" var logResource = logger.ForFile() -// Resource represents an external system with label requirements (deprecated - use LabeledResource) -type Resource struct { - Description string - Secrecy SecrecyLabel - Integrity IntegrityLabel -} - -// NewResource creates a new resource with the given description -func NewResource(description string) *Resource { - return &Resource{ - Description: description, - Secrecy: *NewSecrecyLabel(), - Integrity: *NewIntegrityLabel(), - } -} - -// Empty returns a resource with no label requirements -func EmptyResource() *Resource { - return &Resource{ - Description: "empty resource", - Secrecy: *NewSecrecyLabel(), - Integrity: *NewIntegrityLabel(), - } -} - // LabeledResource represents a resource with DIFC labels // This can be a simple label pair or a complex nested structure for fine-grained filtering type LabeledResource struct { diff --git a/internal/difc/resource_test.go b/internal/difc/resource_test.go index add2b3ffd..dc520f5e9 100644 --- a/internal/difc/resource_test.go +++ b/internal/difc/resource_test.go @@ -7,37 +7,6 @@ import ( "github.com/stretchr/testify/require" ) -func TestNewResource(t *testing.T) { - tests := []struct { - name string - description string - }{ - {name: "basic description", description: "my-resource"}, - {name: "empty description", description: ""}, - {name: "long description", description: "a very long resource description with spaces and special chars: @#$%"}, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - r := NewResource(tt.description) - - require.NotNil(t, r) - assert.Equal(t, tt.description, r.Description) - assert.True(t, r.Secrecy.Label.IsEmpty(), "NewResource should have empty secrecy label") - assert.True(t, r.Integrity.Label.IsEmpty(), "NewResource should have empty integrity label") - }) - } -} - -func TestEmptyResource(t *testing.T) { - r := EmptyResource() - - require.NotNil(t, r) - assert.Equal(t, "empty resource", r.Description) - assert.True(t, r.Secrecy.Label.IsEmpty(), "EmptyResource should have empty secrecy label") - assert.True(t, r.Integrity.Label.IsEmpty(), "EmptyResource should have empty integrity label") -} - func TestNewLabeledResource(t *testing.T) { r := NewLabeledResource("labeled-resource")