test: avoid bundled session normalizer fallback

Keep explicit session-key normalization on loaded channel plugins so
unknown provider contexts pass through without cold-loading bundled channel
runtimes. This preserves active plugin behavior and removes the slow
unknown-provider test path.
This commit is contained in:
Gustavo Madeira Santana
2026-04-17 16:39:48 -04:00
parent 5ae059db16
commit 77e588ebc3

View File

@@ -1,5 +1,5 @@
import type { MsgContext } from "../../auto-reply/templating.js";
import { getChannelPlugin, listChannelPlugins } from "../../channels/plugins/index.js";
import { getLoadedChannelPlugin, listChannelPlugins } from "../../channels/plugins/index.js";
import {
normalizeLowercaseStringOrEmpty,
normalizeOptionalLowercaseString,
@@ -38,7 +38,7 @@ function resolveExplicitSessionKeyNormalizerCandidates(
export function normalizeExplicitSessionKey(sessionKey: string, ctx: MsgContext): string {
const normalized = normalizeLowercaseStringOrEmpty(sessionKey);
for (const channelId of resolveExplicitSessionKeyNormalizerCandidates(normalized, ctx)) {
const normalize = getChannelPlugin(channelId)?.messaging?.normalizeExplicitSessionKey;
const normalize = getLoadedChannelPlugin(channelId)?.messaging?.normalizeExplicitSessionKey;
const next = normalize?.({ sessionKey: normalized, ctx });
if (typeof next === "string" && next.trim()) {
return normalizeLowercaseStringOrEmpty(next);