From 1cd4eb6f09935b591d5b2a156de08b7160ad51a1 Mon Sep 17 00:00:00 2001 From: josh Date: Thu, 17 Sep 2026 09:45:18 -0400 Subject: [PATCH] Use UpdateResourceMeta to apply Komodo deployment tags --- src/lib/server/fleet/create.ts | 2 +- src/lib/server/integrations/komodo.ts | 6 ++++-- tests/unit/komodo-tags.test.ts | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lib/server/fleet/create.ts b/src/lib/server/fleet/create.ts index b2e15df..330a5b6 100644 --- a/src/lib/server/fleet/create.ts +++ b/src/lib/server/fleet/create.ts @@ -243,7 +243,7 @@ async function applyDeploymentTags(deployment: string, gameTagName: string, mapT const res = await komodoUpdateTagsOnResource('Deployment', deployment, tagIds); if (!res.ok) { - console.warn(`[createServer] UpdateTagsOnResource for ${deployment}: ${res.message}`); + console.warn(`[createServer] UpdateResourceMeta (tags) for ${deployment}: ${res.message}`); } } catch (err) { console.warn(`[createServer] tag application for ${deployment} threw:`, err); diff --git a/src/lib/server/integrations/komodo.ts b/src/lib/server/integrations/komodo.ts index b0c8de2..055e7ab 100644 --- a/src/lib/server/integrations/komodo.ts +++ b/src/lib/server/integrations/komodo.ts @@ -617,7 +617,7 @@ async function findTagByName(name: string): Promise { /** * Resolve a tag by name, creating it if it doesn't exist. Returns the tag's - * Komodo id (Mongo ObjectId string) for use in UpdateTagsOnResource. + * Komodo id (Mongo ObjectId string) for use in UpdateResourceMeta. * * Best-effort: callers should treat failure as "skip tagging", not "roll back * the whole operation". Tags are cosmetic organization inside Komodo. @@ -685,7 +685,9 @@ export async function komodoUpdateTagsOnResource( if (!komodoConfigured()) { return { ok: false, kind: 'unconfigured', message: 'komodo not configured' }; } - return postAndClassify('write/UpdateTagsOnResource', { + // UpdateResourceMeta owns tags; omit the other optional metadata fields + // so the deployment's description and template flag remain unchanged. + return postAndClassify('write/UpdateResourceMeta', { target: { type: targetType, id: targetName }, tags: tagIds }); diff --git a/tests/unit/komodo-tags.test.ts b/tests/unit/komodo-tags.test.ts index 2c105c8..66a2d8b 100644 --- a/tests/unit/komodo-tags.test.ts +++ b/tests/unit/komodo-tags.test.ts @@ -45,7 +45,7 @@ describe('Komodo tags', () => { expect(fetchMock.mock.calls.map(([url]) => url)).toEqual([ 'http://komodo.test/read/ListTags', 'http://komodo.test/read/ListTags', - 'http://komodo.test/write/UpdateTagsOnResource' + 'http://komodo.test/write/UpdateResourceMeta' ]); expect(JSON.parse(fetchMock.mock.calls[2][1]!.body as string)).toEqual({ target: { type: 'Deployment', id: 't5-sumpf-1' }, tags: [gameId, mapId]