Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(control-ui): derive the Teams request URL from the draft, matching Slack
Jose Ramirez6aaf7e896c65
diff --git a/control-ui/app/communication-channels/[name]/edit/page.tsx b/control-ui/app/communication-channels/[name]/edit/page.tsxindex 5c0488c94..47153802b 100644--- a/control-ui/app/communication-channels/[name]/edit/page.tsx+++ b/control-ui/app/communication-channels/[name]/edit/page.tsx@@ -28,6 +28,7 @@ import {communicationChannelInitialTab,createCommunicationChannelDraft,hasSlackConfigForRequestUrl,+ hasTeamsConfig,} from '@lib/communicationChannelEdit'import {COMMUNICATION_CHANNEL_PROVIDERS,@@ -38,7 +39,7 @@ import {import {type CommunicationChannelItem,slackWebhookUrlForChannelName,- teamsWebhookUrlForChannel,+ teamsWebhookUrlForChannelName,} from '@lib/communicationChannels'import { canGenerateSlackAppManifest, slackAppManifest } from '@lib/slackAppManifest'@@ -224,7 +225,19 @@ export default function EditCommunicationChannelPage() {item?.metadata?.namespace): null- const teamsRequestUrl = item ? teamsWebhookUrlForChannel(item) : null+ // Gated on the DRAFT, not the persisted item, for the same reason as Slack+ // above: the Teams bot credentials only exist after `teams app create` has+ // run, and that command needs this URL. A URL that required a saved+ // teamsSettings could only appear after the operator had already done the+ // step it describes. The URL depends only on namespace/name, both fixed at+ // create time, and the reader resolves that id regardless of teamsSettings.+ const teamsRequestUrl =+ draft && hasTeamsConfig(draft)+ ? teamsWebhookUrlForChannelName(+ item?.metadata?.name?.trim() || name,+ item?.metadata?.namespace+ )+ : null// A relative request_url is invalid to Slack, so warn instead of handing over a manifest that// cannot work. slackWebhookUrlForChannelName falls back to a bare path when the deployment has// no public webhook address.diff --git a/control-ui/components/__tests__/EditCommunicationChannelPage.test.tsx b/control-ui/components/__tests__/EditCommunicationChannelPage.test.tsxindex 82aa7d800..202dfa12b 100644--- a/control-ui/components/__tests__/EditCommunicationChannelPage.test.tsx+++ b/control-ui/components/__tests__/EditCommunicationChannelPage.test.tsx@@ -1,6 +1,7 @@import React from 'react'import { afterEach, describe, expect, it, vi } from 'vitest'import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'+import userEvent from '@testing-library/user-event'import { ToastProvider } from '@components/Toast'import EditCommunicationChannelPage from '../../app/communication-channels/[name]/edit/page'import * as api from '../../lib/api'@@ -503,3 +504,16 @@ describe('EditCommunicationChannelPage Slack app manifest', () => {expect(vi.mocked(api.apiSend)).not.toHaveBeenCalled()})})++describe('EditCommunicationChannelPage Teams request URL', () => {+ it('shows the Teams request URL from an unsaved draft, before any Teams settings are persisted', async () => {+ mockChannel('teams-support', { hostRef: 'agentjose' })+ await renderLoadedPage()++ const user = userEvent.setup()+ await user.click(await screen.findByRole('radio', { name: /microsoft teams/i }))+ await user.type(screen.getByLabelText(/name/i), 'evenfire-bot')++ expect(await screen.findByText(/\/webhooks\/teams\/teams%3A/)).toBeInTheDocument()+ })+})diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex 047434771..9791393c8 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.413",+ "version": "0.1.414","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.413",+ "version": "0.1.414","dependencies": {"@clerum/llm-providers": "file:../packages/llm-providers","@clerum/workflow-recipe-capability-policy": "file:../packages/workflow-recipe-capability-policy",diff --git a/control-ui/package.json b/control-ui/package.jsonindex d692775df..7505209d4 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.413",+ "version": "0.1.414","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",