@@ -12,6 +12,25 @@ import {
1212} from "./compaction-intercept-runtime.js" ;
1313import compactionInterceptExtension from "./compaction-intercept.js" ;
1414
15+ const logInfo = vi . hoisted ( ( ) => vi . fn ( ) ) ;
16+ const logDebug = vi . hoisted ( ( ) => vi . fn ( ) ) ;
17+ const logWarn = vi . hoisted ( ( ) => vi . fn ( ) ) ;
18+
19+ vi . mock ( "../../logging/subsystem.js" , ( ) => ( {
20+ createSubsystemLogger : ( ) => ( {
21+ subsystem : "compaction-intercept" ,
22+ isEnabled : ( ) => true ,
23+ trace : vi . fn ( ) ,
24+ debug : logDebug ,
25+ info : logInfo ,
26+ warn : logWarn ,
27+ error : vi . fn ( ) ,
28+ fatal : vi . fn ( ) ,
29+ raw : vi . fn ( ) ,
30+ child : vi . fn ( ) ,
31+ } ) ,
32+ } ) ) ;
33+
1534type CompactionHandler = ( event : unknown , ctx : unknown ) => Promise < unknown > ;
1635
1736function stubSessionManager (
@@ -116,6 +135,9 @@ function makeCtx(
116135}
117136
118137afterEach ( ( ) => {
138+ logInfo . mockClear ( ) ;
139+ logDebug . mockClear ( ) ;
140+ logWarn . mockClear ( ) ;
119141 vi . restoreAllMocks ( ) ;
120142} ) ;
121143
@@ -181,6 +203,19 @@ describe("compactionInterceptExtension", () => {
181203 details : { engine : "lcm" , strategy : "intercept" } ,
182204 } ,
183205 } ) ;
206+ expect ( logInfo ) . toHaveBeenCalledWith (
207+ "[compaction-intercept] engine handled compaction intercept" ,
208+ expect . objectContaining ( {
209+ engineId : "lcm" ,
210+ sessionId : "abc-123" ,
211+ tokenBudget : 258_000 ,
212+ currentTokenCount : 232_000 ,
213+ tokensBefore : 232_000 ,
214+ tokensAfter : 80_000 ,
215+ firstKeptEntryId : "entry-keep-me" ,
216+ summaryChars : "LCM-produced summary text" . length ,
217+ } ) ,
218+ ) ;
184219 } finally {
185220 setCompactionInterceptRuntime ( sm , null ) ;
186221 }
0 commit comments