fix: align channel owner context test types

This commit is contained in:
Peter Steinberger
2026-04-10 18:14:14 +01:00
parent 2b5b58194b
commit 527601d7a5
4 changed files with 13 additions and 5 deletions

View File

@@ -11,6 +11,8 @@ export type StoredConversationReference = {
lastSeenAt?: string;
/** Activity ID from the last message */
activityId?: string;
/** Channel thread root activity ID for threaded replies. */
threadId?: string;
/** User who sent the message */
user?: { id?: string; name?: string; aadObjectId?: string };
/** Agent/bot that received the message */

View File

@@ -558,12 +558,15 @@ describe("msteams monitor handler authz", () => {
} as unknown as Parameters<typeof handler>[0]);
expect(conversationStore.upsert).toHaveBeenCalledTimes(1);
const storedArg = conversationStore.upsert.mock.calls[0]?.[1] as Record<string, unknown>;
expect(storedArg).toBeDefined();
// Top-level tenantId must not be present when no source is available.
expect(storedArg.tenantId).toBeUndefined();
// aadObjectId still captured from `from.aadObjectId` when present.
expect(storedArg.aadObjectId).toBe("sender-aad");
expect(conversationStore.upsert).toHaveBeenCalledWith(
"19:no-tenant@thread.tacv2",
expect.not.objectContaining({ tenantId: expect.anything() }),
);
expect(conversationStore.upsert).toHaveBeenCalledWith(
"19:no-tenant@thread.tacv2",
expect.objectContaining({ aadObjectId: "sender-aad" }),
);
});
it("logs an info drop reason when dmPolicy allowlist rejects a sender", async () => {

View File

@@ -168,6 +168,7 @@ vi.mock("../logging/subsystem.js", () => ({
vi.mock("../routing/session-key.js", () => ({
normalizeAgentId: (id: string) => id,
normalizeMainKey: (key?: string) => key ?? "main",
}));
vi.mock("../runtime.js", () => ({

View File

@@ -50,6 +50,8 @@ vi.mock("../../infra/skills-remote.js", () => ({
}));
vi.mock("../../routing/session-key.js", () => ({
normalizeAgentId: (id: string) => id,
normalizeMainKey: (key?: string) => key ?? "main",
resolveAgentIdFromSessionKey: resolveAgentIdFromSessionKeyMock,
}));