From d100826479a02275f8a10b12e3ed59f41d5a4d07 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 21 Jul 2026 10:04:43 +0000 Subject: [PATCH] Preserve third party category on partial update When category was omitted from an MCP, GraphQL, or CLI update payload, ThirdPartyService.Update overwrote the stored category with OTHER. Only apply category when the request explicitly includes it, matching other optional fields on the same update path. Add an MCP e2e test that updates name without category and asserts the existing category is unchanged. Signed-off-by: Cursor Agent Co-authored-by: Bryan FRIMIN --- e2e/mcp/third_party_test.go | 37 ++++++++++++++++++++++++++++++++ pkg/probo/third_party_service.go | 2 -- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/e2e/mcp/third_party_test.go b/e2e/mcp/third_party_test.go index 2533c48fd..a7e126d8a 100644 --- a/e2e/mcp/third_party_test.go +++ b/e2e/mcp/third_party_test.go @@ -92,6 +92,43 @@ func TestMCP_ThirdParty_CRUD(t *testing.T) { assert.Equal(t, "resource not found", msg) } +func TestMCP_ThirdParty_UpdatePreservesCategoryWhenOmitted(t *testing.T) { + t.Parallel() + owner := testutil.NewClient(t, testutil.RoleOwner) + mc := testutil.NewMCPClient(t, owner) + orgID := owner.GetOrganizationID().String() + + var addResult struct { + ThirdParty struct { + ID string `json:"id"` + Category string `json:"category"` + } `json:"third_party"` + } + + name := factory.SafeName("ThirdParty") + mc.CallToolInto("addThirdParty", map[string]any{ + "organizationId": orgID, + "name": name, + "category": "CLOUD_PROVIDER", + }, &addResult) + require.NotEmpty(t, addResult.ThirdParty.ID) + assert.Equal(t, "CLOUD_PROVIDER", addResult.ThirdParty.Category) + + var updateResult struct { + ThirdParty struct { + ID string `json:"id"` + Name string `json:"name"` + Category string `json:"category"` + } `json:"third_party"` + } + mc.CallToolInto("updateThirdParty", map[string]any{ + "id": addResult.ThirdParty.ID, + "name": "Updated ThirdParty", + }, &updateResult) + assert.Equal(t, "Updated ThirdParty", updateResult.ThirdParty.Name) + assert.Equal(t, "CLOUD_PROVIDER", updateResult.ThirdParty.Category) +} + func TestMCP_ThirdParty_ValidationError(t *testing.T) { t.Parallel() owner := testutil.NewClient(t, testutil.RoleOwner) diff --git a/pkg/probo/third_party_service.go b/pkg/probo/third_party_service.go index dc66544c7..dd131ebe8 100644 --- a/pkg/probo/third_party_service.go +++ b/pkg/probo/third_party_service.go @@ -408,8 +408,6 @@ func (s ThirdPartyService) Update( if req.Category != nil { thirdParty.Category = *req.Category - } else { - thirdParty.Category = coredata.ThirdPartyCategoryOther } if req.SecurityPageURL != nil {