From 11f73ddf129706cfc800224eea01a809a528c54e Mon Sep 17 00:00:00 2001 From: Hyu Date: Tue, 15 Sep 2026 15:05:34 +0800 Subject: [PATCH] fix(bots): highlight unsupported processor events and show overlap --- .../bot-form/PluginProcessorBindings.tsx | 83 +++++++++---------- .../event-patterns/event-pattern-groups.ts | 28 +++++++ web/src/i18n/locales/en-US.ts | 2 +- web/src/i18n/locales/es-ES.ts | 21 +++++ web/src/i18n/locales/ja-JP.ts | 2 +- web/src/i18n/locales/ru-RU.ts | 21 +++++ web/src/i18n/locales/th-TH.ts | 21 +++++ web/src/i18n/locales/vi-VN.ts | 21 +++++ web/src/i18n/locales/zh-Hans.ts | 2 +- web/src/i18n/locales/zh-Hant.ts | 21 +++++ .../e2e/bot-processor-compatibility.spec.ts | 53 ++++++++++-- .../unit/event-pattern-coverage.test.mjs | 58 ++++++++++++- 12 files changed, 280 insertions(+), 53 deletions(-) diff --git a/web/src/app/home/bots/components/bot-form/PluginProcessorBindings.tsx b/web/src/app/home/bots/components/bot-form/PluginProcessorBindings.tsx index 23de2ab18..71a89c36b 100644 --- a/web/src/app/home/bots/components/bot-form/PluginProcessorBindings.tsx +++ b/web/src/app/home/bots/components/bot-form/PluginProcessorBindings.tsx @@ -19,8 +19,8 @@ import type { import { httpClient } from '@/app/infra/http'; import { extractI18nObject } from '@/i18n/I18nProvider'; import { - eventPatternCovers, eventPatternLabel, + processorEventCompatibility, } from '@/app/home/components/event-patterns/event-pattern-groups'; import DynamicFormComponent from '@/app/home/components/dynamic-form/DynamicFormComponent'; import { AuthenticatedPluginIcon } from '@/components/AuthenticatedPluginIcon'; @@ -45,7 +45,7 @@ import { } from '@/components/ui/dialog'; import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs'; -function EventCompatibilityWarning({ +function ProcessorEvents({ patterns = [], supportedEvents, }: { @@ -53,28 +53,45 @@ function EventCompatibilityWarning({ supportedEvents: string[]; }) { const { t } = useTranslation(); - // Legacy adapters only emit message.received when no events are declared. - const supported = supportedEvents.length - ? supportedEvents - : ['message.received']; - const unsupported = [...new Set(patterns)].filter( - (pattern) => !supported.some((event) => eventPatternCovers(event, pattern)), + const { entries, matchingEvents } = processorEventCompatibility( + patterns, + supportedEvents, ); - if (!unsupported.length) return null; + const incomplete = entries.some((entry) => !entry.supported); return ( - -