fix(plugin-sdk): add export verification tests and release guard (#27569)

This commit is contained in:
Glucksberg
2026-02-27 10:13:12 +00:00
committed by Peter Steinberger
parent 2438fde6d9
commit 61d14e8a8a
3 changed files with 198 additions and 0 deletions

View File

@@ -46,4 +46,62 @@ describe("plugin-sdk exports", () => {
expect(Object.prototype.hasOwnProperty.call(sdk, key)).toBe(false);
}
});
// Verify critical functions that extensions depend on are exported and callable.
// Regression guard for #27569 where isDangerousNameMatchingEnabled was missing
// from the compiled output, breaking mattermost/googlechat/msteams/irc plugins.
it("exports critical functions used by channel extensions", () => {
const requiredFunctions = [
"isDangerousNameMatchingEnabled",
"createAccountListHelpers",
"buildAgentMediaPayload",
"createReplyPrefixOptions",
"createTypingCallbacks",
"logInboundDrop",
"logTypingFailure",
"buildPendingHistoryContextFromMap",
"clearHistoryEntriesIfEnabled",
"recordPendingHistoryEntryIfEnabled",
"resolveControlCommandGate",
"resolveDmGroupAccessWithLists",
"resolveAllowlistProviderRuntimeGroupPolicy",
"resolveDefaultGroupPolicy",
"resolveChannelMediaMaxBytes",
"warnMissingProviderGroupPolicyFallbackOnce",
"createDedupeCache",
"formatInboundFromLabel",
"resolveRuntimeGroupPolicy",
"emptyPluginConfigSchema",
"normalizePluginHttpPath",
"registerPluginHttpRoute",
"buildBaseAccountStatusSnapshot",
"buildBaseChannelStatusSummary",
"buildTokenChannelStatusSummary",
"collectStatusIssuesFromLastError",
"createDefaultChannelRuntimeState",
"resolveChannelEntryMatch",
"resolveChannelEntryMatchWithFallback",
"normalizeChannelSlug",
"buildChannelKeyCandidates",
];
for (const key of requiredFunctions) {
expect(sdk).toHaveProperty(key);
expect(typeof (sdk as Record<string, unknown>)[key]).toBe("function");
}
});
// Verify critical constants that extensions depend on are exported.
it("exports critical constants used by channel extensions", () => {
const requiredConstants = [
"DEFAULT_GROUP_HISTORY_LIMIT",
"DEFAULT_ACCOUNT_ID",
"SILENT_REPLY_TOKEN",
"PAIRING_APPROVED_MESSAGE",
];
for (const key of requiredConstants) {
expect(sdk).toHaveProperty(key);
}
});
});