@@ -4,7 +4,10 @@ import { afterAll, afterEach, beforeEach, describe, expect, it, vi } from "vites
44import type { createIMessageRpcClient , IMessageRpcClient } from "./client.js" ;
55import { monitorIMessageProvider } from "./monitor.js" ;
66import type { attachIMessageMonitorAbortHandler } from "./monitor/abort-handler.js" ;
7- import { describeIMessageInboundDropDiagnostic } from "./monitor/monitor-provider.js" ;
7+ import {
8+ describeIMessageInboundDropDiagnostic ,
9+ shouldThrottleIMessageInboundDropDiagnostic ,
10+ } from "./monitor/monitor-provider.js" ;
811
912const waitForTransportReadyMock = vi . hoisted ( ( ) =>
1013 vi . fn < typeof waitForTransportReady > ( async ( ) => { } ) ,
@@ -181,6 +184,27 @@ describe("describeIMessageInboundDropDiagnostic", () => {
181184 expect ( diagnostic ) . not . toContain ( "+1555" ) ;
182185 } ) ;
183186
187+ it ( "describes from-me drops and marks them for throttling" , ( ) => {
188+ const diagnostic = describeIMessageInboundDropDiagnostic ( {
189+ accountId : "default" ,
190+ reason : "from me" ,
191+ message : {
192+ id : 43 ,
193+ chat_id : 456 ,
194+ guid : "p:0/outbound-guid" ,
195+ is_group : true ,
196+ created_at : "2026-06-09T10:01:00.000Z" ,
197+ } ,
198+ } ) ;
199+
200+ expect ( diagnostic ) . toBe (
201+ 'imessage: dropped inbound message account=default reason="from me" chat_id=456 group=true message_id=43 guid=present created_at=2026-06-09T10:01:00.000Z' ,
202+ ) ;
203+ expect ( diagnostic ) . not . toContain ( "outbound-guid" ) ;
204+ expect ( shouldThrottleIMessageInboundDropDiagnostic ( "from me" ) ) . toBe ( true ) ;
205+ expect ( shouldThrottleIMessageInboundDropDiagnostic ( "echo" ) ) . toBe ( false ) ;
206+ } ) ;
207+
184208 it ( "keeps normal policy drops quiet" , ( ) => {
185209 expect (
186210 describeIMessageInboundDropDiagnostic ( {
0 commit comments