@@ -263,10 +263,12 @@ describe("scanProjectMediaCodecMap", () => {
263263 expect ( map [ "/assets/clip.mp4" ] ?. browserHostile ) . toBe ( true ) ;
264264 } ) ;
265265
266- it ( "caches a probe per ( path, mtime): a second scan of an unchanged file doesn't reprobe, touching mtime does " , async ( ) => {
266+ it ( "caches by path + mtime + size, invalidating same-mtime re-exports and touched files " , async ( ) => {
267267 const project = tmpProject ( ) ;
268268 const videoPath = join ( project , "clip.mp4" ) ;
269269 writeFileSync ( videoPath , "fake video bytes" ) ;
270+ const pinnedMtime = new Date ( Date . now ( ) - 60_000 ) ;
271+ utimesSync ( videoPath , pinnedMtime , pinnedMtime ) ;
270272 const html = videoHtml ( "clip.mp4" ) ;
271273 const cache = createMediaCodecProbeCache ( ) ;
272274 const probe = countingRunner ( makeRunner ( { [ videoPath ] : "hevc" } ) ) ;
@@ -285,6 +287,15 @@ describe("scanProjectMediaCodecMap", () => {
285287 expect ( second [ "/clip.mp4" ] ?. codecName ) . toBe ( "hevc" ) ;
286288 expect ( probe . calls ( ) ) . toBe ( 1 ) ;
287289
290+ writeFileSync ( videoPath , "larger fake video bytes" ) ;
291+ utimesSync ( videoPath , pinnedMtime , pinnedMtime ) ;
292+ const resized = await scanProjectMediaCodecMap ( project , [ { html } ] , {
293+ cache,
294+ runner : probe . runner ,
295+ } ) ;
296+ expect ( resized [ "/clip.mp4" ] ?. codecName ) . toBe ( "hevc" ) ;
297+ expect ( probe . calls ( ) ) . toBe ( 2 ) ;
298+
288299 const future = new Date ( Date . now ( ) + 60_000 ) ;
289300 utimesSync ( videoPath , future , future ) ;
290301
@@ -293,7 +304,7 @@ describe("scanProjectMediaCodecMap", () => {
293304 runner : probe . runner ,
294305 } ) ;
295306 expect ( third [ "/clip.mp4" ] ?. codecName ) . toBe ( "hevc" ) ;
296- expect ( probe . calls ( ) ) . toBe ( 2 ) ;
307+ expect ( probe . calls ( ) ) . toBe ( 3 ) ;
297308 } ) ;
298309
299310 it ( "bounds the long-lived probe cache while retaining the newest assets" , async ( ) => {
0 commit comments