Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(channel-reader): pin the ephemeral argument order and the workspace key part
Jose Ramirez36f72e4abb0f
diff --git a/channel-reader/package-lock.json b/channel-reader/package-lock.jsonindex ca77df2cd..ad30f5a34 100644--- a/channel-reader/package-lock.json+++ b/channel-reader/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-channel-reader",- "version": "0.1.88",+ "version": "0.1.89","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-channel-reader",- "version": "0.1.88",+ "version": "0.1.89","license": "SEE LICENSE IN LICENSE","dependencies": {"@kubernetes/client-node": "^1.0.0",diff --git a/channel-reader/package.json b/channel-reader/package.jsonindex 638361ed5..b3379099d 100644--- a/channel-reader/package.json+++ b/channel-reader/package.json@@ -1,6 +1,6 @@{"name": "clerum-channel-reader",- "version": "0.1.88",+ "version": "0.1.89","description": "Watches CommunicationChannel CRDs and fetches messages from Telegram, Email, and Slack","main": "dist/main.js","engines": {diff --git a/channel-reader/test/unresolvedSenderNotice.test.ts b/channel-reader/test/unresolvedSenderNotice.test.tsindex 30b1332cd..d11faa77c 100644--- a/channel-reader/test/unresolvedSenderNotice.test.ts+++ b/channel-reader/test/unresolvedSenderNotice.test.ts@@ -146,7 +146,7 @@ function buildReader(options: BuildReaderOptions = {}) {})let eventSeq = 0- const deliver = async (channelId: string, userId: string): Promise<void> => {+ const deliver = async (channelId: string, userId: string, workspaceId = 'T1'): Promise<void> => {eventSeq += 1const message: Message = {channelType: medium,@@ -158,7 +158,7 @@ function buildReader(options: BuildReaderOptions = {}) {providerIdentity: {medium,providerUserId: userId,- providerWorkspaceId: 'T1',+ providerWorkspaceId: workspaceId,providerChannelId: channelId,// Unique per delivery on purpose. A repeated providerEventId is dropped by// the provider-event dedupe *before* authorization runs, which would make@@ -192,6 +192,16 @@ describe('unresolved sender notice', () => {expect(sendEphemeral).toHaveBeenCalledTimes(1)})+ it('posts into the conversation the message came from, addressed to its sender', async () => {+ const { deliver, sendEphemeral } = buildReader()+ await deliver('C1', 'U1')+ // Argument order is load-bearing: sendEphemeral(channelId, userId, content).+ // Swapped, Slack rejects the post, SlackAdapter swallows the error, and the+ // limiter key is already recorded — the sender gets 24h of silence, which is+ // the exact failure this feature exists to remove.+ expect(sendEphemeral).toHaveBeenCalledWith('C1', 'U1', expect.any(String))+ })+it('sends again after the TTL expires and the sweep runs', async () => {vi.useFakeTimers()const { deliver, sendEphemeral, runSweep } = buildReader()@@ -223,6 +233,14 @@ describe('unresolved sender notice', () => {expect(sendEphemeral).toHaveBeenCalledTimes(2)})+ it('treats the same user and channel in a second workspace as its own conversation', async () => {+ vi.useFakeTimers()+ const { deliver, sendEphemeral } = buildReader()+ await deliver('C1', 'U1')+ await deliver('C1', 'U1', 'T2')+ expect(sendEphemeral).toHaveBeenCalledTimes(2)+ })+it('records the key even when sendEphemeral throws, so one failure is not retried forever', async () => {vi.useFakeTimers()const { deliver, sendEphemeral } = buildReader({ ephemeralThrows: true })